/* Design tokens extracted from QuickSMS's actual shipped CSS - project design.
   Evolving the existing brand identity, not replacing it; stripped of the
   Bootstrap-admin-template chrome (heavy shadows, gradient badges, dense borders). */
:root {
  --brand-primary: #448bff;
  --brand-dark: #192039;
  --brand-accent-cyan: #14bae4;
  --brand-accent-pink: #f54394;
  --success: #31c971;
  --warning: #f4c414;
  --danger: #e5484d;
  --text-primary: #1a1d23;
  --text-secondary: #5e676f;
  --surface: #f5f5f6;
  --surface-elevated: #ffffff;
  --border: #e2e5eb;

  --success-bg: #e8f9ee;
  --success-text: #1a7a45;
  --danger-bg: #fdecec;
  --danger-text: #a92323;
  --warning-bg: #fff6dc;
  --warning-text: #8a6d00;
  --selected-bg: #eef4ff;
  --bubble-customer-bg: #eceff3;
  --bubble-automation-bg: #e7f0ff;

  /* Sidebar/topbar ("chrome") colors - light theme gets a light chrome, not a
     permanently-dark one. User explicitly flagged the fixed-dark sidebar as a light-mode
     gap: "left bar and nav bar need to obey light theme". */
  --chrome-bg: #ffffff;
  --chrome-text: var(--text-primary);
  --chrome-text-muted: var(--text-secondary);
  --chrome-border: var(--border);
  --chrome-hover: var(--surface);
  --chrome-active: #eef2fb;

  --radius: 6px;
  --font: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
  /* Tells the browser which theme its OWN unstyled chrome should render in - the
     native date-picker calendar popup, spinner arrows, scrollbars. Without this an
     <input type="date"> keeps a white calendar popup even once its box is styled dark. */
  color-scheme: light;
}

/* Keep every scrollable panel compact and unobtrusive. */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }
:root[data-theme="dark"] { --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3); color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3); color-scheme: dark; }
}

/* ---- dark theme (project design follow-up: user-requested dark/light toggle)
   Every color in this file is a CSS variable, so dark mode is a token swap, not a
   parallel stylesheet - [data-theme] is set on <html> by the toggle script in
   layouts/app.twig, defaulting to the OS preference on first visit. ---- */
:root[data-theme="dark"] {
  --text-primary: #e8e9ec;
  --text-secondary: #9aa0ab;
  /* Navy-tinted, matching --brand-dark's (#192039) hue family, not flat/desaturated
     black - "are you sure why black" flagged the page content reading as pure black
     next to the visibly-navy sidebar/topbar. */
  --surface: #171b2c;
  --surface-elevated: #1e2338;
  --border: #333c58;

  --success-bg: #123422;
  --success-text: #4fdb8e;
  --danger-bg: #3a1618;
  --danger-text: #ff8a8e;
  --warning-bg: #3a3011;
  --warning-text: #f4c414;
  --selected-bg: #1e2a42;
  --bubble-customer-bg: #262a33;
  --bubble-automation-bg: #1e2c42;

  --chrome-bg: var(--brand-dark);
  --chrome-text: #ffffff;
  --chrome-text-muted: rgba(255,255,255,0.75);
  --chrome-border: rgba(255,255,255,0.12);
  --chrome-hover: rgba(255,255,255,0.08);
  --chrome-active: rgba(255,255,255,0.1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text-primary: #e8e9ec;
    --text-secondary: #9aa0ab;
    --surface: #171b2c;
    --surface-elevated: #1e2338;
    --border: #333c58;

    --success-bg: #123422;
    --success-text: #4fdb8e;
    --danger-bg: #3a1618;
    --danger-text: #ff8a8e;
    --warning-bg: #3a3011;
    --warning-text: #f4c414;
    --selected-bg: #1e2a42;
    --bubble-customer-bg: #262a33;
    --bubble-automation-bg: #1e2c42;

    --chrome-bg: var(--brand-dark);
    --chrome-text: #ffffff;
    --chrome-text-muted: rgba(255,255,255,0.75);
    --chrome-border: rgba(255,255,255,0.12);
    --chrome-hover: rgba(255,255,255,0.08);
    --chrome-active: rgba(255,255,255,0.1);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
}

a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  background: var(--chrome-bg);
  color: var(--chrome-text);
  border-bottom: 1px solid var(--chrome-border);
  flex-shrink: 0;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: 0.02em; }
/* Logo chip stays white regardless of theme (the logo asset itself assumes a light
   background) - flagged directly as "too small to read", sized up from 22px. */
/* No forced white chip - the logo file has a real alpha channel (confirmed via its WEBP
   ALPH chunk), so it sits directly on the topbar/sidebar like the real reference does,
   instead of an inconsistent white patch that doesn't obey the theme. */
.brand-logo { display: flex; align-items: center; width: 36px; overflow: hidden; flex-shrink: 0; }
.brand-logo img { height: 36px; width: auto; max-width: none; display: block; }
.brand-name { display: flex; flex-direction: column; color: var(--chrome-text); font-size: 12px; line-height: 1.1; white-space: nowrap; }
.brand-name small { color: var(--chrome-text-muted); font-size: 7px; line-height: 1.2; margin-top: 2px; }
.brand-product { font-size: 14px; font-weight: 500; color: var(--chrome-text-muted); padding-left: 10px; border-left: 1px solid var(--chrome-border); }
.topbar .user-menu { display: flex; align-items: center; gap: 12px; font-size: 13px; position: relative; }
.topbar .user-menu form { display: inline; }
.topbar .user-menu button {
  background: none; border: none; color: var(--chrome-text-muted); cursor: pointer; font-size: 13px;
}
.user-dropdown { position: relative; }
.bell-toggle {
  position: relative; background: none; border: none; color: var(--chrome-text-muted); cursor: pointer;
  padding: 6px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.bell-toggle:hover { background: var(--chrome-hover); color: var(--chrome-text); }
.bell-toggle svg { width: 18px; height: 18px; }
.bell-toggle.has-pending svg { transform-origin: 50% 8%; animation: bell-pending-shake 6s ease-in-out infinite; }
@keyframes bell-pending-shake {
  0%, 82%, 100% { transform: rotate(0); }
  84% { transform: rotate(13deg); }
  86% { transform: rotate(-11deg); }
  88% { transform: rotate(8deg); }
  90% { transform: rotate(-5deg); }
  92% { transform: rotate(0); }
}
.notif-badge {
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 1;
  border-radius: 999px; padding: 2px 5px; min-width: 15px; text-align: center;
}
.bell-toggle .notif-badge { position: absolute; top: 2px; right: 2px; }
.bell-menu { right: 40px; width: 390px; min-width: 300px; max-width: min(420px, calc(100vw - 24px)); max-height: min(440px, calc(100vh - 80px)); overflow-y: auto; padding: 8px; }
.bell-menu-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 4px 8px 10px; color: var(--text-secondary); font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.bell-menu-empty { padding: 18px 12px; color: var(--text-secondary); font-size: 12px; line-height: 1.5; text-align: center; }
.bell-notification { display: grid; gap: 4px; padding: 10px; border-radius: 7px; color: var(--text-primary); font-size: 12px; }
.bell-notification.is-unread { background: color-mix(in srgb, var(--brand-primary) 9%, var(--surface-elevated)); box-shadow: inset 2px 0 var(--brand-primary); }
.bell-notification:hover { background: var(--surface); text-decoration: none; }
.bell-notification-heading { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bell-notification-heading strong { font-size: 12px; }
.bell-notification-preview { color: var(--text-secondary); font-size: 11px; line-height: 1.45; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; overflow-wrap: anywhere; }
.notification-sound-button { display: grid; place-items: center; flex: 0 0 22px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--text-secondary); cursor: pointer; }
.notification-sound-button svg { width: 14px; height: 14px; }
.notification-sound-button:hover { background: var(--surface); color: var(--brand-primary); }
.notification-sound-button:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 1px; }
.bell-toggle.notifications-reconnecting::after { content: ''; position: absolute; right: 1px; bottom: 1px; width: 6px; height: 6px; border: 1px solid var(--chrome-bg); border-radius: 50%; background: var(--warning); }
@media (max-width: 520px) { .bell-menu { right: 0; width: calc(100vw - 24px); min-width: 0; } }
.user-profile-card { padding: 22px; }
.user-profile-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.user-profile-heading h2 { margin: 0 0 5px; }
.user-profile-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }
.user-profile-avatar { display: grid; place-items: center; width: 58px; height: 58px; flex: 0 0 58px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--brand-primary); font-size: 22px; font-weight: 700; }
.user-status-line, .user-profile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.user-profile-phone { margin-top: 4px; color: var(--text-secondary); font-size: 12px; }
.user-inline-meta { color: var(--text-secondary); font-size: 11px; }
.user-inline-meta strong { color: var(--text-primary); font-size: 12px; }
.user-inline-meta .user-active { color: var(--success, #18a968); }
.user-inline-meta .user-inactive { color: var(--danger, #ef476f); }
.user-profile-actions { margin-top: 0; gap: 8px; }
.user-profile-actions > form { display: flex; align-items: center; margin: 0; }
.user-profile-actions > form .btn,
.user-profile-actions > .btn,
.user-profile-actions .user-more-menu > summary.btn {
  display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-height: 32px;
}
.user-profile-actions > form .btn { width: 40px; padding: 6px; }
.user-profile-actions .user-more-menu { display: flex; align-items: center; }
.user-more-menu { position: relative; }
.user-more-menu summary { list-style: none; cursor: pointer; }
.user-profile-actions .user-more-menu > summary.btn { gap: 5px; line-height: 1; white-space: nowrap; }
.user-profile-actions .user-more-menu > summary.btn svg { width: 14px; height: 14px; flex: 0 0 14px; }
.user-more-menu summary::-webkit-details-marker { display: none; }
.user-more-popover { position: absolute; z-index: 20; top: calc(100% + 6px); right: 0; min-width: 150px; padding: 5px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-elevated); box-shadow: var(--card-shadow); }
.user-more-popover button { width: 100%; border: 0; background: transparent; padding: 9px 10px; text-align: left; color: var(--text-primary); cursor: pointer; }
.user-more-popover button:hover { background: var(--surface); }
.user-detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); gap: 16px; margin-top: 16px; }
.user-detail-list { margin: 0; }
.user-detail-list > div { display: grid; grid-template-columns: minmax(100px, .55fr) 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.user-detail-list dt { color: var(--text-secondary); font-weight: 400; }
.user-detail-list dd { margin: 0; overflow-wrap: anywhere; }
.user-permissions-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.user-permissions-heading h2, .section-heading h2, .section-heading h3 { margin: 0 0 5px; }
.user-capability-list { max-height: 480px; overflow-y: auto; margin-top: 4px; padding: 0 10px; }
.effective-permission-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.effective-permission-row:last-child { border-bottom: 0; }
.effective-permission-row > span { display: grid; gap: 3px; }
.effective-permission-row .permission-index { color: var(--text-secondary); font-weight: 400; }
.effective-permission-row strong { font-size: 12px; font-weight: 600; }
.effective-permission-row small { color: var(--text-secondary); font-size: 11px; }
.effective-permission-row code, .permission-row-copy code { color: var(--text-secondary); font-size: 10px; overflow-wrap: anywhere; }
.access-management-card { padding: 22px; }
.access-management-card > .section-heading { padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.role-select-group { max-width: 520px; margin-top: 18px; }
.permission-override-panel { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.permission-override-list { max-height: 480px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 12px; }
.permission-management-list { margin-top: 14px; }
.permission-override-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 2px; border-bottom: 1px solid var(--border); }
.permission-override-row:last-child { border-bottom: 0; }
.permission-override-row .permission-row-copy { display: grid; gap: 3px; min-width: 0; }
.permission-override-row strong { font-size: 12px; }
.permission-override-row small { color: var(--text-secondary); font-size: 11px; }
.permission-override-row select { max-width: 160px; flex: 0 0 150px; }
.permission-assignment-page .page-header { margin-bottom: 18px; }
.permission-assignment-group { padding: 0; overflow: hidden; }
.permission-group-heading { padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.permission-group-select { display: flex; align-items: flex-start; gap: 10px; margin: 0; cursor: pointer; }
.permission-group-select input, .permission-assignment-item input { width: 16px; height: 16px; margin: 2px 0 0; flex: 0 0 16px; accent-color: var(--brand-primary); }
.permission-group-select > span, .permission-assignment-copy { display: grid; gap: 4px; min-width: 0; }
.permission-group-select strong { font-size: 13px; }
.permission-group-select small, .permission-assignment-copy small { color: var(--text-secondary); font-size: 11px; line-height: 1.45; }
.permission-assignment-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.permission-assignment-item { display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 14px 18px; border-bottom: 1px solid var(--border); cursor: pointer; }
.permission-assignment-item:nth-child(3n + 2), .permission-assignment-item:nth-child(3n + 3) { border-left: 1px solid var(--border); }
.permission-assignment-item:hover { background: var(--selected-bg); }
.permission-assignment-copy strong { font-size: 12px; font-weight: 500; }
.permission-info { display: grid; place-items: center; width: 15px; height: 15px; flex: 0 0 15px; border: 1px solid var(--text-secondary); border-radius: 50%; color: var(--text-secondary); font-size: 10px; line-height: 1; }
.permission-assignment-save { display: block; width: 100%; margin: 4px 0 22px; }
.user-create-card { padding: 22px; }
.user-otp-choice { display: flex; align-items: flex-start; gap: 11px; max-width: 560px; margin: 8px 0 22px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.user-otp-choice input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--brand-primary); }
.user-otp-choice span { display: grid; gap: 4px; }
.user-otp-choice small { color: var(--text-secondary); font-size: 11px; }
.user-create-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.user-create-summary > div { display: grid; gap: 4px; }
.user-create-summary > div span { color: var(--text-secondary); font-size: 12px; }
.user-create-actions { position: sticky; bottom: 10px; z-index: 5; padding: 12px; margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-elevated); box-shadow: var(--card-shadow); }
.user-edit-details { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.user-activity-history { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.user-activity-history h3 { margin: 0 0 14px; font-size: 13px; }
.user-activity-list { margin: 0; padding: 0; list-style: none; }
.user-activity-list li { position: relative; display: flex; align-items: flex-start; gap: 11px; min-height: 38px; padding: 0 0 10px; }
.user-activity-list li:last-child { min-height: 0; padding-bottom: 0; }
.user-activity-list li:not(:last-child)::after { content: ''; position: absolute; top: 14px; bottom: 0; left: 6px; width: 1px; background: var(--border); }
.user-activity-dot { position: relative; z-index: 1; width: 12px; height: 12px; margin: 2px 0 0 1px; flex: 0 0 12px; border: 2px solid var(--brand-primary); border-radius: 50%; background: var(--surface-elevated); }
.user-activity-list li:first-child .user-activity-dot { animation: user-history-beacon 2.4s ease-out infinite; }
@keyframes user-history-beacon {
  0%, 100% { box-shadow: 0 0 0 2px rgba(68,139,255,.12), 0 0 4px rgba(68,139,255,.15); }
  50% { box-shadow: 0 0 0 6px rgba(68,139,255,.03), 0 0 12px rgba(68,139,255,.45); }
}
.user-activity-list li > span:last-child { display: grid; gap: 3px; min-width: 0; }
.user-activity-list strong { font-size: 12px; font-weight: 600; }
.user-activity-list small { color: var(--text-secondary); font-size: 10px; line-height: 1.4; }
@media (max-width: 900px) { .permission-assignment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .permission-assignment-item:nth-child(n) { border-left: 0; } .permission-assignment-item:nth-child(2n) { border-left: 1px solid var(--border); } }
@media (max-width: 760px) { .user-profile-heading { align-items: flex-start; flex-direction: column; } .user-detail-grid { grid-template-columns: 1fr; } .user-profile-actions { margin-top: 4px; } .permission-override-row { align-items: flex-start; flex-direction: column; } .permission-override-row select { max-width: none; width: 100%; flex-basis: auto; } .permission-assignment-grid { grid-template-columns: 1fr; } .permission-assignment-item:nth-child(n) { border-left: 0; } }

/* ---- toast notifications (bottom-right, auto-dismiss, no visible countdown) ---- */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.toast {
  display: grid; gap: 5px; background: var(--surface-elevated); color: var(--text-primary);
  border: 1px solid var(--border); border-left: 3px solid var(--brand-primary);
  box-shadow: 0 10px 28px rgba(0,0,0,.18); border-radius: 10px; padding: 13px 15px;
  font-size: 12.5px; cursor: pointer; text-decoration: none;
  animation: toast-in 0.25s ease-out;
}
.toast:hover { box-shadow: 0 12px 32px rgba(0,0,0,.24); text-decoration: none; transform: translateY(-1px); }
.toast:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 3px; }
.toast-heading { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast-heading strong { font-weight: 700; }
.toast .toast-body { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast.toast-leaving { animation: toast-out 0.3s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ---- "Need help?" contact modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 12, 20, 0.55); z-index: 1100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: var(--surface-elevated); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  width: 100%; max-width: 380px; overflow: hidden;
}
.modal-card-header {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-card-header h2 { margin: 0; font-size: 15px; }
.modal-close {
  background: none; border: none; cursor: pointer; color: var(--text-secondary);
  display: flex; align-items: center; padding: 4px; border-radius: var(--radius);
}
.modal-close:hover { background: var(--surface); color: var(--text-primary); }
.modal-close svg { width: 16px; height: 16px; }
.modal-card-body { padding: 16px 20px 20px; }

/* Selects in filter bars and file pickers fell through to the browser's own black/grey; give them
   the same navy surface, border and blue hover as every other input. */
.filter-bar select {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-family: var(--font); background: var(--surface-elevated); color: var(--text-primary);
}
.filter-bar select:focus, .form-group input[type="file"]:focus { outline: none; border-color: var(--brand-primary); }
select option { background: var(--surface-elevated); color: var(--text-primary); }
input[type="file"]::file-selector-button {
  margin-right: 12px; padding: 5px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text-primary); font-family: var(--font); font-size: 12px; cursor: pointer;
}
input[type="file"]::file-selector-button:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.availability { margin: -4px 0 14px; padding: 9px 12px; border-radius: var(--radius); border: 1px solid var(--border); font-size: 12.5px; line-height: 1.45; }
.availability-available { color: var(--success-text); background: var(--success-bg); border-color: transparent; }
.availability-overlap { color: var(--warning-text); background: var(--warning-bg); border-color: transparent; }
.availability-taken, .availability-legacy { color: var(--danger-text); background: var(--danger-bg); border-color: transparent; }
button:disabled, .btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---- shared confirm / prompt dialog (replaces the browser's native confirm()/prompt()) ---- */
.dialog-card { max-width: 420px; animation: dialog-in .14s ease-out both; }
.dialog-message { margin: 0 0 16px; font-size: 13px; line-height: 1.55; color: var(--text-primary); overflow-wrap: anywhere; white-space: pre-line; }
.dialog-field { margin: 0 0 16px; }
.dialog-field label { display: block; margin-bottom: 5px; font-size: 12px; color: var(--text-secondary); }
.dialog-field input {
  width: 100%; box-sizing: border-box; padding: 8px 10px; font-size: 13px; font-family: var(--font);
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-primary);
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions .btn { min-width: 84px; padding: 7px 16px; font-size: 12.5px; }
.btn.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.btn-danger:hover { filter: brightness(1.08); }
.dialog-card .btn:focus-visible, .dialog-card input:focus-visible, .dialog-card .modal-close:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .dialog-card { animation: none; } }
.help-intro { font-size: 12.5px; color: var(--text-secondary); margin: 0 0 14px; }
.help-contact-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
  color: var(--text-primary); margin-bottom: 6px;
}
.help-contact-row:last-child { margin-bottom: 0; }
.help-contact-row:hover { background: var(--surface); }
.help-contact-icon {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--brand-primary) 15%, transparent); color: var(--brand-primary);
}
.help-contact-icon svg { width: 16px; height: 16px; }
.help-contact-label { display: block; font-size: 11px; color: var(--text-secondary); }
.help-contact-value { display: block; font-size: 13.5px; font-weight: 500; }
.user-dropdown-toggle {
  display: flex !important; align-items: center; gap: 8px; color: var(--chrome-text) !important;
  padding: 4px 6px 4px 10px !important; border-radius: 999px;
}
.user-dropdown-toggle:hover { background: var(--chrome-hover); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--brand-primary);
  color: #fff; font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- My Profile: large avatar preview + upload control ---- */
.avatar-upload { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.avatar-upload .user-avatar { width: 72px; height: 72px; font-size: 24px; }
.avatar-upload-controls { display: flex; flex-direction: column; gap: 6px; }
.avatar-upload-controls .form-hint { margin-top: 0; }

/* ---- sidebar nav (project design-inspired grouping, kept flat/light per
   project design - borrowed information architecture, not the heavy
   admin-template visual chrome that doc explicitly steers away from) ---- */
.app-body { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--chrome-bg);
  color: var(--chrome-text-muted);
  border-right: 1px solid var(--chrome-border);
  overflow-y: auto;
  padding: 14px 0;
}
.sidebar-group { margin-bottom: 4px; }
.sidebar-group-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--chrome-text-muted); opacity: 0.7; padding: 14px 18px 6px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; font-size: 14px; color: var(--chrome-text-muted);
  border-left: 2px solid transparent;
}
.sidebar-link:hover { color: var(--chrome-text); text-decoration: none; background: var(--chrome-hover); }
.sidebar-link.active { color: var(--chrome-text); background: var(--chrome-active); border-left-color: var(--brand-primary); }
.sidebar-link .icon { width: 15px; text-align: center; font-size: 12px; flex-shrink: 0; opacity: 0.9; display: inline-flex; }
.sidebar-link .icon svg { width: 15px; height: 15px; }

/* main content area alongside the sidebar */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.app-main .inbox-shell, .app-main .page { flex: 1; min-height: 0; }

/* ---- admin pages (businesses/services/keywords) ---- */
/* "make full use of screen page in all sections" - quicksms's own pages use
   container-fluid (near-full-width), not a narrow fixed column with large blank
   margins either side. 900px left huge unused space on anything wider than a laptop. */
.page { max-width: none; margin: 0; padding: 28px 32px; width: 100%; flex: 1; min-height: 0; overflow-y: auto; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.page-header h1 { font-size: 18px; margin: 0; }
.page-header .meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.page-header-row { display: flex; flex-direction: column; }

.card { background: var(--surface-elevated); border: none; box-shadow: var(--card-shadow); border-radius: 8px; padding: 20px; margin-bottom: 16px; }
.card h2 { font-size: 14px; margin: 0 0 14px; font-weight: 600; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead { box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.data-table th { text-align: left; color: var(--text-secondary); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.partner-select-card { width: 100%; position: relative; }
.partner-select-card > label { display: block; margin-bottom: 7px; font-size: 12px; color: var(--text-secondary); }
.partner-select-card > input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; font-family: var(--font); background: var(--surface-elevated); color: var(--text-primary); }
.partner-select-card > input::placeholder { color: var(--text-secondary); }
.partner-select-card > input:focus { outline: 2px solid color-mix(in srgb, var(--brand-primary) 45%, transparent); outline-offset: 1px; }
.partner-results { position: absolute; top: 76px; left: 20px; right: 20px; z-index: 20; display: grid; gap: 2px; max-height: 240px; overflow-y: auto; padding: 4px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-elevated); box-shadow: 0 8px 20px #0004; }
.partner-results[hidden] { display: none; }
.partner-results button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 4px; color: var(--text-primary); background: transparent; cursor: pointer; }
.partner-results button:hover, .partner-results button.selected { color: var(--text-primary); border-color: var(--brand-primary); background: var(--selected-bg); }
.id-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--warning-bg); color: var(--warning-text); }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-secondary); font-size: 13px; }
.back-link:hover { text-decoration: none; color: var(--text-primary); }
.back-link svg { width: 15px; height: 15px; }
.data-table td { padding: 10px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface); }
.data-table a.row-link { display: block; color: var(--text-primary); }
.data-table a.row-link:hover { text-decoration: none; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-family: var(--font);
  /* Unstyled inputs otherwise fall back to the browser's own white/black UA
     rendering in every theme - invisible on the light theme's white cards, but a
     stray white box once the surrounding card goes dark. */
  background: var(--surface-elevated); color: var(--text-primary);
}
.form-group textarea { min-height: 80px; resize: vertical; }
.form-row { display: flex; gap: 16px; }
/* color-scheme:dark (set at :root above) already asks the browser to draw the
   popup calendar itself in a dark palette, but Chromium still renders the small
   calendar-icon glyph inside the closed <input type="date"> box in its light-mode
   (dark) ink regardless - a dark-on-navy icon that reads as a stray black smudge
   next to everything else on this page. Inverting just the glyph, not the input,
   fixes that without touching the (already-correct) popup itself. */
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) input[type="date"]::-webkit-calendar-picker-indicator,
  :root:not([data-theme="light"]) input[type="time"]::-webkit-calendar-picker-indicator,
  :root:not([data-theme="light"]) input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
  }
}
.form-row .form-group { flex: 1; }
.form-hint { font-size: 11.5px; color: var(--text-secondary); margin-top: 3px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

.stat-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; background: var(--surface); color: var(--text-secondary); }

/* ---- stat-card summary row (matches the reference QuickSMS-family dashboard's card
   recipe: soft shadow instead of a border, an icon accent, not a flat bordered box) ---- */
.stat-cards { display: flex; gap: 14px; margin-bottom: 16px; }
.stat-card {
  flex: 1; background: var(--surface-elevated); border: none; box-shadow: var(--card-shadow);
  border-radius: 8px; padding: 16px 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.stat-card .stat-value { font-size: 24px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-card .stat-label { font-size: 11.5px; color: var(--text-secondary); margin-top: 3px; }
.stat-card .stat-icon {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  background: color-mix(in srgb, var(--stat-color, var(--brand-primary)) 15%, transparent);
  color: var(--stat-color, var(--brand-primary));
}
.stat-card .stat-icon svg { width: 18px; height: 18px; }

/* ---- filter/search bar above a data table ---- */
.filter-bar { display: flex; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.filter-bar input[type="search"], .filter-bar input[type="text"] {
  flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-family: var(--font);
  background: var(--surface-elevated); color: var(--text-primary);
}
.filter-bar button {
  font-size: 12px; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface-elevated); color: var(--text-primary); cursor: pointer;
}

/* ---- per-row "quick links" action menu ---- */
.row-actions { position: relative; text-align: right; }
.row-actions-toggle {
  background: none; border: none; cursor: pointer; color: var(--text-secondary);
  font-size: 15px; padding: 4px 6px; border-radius: var(--radius); line-height: 1;
  display: inline-flex; align-items: center;
}
.row-actions-toggle svg { width: 16px; height: 16px; }
.row-actions-toggle:hover { background: var(--surface); }
/* text-align: left - the menu sits in a right-aligned table cell (.row-actions) and would
   otherwise inherit it, right-aligning every item. Items (links AND the Delete button) share
   one flex layout so icons and labels line up and nothing overflows the box. */
.row-actions-menu {
  position: absolute; right: 0; top: 100%; z-index: 10; min-width: 160px; text-align: left;
  background: var(--surface-elevated); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08); padding: 4px;
}
.row-actions-menu form { margin: 0; }
.row-actions-menu a, .row-actions-menu .menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; box-sizing: border-box;
  padding: 6px 10px; font-size: 12.5px; font-family: inherit; line-height: 1.4; text-align: left;
  color: var(--text-primary); background: none; border: none; border-radius: 4px; cursor: pointer;
}
.row-actions-menu a svg, .row-actions-menu .menu-item svg { width: 13px; height: 13px; flex: 0 0 13px; margin: 0 !important; vertical-align: 0 !important; }  /* !important: older templates set a margin inline on the icon */
.row-actions-menu a:hover, .row-actions-menu .menu-item:hover { background: var(--surface); text-decoration: none; }
.row-actions-menu .menu-item-danger { color: var(--danger); }
.row-actions-menu .dropdown-header {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary);
  padding: 6px 10px 4px; font-weight: 600;
}
.topbar .user-menu button:hover { color: var(--chrome-text); }
#theme-toggle { font-size: 15px !important; padding: 2px 6px !important; border-radius: 4px; }
#theme-toggle:hover { background: rgba(255,255,255,0.1); }

.flash {
  display: flex; align-items: center; gap: 10px; margin: 12px 16px 0; padding: 12px 15px;
  color: var(--text-primary); background: var(--surface-elevated); border: 1px solid var(--border);
  border-left: 3px solid var(--brand-primary); border-radius: 9px; box-shadow: var(--card-shadow);
  font-size: 12.5px; line-height: 1.5; animation: flash-enter .22s ease-out both;
}
.flash:before { display: grid; place-items: center; width: 20px; height: 20px; flex: 0 0 20px; border-radius: 50%; font-size: 12px; font-weight: 700; content: 'i'; color: var(--brand-primary); background: rgba(68,139,255,.12); }
.flash-success { border-left-color: var(--success); }
.flash-success:before { content: '✓'; color: var(--success); background: rgba(49,201,113,.13); }
.flash-error { border-left-color: var(--danger); }
.flash-error:before { content: '!'; color: var(--danger); background: rgba(229,72,77,.13); }
.flash-warning { border-left-color: var(--warning); }
.flash-warning:before { content: '!'; color: var(--warning); background: rgba(244,196,20,.14); }
@keyframes flash-enter { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ---- three-pane inbox layout (project design) ---- */
.inbox-shell { display: flex; flex: 1; min-height: 0; }

/* 2026-09-27: was a fixed 340px sidebar that always sat next to a thread-pane: now the
   list is the only thing in .inbox-shell on the index page (no conversation open), so
   it runs full width there. Once a conversation IS open (inbox/show.twig passes
   compact:true to the include), .inbox-list-compact below puts it back to a narrow
   sidebar beside the thread - "the convo page should maintain the list on the left
   side", not have the thread cover it. */
.inbox-list {
  width: 100%;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: var(--surface-elevated);
  display: flex;
  flex-direction: column;
}
/* The rows scroll inside the list while its header and filters stay put. Without this the
   list simply grew past the shell and the whole page scrolled once there were enough
   conversations (rows spilling below the panel onto the bare page background). */
.inbox-live-rows { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.inbox-list-header { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.inbox-list-header h1 { font-size: 15px; margin: 0 0 8px; }
.inbox-filters { display: flex; gap: 6px; flex-wrap: wrap; }
/* The filter-type/value/date controls below aren't wrapped in .form-group (that'd
   force them into its stacked label+full-width layout, wrong for an inline filter
   bar) - so, same as .composer textarea above, they'd silently fall through to the
   browser's own UA dark-mode gray instead of the app's navy --surface-elevated. */
.inbox-filters select, .inbox-filters input[type="text"], .inbox-filters input[type="datetime-local"] {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 12.5px; font-family: var(--font);
  background: var(--surface-elevated); color: var(--text-primary);
}
.inbox-filters a {
  font-size: 12px; padding: 4px 8px; border-radius: 999px; color: var(--text-secondary);
  border: 1px solid var(--border);
}
.inbox-filters a.active { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.inbox-filters a:hover { text-decoration: none; border-color: var(--brand-primary); }

/* "add mobile filter" - #filterToggleBtn is hidden on desktop (the filter form below
   it is just always visible there, as before) and only appears at narrow widths,
   where the 3-row filter form would otherwise permanently eat a lot of vertical
   space above the list. .filter-bar-wrap starts collapsed on mobile and opens on
   tap, via conversation_list.twig's own inline script (adds/removes .open). */
.filter-toggle-btn { display: none; margin-top: 8px; }
@media (max-width: 640px) {
  .filter-toggle-btn { display: inline-flex; }
  .filter-bar-wrap { display: none; }
  .filter-bar-wrap.open { display: block; }
}

/* One bordered/backgrounded box holding both the service-search input and the service
   <select>, instead of two separate boxes sitting next to each other - "the search and
   all services should be in one box". Each child is stripped of its own border/bg and
   just fills its share of the shared box; a 1px inner divider is the only seam. */
.combo-box {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-elevated);
  overflow: hidden;
}
.combo-box input, .combo-box select {
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  padding: 6px 10px;
  font-size: 12.5px;
  font-family: var(--font);
}
.combo-box input { flex: 1; min-width: 90px; border-right: 1px solid var(--border); }
.combo-box select { flex: 1; min-width: 110px; }
.combo-box input:focus, .combo-box select:focus { outline: none; background: var(--surface); }

/* 2026-09-27: full-width single-line row (identity | preview | meta) - see .inbox-list
   above for why this is no longer a narrow-sidebar stacked card. */
.conversation-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  color: var(--text-primary);
}
.conversation-row:hover { background: var(--surface); text-decoration: none; }
.conversation-row.selected { background: var(--selected-bg); border-left-color: var(--brand-primary); }
.conversation-row .row-identity { flex: 0 0 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conversation-row .msisdn { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-row .service-name { font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-row .preview { flex: 1; min-width: 0; font-size: 13px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-row .row-meta { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; }
.conversation-row .row-shortcode {
  font-size: 10.5px; font-family: ui-monospace, "SF Mono", Consolas, monospace;
  color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 7px; white-space: nowrap;
}
.conversation-row .preview-time { font-size: 11px; color: var(--text-secondary); white-space: nowrap; }
.conversation-row .preview-delivery { font-size: 11px; color: var(--text-secondary); white-space: nowrap; }

/* Once a conversation is open (inbox/show.twig includes the list with compact:true),
   the list goes back to a narrow left-hand sidebar instead of running full width -
   "the convo page should maintain the list on the left side", not have the thread
   cover it. The full-width .conversation-row layout above doesn't fit a 340px column,
   so it's put back into a stacked card here, same shape the sidebar always used. */
.inbox-list-compact { width: 340px; flex: 0 0 340px; border-right: 1px solid var(--border); }
.inbox-list-toggle { border: 1px solid var(--border); background: var(--surface-elevated); color: var(--text-secondary); border-radius: 4px; width: 24px; height: 24px; cursor: pointer; font-size: 18px; line-height: 18px; }
.inbox-list-toggle:hover { color: var(--text-primary); border-color: var(--brand-primary); }
.inbox-list-compact.inbox-list-collapsed { width: 38px !important; flex: 0 0 38px !important; min-width: 38px; }
.inbox-list-compact.inbox-list-collapsed .inbox-list-header { padding: 12px 7px; }
.inbox-list-compact.inbox-list-collapsed .inbox-list-header h1,
.inbox-list-compact.inbox-list-collapsed .inbox-filters,
.inbox-list-compact.inbox-list-collapsed .inbox-live-rows { display: none; }
.inbox-list-compact.inbox-list-collapsed .inbox-list-header > div { justify-content: center; }
.inbox-list-compact .conversation-row { flex-direction: column; align-items: stretch; gap: 4px; padding: 12px 16px; }
/* was: not overriding flex-basis here left .row-identity/.preview/.row-meta carrying
   their full-width row's `flex: 0 0 260px` / `flex: 1` straight into this column-flex
   layout, where flex-basis sets HEIGHT instead of width - .row-identity alone forced
   every row to a 260px-tall block of empty space before its preview/status line ever
   showed up. `flex: 0 0 auto` on all three makes each one size to its own content, the
   normal stacked-card shape this sidebar always had. */
.inbox-list-compact .row-identity { flex: 0 0 auto; flex-direction: row; justify-content: space-between; align-items: baseline; width: 100%; }
.inbox-list-compact .preview { flex: 0 0 auto; white-space: normal; font-size: 12px; }
.inbox-list-compact .row-meta { flex: 0 0 auto; justify-content: space-between; width: 100%; }

/* The thread + context panes sit beside the (now narrow, .inbox-list-compact) list in
   normal flow, taking the rest of the width - not a full overlay covering the list.
   Escape still closes it (see inbox/show.twig's keydown listener, using this element's
   data-back-url) same as a mouse click on .thread-close - it just navigates back to
   the plain (full-width) list instead of un-hiding it in place. */
.thread-overlay {
  flex: 1;
  min-width: 0;
  display: flex;
  background: var(--surface);
}
.thread-close {
  font-size: 18px;
  line-height: 1;
  padding: 4px 10px;
}

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-needs_reply { background: var(--danger-bg); color: var(--danger-text); }
.badge-open { background: var(--success-bg); color: var(--success-text); }
.badge-waiting_for_customer { background: var(--warning-bg); color: var(--warning-text); }
.badge-resolved { background: var(--surface); color: var(--text-secondary); }
.badge-archived { background: var(--surface); color: var(--text-secondary); }

/* ---- service governance lifecycle badges (project design) ---- */
.badge-lifecycle-draft { background: var(--surface); color: var(--text-secondary); }
.badge-lifecycle-testing { background: var(--selected-bg); color: var(--brand-primary); }
.badge-lifecycle-shadow { background: var(--selected-bg); color: var(--brand-primary); }
.badge-lifecycle-awaiting_approval { background: var(--warning-bg); color: var(--warning-text); }
.badge-lifecycle-active { background: var(--success-bg); color: var(--success-text); }
.badge-lifecycle-rejected { background: var(--danger-bg); color: var(--danger-text); }
.badge-lifecycle-suspended { background: var(--warning-bg); color: var(--warning-text); }
.badge-lifecycle-archived { background: var(--surface); color: var(--text-secondary); }
.badge-lifecycle-disabled { background: var(--surface); color: var(--text-secondary); }

/* ---- TEST tenant marker (project design: "The UI must show a
   prominent TEST badge") - amber/black, deliberately louder than the status badges
   above so it can't be mistaken for ordinary chrome. ---- */
.badge-test {
  display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 700;
  letter-spacing: 0.04em; background: var(--warning); color: #3a2e00; vertical-align: middle; margin-left: 6px;
}

.empty-state { padding: 40px 20px; text-align: center; color: var(--text-secondary); font-size: 13px; }

/* ---- thread ---- */
.thread-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.thread-header { padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--surface-elevated); display: flex; justify-content: space-between; align-items: center; }
.thread-header h2 { margin: 0; font-size: 15px; }
.thread-header .meta { font-size: 12px; color: var(--text-secondary); }
.thread-actions { display: flex; gap: 8px; }
/* .btn is the one base button rule - previously ".thread-actions button, .btn" also
   matched any bare <button> in that container by element selector, which outranks a
   single class like .btn-primary on `background` (both matching rules were the same
   specificity tier except the element+descendant part), silently overriding
   .btn-primary's blue background back to the default surface color while its
   `color: #fff` still applied - white text on a white/light background, invisible in
   light mode. Every button, including plain ones, now needs the .btn class instead of
   relying on being inside .thread-actions. */
.btn {
  font-size: 12px; padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface-elevated); color: var(--text-primary); cursor: pointer;
}
/* .btn.btn-primary (not just .btn-primary): several container-scoped rules below
   (.filter-bar button, .composer-tabs button, etc.) match by bare element selector
   scoped to a class, which has the same specificity tier as a single class like
   .btn-primary and can silently win on `background` depending on source order -
   already bit us once (SHORTCODE_ENGINE-era inbox buttons), doing it again here via
   .filter-bar button on the reports date-filter form. Compounding .btn + .btn-primary
   (0,2,0) beats any single container+element selector (0,1,1) unconditionally, so this
   class of bug can't recur regardless of where a primary button is placed. */
.btn.btn-primary { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }

.thread-messages { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 5px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
/* Day break inside a thread (Today / Yesterday / Monday / 27/09/2026), as in WhatsApp. */
.day-group { display: flex; flex-direction: column; gap: 5px; }
/* The label is pinned to the top of the thread while its own day scrolls; being sticky inside
   .day-group (not the whole thread) it is pushed off by the next day's label, never stacked. */
.date-divider { align-self: center; margin: 4px 0 6px; position: sticky; top: 0; z-index: 2; }
.date-divider span { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--surface-elevated); border: 1px solid var(--border); color: var(--text-secondary); font-size: 11px; font-weight: 600; }
.thread-messages::-webkit-scrollbar { width: 6px; }
.thread-messages::-webkit-scrollbar-track { background: transparent; }
.thread-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* 2026-09-27: "why so thick" - was padding:10px 14px + border-radius:10px + a 4px
   gap before the meta line, on top of a 10px gap between bubbles - each on its own
   reasonable, but stacked across a whole thread it read as bulky/thick, not the tight
   chat-bubble feel the rest of the theme goes for. Trimmed padding, radius, meta
   spacing, and inter-bubble gap all down together rather than any single one alone. */
.message { max-width: 60%; padding: 6px 10px; border-radius: 8px; font-size: 14px; line-height: 1.35; }
/* Dimmed with colour, not opacity: opacity would also dull the blue delivered ticks. */
.message .meta { font-size: 10px; margin-top: 2px; color: color-mix(in srgb, currentColor 60%, transparent); }
/* The body keeps its line breaks (numbered lists, addresses) and breaks very long words; a long
   one is folded to about eight lines until "Read more" is pressed. */
.message-body { white-space: pre-line; overflow-wrap: anywhere; }
.message-body.collapsed { max-height: 9.6em; overflow: hidden; }
.read-more { background: none; border: 0; padding: 4px 0 0; margin: 0; color: var(--brand-accent-cyan, #22d3ee); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.message-agent .read-more { color: #fff; text-decoration: underline; }
.read-more:hover { text-decoration: underline; }
.delivery-ticks { display: inline-block; letter-spacing: -2px; margin-right: 2px; white-space: nowrap; }
/* Delivered = the double tick turns blue, as in WhatsApp (Sent stays a plain single tick). On the blue
   agent bubble a lighter blue keeps it visible. */
.delivery-ticks-delivered { color: #53bdeb; font-weight: 700; }
.message-agent .delivery-ticks-delivered { color: #bff0ff; }
.message-customer { align-self: flex-start; background: var(--bubble-customer-bg); color: var(--text-primary); border-bottom-left-radius: 2px; }
.message-automation { align-self: flex-end; background: var(--bubble-automation-bg); color: var(--text-primary); border-bottom-right-radius: 2px; }
.message-agent { align-self: flex-end; background: var(--brand-primary); color: #fff; border-bottom-right-radius: 2px; }
.message-note { align-self: center; background: var(--warning-bg); color: var(--warning-text); border-radius: var(--radius); font-style: italic; max-width: 80%; }
.message-system { align-self: center; background: none; color: var(--text-secondary); font-size: 11px; }

.delivery-status { font-size: 10.5px; }
.delivery-failed { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--danger-bg); color: var(--danger-text); font-weight: 600; cursor: help; }
.credit-alert { flex-shrink: 0; padding: 10px 20px; background: var(--danger-bg); color: var(--danger-text); border-bottom: 1px solid var(--danger-text); font-size: 13px; line-height: 1.45; }
.credit-alert strong { text-transform: uppercase; letter-spacing: 0.03em; margin-right: 6px; }

.composer { border-top: 1px solid var(--border); background: var(--surface-elevated); padding: 12px 20px; }
.composer textarea {
  width: 100%; min-height: 60px; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 10px; font-family: var(--font); font-size: 13px; resize: vertical;
  background: var(--surface-elevated); color: var(--text-primary);
}
.composer-actions { display: flex; justify-content: space-between; margin-top: 8px; }
.composer-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.composer-tabs button { font-size: 12px; padding: 4px 10px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-elevated); cursor: pointer; }
.composer-tabs button.active { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }

/* ---- context panel ---- */
.context-pane { width: 280px; flex-shrink: 0; border-left: 1px solid var(--border); background: var(--surface-elevated); padding: 16px; font-size: 13px; overflow-y: auto; }
.context-pane h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); margin: 16px 0 8px; }
.context-pane h3:first-child { margin-top: 0; }
/* align-items: flex-start (not the flex default, stretch) + text-align: right on the
   value - without these, a value that's short enough to fit one line looks fine, but a
   long one (e.g. a service name that wraps) has its second line start flush left under
   the label instead of lining up with the first line's right edge - "why alignment bad
   on one [but not the other]". */
.context-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 4px 0; }
.context-row .label { color: var(--text-secondary); flex-shrink: 0; }
.context-row > span:last-child { text-align: right; }

/* ---- auth ---- */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--brand-dark); position: relative; }
.auth-login { width: min(420px, calc(100vw - 36px)); display: flex; flex-direction: column; align-items: stretch; }
.auth-login .auth-logo { display: flex; justify-content: center; margin: 0 0 26px; }
.auth-login .auth-logo img { height: auto; width: 150px; max-width: 100%; }
.auth-watermark {
  position: absolute; bottom: 16px; left: 20px;
  font-size: 11.5px; color: rgba(255,255,255,0.35); letter-spacing: 0.02em;
}
.auth-card { background: var(--surface-elevated); color: var(--text-primary); border-radius: 10px; padding: 32px; width: 340px; }
.auth-logo { margin-bottom: 14px; }
.auth-logo img { height: 32px; }
.auth-card h1 { font-size: 15px; font-weight: 500; color: var(--text-secondary); margin: 0 0 20px; }
.auth-card label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.auth-card input { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; }
.auth-card input:not([type="checkbox"]) { background: transparent; color: var(--text-primary); border-color: rgba(148,163,184,0.18); }
.auth-card input:not([type="checkbox"]):-webkit-autofill { -webkit-text-fill-color: var(--text-primary); -webkit-box-shadow: 0 0 0 1000px var(--brand-dark) inset; transition: background-color 9999s ease-out 0s; }
.auth-card button { width: 100%; padding: 10px; background: var(--brand-primary); color: #fff; border: none; border-radius: var(--radius); font-size: 13px; cursor: pointer; }
.auth-otp-input { letter-spacing: 0.3em; text-align: center; font-size: 18px !important; }
.auth-otp-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 0; }
.auth-otp-action-button { width: 100% !important; min-height: 38px; display: inline-flex; justify-content: center; align-items: center; gap: 6px; padding: 8px 10px !important; white-space: nowrap; }
.auth-otp-resend-form { display: block; margin: 0; min-width: 0; }
.auth-otp-resend-button { color: var(--text-primary) !important; background: transparent !important; border: 1px solid var(--border) !important; }
.auth-otp-resend-button:disabled { opacity: 0.72; cursor: not-allowed; }
.auth-otp-resend-button span:last-child:not(:first-child) { color: var(--text-secondary); font-size: 11px; font-variant-numeric: tabular-nums; padding: 2px 5px; border-radius: 999px; background: rgba(148,163,184,0.12); }
.auth-login-card { width: 100%; padding: 42px 48px 38px; background: rgba(255,255,255,0.012); border: 1px solid rgba(255,255,255,0.025); box-shadow: none; }
.auth-login-card h1 { font-size: 20px; font-weight: 500; color: var(--text-primary); margin: 0 0 8px; }
.auth-subtitle { color: var(--text-secondary); font-size: 13px; margin: 0 0 24px; }
.auth-login-card label { font-size: 14px; color: var(--text-primary); margin-bottom: 8px; }
.auth-login-card input { padding: 10px 12px; margin-bottom: 18px; font-size: 14px; }
.auth-login-card input[type="text"], .auth-login-card input[type="password"] { background: transparent; color: var(--text-primary); border-color: rgba(148,163,184,0.14); }
.auth-login-card input[type="text"]:-webkit-autofill, .auth-login-card input[type="password"]:-webkit-autofill { -webkit-text-fill-color: var(--text-primary); -webkit-box-shadow: 0 0 0 1000px var(--brand-dark) inset; transition: background-color 9999s ease-out 0s; }
.auth-login-card input::placeholder { color: var(--text-secondary); opacity: .62; }
.auth-login-options { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: -3px 0 18px; color: var(--text-secondary); font-size: 13px; }
.auth-login-options a { color: var(--text-secondary); text-decoration: none; }
.auth-login-options a:hover { color: var(--text-primary); }
.auth-login-options .auth-remember { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--text-secondary); cursor: pointer; }
.auth-login-options input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--brand-primary); }
.auth-login-card button { width: auto; min-width: 66px; padding: 10px 14px; font-size: 14px; font-weight: 600; }
.auth-login-card .flash { margin: 0 0 16px; border-radius: 6px; }
.auth-copyright { margin-top: 22px; text-align: center; color: var(--text-secondary); font-size: 13px; }
@media (max-width: 480px) {
  .auth-login-card { padding: 32px 18px; }
  .auth-watermark { left: 12px; bottom: 10px; }
}

[hidden] { display: none !important; }

/* ---- trace timeline ---- */
.trace-chain { display: flex; flex-direction: column; align-items: flex-start; }
.trace-step { display: flex; align-items: flex-start; gap: 12px; }
.trace-time { width: 64px; flex-shrink: 0; font-size: 11px; color: var(--text-secondary); padding-top: 2px; font-variant-numeric: tabular-nums; }
.trace-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-primary); margin-top: 5px; flex-shrink: 0; }
.trace-body strong { font-size: 13px; text-transform: uppercase; letter-spacing: 0.02em; }
.trace-payload { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.trace-arrow { margin-left: 76px; color: var(--border); font-size: 14px; line-height: 1.4; }
code { background: var(--surface); padding: 1px 5px; border-radius: 3px; font-size: 11.5px; }

/* ---- reports module (detailed CSAT/NPS/CES breakdowns) ---- */
.scoring-hint {
  font-size: 11.5px; color: var(--text-secondary); background: var(--surface);
  border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; line-height: 1.5;
}
.report-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 20px; align-items: center; }
@media (max-width: 700px) { .report-grid { grid-template-columns: 1fr; } }
.report-chart-box { position: relative; height: 200px; }
.report-chart-box-large { height: 440px; }
@media (max-width: 700px) { .report-chart-box-large { height: 340px; } }
.report-subheading { font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-secondary); margin: 20px 0 10px; }
.scale-breakdown { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-secondary); }
.scale-breakdown .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.scale-breakdown strong { margin-left: 6px; color: var(--text-primary); }

/* ---- CSAT/CES mini score cards (visual sibling of the NPS big-number treatment) ---- */
.score-mini-row { display: flex; gap: 20px; }
.score-mini { flex: 1; }
.score-mini-value { font-size: 26px; font-weight: 700; }
.score-mini-value.nps-score-good { color: var(--success); }
.score-mini-value.score-mini-warn { color: var(--warning); }
.score-mini-value.nps-score-bad { color: var(--danger); }
.score-mini-max { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.score-mini-label { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }

/* ---- NPS summary (score + promoter/passive/detractor stacked bar) ---- */
.nps-summary { display: flex; gap: 18px; align-items: center; padding-bottom: 16px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.nps-score { font-size: 34px; font-weight: 700; flex-shrink: 0; width: 70px; text-align: center; }
.nps-score-good { color: var(--success); }
.nps-score-bad { color: var(--danger); }
.nps-detail { flex: 1; min-width: 0; }
.nps-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.nps-stack { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface); }
.nps-seg-detractor { background: var(--danger); }
.nps-seg-passive { background: var(--warning); }
.nps-seg-promoter { background: var(--success); }
.nps-legend { display: flex; gap: 14px; margin-top: 8px; font-size: 11px; color: var(--text-secondary); }
.nps-legend .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; }

/* ---- dashboard ---- */
.dashboard-columns { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
.dashboard-kpi { min-width: 0; }
.page-header:has(.dashboard-date-filter) { align-items: flex-start; }
.dashboard-date-filter { position: relative; z-index: 5; }
.dashboard-date-filter-toggle { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.dashboard-date-filter-toggle svg { width: 15px; height: 15px; }
.dashboard-date-filter-popover { position: absolute; top: calc(100% + 8px); right: 0; width: min(360px, calc(100vw - 32px)); padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-elevated); box-shadow: 0 12px 32px rgba(5, 10, 28, .32); color: var(--text-primary); }
.dashboard-date-filter-popover > strong { display: block; margin-bottom: 12px; font-size: 13px; }
.dashboard-date-filter-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dashboard-date-filter-fields label { display: grid; gap: 6px; color: var(--text-secondary); font-size: 11px; }
.dashboard-date-filter-fields input { min-width: 0; width: 100%; }
.dashboard-date-filter-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 13px; }
.dashboard-date-filter-status { min-height: 16px; margin-top: 10px; color: var(--text-secondary); font-size: 10px; line-height: 1.4; }
@media (max-width: 900px) { .dashboard-columns { grid-template-columns: 1fr; } }

.metric-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.metric-row:last-child { border-bottom: none; }
.metric-label { font-size: 12.5px; margin-bottom: 6px; }
.metric-prompt { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }
.metric-bar-track { height: 6px; border-radius: 999px; background: var(--surface); overflow: hidden; }
.metric-bar { height: 100%; border-radius: 999px; }
.metric-bar-good { background: var(--success); }
.metric-bar-warn { background: var(--warning); }
.metric-bar-bad { background: var(--danger); }
.metric-value { font-size: 12px; margin-top: 4px; font-weight: 600; }
.metric-count { font-weight: 400; color: var(--text-secondary); }

.activity-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.activity-row { font-size: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.activity-row:last-child { border-bottom: none; }
.activity-actor { font-weight: 600; }
.activity-action { color: var(--text-secondary); margin-top: 1px; }

/* ---- donut chart legend (conversation status card) ---- */
.donut-wrap { display: flex; align-items: center; gap: 24px; }
.donut-canvas-box { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.metrics-canvas-box { position: relative; width: 100%; }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; }
.donut-legend li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 6px 0; color: var(--text-secondary); }
.donut-legend .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.donut-legend strong { margin-left: auto; color: var(--text-primary); font-weight: 700; }

/* ---- activity feed - real timeline component, pulled directly from QuickSMS's own
   theme.css (.timeline/.tl-item/.tl-dot/.tl-content/.tl-date, home.twig's "Account
   Activity" panel) rather than a hand-rolled approximation. Colors swapped for our
   own CSS variables so dark mode still works, geometry/spacing kept identical. ---- */
.timeline { position: relative; border-color: var(--border); padding: 0; margin: 0; max-height: 380px; overflow-y: auto; }
.tl-item { border-radius: 3px; position: relative; display: flex; }
.tl-item > * { padding: 10px; }
.tl-item:last-child .tl-dot:after { display: none; }
.tl-item.active .tl-dot:before { border-color: var(--brand-primary); animation: timeline-beacon 2.4s ease-out infinite; }
.tl-item.active .tl-dot:after { border-color: var(--brand-primary); opacity: .5; filter: drop-shadow(0 0 3px rgba(68,139,255,.5)); animation: timeline-beam 2.4s ease-in-out infinite; }
@keyframes timeline-beacon {
  0%, 100% { box-shadow: 0 0 0 3px rgba(68,139,255,.13), 0 0 5px rgba(68,139,255,.18); }
  50% { box-shadow: 0 0 0 7px rgba(68,139,255,.03), 0 0 14px rgba(68,139,255,.55); }
}
@keyframes timeline-beam { 0%, 100% { opacity: .3; } 50% { opacity: .85; } }
.tl-dot { position: relative; border-color: var(--border); width: 30px; flex-shrink: 0; }
.tl-dot:before, .tl-dot:after {
  content: ''; position: absolute; border-color: inherit; border-width: 2px; border-style: solid;
  border-radius: 50%; width: 10px; height: 10px; top: 15px; left: 50%; transform: translateX(-50%);
}
.tl-dot:after {
  width: 0; height: auto; top: 25px; bottom: -15px;
  border-right-width: 0; border-top-width: 0; border-bottom-width: 0; border-radius: 0;
}
.tl-content p { margin: 0 0 2px; font-size: 13px; color: var(--text-primary); }
.tl-content p:last-child { margin-bottom: 0; }
.tl-content a { font-weight: 600; }
.tl-date { font-size: 11px; color: var(--text-secondary); }

@media (prefers-reduced-motion: reduce) {
  .bell-toggle.has-pending svg, .tl-item.active .tl-dot:before, .tl-item.active .tl-dot:after,
  .user-activity-list li:first-child .user-activity-dot, .flash, .toast { animation: none; }
  .toast:hover { transform: none; }
}

/* ---- simulator ---- */
.simulator-result { margin-top: 20px; }
.sim-step { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.sim-step:last-child { border-bottom: none; }
.sim-step .sim-label { color: var(--text-secondary); width: 140px; flex-shrink: 0; }
.sim-banner { background: var(--brand-dark); color: #fff; padding: 8px 14px; border-radius: var(--radius); font-size: 12px; margin-bottom: 16px; text-align: center; }

/* ---- simulator action-chain result (project design Step 4:
   the simulator must show the full ordered chain, not just the winning action) ---- */
.sim-step:has(.sim-action-chain) { align-items: flex-start; }
.sim-thread { background: var(--surface); border-radius: 10px; padding: 18px 22px; min-height: 58vh; display: flex; flex-direction: column; }
.sim-thread .sim-label { display: block; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 14px; }
.sim-thread > div[style*="justify-content"] { display: flex !important; }
.message-bubble { padding: 10px 14px; border-radius: 14px; line-height: 1.45; font-size: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.message-inbound { background: var(--surface-raised); color: var(--text-primary); border-bottom-left-radius: 4px; }
.message-outbound { background: var(--brand-primary); color: #fff; border-bottom-right-radius: 4px; }
.sim-composer, .sim-save-form { display: flex; width: 100%; box-sizing: border-box; gap: 12px; align-items: center; border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.sim-thread .sim-composer { margin-top: auto; }
.sim-composer input, .sim-save-form input { flex: 1 1 auto; min-width: 0; width: 100%; min-height: 42px; box-sizing: border-box; }
.sim-composer textarea { flex: 1 1 100%; flex-basis: 100%; min-width: 0; width: 100%; min-height: 60px; resize: vertical; box-sizing: border-box; color: var(--text-primary); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; font: inherit; }
.sim-composer { align-items: flex-end; flex-wrap: wrap; }
.sim-composer button { margin-left: auto; }
.sim-composer button, .sim-save-form button { flex: 0 0 auto; white-space: nowrap; }
.sim-save-form { border-top: 0; padding-top: 0; margin-top: 14px; }
.sim-thread-header { display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--border); padding-bottom:12px; margin-bottom:10px; }
.sim-thread-header .sim-label { margin-bottom:0; }
.sim-composer input, .sim-save-form input { color: var(--text-primary); background: var(--surface); border-color: var(--border); }
.sim-composer input::placeholder, .sim-save-form input::placeholder { color: var(--text-secondary); opacity: 1; }
.sim-action-chain { list-style: decimal; margin: 4px 0 0; padding-left: 18px; }
.sim-action-chain li { margin-bottom: 6px; }
.sim-action-meta { display: block; font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.sim-payload { margin-top: 6px; }
.sim-payload-label { display: block; font-size: 11px; color: var(--text-secondary); margin-bottom: 2px; }
.sim-payload pre {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 10px; font-size: 11.5px; color: var(--text-primary); overflow-x: auto; margin: 0;
  font-family: 'SFMono-Regular', Consolas, monospace;
}

/* ---- Subscriptions screens (overview, subscribers, content calendar, charges) ---- */
.sub-alert { background: var(--warning-bg); color: var(--warning-text); border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; font-size: 13px; }
.sub-alert a { color: inherit; text-decoration: underline; margin-left: 6px; }
.sub-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
.sub-chart-box { position: relative; height: 220px; }
.sub-pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px; border-top: 1px solid var(--border); }
.sub-reasons { list-style: none; margin: 0; padding: 0; }
.sub-reasons li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.sub-reasons li:last-child { border-bottom: none; }

.sub-calendar-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1150px) { .sub-calendar-layout { grid-template-columns: 1fr; } }
.sub-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sub-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.sub-cal-weekdays { margin-bottom: 6px; font-size: 11px; color: var(--text-secondary); text-align: center; text-transform: uppercase; letter-spacing: .04em; }
.sub-cal-cell {
  display: flex; flex-direction: column; gap: 3px; min-height: 78px; padding: 6px 7px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-elevated); color: var(--text-primary); overflow: hidden;
}
a.sub-cal-cell:hover { text-decoration: none; border-color: var(--brand-primary); }
.sub-cal-blank { border: none; background: transparent; }
.sub-cal-day { font-size: 12px; font-weight: 600; }
.sub-cal-snippet { font-size: 11px; line-height: 1.3; color: var(--text-secondary); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.sub-cal-state { margin-top: auto; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.sub-cal-missing { color: var(--text-secondary); font-weight: 500; }
.sub-cal-cell.is-scheduled, .sub-swatch.is-scheduled { background: var(--selected-bg); border-color: var(--brand-primary); }
.sub-cal-cell.is-scheduled .sub-cal-state { color: var(--brand-primary); }
.sub-cal-cell.is-sent, .sub-swatch.is-sent { background: var(--success-bg); border-color: var(--success); }
.sub-cal-cell.is-sent .sub-cal-state { color: var(--success-text); }
.sub-cal-cell.is-past { opacity: .55; }
.sub-cal-cell.is-empty { border-style: dashed; }
.sub-cal-cell.is-today .sub-cal-day { color: var(--brand-primary); }
.sub-cal-cell.is-today { box-shadow: 0 0 0 2px var(--brand-primary); }
.sub-cal-cell.is-editing { outline: 2px solid var(--text-primary); }
.sub-legend { list-style: none; padding: 0; margin: 12px 0 0; font-size: 13px; display: grid; gap: 8px; }
.sub-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--border); vertical-align: -2px; margin-right: 6px; }
.sub-swatch.is-empty { border-style: dashed; }
.sub-sent-body { white-space: pre-wrap; background: var(--surface); border-radius: 8px; padding: 12px; font-size: 13px; }
#day-editor textarea { width: 100%; box-sizing: border-box; }

.sub-timeline { list-style: none; margin: 0; padding: 0; }
.sub-timeline li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.sub-timeline li:last-child { border-bottom: none; }
.sub-tl-title { font-size: 13.5px; font-weight: 600; }
.sub-tl-dot { flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--text-secondary); }
.sub-tl-good .sub-tl-dot { background: var(--success); }
.sub-tl-bad .sub-tl-dot { background: var(--danger); }

/* ---- Revenue dashboard and the dashboard's revenue panels ---- */
.rev-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.rev-change { font-size: 12px; font-weight: 600; margin-top: 4px; }
.rev-change.is-up { color: var(--success-text); }
.rev-change.is-down { color: var(--danger-text); }
.rev-bar { height: 6px; border-radius: 999px; background: var(--surface); overflow: hidden; }
.rev-bar span { display: block; height: 100%; background: var(--brand-primary); border-radius: 999px; }
.stat-cards.is-wrap { flex-wrap: wrap; }
.stat-cards.is-wrap .stat-card { min-width: 200px; }
.dash-split { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; margin: 10px 0 4px; }
.dash-top { margin-top: 10px; }
.dash-attention { list-style: none; margin: 0; padding: 0; }
.dash-attention li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 12px; margin-bottom: 8px; border-radius: 8px; border-left: 4px solid var(--border); background: var(--surface); font-size: 13px; }
.dash-attention li.dash-att-bad { border-left-color: var(--danger); }
.dash-attention li.dash-att-warn { border-left-color: var(--warning); }
.dash-attention .btn { flex-shrink: 0; }
.dash-clear { display: flex; align-items: center; gap: 12px; padding: 18px 4px; color: var(--success-text); }
.dash-clear svg { width: 28px; height: 28px; }
.sub-word-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.sub-word-tabs .btn { display: inline-flex; align-items: center; gap: 8px; }
