:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --sidebar: #111827;
  --sidebar-hover: #1f2937;
  --line: #e3e7ec;
  --line-strong: #d5dbe3;
  --text: #18212f;
  --muted: #687386;
  --muted-light: #98a2b3;
  --green: #168a4a;
  --green-hover: #11743e;
  --green-soft: #eaf7ef;
  --blue: #2563eb;
  --blue-soft: #eef4ff;
  --violet: #6941c6;
  --violet-soft: #f2effb;
  --amber: #b45309;
  --amber-soft: #fff6e8;
  --red: #c43242;
  --red-soft: #fff0f1;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4, p { margin-top: 0; }
.screen { display: none; }
.screen.active { display: flex; }
.hidden { display: none !important; }
.panel { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }

.login-screen { min-height: 100vh; align-items: center; justify-content: center; background-color: #eef1f4; background-image: linear-gradient(rgba(17, 24, 39, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(17, 24, 39, .025) 1px, transparent 1px); background-size: 32px 32px; }
.login-shell { width: calc(100% - 32px); max-width: 410px; text-align: center; }
.brand-mark { width: 48px; height: 48px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 12px; background: #167c46; color: white; font-size: 21px; font-weight: 700; letter-spacing: -.04em; box-shadow: 0 6px 16px rgba(22, 124, 70, .2); }
.brand-mark.small { width: 36px; height: 36px; margin: 0; border-radius: 9px; font-size: 16px; box-shadow: none; }
.login-card { width: 100%; border-radius: 14px; padding: 34px; text-align: left; box-shadow: var(--shadow-md); }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 600; }
.login-card .eyebrow { color: var(--green); }
.login-card h1 { margin: 9px 0 8px; font-size: 25px; line-height: 1.25; letter-spacing: -.025em; }
.login-card > p { margin-bottom: 26px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.login-footnote { margin: 18px 0 0; color: #7d8795; font-size: 11px; }

.field { display: block; margin-bottom: 17px; }
.field > span { display: block; margin-bottom: 7px; color: #344054; font-size: 12px; font-weight: 600; }
.field input, .field textarea, .field select, .search-input, .toolbar-controls select { width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text); padding: 11px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
.field textarea { resize: vertical; line-height: 1.55; }
.field input::placeholder, .field textarea::placeholder, .search-input::placeholder { color: #a0a8b4; }
.field input:focus, .field textarea:focus, .field select:focus, .search-input:focus, .toolbar-controls select:focus { border-color: #4ba173; box-shadow: 0 0 0 3px rgba(22, 138, 74, .1); }
.field small { display: block; margin-top: 5px; color: var(--muted-light); font-size: 10px; text-align: right; }
.primary-button { border: 1px solid var(--green); border-radius: 8px; background: var(--green); color: white; padding: 11px 16px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, box-shadow .15s; }
.primary-button:hover { background: var(--green-hover); border-color: var(--green-hover); box-shadow: 0 3px 8px rgba(17, 116, 62, .18); }
.primary-button:disabled { opacity: .55; cursor: wait; box-shadow: none; }
.primary-button.full { width: 100%; }
.form-message { margin: 13px 0 0; font-size: 12px; }
.form-message.error { color: var(--red); }
.form-message.success { color: var(--green); }

.dashboard-screen { min-height: 100vh; }
.sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; width: 244px; display: flex; flex-direction: column; padding: 22px 14px 18px; background: var(--sidebar); color: #e5e7eb; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; }
.sidebar-brand strong { display: block; font-size: 14px; font-weight: 700; }
.sidebar-brand span { display: block; margin-top: 2px; color: #8993a3; font-size: 10px; }
.sidebar nav { display: grid; gap: 4px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 11px; border: 0; border-radius: 7px; background: transparent; color: #98a2b3; font-size: 12px; font-weight: 500; text-align: left; cursor: pointer; transition: background .15s, color .15s; }
.nav-item svg, .refresh-button svg, .stat-icon svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-item:hover { background: rgba(255, 255, 255, .055); color: #e5e7eb; }
.nav-item.active { background: var(--sidebar-hover); color: white; }
.nav-item.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #38b66f; }
.sidebar-status { margin-top: auto; display: flex; align-items: flex-start; gap: 9px; padding: 12px 10px; border-top: 1px solid #283243; }
.sidebar-status strong, .sidebar-status span { display: block; font-size: 10px; }
.sidebar-status strong { color: #d1d5db; font-weight: 600; }
.sidebar-status span { margin-top: 3px; color: #7f8998; }
.live-dot { width: 7px; height: 7px; margin: 3px 1px; border-radius: 50%; background: #39b86f; box-shadow: 0 0 0 3px rgba(57, 184, 111, .12); }
.logout-button { border: 0; background: transparent; color: #7f8998; font-size: 11px; padding: 12px 10px 0; text-align: left; cursor: pointer; }
.logout-button:hover { color: #fca5a5; }
.main-content { width: calc(100% - 244px); margin-left: 244px; padding: 0 32px 48px; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 4px 0 0; font-size: 21px; line-height: 1.25; letter-spacing: -.02em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.connection-pill { display: flex; align-items: center; gap: 7px; min-height: 34px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); font-size: 10px; }
.connection-pill span { width: 6px; height: 6px; border-radius: 50%; background: #d97706; }
.connection-pill.connected span { background: #16a05a; }
.connection-pill.disconnected span { background: var(--red); }
.connection-pill b { font-weight: 600; }
.refresh-button, .mobile-menu { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: #596579; cursor: pointer; }
.refresh-button:hover, .mobile-menu:hover { background: var(--surface-soft); color: var(--text); }
.refresh-button svg { width: 17px; height: 17px; }
.refresh-button.spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.admin-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #e8edf2; color: #3d4a5d; font-size: 11px; font-weight: 700; }
.mobile-menu { display: none; font-size: 17px; }
.toast { position: fixed; z-index: 40; top: 92px; right: 28px; max-width: 360px; padding: 11px 14px; border: 1px solid #b8dec7; border-radius: 8px; background: #f1fbf5; color: #18633b; font-size: 12px; box-shadow: var(--shadow-md); }

.tab-content { display: none; }
.tab-content.active { display: block; }
.welcome-row, .section-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.welcome-row h2, .section-toolbar h2 { margin-bottom: 4px; font-size: 18px; letter-spacing: -.015em; }
.welcome-row p, .section-toolbar p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.welcome-row > span { color: var(--muted-light); font-size: 10px; white-space: nowrap; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card { min-height: 143px; padding: 17px; border-radius: 10px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px; }
.stat-icon svg { width: 17px; height: 17px; }
.stat-icon.violet { background: var(--violet-soft); color: var(--violet); }
.stat-icon.green { background: var(--green-soft); color: var(--green); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber); }
.stat-icon.blue { background: var(--blue-soft); color: var(--blue); }
.trend { color: var(--muted-light); font-size: 9px; font-weight: 600; }
.trend.positive { color: var(--green); }
.stat-card > strong { display: block; margin-top: 18px; font-size: 29px; line-height: 1; letter-spacing: -.035em; }
.stat-card > p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.live-bar { display: none; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 14px; margin-top: 14px; }
.section-card { padding: 20px; border-radius: 10px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.section-heading h3 { margin: 5px 0 0; font-size: 14px; }
.text-button { border: 0; background: transparent; color: var(--green); font-size: 10px; font-weight: 600; cursor: pointer; }
.text-button:hover { color: var(--green-hover); text-decoration: underline; }
.activity-list { display: grid; }
.activity-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid #edf0f3; }
.activity-avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #eef1f4; color: #667085; font-size: 10px; font-weight: 700; }
.activity-item strong, .activity-item span { display: block; font-size: 11px; }
.activity-item span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.activity-item time { color: var(--muted-light); font-size: 9px; }
.muted { color: var(--muted); font-size: 11px; line-height: 1.6; }
.mode-badge { padding: 4px 7px; border: 1px solid #b8dec7; border-radius: 5px; background: var(--green-soft); color: var(--green); font-size: 9px; font-weight: 600; }
.mode-selector { display: grid; gap: 7px; margin-top: 18px; }
.mode-selector button { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: #475467; padding: 11px 12px; text-align: left; cursor: pointer; }
.mode-selector button:hover { border-color: #b8c1cc; }
.mode-selector button b, .mode-selector button span { display: block; }
.mode-selector button b { font-size: 11px; }
.mode-selector button span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.mode-selector button.active { border-color: #72b68f; background: #f4fbf7; color: var(--green); }

.toolbar-controls { display: flex; gap: 8px; }
.search-input { width: 230px; }
.toolbar-controls select { width: 175px; }
.search-input, .toolbar-controls select { padding: 9px 11px; font-size: 11px; }
.table-panel { overflow: hidden; border-radius: 10px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 850px; border-collapse: collapse; }
th, td { padding: 13px 15px; border-bottom: 1px solid #edf0f3; font-size: 11px; text-align: left; vertical-align: middle; }
th { background: var(--surface-soft); color: #667085; font-size: 9px; font-weight: 600; letter-spacing: .025em; text-transform: none; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
td code { color: #596579; font-size: 9px; }
.user-cell { display: flex; align-items: center; gap: 9px; }
.user-cell b { display: block; font-size: 11px; }
.user-cell small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.status-badge, .package-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 5px; font-size: 9px; font-weight: 600; }
.status-badge.online { background: var(--green-soft); color: var(--green); }
.status-badge.offline { background: #f0f2f4; color: #667085; }
.status-badge.online::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #1a9b54; }
.package-badge.premium { background: var(--amber-soft); color: var(--amber); }
.package-badge.standard { background: #f0f2f4; color: #667085; }
.row-action { border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: #475467; padding: 6px 9px; font-size: 9px; cursor: pointer; }
.row-action:hover { border-color: #72b68f; color: var(--green); }
.message-cell { max-width: 340px; }
.message-cell b, .message-cell span { display: block; }
.message-cell span { margin-top: 4px; color: var(--muted); line-height: 1.45; white-space: normal; }
.empty-state { padding: 34px; color: var(--muted); font-size: 11px; text-align: center; }

.notify-layout { display: grid; grid-template-columns: minmax(520px, 1fr) 330px; gap: 16px; align-items: start; }
.notification-form, .preview-card { padding: 23px; border-radius: 10px; }
.form-section { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.form-section h3 { margin: 0 0 4px; font-size: 13px; }
.form-section p { margin: 0; color: var(--muted); font-size: 10px; }
.step { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 28px; border-radius: 6px; background: var(--green-soft); color: var(--green); font-size: 9px; font-weight: 700; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.audience-box { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 14px; border: 1px solid #cbe4d5; border-radius: 8px; background: #f5fbf7; }
.audience-box span, .audience-box strong { display: block; }
.audience-box span { color: var(--muted); font-size: 9px; }
.audience-box strong { margin-top: 3px; color: var(--green); font-size: 16px; }
.audience-box p { margin: 0; color: var(--muted); font-size: 9px; }
.divider { height: 1px; margin: 22px 0; background: var(--line); }
.notification-form code, .tag-help code { padding: 2px 4px; border-radius: 4px; background: var(--green-soft); color: var(--green); }
.notification-form > .primary-button { width: 100%; display: flex; justify-content: space-between; }
.preview-card h3 { margin: 6px 0 20px; font-size: 13px; }
.phone-preview { position: relative; height: 350px; padding: 38px 11px 0; border: 7px solid #202733; border-radius: 30px; background: #dce3e8; box-shadow: inset 0 0 50px rgba(31, 41, 55, .12); }
.phone-top { position: absolute; top: 0; left: 50%; width: 72px; height: 16px; transform: translateX(-50%); border-radius: 0 0 11px 11px; background: #202733; }
.push-preview { display: grid; grid-template-columns: 29px 1fr; gap: 8px; padding: 10px; border: 1px solid rgba(17, 24, 39, .08); border-radius: 11px; background: rgba(255, 255, 255, .95); color: #172033; box-shadow: 0 8px 22px rgba(16, 24, 40, .13); }
.app-mini { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; background: var(--green); color: white; font-size: 10px; font-weight: 700; }
.push-meta { color: #7b8491; font-size: 7px; font-weight: 600; }
.push-preview strong { display: block; margin: 3px 0; font-size: 10px; }
.push-preview p { margin: 0; color: #465163; font-size: 8px; line-height: 1.45; overflow-wrap: anywhere; }
.tag-help { display: flex; align-items: flex-start; gap: 9px; margin-top: 16px; }
.tag-help p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.5; }

.support-table { min-width: 1180px; }
.support-row { vertical-align: top; }
.support-thread { min-width: 390px; max-width: 520px; }
.support-thread h4 { margin: 0 0 11px; font-size: 12px; }
.support-bubble { width: fit-content; max-width: 88%; margin: 6px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #f7f8fa; }
.support-bubble.user { margin-left: auto; border-color: #cbe4d5; background: #f2faf5; }
.support-bubble b { color: var(--green); font-size: 8px; }
.support-bubble p { margin: 4px 0; font-size: 10px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.support-bubble time, .support-date { display: block; color: var(--muted-light); font-size: 8px; }
.support-date { margin-top: 7px; }
.support-actions { width: 250px; }
.support-actions textarea { width: 100%; resize: vertical; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--text); padding: 9px; font-size: 10px; outline: none; }
.support-actions textarea:focus { border-color: #4ba173; box-shadow: 0 0 0 3px rgba(22, 138, 74, .08); }
.support-actions button { width: 100%; margin-top: 7px; }

@media (max-width: 1080px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: 1fr; }
  .notify-layout { grid-template-columns: 1fr; }
  .preview-card { display: none; }
}

@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-md); }
  .sidebar.open { transform: translateX(0); }
  .main-content { width: 100%; margin-left: 0; padding: 0 16px 34px; }
  .mobile-menu { display: grid; }
  .topbar { height: 72px; margin-bottom: 22px; }
  .topbar .eyebrow, .admin-avatar { display: none; }
  .connection-pill b { display: none; }
  .welcome-row { align-items: flex-start; }
  .welcome-row > span { display: none; }
  .section-toolbar { display: block; }
  .toolbar-controls { display: grid; margin-top: 14px; }
  .search-input, .toolbar-controls select, .section-toolbar > .search-input { width: 100%; }
  .section-toolbar > .search-input { margin-top: 14px; }
  .filter-grid { grid-template-columns: 1fr; }
  .notification-form { padding: 18px; }
  .audience-box { display: block; }
  .audience-box p { margin-top: 7px; }
  .toast { top: 80px; left: 16px; right: 16px; }
}

@media (max-width: 460px) {
  .stats-grid { grid-template-columns: 1fr; gap: 10px; }
  .stat-card { min-height: 125px; }
  .login-shell { width: calc(100% - 24px); }
  .login-card { padding: 28px 22px; }
}
