:root {
  --app-bg: #0f0b18;
  --app-sidebar: #171022;
  --app-panel: #191127;
  --app-panel-raised: #20152f;
  --app-text: #f7f3ff;
  --app-muted: #a89eb8;
  --app-accent: #8b5cf6;
  --app-accent-light: #c084fc;
  --app-border: rgba(255, 255, 255, .09);
  --sidebar-width: 264px;
  --purple-950: #24113d;
  --purple-800: #4b2378;
  --purple-650: #6e38a4;
  --purple-100: #f2ebfa;
  --ink: #201a29;
  --muted: #6f6879;
  --line: #e6e0eb;
  --surface: #ffffff;
  --background: #f7f5f9;
  --success: #177447;
  --danger: #a52b3a;
  --input-background: #ffffff;
  --input-border: #cec5d8;
  --button-ghost-text: var(--purple-800);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
}
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body { margin: 0; min-height: 100vh; background: var(--background); }
.admin-theme,
.app-theme {
  --purple-800: #5b2d89;
  --purple-650: #9b6bea;
  --purple-100: rgba(155, 107, 234, .14);
  --ink: #f7f3ff;
  --muted: #aaa0b8;
  --line: rgba(255, 255, 255, .09);
  --surface: #191127;
  --background: #0f0b18;
  --success: #5ee092;
  --danger: #fb7185;
  --input-background: #120d1d;
  --input-border: rgba(255, 255, 255, .14);
  --button-ghost-text: #d9c5fa;
  color: var(--ink);
  background: radial-gradient(circle at 12% 8%, rgba(139, 92, 246, .15), transparent 28%), var(--background);
}
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.site-header { height: 72px; padding: 0 32px; display: flex; align-items: center; gap: 36px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 210px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: white; font-weight: 800; background: linear-gradient(145deg, var(--purple-650), var(--purple-950)); }
.brand strong, .brand small { display: block; line-height: 1.05; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.page-shell { max-width: 1220px; margin: 0 auto; padding: 42px 30px 70px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
h1 { margin: 5px 0 7px; font-size: clamp(30px, 4vw, 44px); letter-spacing: -.035em; }
h2 { margin: 0; font-size: 18px; }
p { line-height: 1.55; }
.muted { color: var(--muted); margin: 0; }
.eyebrow { color: var(--purple-650); font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.button { border: 0; border-radius: 9px; padding: 10px 16px; font: inherit; font-weight: 750; cursor: pointer; }
.button-primary { background: var(--purple-650); color: white; }
.button-primary:hover { background: var(--purple-800); }
.button-ghost { background: var(--purple-100); color: var(--button-ghost-text); }
.button-danger { background: var(--danger); color: #fff; }
.button-danger:hover { filter: brightness(1.08); }
.button-danger-ghost { border: 1px solid rgba(251, 113, 133, .35); color: var(--danger); background: rgba(251, 113, 133, .08); }
.button-full { width: 100%; margin-top: 12px; }
.login-layout { min-height: calc(100vh - 180px); display: grid; place-items: center; }
.login-card { width: min(430px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 38px; box-shadow: 0 22px 60px rgba(58, 28, 85, .1); }
.login-card h1 { font-size: 34px; }
label { display: block; margin: 21px 0 7px; font-weight: 700; font-size: 14px; }
input[type="email"], input[type="password"], input[type="text"], input[type="search"], select { width: 100%; padding: 12px 13px; border: 1px solid var(--input-border); border-radius: 9px; color: var(--ink); font: inherit; background: var(--input-background); }
.password-field { position: relative; }
.password-field input { padding-right: 48px; }
.password-toggle { position: absolute; top: 50%; right: 8px; width: 34px; height: 34px; padding: 7px; transform: translateY(-50%); border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; }
.password-toggle:hover { color: var(--purple-650); background: var(--purple-100); }
.password-toggle:focus-visible { outline: 3px solid rgba(110, 56, 164, .22); }
.password-toggle svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-toggle.is-visible::after { content: ""; position: absolute; left: 7px; top: 16px; width: 20px; height: 2px; border-radius: 2px; background: currentColor; transform: rotate(-42deg); }
select[multiple] { min-height: 145px; }
option { color: var(--ink); background: var(--input-background); }
input:focus { outline: 3px solid rgba(110, 56, 164, .17); border-color: var(--purple-650); }
.field-error { color: var(--danger); font-size: 13px; margin-top: 5px; }
.alert { padding: 12px 15px; border-radius: 9px; margin-bottom: 20px; }
.alert-error { background: #fdecef; color: #812130; border: 1px solid #f5cad1; }
.alert-success { background: #e2f5ea; color: var(--success); border: 1px solid #bde5cd; }
.admin-theme .alert-error { background: rgba(251, 113, 133, .12); color: #fecdd3; border-color: rgba(251, 113, 133, .3); }
.admin-theme .alert-success { background: rgba(74, 222, 128, .10); color: #b7f7cb; border-color: rgba(74, 222, 128, .24); }
.app-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.section-heading { margin: 30px 0 14px; }
.dashboard-summary { display: block; color: inherit; text-decoration: none; }
.dashboard-summary:hover { border-color: var(--purple-650); }
.dashboard-summary .panel-heading h2 { margin-top: 5px; }
.dashboard-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; padding: 22px 0 18px; }
.dashboard-metrics span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.dashboard-metrics strong { display: block; margin-top: 8px; font-size: 26px; }
.dashboard-summary progress { width: 100%; accent-color: var(--purple-650); }
.summary-status { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; color: var(--success) !important; background: rgba(74, 222, 128, .10); font-weight: 750; }
.summary-status.status-warning { color: #fbbf24 !important; background: rgba(251, 191, 36, .10); }
.dashboard-unavailable h2 { margin: 8px 0; }
.app-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; text-decoration: none; transition: transform .15s ease, border-color .15s ease; }
.app-card:hover { transform: translateY(-2px); border-color: #b99ad3; }
.app-card p { margin: 6px 0 0; color: var(--muted); }
.app-icon { font-size: 28px; }
.arrow { color: var(--purple-650); font-size: 25px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric { padding: 21px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.metric span { display: block; color: var(--muted); font-size: 13px; font-weight: 650; }
.metric strong { display: block; margin-top: 10px; font-size: 30px; }
.metric-accent { background: var(--purple-950); border-color: var(--purple-950); color: white; }
.metric-accent span { color: #d7c2e8; }
.content-grid { display: grid; grid-template-columns: 1.45fr 1fr; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 23px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.panel-heading span, .freshness span { color: var(--muted); font-size: 12px; }
.leaderboard { list-style-position: inside; padding: 0; margin: 0; }
.leaderboard li { padding: 15px 4px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
.leaderboard li span { color: var(--muted); }
.legend { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 16px; color: var(--muted); font-size: 12px; }
.freshness { text-align: right; }
.freshness strong { display: block; margin-top: 5px; font-size: 13px; }
.sync-warning { display: block; margin-top: 7px; color: var(--danger) !important; font-weight: 700; }
.activity-panel { margin-top: 18px; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { display: flex; justify-content: space-between; gap: 20px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.activity-list span { color: var(--muted); font-size: 13px; text-align: right; }
.table-panel { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.badge, .status { display: inline-block; padding: 5px 9px; border-radius: 999px; font-weight: 750; font-size: 11px; }
.badge { background: var(--purple-100); color: var(--purple-800); }
.status-active { background: #e2f5ea; color: var(--success); }
.status-inactive { background: #f4edf0; color: var(--muted); }
.admin-theme .status-active { background: rgba(74, 222, 128, .11); }
.admin-theme .status-inactive { background: rgba(255, 255, 255, .07); }
.empty-state { color: var(--muted); padding: 24px 0; }
.actions { white-space: nowrap; }
.actions a, .link-button { margin-right: 10px; color: var(--purple-650); font: inherit; font-size: 13px; font-weight: 700; }
.actions form { display: inline; }
.link-button { padding: 0; border: 0; background: none; cursor: pointer; text-decoration: underline; }
.form-panel { max-width: 680px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.checkbox-row { display: flex; align-items: center; gap: 9px; }
.permission-checklist { display: grid; gap: 8px; margin: 20px 0 0; padding: 0; border: 0; }
.permission-checklist legend { margin-bottom: 8px; color: var(--app-text); font-weight: 750; }
.permission-checkbox { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 10px 12px; border: 1px solid var(--app-border); border-radius: 10px; background: rgba(255, 255, 255, .025); cursor: pointer; }
.permission-checkbox:hover { border-color: rgba(167, 139, 250, .42); background: rgba(139, 92, 246, .08); }
.permission-checkbox input { width: auto; margin-top: 2px; accent-color: var(--purple-500); }
.permission-checkbox span { color: var(--app-text); font-size: 14px; line-height: 1.35; }
.field-help { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.management-tabs { display: flex; align-items: center; gap: 6px; width: fit-content; margin: 0 0 26px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .025); }
.management-tab { min-width: 108px; padding: 9px 16px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 750; text-align: center; text-decoration: none; }
.management-tab:hover { color: var(--ink); background: rgba(255, 255, 255, .04); }
.management-tab.active { color: #fff; background: linear-gradient(135deg, rgba(139, 92, 246, .34), rgba(116, 66, 200, .2)); box-shadow: inset 0 0 0 1px rgba(192, 132, 252, .18); }
.position-panel { display: grid; grid-template-columns: 1fr minmax(280px, .6fr); gap: 30px; margin-top: 18px; }
.filter-bar { display: grid; grid-template-columns: minmax(240px, 1.4fr) repeat(3, minmax(145px, .65fr)) auto; align-items: end; gap: 14px; margin-bottom: 18px; }
.filter-field label { margin: 0 0 7px; }
.filter-actions { display: flex; gap: 8px; padding-bottom: 1px; }
.admin-split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .55fr); gap: 18px; align-items: start; }
.admin-split > * { min-width: 0; }
.compact-form { position: sticky; top: 22px; }
.table-panel .panel-heading { margin: -2px 0 8px; }
.table-panel table { min-width: 850px; }
.table-panel .positions-table { min-width: 0; table-layout: fixed; }
.positions-table .position-name-column { width: 29%; }
.positions-table .position-status-column { width: 18%; }
.positions-table .position-count-column { width: 11%; }
.positions-table .position-permissions-column { width: 17%; }
.positions-table .position-actions-column { width: 25%; }
.positions-table th, .positions-table td { padding-right: 9px; padding-left: 9px; }
.positions-table th:last-child, .positions-table td:last-child { padding-left: 16px; }
.positions-table td:first-child { overflow-wrap: anywhere; }
.table-panel { overflow-x: auto; }
.confirmation-panel p { margin-bottom: 0; }
.error-card { text-align: center; margin: 12vh auto; max-width: 500px; }
.status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.system-overall { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.system-overall h2 { margin-top: 5px; font-size: 24px; }
.system-overall.is-healthy { border-color: rgba(94, 224, 146, .28); }
.system-overall.needs-attention { border-color: rgba(251, 191, 36, .3); }
.status-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.health-pill { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.health-pill.healthy { color: var(--success); background: rgba(94, 224, 146, .08); border-color: rgba(94, 224, 146, .24); }
.health-pill.warning, .health-pill.unknown { color: #fbbf24; background: rgba(251, 191, 36, .08); border-color: rgba(251, 191, 36, .24); }
.health-pill.failed { color: var(--danger); background: rgba(251, 113, 133, .08); border-color: rgba(251, 113, 133, .24); }
.status-list { margin: 18px 0 0; }
.status-list div { display: flex; justify-content: space-between; gap: 24px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.status-list div:last-child { border-bottom: 0; }
.status-list dt { color: var(--muted); }
.status-list dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.gift-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 18px; align-items: start; }
.gift-inventory { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding-top: 18px; }
.gift-inventory div { padding: 16px; border: 1px solid var(--app-border); border-radius: 12px; background: rgba(139, 92, 246, .07); }
.gift-inventory span, .gift-inventory strong, .gift-inventory small { display: block; }
.gift-inventory strong { margin-top: 6px; color: #fff; font-size: 25px; }
.gift-inventory small { margin-top: 3px; color: var(--app-muted); }
.gift-confirmation { margin-top: 18px; max-width: 900px; }
.gift-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 22px 0 0; padding: 0; border: 0; }
.gift-options legend { grid-column: 1 / -1; color: var(--app-muted); font-size: 13px; font-weight: 750; }
.gift-option { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; padding: 16px; border: 1px solid var(--app-border); border-radius: 12px; cursor: pointer; }
.gift-option input { width: auto; grid-row: 1 / 3; align-self: center; }
.gift-option span { color: #fff; font-size: 18px; font-weight: 800; }
.gift-option small { color: var(--app-muted); }
.gift-option.disabled { cursor: not-allowed; opacity: .45; }

.app-shell-page { min-width: 320px; color: var(--app-text); background: var(--app-bg); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); background: radial-gradient(circle at 82% 6%, rgba(139, 92, 246, .10), transparent 27%), var(--app-bg); }
.app-sidebar { position: sticky; top: 0; z-index: 40; height: 100vh; min-height: 620px; display: flex; flex-direction: column; padding: 24px 18px 18px; border-right: 1px solid var(--app-border); background: linear-gradient(180deg, #1a1127 0%, var(--app-sidebar) 66%, #120c1c 100%); box-shadow: 20px 0 60px rgba(0, 0, 0, .14); }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 5px 27px; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; min-width: 0; text-decoration: none; }
.sidebar-brand .brand-mark { flex: 0 0 auto; background: linear-gradient(145deg, var(--app-accent), #4b2378); box-shadow: 0 8px 28px rgba(139, 92, 246, .28); }
.sidebar-brand strong, .sidebar-brand small { display: block; line-height: 1.05; }
.sidebar-brand strong { color: #fff; font-size: 16px; }
.sidebar-brand small { margin-top: 5px; color: var(--app-muted); font-size: 10px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.sidebar-close { display: none; border: 0; color: var(--app-muted); background: transparent; font-size: 28px; cursor: pointer; }
.sidebar-nav { display: flex; flex: 1; flex-direction: column; gap: 26px; overflow-y: auto; }
.nav-group { display: grid; gap: 6px; }
.nav-label { padding: 0 12px 7px; color: #766b84; font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px; border: 1px solid transparent; border-radius: 11px; color: var(--app-muted); font-size: 14px; font-weight: 700; text-decoration: none; transition: color .16s ease, background .16s ease, border-color .16s ease; }
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .04); }
.nav-item.active { color: #fff; border-color: rgba(192, 132, 252, .15); background: linear-gradient(90deg, rgba(139, 92, 246, .22), rgba(139, 92, 246, .07)); box-shadow: inset 3px 0 0 var(--app-accent-light); }
.nav-icon { width: 23px; display: inline-grid; place-items: center; color: var(--app-accent-light); font-size: 18px; }
.nav-icon-svg { width: 20px; height: 20px; display: block; }
.nav-count { min-width: 24px; margin-left: auto; padding: 3px 7px; border-radius: 999px; color: #fff; background: var(--app-accent); font-size: 10px; font-weight: 800; text-align: center; }
.sidebar-account { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; padding: 16px 5px 2px; border-top: 1px solid var(--app-border); }
.account-avatar { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(192, 132, 252, .25); border-radius: 12px; color: #fff; background: rgba(139, 92, 246, .14); font-weight: 800; }
.account-copy { min-width: 0; }
.account-copy strong, .account-copy span, .account-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { color: #fff; font-size: 13px; }
.account-copy span { margin-top: 3px; color: var(--app-muted); font-size: 11px; }
.account-copy small { margin-top: 3px; color: var(--app-accent-light); font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.sidebar-account form { grid-column: 1 / -1; margin: 8px 0 0; }
.sidebar-logout { width: 100%; padding: 9px 12px; border: 1px solid var(--app-border); border-radius: 9px; color: var(--app-muted); background: rgba(255, 255, 255, .025); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.sidebar-logout:hover { color: #fff; border-color: rgba(192, 132, 252, .26); }
.app-workspace { min-width: 0; }
.mobile-header { display: none; }
.app-content { width: 100%; max-width: 1320px; min-width: 0; margin: 0 auto; padding: 42px 38px 70px; }
.sidebar-scrim { display: none; }
.app-theme .page-heading { align-items: center; }
.app-theme .panel,
.app-theme .app-card { box-shadow: 0 18px 50px rgba(0, 0, 0, .14); }
.app-theme .button-primary { background: linear-gradient(135deg, var(--app-accent), #7442c8); box-shadow: 0 9px 24px rgba(139, 92, 246, .18); }
.app-theme .button-primary:hover { background: linear-gradient(135deg, #9b71f7, #8252d2); }

.missed-call-count { min-width: 130px; padding: 13px 17px; border: 1px solid rgba(192, 132, 252, .2); border-radius: 14px; background: rgba(139, 92, 246, .1); text-align: right; }
.missed-call-count strong, .missed-call-count span { display: block; }
.missed-call-count strong { color: #fff; font-size: 28px; }
.missed-call-count span { color: var(--app-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.missed-calls-view, .missed-call-list, .missed-call-card, .missed-call-list > .empty-state { width: 100%; min-width: 0; }
.queue-tabs { display: flex; gap: 7px; margin-bottom: 22px; padding: 5px; overflow-x: auto; border: 1px solid var(--app-border); border-radius: 13px; background: rgba(255, 255, 255, .025); }
.queue-tab { display: inline-flex; align-items: center; gap: 9px; flex: 0 0 auto; padding: 10px 14px; border-radius: 9px; color: var(--app-muted); font-size: 13px; font-weight: 750; text-decoration: none; cursor: pointer; }
.queue-tab:hover, .queue-tab.active { color: #fff; background: rgba(139, 92, 246, .16); }
.queue-tab span { min-width: 22px; padding: 2px 6px; border-radius: 999px; background: rgba(255, 255, 255, .08); font-size: 10px; text-align: center; }
.inbox-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.inbox-toolbar p { margin-top: 5px; }
.missed-call-list { display: grid; gap: 11px; }
.missed-call-card { display: grid; grid-template-columns: minmax(160px, 1.1fr) minmax(310px, 1.7fr) minmax(115px, .65fr) minmax(245px, 1.2fr); align-items: center; gap: 20px; padding: 18px 20px; border: 1px solid var(--app-border); border-radius: 15px; background: var(--app-panel); box-shadow: 0 14px 35px rgba(0, 0, 0, .12); }
.caller-phone-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.caller-number { display: block; color: #fff; font-size: 18px; font-weight: 800; }
.copy-phone-button { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; min-height: 30px; padding: 5px 7px; border: 1px solid rgba(192, 132, 252, .22); border-radius: 8px; color: var(--app-accent-light); background: rgba(139, 92, 246, .08); font: inherit; font-size: 10px; font-weight: 750; cursor: pointer; }
.copy-phone-button:hover, .copy-phone-button:focus-visible { color: #fff; border-color: rgba(192, 132, 252, .45); background: rgba(139, 92, 246, .18); }
.copy-phone-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.copy-phone-button.is-copied { color: var(--success); border-color: rgba(74, 222, 128, .35); }
.caller-block small, .case-state small { display: block; margin-top: 6px; color: var(--app-muted); font-size: 11px; }
.case-timing { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; }
.case-timing div { min-width: 0; }
.case-timing-placeholder { visibility: hidden; }
.case-timing dt { color: var(--app-muted); font-size: 10px; font-weight: 750; text-transform: uppercase; }
.case-timing dd { margin: 5px 0 0; color: #fff; font-size: 12px; overflow-wrap: anywhere; }
.status-open { color: #fbbf24; background: rgba(251, 191, 36, .12); }
.status-claimed { color: #c4b5fd; background: rgba(139, 92, 246, .16); }
.status-resolved { color: var(--success); background: rgba(74, 222, 128, .1); }
.case-actions { display: flex; justify-content: flex-end; gap: 8px; }
.case-actions form { margin: 0; }
.complete-form { display: flex; gap: 7px; }
.complete-form select { min-width: 132px; padding: 9px 10px; font-size: 12px; }
.case-actions .button { padding: 9px 12px; font-size: 12px; }

@media (max-width: 1160px) {
  .missed-call-card { grid-template-columns: minmax(170px, .9fr) minmax(320px, 1.5fr) minmax(110px, .55fr); }
  .case-actions { grid-column: 1 / -1; justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--app-border); }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .app-sidebar { position: fixed; inset: 0 auto 0 0; width: min(310px, 86vw); height: 100dvh; min-height: 0; transform: translateX(-105%); transition: transform .2s ease; }
  .sidebar-open .app-sidebar { transform: translateX(0); }
  .sidebar-close { display: block; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 30; width: 100%; height: 100%; border: 0; background: rgba(5, 3, 9, .72); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .sidebar-open .sidebar-scrim { display: block; opacity: 1; pointer-events: auto; }
  .sidebar-open { overflow: hidden; }
  .mobile-header { position: sticky; top: 0; z-index: 20; height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 20px; border-bottom: 1px solid var(--app-border); background: rgba(23, 16, 34, .94); backdrop-filter: blur(14px); }
  .menu-button { width: 40px; height: 40px; border: 1px solid var(--app-border); border-radius: 10px; color: #fff; background: rgba(255, 255, 255, .04); font-size: 20px; cursor: pointer; }
  .mobile-brand { display: inline-flex; align-items: center; gap: 9px; color: #fff; font-weight: 800; text-decoration: none; }
  .mobile-brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: linear-gradient(145deg, var(--app-accent), #4b2378); font-size: 13px; }
  .app-content { padding: 30px 22px 55px; }
  .position-panel, .admin-split, .filter-bar { grid-template-columns: 1fr; }
  .compact-form { position: static; }
  .filter-actions { padding-bottom: 0; }
}

@media (max-width: 820px) {
  .site-header { height: auto; padding: 16px 20px; flex-wrap: wrap; gap: 16px; }
  .page-shell { padding: 30px 18px 50px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid, .app-grid, .status-grid, .dashboard-metrics { grid-template-columns: 1fr; }
  .gift-layout { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .freshness { text-align: left; }
  .missed-call-card { grid-template-columns: 1fr 1fr; }
  .case-timing { grid-template-columns: 1fr; }
  .case-actions { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .app-content { padding: 24px 15px 45px; }
  .panel { padding: 18px; }
  .page-heading { margin-bottom: 22px; }
  h1 { font-size: 31px; }
  .form-actions { justify-content: stretch; flex-direction: column-reverse; }
  .form-actions .button { width: 100%; text-align: center; }
  .status-list div { align-items: flex-start; flex-direction: column; gap: 5px; }
  .status-list dd { text-align: left; }
  .login-card { padding: 28px 22px; }
  .management-tabs { width: 100%; }
  .management-tab { flex: 1; min-width: 0; }
  .table-panel .positions-table { min-width: 620px; }
  .missed-call-count { min-width: 0; text-align: left; }
  .queue-tabs { margin-right: -15px; margin-left: -15px; padding-right: 15px; padding-left: 15px; border-right: 0; border-left: 0; border-radius: 0; }
  .inbox-toolbar { align-items: flex-start; flex-direction: column; }
  .missed-call-card { grid-template-columns: 1fr; padding: 17px; }
  .case-timing { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .case-state { display: flex; align-items: center; gap: 8px; }
  .case-state small { margin-top: 0; }
  .case-actions { grid-column: auto; align-items: stretch; flex-direction: column; }
  .complete-form { align-items: stretch; flex-direction: column; }
  .complete-form select, .case-actions .button { width: 100%; }
  .gift-inventory, .gift-options { grid-template-columns: 1fr; }
}

.agents-online-widget { position: fixed; right: 20px; bottom: 18px; z-index: 25; width: min(468px, calc(100vw - 40px)); overflow: hidden; border: 1px solid rgba(196, 181, 253, .20); border-radius: 15px; background: #171020; box-shadow: 0 20px 54px rgba(0, 0, 0, .46), 0 0 0 1px rgba(139, 92, 246, .04); }
.agents-online-toggle { width: 100%; min-height: 70px; display: grid; grid-template-columns: minmax(138px, auto) minmax(0, 1fr) 18px; align-items: center; gap: 14px; padding: 10px 14px; border: 0; color: var(--app-text); background: linear-gradient(135deg, rgba(139, 92, 246, .13), rgba(76, 29, 149, .05)); font: inherit; text-align: left; cursor: pointer; }
.agents-online-toggle:hover { background: linear-gradient(135deg, rgba(139, 92, 246, .18), rgba(76, 29, 149, .08)); }
.agents-online-toggle:focus-visible, .agents-online-panel-heading button:focus-visible, .agents-online-group-toggle:focus-visible, .agents-online-filter:focus-visible { outline: 2px solid var(--app-accent-light); outline-offset: -3px; }
.agents-online-toggle-identity { min-width: 0; display: flex; align-items: center; gap: 9px; }
.agents-online-icon { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid rgba(74, 222, 128, .18); border-radius: 9px; color: var(--success); background: rgba(74, 222, 128, .07); }
.agents-online-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.agents-online-toggle-copy, .agents-online-heading-copy { min-width: 0; display: grid; gap: 1px; }
.agents-online-title { display: flex; align-items: center; gap: 8px; }
.agents-online-title strong { color: #fff; font-size: 13px; letter-spacing: -.01em; }
.agents-online-status-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(74, 222, 128, .10); }
.agents-online-toggle-copy > small, .agents-online-heading-copy > small { color: var(--app-muted); font-size: 10px; font-weight: 700; }
.agents-online-position-counts { min-width: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(42px, 1fr); gap: 5px; overflow: hidden; }
.agents-online-position-count { min-width: 0; display: grid; justify-items: center; gap: 1px; padding: 4px 5px; border: 1px solid rgba(196, 181, 253, .10); border-radius: 7px; background: rgba(255, 255, 255, .025); }
.agents-online-position-count > span { max-width: 100%; overflow: hidden; color: var(--app-muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.agents-online-position-count strong { color: var(--success); font-size: 15px; line-height: 1; }
.agents-online-chevron { width: 18px; height: 18px; flex: 0 0 auto; color: var(--app-accent-light); fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.agents-online-widget.is-expanded .agents-online-toggle { display: none; }
.agents-online-panel { background: #171020; }
.agents-online-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px; border-bottom: 1px solid rgba(255, 255, 255, .07); background: linear-gradient(135deg, rgba(139, 92, 246, .13), rgba(76, 29, 149, .05)); }
.agents-online-panel-heading button { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid rgba(196, 181, 253, .16); border-radius: 9px; color: var(--app-accent-light); background: rgba(255, 255, 255, .025); cursor: pointer; }
.agents-online-panel-heading button:hover { background: rgba(139, 92, 246, .12); }
.agents-online-panel-heading svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.agents-online-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 7px 14px; border-bottom: 1px solid rgba(255, 255, 255, .055); color: var(--app-muted); font-size: 9px; }
.agents-online-filter { height: 27px; padding: 0 28px 0 9px; border: 1px solid rgba(196, 181, 253, .15); border-radius: 7px; color: var(--app-text); background-color: #21172d; font: inherit; font-size: 10px; cursor: pointer; }
.agents-online-groups { max-height: min(68vh, 560px); overflow-y: auto; padding: 0 12px 10px; scrollbar-width: thin; scrollbar-color: rgba(192, 132, 252, .32) transparent; }
.agents-online-group { border-bottom: 1px solid rgba(255, 255, 255, .055); }
.agents-online-group-toggle { width: 100%; display: grid; grid-template-columns: 7px minmax(0, auto) minmax(0, 1fr) 16px; align-items: center; gap: 8px; padding: 10px 3px; border: 0; color: inherit; background: transparent; font: inherit; text-align: left; cursor: pointer; }
.agents-online-group-toggle:hover { background: rgba(139, 92, 246, .045); }
.agents-online-group-toggle strong { overflow: hidden; color: #d8b4fe; font-size: 10px; letter-spacing: .06em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.agents-online-group-toggle > span:nth-child(3) { overflow: hidden; color: var(--app-muted); font-size: 9px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.agents-online-group-dot { width: 6px; height: 6px; border-radius: 50%; background: #28633e; opacity: .65; }
.agents-online-group-dot.has-online { background: var(--success); opacity: 1; box-shadow: 0 0 0 3px rgba(74, 222, 128, .08); }
.agents-online-group-chevron { width: 16px; height: 16px; color: var(--app-muted); fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; transition: transform .15s ease; }
.agents-online-group.is-open .agents-online-group-chevron { transform: rotate(90deg); }
.agents-online-group ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 12px; margin: 0; padding: 0 3px 9px; list-style: none; }
.agents-online-group ul[hidden] { display: none; }
.agents-online-group li { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 7px; min-height: 25px; padding: 2px 4px; border-radius: 6px; color: var(--app-text); font-size: 11px; }
.agents-online-group li small { color: var(--app-muted); font-size: 9px; }
.agents-online-group li.is-online small { color: var(--success); }
.agents-online-group li.is-offline { opacity: .42; }
.agents-online-dot { width: 6px; height: 6px; border-radius: 50%; background: #6b6474; }
.is-online .agents-online-dot { background: var(--success); box-shadow: 0 0 0 3px rgba(74, 222, 128, .09); }
.agents-online-empty { display: block !important; min-height: 0 !important; color: var(--app-muted) !important; font-style: italic; }

@media (max-width: 520px) {
  .agents-online-widget { right: 10px; bottom: 10px; width: calc(100vw - 20px); }
  .agents-online-groups { max-height: 58vh; }
  .agents-online-toggle { grid-template-columns: minmax(124px, auto) minmax(0, 1fr) 16px; gap: 8px; padding-inline: 10px; }
  .agents-online-icon { width: 28px; height: 28px; }
  .agents-online-position-counts { gap: 3px; }
  .agents-online-position-count { padding-inline: 3px; }
  .agents-online-position-count > span { font-size: 7px; }
  .agents-online-position-count strong { font-size: 13px; }
  .agents-online-group ul { grid-template-columns: 1fr; }
}
