/* Africare web. Colour tokens on :root, dark theme under prefers-color-scheme and [data-theme="dark"]. */

:root {
  --primary: #1264E9;
  --navy: #164078;
  --secondary: #2878ED;
  --background: #F5F7FB;
  --card: #FFFFFF;
  --blue-tint: #EAF2FF;
  --text: #172033;
  --muted: #687386;
  --border: #E5EAF2;
  --success: #16B981;
  --warning: #F5A623;
  --error: #E5484D;
  --chat: #2878ED;
  --calls: #16A36A;
  --notes: #F5A623;
  --email: #9255D8;
  --tasks: #0EAFA6;
  --info: #2878ED;
  --success-ink: #0B7A55;
  --warning-ink: #9A5B00;
  --accent-ink: #1264E9;
  --focus: #1264E9;
  --shadow: 0 1px 2px rgba(23, 32, 51, .06);
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #1264E9;
    --secondary: #2878ED;
    --background: #0F1626;
    --card: #172033;
    --blue-tint: #1B2A47;
    --text: #F2F5FA;
    --muted: #9AA5B8;
    --border: #26324A;
    --success-ink: #34D399;
    --warning-ink: #F5A623;
    --accent-ink: #7FB0FF;
    --focus: #7FB0FF;
    --info: #5C9BF0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --primary: #1264E9;
  --secondary: #2878ED;
  --background: #0F1626;
  --card: #172033;
  --blue-tint: #1B2A47;
  --text: #F2F5FA;
  --muted: #9AA5B8;
  --border: #26324A;
  --success-ink: #34D399;
  --warning-ink: #F5A623;
  --accent-ink: #7FB0FF;
  --focus: #7FB0FF;
  --info: #5C9BF0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--background);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}

h1, h2, h3 { line-height: 1.25; margin: 0; overflow-wrap: anywhere; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; margin: 20px 0 8px; }
h3 { font-size: 15px; font-weight: 700; margin: 16px 0 8px; }
p { margin: 0; overflow-wrap: anywhere; }
a { color: var(--accent-ink); }
code { font-size: 13px; overflow-wrap: anywhere; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -100px;
  z-index: 100;
  background: var(--card);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
}
.skip-link:focus { top: 8px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; }
.pad { padding: 14px 16px; }
.grow { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.grow strong, .grow small { overflow-wrap: anywhere; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 600; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); }
.text-danger { color: var(--error); }
.empty { color: var(--muted); text-align: center; padding: 24px 12px; margin: 0; }
.note-line { color: var(--muted); font-size: 12px; text-align: center; margin: 16px 0 0; }
.noscript { padding: 24px; }

.alert {
  border: 1px solid var(--error);
  color: var(--error);
  background: color-mix(in srgb, var(--error) 8%, transparent);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0;
  list-style: none;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.icon { width: 20px; height: 20px; flex: none; }

/* ---------- App shell ---------- */

.app {
  display: block;
  overflow-x: clip;
}

.sidebar { display: none; }

.page {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
  flex: none;
}
.brand-mark { width: 28px; height: 28px; flex: none; }

.search { flex: 1 1 200px; min-width: 0; max-width: 520px; margin: 0; }
.search input { border-radius: 999px; }

.ws-switch { flex: none; }
.ws-switch select {
  width: auto;
  min-width: 120px;
  border-radius: 999px;
  font-weight: 600;
}

.avatar-link {
  text-decoration: none;
  flex: none;
  width: 44px;
  height: 44px;
  background: var(--blue-tint);
  color: var(--accent-ink);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 16px 16px calc(104px + env(safe-area-inset-bottom, 0px));
  outline: none;
}

/* Narrow screens: bottom bar, wrapped top bar, search on its own row. */
@media (max-width: 767px) {
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 20;
    background: var(--card);
    border-top: 1px solid var(--border);
    overflow-x: auto;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .bottom-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    min-width: 100%;
  }
  .bottom-nav li { flex: 1 0 68px; }
  .bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 56px;
    padding: 6px 2px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
  }
  .bottom-nav a[aria-current="page"] { color: var(--accent-ink); }
  .bottom-nav a[aria-current="page"] .icon { background: var(--blue-tint); border-radius: 12px; padding: 4px; width: 36px; height: 28px; }
}

/* Wide screens: left sidebar. */
@media (min-width: 768px) {
  .app {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    min-height: 100vh;
  }
  .sidebar {
    display: block;
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--card);
    border-right: 1px solid var(--border);
    overflow-y: auto;
  }
  .side-nav {
    list-style: none;
    margin: 0;
    padding: 16px 12px;
    display: grid;
    gap: 4px;
  }
  .side-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
  }
  .side-nav a:hover { background: var(--blue-tint); color: var(--text); }
  .side-nav a[aria-current="page"] { background: var(--blue-tint); color: var(--accent-ink); }
  .bottom-nav { display: none; }
  .topbar { padding: 10px 24px; flex-wrap: nowrap; }
  .main { padding: 24px 28px 40px; }
}

/* ---------- Buttons, chips, fields ---------- */

.btn, .icon-btn, .chip, .back-link, .back-inline {
  min-height: 44px;
  font: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn .icon { width: 18px; height: 18px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--error); border-color: var(--error); color: #fff; }
.btn.danger-ghost { background: transparent; border-color: var(--error); color: var(--error); }
.btn.icon-only { width: 44px; min-width: 44px; padding: 0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.icon-btn {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  flex: none;
  padding: 0;
  text-decoration: none;
}
.icon-btn .icon { width: 22px; height: 22px; }

.back-link { color: var(--text); }
.back-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 4px;
  padding: 8px 0;
}
.back-inline .icon { width: 18px; height: 18px; }

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}
.chip {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.chip[aria-pressed="true"] {
  background: var(--blue-tint);
  border-color: var(--primary);
  color: var(--accent-ink);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--primary); margin: 0; flex: none; }
input[type="range"] { flex: 1; accent-color: var(--primary); min-height: 44px; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--error); }

.toolbar {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
}
.toolbar > input { flex: 1 1 200px; }

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 0;
  margin: 0;
  padding: 0;
}
.field > label, .field > legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  padding: 0;
  margin-bottom: 2px;
}
.field-row { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 520px) { .field-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.field-error { color: var(--error); font-size: 13px; margin: 0; }
.form-error { margin: 0; }
.form-stack { display: grid; gap: 14px; }

.check-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}

.radio-group { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.radio-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}
.radio-card span { display: grid; }
.radio-card small { color: var(--muted); }
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--blue-tint); }

.range-row { display: flex; align-items: center; gap: 12px; }
.range-row output { min-width: 52px; text-align: right; font-weight: 700; }

.action-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.action-row .btn { flex: 1 1 140px; }

.dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 4px; }
.dialog-actions .btn { flex: 1 1 auto; }
@media (min-width: 520px) { .dialog-actions .btn { flex: 0 0 auto; } }

.editor-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.save-status { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- Tags, avatars, lists ---------- */

.tag {
  --tone: var(--muted);
  --tone-ink: var(--muted);
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  background: color-mix(in srgb, var(--tone) 14%, transparent);
  color: var(--tone-ink);
}
.tag-danger  { --tone: var(--error);   --tone-ink: var(--error); }
.tag-warning { --tone: var(--warning); --tone-ink: var(--warning-ink); }
.tag-primary { --tone: var(--primary); --tone-ink: var(--accent-ink); }
.tag-success { --tone: var(--success); --tone-ink: var(--success-ink); }
.tag-info    { --tone: var(--info);    --tone-ink: var(--accent-ink); }
.tag-muted   { --tone: var(--muted);   --tone-ink: var(--muted); }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }

.avatar {
  --av: var(--primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex: none;
  background: color-mix(in srgb, var(--av) 16%, transparent);
  color: var(--av);
}
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.xl { width: 96px; height: 96px; font-size: 30px; }
.avatar-link { color: var(--accent-ink); }

.badge {
  background: var(--chat);
  color: #fff;
  border-radius: 999px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}
.row-meta { display: grid; justify-items: end; gap: 4px; flex: none; font-size: 12px; }

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
.list > li + li { border-top: 1px solid var(--border); }

.row-link,
.list-btn,
.task-row,
.file-row,
.row-line {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 12px 16px;
  color: inherit;
  text-decoration: none;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.row-line { cursor: default; }
.row-link:hover, .list-btn:hover, .task-row:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.row-link.is-active, .task-row.is-active { background: var(--blue-tint); }
.row-link strong, .task-row strong { font-weight: 600; }

.stats {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.stats li + li { border-left: 1px solid var(--border); }
.stats a { display: grid; gap: 2px; padding: 14px; min-height: 44px; color: inherit; text-decoration: none; }
.stats strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 12px; }

.hero h1 { font-size: 28px; }
.hero p { margin-top: 4px; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.module {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  min-height: 44px;
  color: inherit;
  text-decoration: none;
}
.module-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
  background: color-mix(in srgb, var(--mc, var(--primary)) 14%, transparent);
  color: var(--mc, var(--primary));
}
.module .grow strong { font-size: 15px; }

/* ---------- Screens and split layout ---------- */

.screen {
  display: grid;
  gap: 12px;
  min-width: 0;
  align-content: start;
}

.screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.split { grid-template-columns: minmax(0, 1fr); }
.split-list { display: grid; gap: 12px; min-width: 0; align-content: start; }
.split-detail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.split-detail .detail-inner { padding: 16px; }
.detail-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  min-height: 56px;
}
.detail-title { font-size: 20px; margin-bottom: 4px; }
.placeholder { padding: 32px 20px; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }

@media (max-width: 767px) {
  .split:not(.has-detail) > .split-detail { display: none; }
  .split.has-detail > .split-list { display: none; }
  .split.has-detail .split-detail { min-height: 70vh; }
  .split.has-detail .split-detail .detail-head { display: flex; }
}
@media (min-width: 768px) {
  .split { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); align-items: start; gap: 20px; }
  .split-detail { min-height: 60vh; }
  .back-link { display: none; }
  .split-detail .detail-head .back-link { display: none; }
}

/* ---------- Chat ---------- */

.thread-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.thread-name { font-size: 16px; overflow-wrap: anywhere; }
.thread-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  min-height: 260px;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--background);
}
.bubble {
  max-width: 80%;
  padding: 8px 12px 6px;
  border-radius: 16px;
  overflow-wrap: anywhere;
}
.bubble p { white-space: pre-wrap; }
.bubble small { display: block; font-size: 11px; opacity: .75; text-align: right; margin-top: 2px; }
.bubble.them { background: var(--card); border: 1px solid var(--border); align-self: flex-start; }
.bubble.me { background: var(--chat); color: #fff; align-self: flex-end; }
.card-bubble strong { display: block; margin: 2px 0; }
.card-bubble p { font-size: 13px; }
.card-kind { text-align: left !important; font-weight: 700; opacity: .9; }
.composer {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--card);
}
.composer input { flex: 1; min-width: 0; border-radius: 999px; }

/* ---------- Calls ---------- */

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.tabs button {
  flex: 1 0 auto;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--blue-tint); color: var(--accent-ink); }

.meeting { padding: 16px; display: grid; gap: 6px; }
.meeting h3 { margin: 0; font-size: 16px; }

.call-panel { display: grid; justify-items: center; gap: 12px; text-align: center; }
.call-self {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  background: var(--blue-tint);
  color: var(--muted);
  display: grid;
  place-items: center;
  padding: 12px;
}
.call-panel h3 { margin: 0; }
.call-status { color: var(--muted); }
.call-controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.call-controls .btn { min-width: 110px; }

/* ---------- Notes ---------- */

.note-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
}
.note-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  min-height: 150px;
  text-align: left;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--nc) 35%, transparent);
  background: color-mix(in srgb, var(--nc) 12%, var(--card));
  min-width: 0;
}
.note-title { font-weight: 700; display: flex; gap: 6px; align-items: center; overflow-wrap: anywhere; }
.pin-mark .icon { width: 16px; height: 16px; color: var(--warning-ink); fill: currentColor; }
.note-body {
  color: var(--muted);
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.note-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.note-foot small { color: var(--nc); font-weight: 600; font-size: 12px; }

/* ---------- Tasks ---------- */

.task-row { align-items: center; }
.task-ref {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  color: var(--tasks);
  min-width: 36px;
  flex: none;
}
.task-side { display: grid; justify-items: end; gap: 4px; flex: none; }
.status-text { font-size: 12px; color: var(--muted); }
.done { text-decoration: line-through; color: var(--muted); }

.info { margin: 0; padding: 4px 0; }
.info > div {
  display: flex;
  gap: 12px;
  padding: 10px 16px;
}
.info > div + div { border-top: 1px solid var(--border); }
.info dt { width: 120px; flex: none; color: var(--muted); font-size: 13px; }
.info dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

.progress-row { display: flex; align-items: center; gap: 12px; }
.progress-row strong { min-width: 44px; text-align: right; }
.progress {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.progress span { display: block; height: 100%; background: var(--tasks); border-radius: 999px; }

/* ---------- Files ---------- */

.file-row { flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.file-main { display: flex; gap: 12px; align-items: center; flex: 1 1 220px; min-width: 0; }
.file-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.file-actions .btn { min-height: 44px; padding: 8px 10px; font-size: 13px; }

/* ---------- Email ---------- */

.mail-row { display: flex; align-items: center; gap: 4px; padding: 0 8px 0 0; }
.mail-open {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 12px 8px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mail-open time { font-size: 12px; flex: none; }
.mail-subject { display: block; font-weight: 500; }
.mail-row.is-unread strong { font-weight: 700; }
.mail-row.is-unread .mail-subject { font-weight: 700; }
.mail-row.is-unread .mail-open strong::after {
  content: " ●";
  color: var(--email);
  font-size: 10px;
}
.star {
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 12px;
}
.star .icon { width: 20px; height: 20px; }
.star[aria-pressed="true"] { color: var(--warning); }
.star[aria-pressed="true"] .icon { fill: currentColor; }

/* ---------- Settings ---------- */

.settings-block { padding: 16px; display: grid; gap: 10px; margin-bottom: 12px; }
.settings-block h2 { margin: 0; }

/* ---------- Dialogs and toast ---------- */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(8, 14, 28, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.dialog {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
  overflow: hidden;
}
.dialog:focus { outline: none; }
.dialog.dialog-sm { width: min(420px, 100%); }
.dialog.dialog-wide { width: min(720px, 100%); }
.dialog.dialog-call { width: min(420px, 100%); }
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 10px 10px 18px;
  border-bottom: 1px solid var(--border);
}
.dialog-head h2 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.dialog-body { padding: 16px 18px 18px; overflow-y: auto; min-height: 0; }

@media (max-width: 767px) {
  .dialog-backdrop { align-items: flex-end; padding: 0; }
  .dialog,
  .dialog.dialog-sm,
  .dialog.dialog-wide,
  .dialog.dialog-call {
    width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }
  .dialog-body { padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: calc(100vw - 32px);
  background: var(--text);
  color: var(--background);
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.toast.show { opacity: 1; }
@media (min-width: 768px) { .toast { bottom: 28px; } }

/* ---------- Motion and touch ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

@media (pointer: coarse) {
  .chip, .btn, .icon-btn, .row-link, .task-row, .mail-open { min-height: 44px; }
}
