/* OPL Communication Portal
   Calm, dense work surface in pine green. The one loud element is the yellow
   "internal slip" used for everything that never leaves the portal. */

:root {
  --pine-950: #0d241c;
  --pine-900: #12342a;
  --pine-800: #174536;
  --pine-700: #145a43;
  --pine-600: #0f6b4f;
  --pine-500: #1f8a67;
  --pine-100: #d5ebe2;
  --pine-50:  #ebf5f1;
  --paper:    #f2f5f4;
  --surface:  #ffffff;
  --line:     #dde3e0;
  --line-soft:#e9edeb;
  --ink:      #1d2b25;
  --muted:    #5e6e67;
  --faint:    #8a9892;
  --slip:     #fff6d6;
  --slip-edge:#e3b341;
  --slip-ink: #5c4500;
  --danger:   #b42318;

  /* Chart series (validated palette: adjacent pairs clear colour-blind separation) */
  --c-blue:   #2a78d6;
  --c-orange: #eb6834;
  --c-aqua:   #1baf7a;
  --c-yellow: #eda100;
  --c-violet: #6250d6;
  --c-red:    #d03b3b;   /* status: late / failing (always with a label) */
  --c-pine:   #1f8a67;
  --shadow-1: 0 1px 2px rgba(16, 40, 30, .05), 0 1px 1px rgba(16, 40, 30, .03);
  --shadow-2: 0 6px 20px rgba(16, 40, 30, .08);

  --bs-body-font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Noto Nastaliq Urdu", Arial, sans-serif;
  --bs-body-font-size: .875rem;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-border-color: var(--line);
  --bs-primary: var(--pine-600);
  --bs-primary-rgb: 15, 107, 79;
  --bs-link-color: var(--pine-700);
  --bs-link-color-rgb: 20, 90, 67;
  --bs-link-hover-color: var(--pine-900);
  --bs-link-hover-color-rgb: 18, 52, 42;
  --bs-focus-ring-color: rgba(15, 107, 79, .3);
  --sidebar-w: 248px;
}

body { font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5 { color: var(--ink); letter-spacing: -.01em; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--pine-500); outline-offset: 2px; }
.skip-link { position: absolute; top: 8px; left: 8px; z-index: 2000; background: #fff; padding: 8px 12px; border-radius: 6px; }

/* ---------- Bootstrap overrides ---------- */
.btn { --bs-btn-font-size: .875rem; --bs-btn-border-radius: 6px; font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--pine-600); --bs-btn-border-color: var(--pine-600); --bs-btn-hover-bg: var(--pine-700); --bs-btn-hover-border-color: var(--pine-700);
  --bs-btn-active-bg: var(--pine-800); --bs-btn-active-border-color: var(--pine-800); --bs-btn-disabled-bg: var(--pine-600); --bs-btn-disabled-border-color: var(--pine-600); }
.btn-outline-primary { --bs-btn-color: var(--pine-700); --bs-btn-border-color: var(--pine-600); --bs-btn-hover-bg: var(--pine-600); --bs-btn-hover-border-color: var(--pine-600);
  --bs-btn-active-bg: var(--pine-700); --bs-btn-active-border-color: var(--pine-700); }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--line); --bs-btn-hover-bg: var(--paper); --bs-btn-hover-border-color: var(--line); }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; border-radius: 8px; color: var(--muted); font-size: 1.15rem; }
.btn-icon:hover { background: var(--paper); color: var(--ink); }
.form-control, .form-select { border-radius: 6px; font-size: .875rem; border-color: #cfd8d4; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--pine-500); box-shadow: 0 0 0 .2rem rgba(15, 107, 79, .15); }
.form-check-input:checked { background-color: var(--pine-600); border-color: var(--pine-600); }
.form-label { font-weight: 600; font-size: .8125rem; margin-bottom: .3rem; }
.form-text { color: var(--muted); }
.table { --bs-table-color: var(--ink); --bs-table-border-color: var(--line-soft); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .6rem .75rem; vertical-align: middle; }
.table thead th { font-size: .75rem; font-weight: 600; color: var(--muted); background: #f7f9f8; border-bottom-color: var(--line); white-space: nowrap; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f6faf8; }
.alert { border-radius: 8px; font-size: .875rem; }
.dropdown-menu { --bs-dropdown-font-size: .875rem; --bs-dropdown-border-color: var(--line); border-radius: 8px; --bs-dropdown-link-active-bg: var(--pine-600); }
.modal-content { border: 0; border-radius: 10px; }
.modal-header { border-bottom-color: var(--line-soft); }
.modal-footer { border-top-color: var(--line-soft); }
.pagination { --bs-pagination-color: var(--pine-700); --bs-pagination-active-bg: var(--pine-600); --bs-pagination-active-border-color: var(--pine-600); --bs-pagination-border-color: var(--line); }
.nav-tabs { --bs-nav-tabs-border-color: var(--line); --bs-nav-link-color: var(--muted); --bs-nav-link-hover-color: var(--ink); --bs-nav-tabs-link-active-color: var(--ink); }
.nav-tabs .nav-link.active { font-weight: 600; border-bottom-color: #fff; }
.badge-count { background: var(--pine-50); color: var(--pine-700); border-radius: 999px; padding: 1px 8px; font-size: .75rem; font-weight: 600; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: linear-gradient(180deg, var(--pine-900) 0%, var(--pine-950) 100%); color: #cfe3da;
  display: flex; flex-direction: column; padding: 14px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 1040;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 4px 6px 16px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--slip-edge); color: var(--pine-950); display: grid; place-items: center; font-size: 1.1rem; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: .875rem; font-weight: 600; color: #fff; }
.brand-text small { color: #93b5a7; font-size: .75rem; }
.btn-compose { background: var(--slip-edge); color: var(--pine-950); border: 0; width: 100%; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; justify-content: center; padding: 8px; }
.btn-compose:hover { background: #f0c45a; color: var(--pine-950); }
.nav-heading { color: #7fa496; font-size: .75rem; font-weight: 600; padding: 16px 10px 6px; }
.sidebar > * { flex-shrink: 0; }
.sidebar { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-item { display: flex; align-items: center; gap: 11px; color: #cfe3da; padding: 8px 10px; border-radius: 7px; font-weight: 500; }
.nav-item i { font-size: 1.05rem; width: 18px; text-align: center; color: #93b5a7; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item { position: relative; }
.nav-item.active { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 4px; border-radius: 0 4px 4px 0; background: var(--slip-edge); }
.nav-item.active i { color: var(--slip-edge); }
.nav-count { margin-left: auto; background: var(--slip-edge); color: var(--pine-950); font-size: .72rem; font-weight: 700; border-radius: 999px; min-width: 22px; padding: 1px 7px; text-align: center; }
.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-top: 1px solid rgba(255,255,255,.08); color: #fff; }
.sidebar-user:hover { text-decoration: none; background: rgba(255,255,255,.05); border-radius: 8px; }
.sidebar-user span { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.sidebar-user strong { font-weight: 600; font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { color: #93b5a7; font-size: .75rem; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1030; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(16,40,30,.02); height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 20px; }
.topbar-search { flex: 1; max-width: 560px; position: relative; }
.topbar-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.topbar-search input { width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 8px 12px 8px 36px; font-size: .875rem; }
.topbar-search input:focus { outline: none; background: #fff; border-color: var(--pine-500); box-shadow: 0 0 0 .2rem rgba(15,107,79,.12); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.btn-user { display: flex; align-items: center; gap: 8px; border: 0; padding: 4px 8px; border-radius: 8px; color: var(--ink); }
.btn-user:hover { background: var(--paper); }
.bell-dot { position: absolute; top: 7px; right: 8px; width: 9px; height: 9px; background: #e5484d; border: 2px solid #fff; border-radius: 50%; }
.content { padding: 22px 24px 48px; max-width: 1480px; width: 100%; }
.sidebar-backdrop { display: none; }
.main { min-height: 100vh; }
.content { flex: 1 0 auto; }
.app-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px 24px; flex-wrap: wrap; padding: 14px 24px; margin-top: 8px;
  border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: .78rem; }
.app-footer > div { display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; }
.app-footer i { margin-right: 5px; color: var(--faint); }
.af-brand { color: var(--ink); font-weight: 600; }
.af-brand i { color: var(--pine-600); }
.af-mid { color: #5c4500; }
.af-mid i { color: var(--slip-edge); }

.new-mail-bar { background: var(--pine-700); color: #fff; display: flex; align-items: center; gap: 10px; padding: 8px 24px; font-weight: 500; }
.new-mail-bar .btn { margin-left: auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.5rem; font-weight: 650; margin: 0; }
.page-sub { color: var(--muted); margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: .8125rem; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; margin: 0; padding: 0; }
.crumbs li { display: flex; align-items: center; }
.crumbs li + li::before { content: "\203A"; margin: 0 7px; color: var(--faint); }
.crumbs li a { color: var(--pine-700); font-weight: 500; }
.crumbs li[aria-current] { color: var(--ink); }
.crumb-back { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink) !important; font-weight: 600; }
.crumb-back:hover { border-color: var(--pine-500); background: var(--pine-50); text-decoration: none; }

/* ---------- Header banner ---------- */
.hero { position: relative; overflow: hidden; background: var(--pine-900); color: #fff; isolation: isolate; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; z-index: -2; }
.hero-shaded::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(8,26,20,.72) 0%, rgba(8,26,20,.38) 45%, rgba(8,26,20,0) 75%); }
.hero-slim { height: 76px; }
.hero-slim .hero-img { object-position: center 62%; }
.hero-compact { height: 132px; }
.hero-standard { height: 196px; }
.hero-tall { height: 280px; }
.hero-text { position: absolute; left: 24px; right: 24px; bottom: 18px; display: flex; flex-direction: column; gap: 2px; max-width: 760px; text-shadow: 0 1px 12px rgba(0,0,0,.35); }
.hero-text strong { font-size: 1.5rem; font-weight: 650; letter-spacing: -.01em; line-height: 1.2; }
.hero-text span { font-size: .9375rem; color: rgba(255,255,255,.86); }
.hero-tall .hero-text strong { font-size: 2rem; }
.hero-slim .hero-text { bottom: auto; top: 50%; transform: translateY(-50%); }
.hero-slim .hero-text strong { font-size: 1.0625rem; font-weight: 600; }

/* sidebar sub-pages */
.nav-caret { margin-left: auto; font-size: .7rem !important; width: auto !important; opacity: .7; }
.nav-sub { display: flex; flex-direction: column; margin: 2px 0 6px 21px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.12); }
.nav-subitem { color: #a9c8bb; padding: 5px 10px; border-radius: 6px; font-size: .84rem; }
.nav-subitem:hover { color: #fff; background: rgba(255,255,255,.06); text-decoration: none; }
.nav-subitem.active { color: #fff; background: rgba(255,255,255,.1); font-weight: 600; }

/* uploaded logo in the brand mark */
.brand-mark.has-logo { background: #fff; overflow: hidden; padding: 3px; }
.brand-mark.has-logo img { width: 100%; height: 100%; object-fit: contain; }

/* branding page */
.brand-preview { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.brand-preview .hero { border-radius: 0; }
.img-drop { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; background: var(--paper); }
.img-drop img { max-height: 64px; max-width: 220px; border-radius: 6px; background: #fff; border: 1px solid var(--line); }
.img-drop .logo-thumb { width: 64px; height: 64px; object-fit: contain; padding: 4px; }
.env-table td:first-child { white-space: nowrap; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-1); }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.panel-head h2 { font-size: .9375rem; font-weight: 650; margin: 0; }
.panel-body { padding: 16px; }
.panel-foot { padding: 10px 16px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: .8125rem; }

/* ---------- Avatars & badges ---------- */
.avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; font-size: .75rem; font-weight: 700; color: #fff; letter-spacing: .02em; }
.avatar-sm { width: 26px; height: 26px; font-size: .68rem; }
.avatar-xs { width: 22px; height: 22px; font-size: .62rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar-c0 { background: #1f6f8b; } .avatar-c1 { background: #7a4fa3; } .avatar-c2 { background: #b3541e; } .avatar-c3 { background: #2f7d32; }
.avatar-c4 { background: #a3324f; } .avatar-c5 { background: #5c6bc0; } .avatar-c6 { background: #00796b; } .avatar-c7 { background: #8d6e00; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { border: 2px solid #fff; margin-left: -6px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

.badge-status, .badge-prio, .badge-role, .badge-soft {
  display: inline-flex; align-items: center; gap: 5px; font-size: .75rem; font-weight: 600; line-height: 1; padding: 4px 8px; border-radius: 999px; white-space: nowrap;
}
.badge-status i, .badge-role i { font-size: .8rem; }
.status-new      { background: #e6eefb; color: #1f4f96; }
.status-reopened { background: #fdebdc; color: #a1450a; }
.status-assigned { background: #eee9fa; color: #523896; }
.status-progress { background: #def2f6; color: #0b6278; }
.status-draft    { background: var(--slip); color: var(--slip-ink); box-shadow: inset 0 0 0 1px #f0d58a; }
.status-replied  { background: #e2f3e7; color: #17663a; }
.status-closed   { background: #edf0ee; color: #56645e; }
.prio-urgent { background: var(--danger); color: #fff; }
.prio-high   { background: #fff; color: #b54708; box-shadow: inset 0 0 0 1px #f2b98c; }
.prio-normal { background: #edf0ee; color: #56645e; }
.prio-low    { background: #fff; color: var(--faint); box-shadow: inset 0 0 0 1px var(--line); }
.role-admin { background: #fde8e7; color: #9b2c22; } .role-floor { background: #ece9fb; color: #4b3bb5; } .role-supervisor { background: var(--pine-50); color: var(--pine-700); }
.role-agent { background: #e6eefb; color: #1f4f96; } .role-auditor { background: #f1ecdf; color: #6b5414; }
.badge-soft { background: #edf0ee; color: #4b5a54; }
.badge-soft.ok { background: #e2f3e7; color: #17663a; } .badge-soft.info { background: #e9f1fc; color: #1f5aa6; } .badge-soft.bad { background: #fde8e7; color: #9b2c22; } .badge-soft.warn { background: #fff1d6; color: #8a5a00; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); }
.dot.ok { background: #22a35a; } .dot.bad { background: #e5484d; } .dot.warn { background: #e0a100; }

/* ---------- Inbox list ---------- */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.filter-bar .form-select, .filter-bar .form-control { width: auto; min-width: 140px; font-size: .8125rem; padding-top: .3rem; padding-bottom: .3rem; }
.tabs-row { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab-link { display: flex; align-items: center; gap: 7px; padding: 11px 12px 10px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab-link:hover { color: var(--ink); text-decoration: none; }
.tab-link.active { color: var(--pine-700); border-bottom-color: var(--pine-600); font-weight: 600; }
.tab-link .tab-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); }
.tab-waiting { background: var(--c-blue) !important; } .tab-drafts { background: var(--c-yellow) !important; } .tab-forwarded { background: var(--c-violet) !important; }
.tab-open { background: var(--c-orange) !important; } .tab-replied { background: var(--c-aqua) !important; } .tab-closed { background: #9aa8a2 !important; }
.tab-all { background: var(--pine-600) !important; } .tab-active { background: var(--c-blue) !important; } .tab-completed { background: var(--c-aqua) !important; }
.tab-link.active .badge-count { background: var(--pine-600); color: #fff; }
.inbox-panel .filter-bar input[type=search] { flex: 1 1 220px; }
.kpi-grid.compact .kpi { padding: 12px 14px; gap: 6px; }
.kpi-grid.compact .kpi-value { font-size: 1.5rem; }
.kpi-grid.compact .kpi-icon { width: 30px; height: 30px; font-size: .95rem; }
.tab-link .badge-count { font-size: .7rem; }

.mail-list { list-style: none; margin: 0; padding: 0; }
.mail-row { display: grid; grid-template-columns: 6px 36px minmax(150px, 220px) 1fr auto; gap: 0 12px; align-items: center; padding: 11px 16px 11px 0; border-bottom: 1px solid var(--line-soft); color: var(--ink); position: relative; }
.mail-row:hover { background: #f6faf8; text-decoration: none; color: var(--ink); }
.mail-row .stripe { align-self: stretch; border-radius: 0 3px 3px 0; background: transparent; }
.mail-row.is-unread .stripe { background: var(--pine-500); }
.mail-row.is-urgent .stripe { background: var(--danger); }
.mail-from { min-width: 0; }
.mail-from strong, .mail-from span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mail-from strong { font-weight: 500; }
.mail-from span { color: var(--faint); font-size: .75rem; }
.mail-row.is-unread .mail-from strong, .mail-row.is-unread .mail-subject { font-weight: 700; }
.mail-main { min-width: 0; }
.mail-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mail-subject { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 500; }
.mail-snippet { color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .8125rem; margin-top: 2px; }
.mail-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; white-space: nowrap; font-size: .78rem; color: var(--muted); }
.mail-meta-line { display: flex; align-items: center; gap: 8px; }
.mail-tags { display: flex; gap: 6px; flex: none; }
.tag-followup { font-size: .7rem; font-weight: 600; color: #a1450a; }
.mail-row .sla-late { color: var(--danger); font-weight: 600; }
.mail-row .sla-warn { color: #a66a00; font-weight: 600; }

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-state > i { font-size: 2.4rem; color: #b6c4be; display: block; }
.empty-state h2, .empty-state h3 { font-size: 1rem; color: var(--ink); margin: 12px 0 4px; font-weight: 600; }

/* ---------- Email page ---------- */
.email-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.email-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line-soft); }
.email-subject { font-size: 1.25rem; font-weight: 600; margin: 0 0 12px; word-break: break-word; }
.email-from { display: flex; gap: 12px; align-items: flex-start; }
.email-from .who { min-width: 0; flex: 1; }
.email-from .who strong { font-weight: 600; }
.email-from .addr { color: var(--muted); }
.email-from .recips { color: var(--muted); font-size: .8125rem; margin-top: 2px; word-break: break-word; }
.email-from .when { color: var(--muted); font-size: .8125rem; white-space: nowrap; text-align: right; }
.email-body-wrap { padding: 4px 20px 16px; }
.email-frame { width: 100%; border: 0; min-height: 120px; display: block; }
.images-note { display: flex; align-items: center; gap: 10px; font-size: .8125rem; color: var(--muted); background: var(--paper); border-radius: 6px; padding: 7px 10px; margin: 12px 20px 0; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px 18px; }
.att { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; max-width: 280px; color: var(--ink); background: #fff; }
.att:hover { border-color: var(--pine-500); text-decoration: none; color: var(--ink); }
.att i { font-size: 1.4rem; color: var(--pine-600); }
.att span { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.att strong { font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.att small { color: var(--muted); }
.att.blocked { background: #fdf3f2; border-color: #f3c7c3; cursor: not-allowed; }
.att.blocked i { color: var(--danger); }

.thread { list-style: none; padding: 0; margin: 0; }
.thread-item { display: flex; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); align-items: flex-start; color: var(--ink); }
.thread-item:last-child { border-bottom: 0; }
.thread-item.current { background: var(--pine-50); }
.thread-item .ti-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: .85rem; }
.thread-item .ti-in { background: #e6eefb; color: #1f4f96; }
.thread-item .ti-out { background: #e2f3e7; color: #17663a; }
.thread-item .ti-text { min-width: 0; flex: 1; }
.thread-item .ti-text strong { font-weight: 500; }
.thread-item .ti-text div { color: var(--muted); font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Internal discussion: the yellow slip */
.internal { background: var(--slip); border: 1px solid #efd78f; border-radius: 10px; margin-top: 16px; overflow: hidden; }
.internal-head { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px dashed #e6c870; color: var(--slip-ink); }
.internal-head h2 { font-size: .9375rem; font-weight: 700; margin: 0; color: var(--slip-ink); }
.internal-head .seal { margin-left: auto; font-size: .75rem; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; background: #fff; border: 1px solid #e6c870; padding: 3px 8px; border-radius: 999px; }
.internal-list { list-style: none; margin: 0; padding: 6px 16px; }
.note { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px dashed #ecd48a; }
.note:last-child { border-bottom: 0; }
.note-body { flex: 1; min-width: 0; }
.note-meta { font-size: .8125rem; color: #7a6420; }
.note-meta strong { color: var(--slip-ink); font-weight: 600; }
.note-text { margin-top: 4px; white-space: normal; word-break: break-word; color: #3e3000; }
.note.proposed .note-text { background: #fff; border: 1px solid #e6c870; border-left: 4px solid var(--slip-edge); border-radius: 6px; padding: 10px 12px; }
.note-flag { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; color: #8a5a00; background: #fff; border: 1px solid #e6c870; border-radius: 999px; padding: 2px 8px; margin-left: 6px; }
.internal-form { padding: 12px 16px 14px; border-top: 1px dashed #e6c870; }
.internal-form textarea { background: #fffdf3; border-color: #e6c870; }
.internal-form textarea:focus { background: #fff; border-color: var(--slip-edge); box-shadow: 0 0 0 .2rem rgba(227,179,65,.25); }
.internal-empty { padding: 14px 0; color: #7a6420; }

/* Side panel on the email page */
.side-block { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.side-block:last-child { border-bottom: 0; }
.side-block h3 { font-size: .8125rem; font-weight: 600; color: var(--muted); margin: 0 0 10px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 7px 10px; font-size: .8125rem; }
.kv dt { color: var(--muted); font-weight: 400; }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }
.assignee { display: flex; align-items: center; gap: 9px; padding: 7px 0; }
.assignee + .assignee { border-top: 1px solid var(--line-soft); }
.assignee .info { flex: 1; min-width: 0; line-height: 1.3; }
.assignee .info small { color: var(--muted); display: block; font-size: .75rem; }
.assignee-note { font-size: .8125rem; background: var(--paper); border-radius: 6px; padding: 6px 9px; margin: 2px 0 6px 35px; color: #3c4b45; }
.action-stack { display: grid; gap: 8px; }
.action-stack .btn { justify-content: flex-start; display: flex; align-items: center; gap: 8px; }
.history { list-style: none; margin: 0; padding: 0; font-size: .8125rem; }
.history li { position: relative; padding: 0 0 10px 16px; color: var(--muted); }
.history li::before { content: ""; position: absolute; left: 3px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.history li strong { color: var(--ink); font-weight: 500; }

/* Brief/instructions to agent */
.brief { background: #eef6f2; border: 1px solid var(--pine-100); border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; display: flex; gap: 12px; }
.brief i { color: var(--pine-600); font-size: 1.2rem; }

/* ---------- Dashboard ---------- */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.dash-head h1 { font-size: 1.5rem; font-weight: 650; margin: 0; }
.dash-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dash-filters .form-select { width: auto; min-width: 190px; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; box-shadow: var(--shadow-1); }
.seg-btn { border: 0; background: transparent; color: var(--muted); font-weight: 500; font-size: .8125rem; padding: 5px 12px; border-radius: 6px; }
.seg-btn:hover { color: var(--ink); background: var(--paper); }
.seg-btn.active { background: var(--pine-600); color: #fff; }
.section-label { font-size: .8125rem; font-weight: 600; color: var(--muted); margin: 20px 0 10px; display: flex; align-items: center; gap: 10px; }
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 4px; }
.kpi-stack { display: grid; gap: 14px; }
.kpi { --tint: #eef1f4; --solid: #4b5d6e; position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px 16px 14px; border-radius: 12px;
  background: linear-gradient(140deg, var(--tint) 0%, #fff 62%); border: 1px solid var(--line); box-shadow: var(--shadow-1); color: var(--ink); overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--solid); }
a.kpi:hover { text-decoration: none; color: var(--ink); border-color: var(--solid); box-shadow: var(--shadow-2); }
.kpi-top { display: flex; align-items: center; gap: 10px; }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--solid); color: #fff; font-size: 1.05rem; flex: none; }
.kpi-label { font-weight: 600; font-size: .8125rem; color: #3d4c46; }
.kpi-mid { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; min-height: 40px; }
.kpi-value { font-size: 1.95rem; font-weight: 650; line-height: 1; letter-spacing: -.02em; font-variant-numeric: proportional-nums; }
.kpi .spark { width: 112px; height: 38px; flex: none; }
.kpi-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .75rem; color: var(--muted); min-height: 20px; }
.kpi.is-alert { border-color: #f1c4c4; }
.kpi.is-alert .kpi-value { color: var(--c-red); }
.tone-blue   { --tint: #e9f1fc; --solid: #2a78d6; }
.tone-violet { --tint: #efedfc; --solid: #6250d6; }
.tone-amber  { --tint: #fff4d6; --solid: #c98500; }
.tone-red    { --tint: #fdeaea; --solid: #d03b3b; }
.tone-aqua   { --tint: #e3f6ee; --solid: #14936a; }
.tone-green  { --tint: #e6f4e8; --solid: #23843d; }
.tone-slate  { --tint: #edf1f5; --solid: #4b5d6e; }
.tone-pine   { --tint: #e4f2ec; --solid: #0f6b4f; }
.tone-orange { --tint: #fdeee6; --solid: #d95926; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: #edf0ee; color: #4b5a54; }
.delta.good { background: #e2f3e7; color: #17663a; }
.delta.bad { background: #fde8e7; color: #9b2c22; }
.ph-icon { width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--tint); color: var(--solid); font-size: .9rem; margin-right: 9px; vertical-align: -1px; flex: none; }
.panel-head h2 { display: flex; align-items: center; }

.chart-box { padding-top: 10px; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .grid { stroke: #e5ebe8; stroke-width: 1; }
.chart-svg .tick { fill: #6b7a73; font-size: 12px; font-family: inherit; }
.chart-svg .cap { fill: var(--ink); font-size: 12px; font-weight: 600; font-family: inherit; }
.chart-svg .line, .spark .line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .area, .spark .area { opacity: .1; }
.chart-svg .end-dot, .spark .end-dot { stroke: #fff; stroke-width: 2; }
.chart-svg .xhair { stroke: #8d9b95; stroke-width: 1; opacity: 0; pointer-events: none; }
.chart-svg.hovering .xhair { opacity: 1; }
.chart-svg .hit { fill: transparent; cursor: default; }
.chart-svg .bar { transition: opacity .12s; }
.chart-svg .hit:hover + .bar, .chart-svg:hover .bar { opacity: .92; }
.chart-empty { color: var(--muted); text-align: center; padding: 40px 12px; font-size: .8125rem; }
.chart-tip { position: fixed; z-index: 3000; pointer-events: none; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-2); border-radius: 8px; padding: 8px 10px; font-size: .8125rem; min-width: 120px; max-width: 280px; opacity: 0; transition: opacity .08s; }
.chart-tip.show { opacity: 1; }
.chart-tip .tt-title { color: var(--muted); font-size: .75rem; margin-bottom: 4px; }
.chart-tip .tt-row { display: flex; align-items: center; gap: 7px; }
.chart-tip .tt-row strong { font-weight: 650; }
.chart-tip .tt-row span { color: var(--muted); }
.chart-tip .tt-key { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.chart-table { margin-top: 8px; font-size: .8125rem; }
.chart-table summary { color: var(--muted); cursor: pointer; display: inline-block; }
.chart-table summary:hover { color: var(--ink); }
.chart-table .table-wrap { max-height: 260px; overflow: auto; margin-top: 6px; border: 1px solid var(--line-soft); border-radius: 8px; }

.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8125rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend strong { color: var(--ink); font-weight: 600; }
.legend .key { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.legend .line-key { width: 14px; height: 3px; border-radius: 2px; }
.legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin-top: 16px; }
.legend-grid li { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 8px; align-items: center; }
.legend-grid a, .legend-grid span { color: var(--ink); }
.legend-grid small { color: var(--faint); min-width: 32px; text-align: right; }
.stackbar { display: flex; gap: 2px; height: 16px; border-radius: 6px; overflow: hidden; background: var(--line-soft); }
.stackbar span { min-width: 4px; }
.stackbar span:first-child { border-radius: 6px 0 0 6px; } .stackbar span:last-child { border-radius: 0 6px 6px 0; }
.mini-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.mini-facts div { display: flex; flex-direction: column; gap: 2px; }
.mini-facts span { color: var(--muted); font-size: .75rem; }
.mini-facts strong { font-size: 1.15rem; font-weight: 650; }

.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hbars li { display: grid; grid-template-columns: minmax(0, 42%) 1fr 48px; gap: 12px; align-items: center; }
.hb-label { min-width: 0; line-height: 1.25; }
.hb-label a, .hb-label small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-label small { color: var(--faint); font-size: .72rem; }
.hb-track { height: 10px; background: #eef2f0; border-radius: 0 4px 4px 0; overflow: hidden; display: block; }
.hb-track > span { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.hb-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.cell-bar { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.cell-bar .n { width: 22px; font-weight: 600; text-align: right; }
.cell-bar .hb-track { flex: 1; }
.perf-table td { vertical-align: middle; }

.heatmap { display: grid; gap: 3px; font-size: .7rem; color: var(--muted); }
.hm-col { text-align: left; white-space: nowrap; overflow: visible; }
.hm-row { display: flex; align-items: center; }
.hm-cell { display: block; height: 22px; border-radius: 3px; background: #eef2f0; }
.hm-cell.s1 { background: #cde2fb; } .hm-cell.s2 { background: #9ec5f4; } .hm-cell.s3 { background: #6da7ec; }
.hm-cell.s4 { background: #3987e5; } .hm-cell.s5 { background: #256abf; } .hm-cell.s6 { background: #184f95; }
.heatmap .hm-cell:hover { outline: 2px solid var(--ink); outline-offset: -1px; }
.hm-scale { display: flex; align-items: center; gap: 3px; justify-content: flex-end; margin-top: 10px; font-size: .72rem; color: var(--muted); }
.hm-scale .hm-cell { width: 16px; height: 10px; display: inline-block; }
.hm-scale span { margin: 0 4px; }

.wait-list { list-style: none; margin: 0; padding: 4px 0; }
.wait-list a { display: flex; align-items: center; gap: 10px; padding: 9px 16px; color: var(--ink); }
.wait-list a:hover { background: #f6faf8; text-decoration: none; }
.wl-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.wl-text strong, .wl-text span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.wl-text strong { font-weight: 600; }
.wl-text span { color: var(--muted); font-size: .8125rem; }
.wl-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.wl-age { font-weight: 600; font-size: .78rem; color: #8a5a00; background: #fff4d6; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.wl-age.late { color: #9b2c22; background: #fde8e7; }
.mb-health { list-style: none; margin: 0; padding: 0; }
.mb-health li { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.mb-health li:last-child { border-bottom: 0; }
.mb-health strong { font-weight: 600; }
.mb-health small { color: var(--muted); display: block; }
.min-w-0 { min-width: 0; }
.mb-count { text-align: right; min-width: 70px; }
.mb-count strong { display: block; font-size: 1.05rem; line-height: 1.1; }
.mb-state { width: 150px; text-align: right; font-size: .75rem; color: var(--muted); }
.kpi-grid + .row, .kpi-grid + .panel { margin-top: 14px; }

/* Role dashboards */
.role-tag { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600; color: var(--pine-700); background: var(--pine-50); border-radius: 999px; padding: 2px 10px; margin: 4px 0 2px; }
.draft-list { list-style: none; margin: 0; padding: 6px 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 6px; }
.draft-list a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; background: var(--slip); border: 1px solid #efd78f; color: var(--ink); }
.draft-list a:hover { text-decoration: none; border-color: var(--slip-edge); box-shadow: var(--shadow-2); }
.dl-slip { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--slip-edge); color: #fff; flex: none; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 12px; }
.quick-actions a { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; font-size: .8125rem; }
.quick-actions a i { font-size: 1.2rem; color: var(--solid, var(--pine-600)); }
.quick-actions a:hover { text-decoration: none; border-color: var(--pine-500); box-shadow: var(--shadow-2); }
.status-list { list-style: none; margin: 0; padding: 0; }
.status-list li { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.status-list li:last-child { border-bottom: 0; }
.status-list .sl-text { flex: 1; min-width: 0; line-height: 1.3; }
.status-list .sl-text small { display: block; color: var(--muted); }
.event-list { list-style: none; margin: 0; padding: 0; }
.event-list li { display: flex; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line-soft); align-items: flex-start; }
.event-list li:last-child { border-bottom: 0; }
.event-list .ev-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--tint); color: var(--solid); flex: none; }
.event-list .ev-text { flex: 1; min-width: 0; line-height: 1.3; }
.event-list .ev-text small { display: block; color: var(--muted); }
.event-list .ev-time { color: var(--faint); font-size: .75rem; white-space: nowrap; }

/* Legacy compact stat row (account activity, backups) */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; color: var(--ink); display: block; box-shadow: var(--shadow-1); position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--pine-500); }
.stat:nth-child(4n+2)::before { background: var(--c-blue); } .stat:nth-child(4n+3)::before { background: var(--c-violet); } .stat:nth-child(4n+4)::before { background: var(--c-yellow); }
a.stat:hover { border-color: var(--pine-500); text-decoration: none; color: var(--ink); box-shadow: var(--shadow-2); }
.stat .label { color: var(--muted); font-size: .8125rem; display: flex; align-items: center; gap: 6px; font-weight: 500; }
.stat .value { font-size: 1.75rem; font-weight: 650; line-height: 1.15; margin-top: 4px; }
.stat .hint { font-size: .75rem; color: var(--faint); }
.stat.attn { border-color: #f3c7c3; background: #fffafa; }
.stat.attn::before { background: var(--c-red); }
.stat.attn .value { color: var(--danger); }
.bar { height: 6px; background: var(--line-soft); border-radius: 999px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--pine-500); border-radius: 999px; }

/* ---------- Messages ---------- */
.chat { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 58px - 22px - 48px - 70px); min-height: 460px; }
.chat-list { border-right: 1px solid var(--line); overflow-y: auto; }
.chat-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); color: var(--ink); align-items: center; }
.chat-item:hover { background: #f6faf8; text-decoration: none; color: var(--ink); }
.chat-item.active { background: var(--pine-50); }
.chat-item .ci-text { min-width: 0; flex: 1; }
.chat-item .ci-text strong, .chat-item .ci-text span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-item .ci-text span { color: var(--muted); font-size: .8125rem; }
.chat-item .unread { background: var(--pine-600); color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 700; padding: 1px 7px; }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #fbfcfb; }
.msg { max-width: 72%; align-self: flex-start; }
.msg.mine { align-self: flex-end; }
.msg-bubble { background: #fff; border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; padding: 8px 12px; word-break: break-word; }
.msg.mine .msg-bubble { background: var(--pine-600); border-color: var(--pine-600); color: #fff; border-radius: 12px 12px 4px 12px; }
.msg.mine .msg-bubble a { color: #fff; text-decoration: underline; }
.msg-meta { font-size: .72rem; color: var(--faint); margin: 3px 4px 0; }
.msg.mine .msg-meta { text-align: right; }
.chat-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.chat-form textarea { resize: none; }

/* Mailbox form: portal account */
.acct-section { background: #f8fbfa; }
.acct-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.acct-mode { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 12px; cursor: pointer; margin: 0; }
.acct-mode:has(input:checked) { border-color: var(--pine-500); box-shadow: 0 0 0 3px rgba(15,107,79,.12); }
.acct-mode .form-check-input { margin-top: 3px; flex: none; }
.acct-mode span { display: flex; flex-direction: column; line-height: 1.3; }
.acct-mode i { color: var(--pine-600); font-size: 1.1rem; margin-bottom: 2px; }
.acct-mode small { color: var(--muted); }
.linked-user { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
@media (max-width: 767.98px) { .acct-modes { grid-template-columns: 1fr; } }

/* Add staff: role cards and live signature */
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.role-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 12px; cursor: pointer; margin: 0; }
.role-card:has(input:checked) { border-color: var(--pine-500); box-shadow: 0 0 0 3px rgba(15,107,79,.12); background: #f8fcfa; }
.role-card .form-check-input { margin-top: 3px; flex: none; }
.role-card span { display: flex; flex-direction: column; line-height: 1.3; }
.role-card i { color: var(--pine-600); font-size: 1.15rem; margin-bottom: 3px; }
.role-card small { color: var(--muted); }
.sig-live { font-family: inherit; font-size: .875rem; background: #fafcfb; border: 1px dashed var(--line); border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; margin-bottom: 8px; }
@media (max-width: 991.98px) { .role-cards { grid-template-columns: 1fr 1fr; } }

/* Test results (mail server, Plesk) */
.test-results { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-1); overflow: hidden; max-width: 1100px; }
.tr-summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-size: .95rem; }
.tr-summary.ok { background: #e2f3e7; color: #17663a; } .tr-summary.bad { background: #fde8e7; color: #9b2c22; }
.tr-summary span { margin-left: auto; font-size: .8125rem; }
.tr-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px; border-top: 1px solid var(--line-soft); }
.tr-row > i { font-size: 1.05rem; margin-top: 1px; }
.tr-row.ok > i { color: #22a35a; } .tr-row.bad > i { color: var(--c-red); } .tr-row.warn > i { color: #b98900; }
.tr-row div { display: flex; flex-direction: column; line-height: 1.35; }
.tr-row span { color: var(--muted); font-size: .8125rem; word-break: break-word; }
pre.cmd { background: #10241c; color: #d5ebe2; border-radius: 8px; padding: 10px 12px; font-size: .78rem; white-space: pre-wrap; word-break: break-all; }
.plesk-opt { background: #f3f8fd; border: 1px solid #d6e6f8; border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }

/* Staff import */
.step-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--pine-600); color: #fff; font-size: .75rem; margin-right: 8px; vertical-align: 1px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 2px dashed #c6d3cd; border-radius: 12px; padding: 26px; background: #fafcfb; cursor: pointer; text-align: center; margin: 0; }
.dropzone:hover, .dropzone:focus-within { border-color: var(--pine-500); background: var(--pine-50); }
.dropzone i { font-size: 2rem; color: var(--pine-600); }
.dropzone span { color: var(--muted); font-size: .8125rem; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.import-head { margin-bottom: 14px; }
.import-progress { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); background: #f7fbf9; }
.import-progress .progress { height: 10px; }
.import-table { max-height: 62vh; overflow: auto; }
.import-table thead th { position: sticky; top: 0; z-index: 1; }
.import-table tr.st-error td { background: #fff7f6; }
.import-table tr.st-created td { background: #f3fbf5; }
.import-result { min-width: 220px; }
.badge-soft.soft { background: var(--pine-50); color: var(--pine-700); }

/* Teams */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.team-card { margin: 0 !important; }
.team-lead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.team-lead span { display: flex; flex-direction: column; line-height: 1.3; }
.team-lead small { color: var(--muted); }
.team-stats { display: flex; gap: 18px; color: var(--muted); font-size: .8125rem; margin-bottom: 10px; }
.team-stats strong { color: var(--ink); font-size: 1rem; }
.team-members { display: flex; flex-wrap: wrap; gap: 6px; }
.tm { display: inline-flex; align-items: center; gap: 5px; background: var(--paper); border-radius: 999px; padding: 2px 9px 2px 2px; font-size: .78rem; }
.tm.more { padding: 3px 9px; color: var(--muted); }
.picker-list.tall { max-height: 420px; }

/* Recipient picker (new message) */
.picker { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.picker-tools { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 10px 12px; background: #f7f9f8; border-bottom: 1px solid var(--line); }
.picker-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 10px; font-size: .78rem; font-weight: 500; color: var(--ink); display: inline-flex; align-items: center; gap: 5px; }
.chip:hover { border-color: var(--pine-500); color: var(--pine-700); }
.chip span { color: var(--muted); }
.picker-search { position: relative; margin-left: auto; min-width: 180px; }
.picker-search i { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: .8rem; }
.picker-search input { padding-left: 28px; }
.picker-list { max-height: 260px; overflow-y: auto; }
.picker-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); cursor: pointer; margin: 0; }
.picker-row:last-child { border-bottom: 0; }
.picker-row:hover { background: #f6faf8; }
.picker-row:has(input:checked) { background: var(--pine-50); }
.picker-row strong { font-weight: 500; display: block; }
.picker-row small { color: var(--muted); display: block; font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-copy { background: #f3f8fd; border: 1px solid #d6e6f8; border-radius: 10px; padding: 10px 12px; }

/* ---------- Dashboard alerts (unread notifications) ---------- */
.alerts { margin: 14px 0 4px; border: 1px solid #f0d58a; border-left: 5px solid var(--slip-edge); background: linear-gradient(100deg, #fff8e3 0%, #fff 55%); border-radius: 12px; box-shadow: var(--shadow-1); overflow: hidden; }
.alerts.is-urgent { border-color: #f1c4c4; border-left-color: var(--c-red); background: linear-gradient(100deg, #fdeeee 0%, #fff 55%); }
.alerts.is-empty { display: none; }
.alerts-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.alerts-bell { position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--slip-edge); color: #fff; font-size: 1.1rem; flex: none; }
.alerts.is-urgent .alerts-bell { background: var(--c-red); }
.alerts-pulse { position: absolute; inset: -4px; border-radius: 50%; border: 2px solid currentColor; color: var(--slip-edge); animation: alert-pulse 1.8s ease-out infinite; }
.alerts.is-urgent .alerts-pulse { color: var(--c-red); }
@keyframes alert-pulse { 0% { transform: scale(.85); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.alerts-title { display: flex; flex-direction: column; line-height: 1.3; }
.alerts-title strong { font-size: .95rem; }
.alerts-title small { color: var(--muted); }
.alerts-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.alerts-actions .btn[aria-pressed="true"] { background: var(--pine-50); border-color: var(--pine-500); color: var(--pine-700); }
.alerts-list { list-style: none; margin: 0; padding: 0 8px 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px; }
.alerts-list a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; background: #fff; border: 1px solid var(--line-soft); color: var(--ink); }
.alerts-list a:hover { text-decoration: none; border-color: var(--solid); box-shadow: var(--shadow-2); }
.alerts-list li.fresh a { animation: alert-in .5s ease-out; border-color: var(--solid); }
@keyframes alert-in { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
.al-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--tint); color: var(--solid); flex: none; }
.al-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.al-text small { color: var(--solid); font-weight: 600; font-size: .72rem; }
.al-text strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-time { color: var(--faint); font-size: .72rem; white-space: nowrap; }
.bell-dot { animation: bell-blink 2s ease-in-out infinite; }
@keyframes bell-blink { 50% { transform: scale(1.35); } }

/* ---------- Notifications ---------- */
.notif-menu { width: 380px; padding: 0; overflow: hidden; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); color: var(--ink); font-size: .8125rem; }
.notif-item:hover { background: #f6faf8; text-decoration: none; color: var(--ink); }
.notif-item.unread { background: #f3f9f6; }
.notif-item.unread .ni-title { font-weight: 600; }
.notif-item i { color: var(--pine-600); font-size: 1rem; margin-top: 1px; }
.notif-item small { color: var(--faint); display: block; margin-top: 2px; }
.notif-empty { padding: 24px; text-align: center; color: var(--muted); font-size: .8125rem; }
.notif-foot { display: block; text-align: center; padding: 9px; font-weight: 500; border-top: 1px solid var(--line-soft); }

/* ---------- Logs ---------- */
.people-online { list-style: none; margin: 0; padding: 0; max-height: 330px; overflow-y: auto; }
.people-online > li { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line-soft); }
.people-online > li:last-child { border-bottom: 0; }
.people-online strong { font-weight: 600; }
.people-online small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device { display: flex; align-items: center; gap: 9px; }
.device > i { font-size: 1.2rem; color: var(--muted); }
.device div { line-height: 1.3; }
.device small { color: var(--muted); display: block; }
.mono { font-family: Consolas, "Cascadia Mono", Menlo, monospace; font-size: .8rem; }
.json-details { font-family: Consolas, "Cascadia Mono", Menlo, monospace; font-size: .75rem; white-space: pre-wrap; word-break: break-word; max-width: 420px; color: #3c4b45; background: var(--paper); border-radius: 6px; padding: 6px 8px; margin: 0; }
.log-filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.table-wrap { overflow-x: auto; }

/* ---------- Compose / forms ---------- */
.form-section { padding: 18px 20px; border-bottom: 1px solid var(--line-soft); }
.form-section:last-child { border-bottom: 0; }
.form-section h2 { font-size: .9375rem; font-weight: 600; margin: 0 0 4px; }
.form-section > p { color: var(--muted); margin: 0 0 14px; }
.composer-body { min-height: 220px; font-family: inherit; line-height: 1.55; }
.quoted { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; color: var(--muted); font-size: .8125rem; max-height: 160px; overflow: auto; white-space: pre-wrap; }
.sig-preview { margin-top: 8px; border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; background: #fafcfb; }
.sig-preview .sig-label { font-size: .75rem; color: var(--muted); }
.sig-preview pre { margin: 4px 0 0; font-family: inherit; font-size: .8125rem; color: #3c4b45; white-space: pre-wrap; }
.secret-box { font-family: Consolas, Menlo, monospace; font-size: 1.1rem; background: var(--slip); border: 1px dashed var(--slip-edge); padding: 10px 14px; border-radius: 8px; letter-spacing: .04em; user-select: all; }

/* ---------- Guest (login) ---------- */
.guest { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr); background: #fff; }
.guest-art { background: var(--pine-900); color: #d5ebe2; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.guest-art h1 { color: #fff; font-size: 2rem; font-weight: 600; max-width: 460px; line-height: 1.2; }
.guest-art p { max-width: 440px; color: #a9c8bb; font-size: .9375rem; }
.guest-art.has-image { background: var(--pine-950); }
.guest-art-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 70% 100%; z-index: 0; }
.guest-art.has-image::before { content: ""; position: absolute; inset: 0; z-index: 0; background: linear-gradient(180deg, rgba(8,26,20,.88) 0%, rgba(8,26,20,.55) 55%, rgba(8,26,20,.75) 100%); }
.guest-art > :not(.guest-art-img) { position: relative; z-index: 1; }
.slip-stack { position: relative; height: 260px; margin: 32px 0; }
.slip-card { position: absolute; background: #fff; color: var(--ink); border-radius: 8px; padding: 12px 14px; width: 300px; font-size: .8125rem; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.slip-card.one { left: 0; top: 0; transform: rotate(-2deg); }
.slip-card.two { left: 70px; top: 88px; background: var(--slip); color: var(--slip-ink); transform: rotate(1.5deg); border: 1px solid #efd78f; }
.slip-card.three { left: 150px; top: 172px; transform: rotate(-1deg); }
.slip-card strong { display: block; font-weight: 600; margin-bottom: 2px; }
.guest-form { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px 20px; position: relative; }
.guest-footer { position: absolute; bottom: 16px; left: 24px; right: 24px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .72rem; color: var(--faint); }
.login-box { width: 100%; max-width: 360px; }
.login-box h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 4px; }
.login-box .lead-sm { color: var(--muted); margin-bottom: 24px; }
.login-box .form-control { padding: .6rem .8rem; font-size: .9375rem; }
.login-foot { margin-top: 28px; font-size: .75rem; color: var(--faint); line-height: 1.5; }
.pw-wrap { position: relative; }
.pw-wrap .btn-icon { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; }

/* ---------- Two-factor ---------- */
.tfa-icon { width: 52px; height: 52px; border-radius: 12px; background: var(--pine-50); color: var(--pine-700); display: grid; place-items: center; font-size: 1.6rem; margin-bottom: 16px; }
.code-input { font-size: 1.35rem; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }
.code-input::placeholder { letter-spacing: .1em; color: #b3bfba; }
.tfa-setup { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.tfa-qr { width: 200px; height: 200px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: #fff; }
.recovery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 160px)); gap: 6px 32px; white-space: pre-line; }
.recovery-grid span { display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 1399.98px) {
  .kpi .spark { width: 84px; }
}
@media (max-width: 1199.98px) {
  .email-layout { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; }
  .app.sidebar-open .sidebar { transform: none; }
  .app.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1035; }
  .content { padding: 16px 14px 40px; }
  .hero-standard, .hero-tall { height: 148px; }
  .hero-compact { height: 112px; }
  .hero-slim { height: 56px; }
  .hero-text { left: 14px; right: 14px; bottom: 12px; }
  .hero-text strong, .hero-tall .hero-text strong { font-size: 1.15rem; }
  .hero-slim .hero-text strong { font-size: .95rem; }
  .topbar { padding: 0 12px; }
  .mail-row { grid-template-columns: 4px 32px 1fr; padding-right: 12px; }
  .mail-row .mail-from { grid-column: 3; }
  .mail-row .mail-main { grid-column: 2 / 4; padding-left: 0; }
  .mail-row .mail-meta { grid-column: 2 / 4; flex-direction: row; align-items: center; justify-content: flex-start; margin-top: 4px; }
  .mail-row .avatar-col { grid-row: 1; }
  .guest { grid-template-columns: 1fr; }
  .guest-art { display: none; }
  .chat { grid-template-columns: 1fr; height: auto; }
  .chat-list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 240px; }
  .chat-msgs { min-height: 360px; }
  .notif-menu { width: min(380px, 92vw); }
  .chart-box { overflow-x: auto; }
  .app-footer { padding: 14px; justify-content: center; text-align: center; }
  .app-footer > div { justify-content: center; }
  .chart-box .chart-svg { min-width: 520px; }
}
@media (max-width: 575.98px) {
  .email-from { flex-wrap: wrap; }
  .email-from .who { flex-basis: calc(100% - 60px); }
  .email-from .when { width: 100%; text-align: left; padding-left: 60px; }
  .email-head, .email-body-wrap { padding-left: 14px; padding-right: 14px; }
  .attachments { padding: 0 14px 14px; }
  .page-head h1, .dash-head h1 { font-size: 1.25rem; }
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .legend-grid, .mini-facts { grid-template-columns: 1fr 1fr; }
  .heatmap { font-size: .6rem; }
  .hm-cell { height: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@media print {
  .sidebar, .topbar, .hero, .crumb-back, .page-actions, .internal-form, .no-print, .app-footer { display: none !important; }
  .content { padding: 0; }
}

/* distribution lists */
.chip-list { border-color: #d9d3f6; background: #f5f3fe; color: #4b3bb5; }
.chip-list i { color: #6250d6; }
.list-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.list-card:last-child { border-bottom: 0; }
.list-card .ph-icon { flex: none; }
.list-card .lc-main { flex: 1; min-width: 0; }
.list-card .lc-main small { color: var(--muted); display: block; }
.list-card .avatar-stack { margin-top: 6px; }
.reply-note { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; line-height: 1.4; }
.domain-note { display: flex; gap: 8px; align-items: flex-start; font-size: .8125rem; color: var(--muted); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.domain-note i { color: var(--pine-600); margin-top: 2px; }
.assignee-more summary { font-size: .8125rem; color: var(--pine-700); font-weight: 600; cursor: pointer; padding: 6px 0; }
