:root {
  --ink: #1d3034;
  --ink-soft: #52666a;
  --muted: #809194;
  --paper: #f2f6f3;
  --surface: #fbfcfa;
  --surface-2: #e8efeb;
  --line: #dce6e1;
  --teal: #146c68;
  --teal-dark: #0b4b49;
  --teal-wash: #dcefeb;
  --lime: #c6db6a;
  --amber: #d48637;
  --amber-wash: #fff2df;
  --red: #b84d4a;
  --red-wash: #fae7e5;
  --green: #3b8061;
  --green-wash: #e2f2e9;
  --shadow: 0 12px 36px rgba(31, 62, 59, .07);
  --radius: 14px;
  --font-body: 'Avenir Next', Avenir, 'Segoe UI', sans-serif;
  --font-display: 'Trebuchet MS', 'Avenir Next', sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}
body.dark-theme {
  --ink: #e1eeea;
  --ink-soft: #b1c5bf;
  --muted: #95aaa6;
  --paper: #142b2b;
  --surface: #1c3736;
  --surface-2: #274341;
  --line: #345351;
  --teal: #65b5a7;
  --teal-dark: #8bcbbc;
  --teal-wash: #294e49;
  --amber-wash: #55452e;
  --red-wash: #503635;
  --green-wash: #294b3e;
  --shadow: 0 12px 36px rgba(0,0,0,.13);
}
body.dark-theme .topbar { background: rgba(28,55,54,.9); }
body.dark-theme input,body.dark-theme select,body.dark-theme textarea { background: #213c3b; color: var(--ink); border-color: var(--line); }
body.dark-theme .form-actions,body.dark-theme .detail-item { background: #203b39; }
body.dark-theme tbody tr:hover { background: #203c39; }
body.dark-theme .preview-phone { background: #eaf0ed; }
body.dark-theme .preview-notification { color: #1d3034; }
body.dark-theme .login-layout { background: #142b2b; }
body.dark-theme .chart .gridline { stroke: #35514f; }
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font: 14px/1.5 var(--font-body); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
.shell { min-height: 100dvh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 248px; display: flex; flex-direction: column; background: #173d3c; color: #ecf4ef; padding: 24px 16px 16px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 26px; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; color: #143c3a; background: var(--lime); border-radius: 11px; }
.brand-mark svg { width: 19px; height: 19px; }
.brand-name { font: 800 16px var(--font-display); letter-spacing: -.5px; }
.brand-caption { color: #a6bfba; font: 10px var(--font-mono); letter-spacing: .04em; margin-top: 2px; }
.nav-label { color: #91afaa; font: 10px var(--font-mono); text-transform: uppercase; letter-spacing: .13em; padding: 10px 12px 7px; }
.nav-list { display: grid; gap: 3px; }
.nav-link { min-height: 40px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border-radius: 9px; color: #bfd0cc; font-size: 13px; transition: background .18s, color .18s, transform .18s; }
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; transform: translateX(2px); }
.nav-link.active { background: #285653; color: #fff; box-shadow: inset 2px 0 var(--lime); }
.nav-link svg { width: 17px; height: 17px; opacity: .88; flex: none; }
.sidebar-bottom { margin-top: auto; }
.workspace-card { margin: 0 4px 14px; border: 1px solid rgba(220,239,235,.14); border-radius: 12px; padding: 13px; background: rgba(255,255,255,.04); }
.workspace-card small { color: #9db6b1; display: block; font: 10px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
.workspace-card strong { display: block; margin-top: 6px; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot { display: flex; align-items: center; gap: 10px; padding: 12px 8px 2px; border-top: 1px solid rgba(255,255,255,.12); }
.user-dot { width: 30px; height: 30px; border-radius: 50%; background: #426f67; color: #e7f1ea; display: grid; place-items: center; font: 11px var(--font-mono); }
.user-email { color: #c4d4cf; font-size: 11px; max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout { margin-left: auto; border: 0; color: #c4d4cf; background: transparent; padding: 6px; }
.logout:hover { color: var(--lime); }
.logout svg { display: block; width: 16px; height: 16px; }
.main { margin-left: 248px; min-height: 100dvh; }
.topbar { height: 64px; padding: 0 38px; background: rgba(251,252,250,.88); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.crumb { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.crumb strong { color: var(--ink); font-weight: 600; }
.top-meta { display: flex; align-items: center; gap: 15px; color: var(--muted); font-size: 11px; }
.theme-toggle { display: inline-grid; place-items: center; width: 30px; height: 30px; color: var(--ink-soft); background: transparent; border: 1px solid var(--line); border-radius: 7px; }
.theme-toggle svg { width: 15px; height: 15px; }
.live-indicator { display: flex; align-items: center; gap: 6px; color: var(--green); }
.live-indicator:before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #59a57d; box-shadow: 0 0 0 3px #e0f1e6; }
.mobile-menu { display: none; border: 0; background: transparent; color: var(--ink); padding: 6px; }
.content { max-width: 1530px; margin: 0 auto; padding: 34px 38px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.eyebrow { font: 10px var(--font-mono); color: var(--teal); letter-spacing: .12em; text-transform: uppercase; margin: 0 0 7px; }
h1,h2,h3,p { margin-top: 0; }
h1 { font: 800 clamp(25px, 3vw, 34px)/1.15 var(--font-display); letter-spacing: -1.25px; margin: 0; }
.page-subtitle { color: var(--muted); margin: 8px 0 0; font-size: 13px; }
.head-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.btn { min-height: 38px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 8px; padding: 0 14px; background: var(--teal); color: white; font-size: 12px; font-weight: 700; transition: transform .18s, background .18s, box-shadow .18s; }
.btn:hover { transform: translateY(-1px); background: var(--teal-dark); box-shadow: 0 5px 12px rgba(20,108,104,.18); }
.btn svg { width: 15px; height: 15px; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface-2); box-shadow: none; }
.btn.danger { background: var(--red-wash); color: var(--red); }
.btn.danger:hover { background: #f4d5d2; box-shadow: none; }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 11px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 21px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.section-title h2,.section-title h3 { font: 700 15px var(--font-display); letter-spacing: -.25px; margin: 0; }
.section-title p { color: var(--muted); font-size: 11px; margin: 4px 0 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { padding: 18px 19px; min-height: 116px; position: relative; overflow: hidden; }
.stat-card:after { content: ''; position: absolute; right: -20px; top: -24px; width: 94px; height: 94px; border: 1px solid rgba(20,108,104,.1); border-radius: 50%; box-shadow: 0 0 0 12px rgba(20,108,104,.025),0 0 0 25px rgba(20,108,104,.018); }
.stat-label { color: var(--muted); font: 10px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.stat-value { font: 800 27px var(--font-display); letter-spacing: -1px; margin: 12px 0 3px; }
.stat-foot { color: var(--muted); font-size: 11px; }
.two-col { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(290px,.85fr); gap: 16px; }
.split { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.chart-wrap { min-height: 218px; position: relative; }
.chart { width: 100%; height: 190px; overflow: visible; }
.chart .gridline { stroke: #e5ece8; stroke-width: 1; }
.chart .line { fill: none; stroke: var(--teal); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart .area { fill: url(#chartFill); }
.chart text { fill: #829294; font: 10px var(--font-mono); }
.chart .point { fill: var(--surface); stroke: var(--teal); stroke-width: 2; }
.categorical-chart { height: auto; min-height: 130px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 10px; }
.legend b { display: inline-block; width: 7px; height: 7px; background: var(--teal); border-radius: 50%; margin-right: 5px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 11px 13px; border-bottom: 1px solid var(--line); color: #829294; font: 10px var(--font-mono); text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; }
td { padding: 13px; border-bottom: 1px solid #edf1ee; font-size: 12px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7faf7; }
.primary-cell { font-weight: 700; color: var(--ink); }
.secondary-cell { color: var(--muted); font-size: 11px; margin-top: 3px; }
.mono { font: 11px var(--font-mono); color: #506265; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 30px; padding: 4px 8px; background: var(--surface-2); color: #53676a; font: 10px var(--font-mono); text-transform: capitalize; white-space: nowrap; }
.badge:before { content: ''; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }
.badge.active,.badge.sent,.badge.success { background: var(--green-wash); color: var(--green); }
.badge.inactive,.badge.failed,.badge.cancelled { background: var(--red-wash); color: var(--red); }
.badge.queued,.badge.scheduled,.badge.processing { background: var(--amber-wash); color: #a86b27; }
.badge.partial { background: #f0e9d7; color: #897337; }
.table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; color: #65777a; border: 1px solid var(--line); border-radius: 7px; background: transparent; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 14px; height: 14px; }
.toolbar { display: flex; gap: 9px; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.field { display: grid; gap: 6px; }
.field label,.label { color: #52666a; font-size: 11px; font-weight: 700; }
.field small,.help { color: var(--muted); font-size: 10px; line-height: 1.5; }
input, select, textarea { width: 100%; min-height: 38px; border: 1px solid #d5e0db; border-radius: 7px; background: #fff; color: var(--ink); padding: 8px 10px; outline: none; transition: border .15s, box-shadow .15s; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #5b9a90; box-shadow: 0 0 0 3px rgba(20,108,104,.11); }
input[type=checkbox],input[type=radio] { width: 16px; min-height: 16px; accent-color: var(--teal); }
.compact-input { min-height: 34px; width: auto; min-width: 145px; font-size: 11px; }
.search-box { position: relative; }
.search-box input { padding-left: 33px; }
.search-box svg { width: 15px; position: absolute; left: 10px; top: 10px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.form-grid .full { grid-column: 1/-1; }
.form-section { padding: 20px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section-title { font: 700 13px var(--font-display); margin: 0 0 15px; }
.form-actions { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #f8faf8; border-radius: 0 0 var(--radius) var(--radius); }
.action-stack { display: flex; gap: 8px; flex-wrap: wrap; }
.empty-state { min-height: 220px; padding: 34px; display: grid; align-content: center; justify-items: center; text-align: center; }
.empty-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--teal-wash); color: var(--teal); display: grid; place-items: center; margin-bottom: 13px; }
.empty-icon svg { width: 22px; }
.empty-state h3 { font: 700 15px var(--font-display); margin: 0 0 6px; }
.empty-state p { max-width: 340px; color: var(--muted); font-size: 12px; margin: 0 0 16px; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.pagination nav { display: flex; gap: 5px; }
.pagination a,.pagination span { display: grid; place-items: center; min-width: 29px; height: 29px; padding: 0 7px; border: 1px solid var(--line); border-radius: 6px; }
.pagination .current { color: white; background: var(--teal); border-color: var(--teal); }
.pagination .disabled { opacity: .45; }
.notice { display: flex; gap: 10px; align-items: flex-start; border-radius: 9px; padding: 12px 14px; font-size: 12px; margin-bottom: 16px; }
.notice > svg { width: 18px; height: 18px; flex: none; }
.notice.info { color: #245b58; background: var(--teal-wash); }
.notice.warning { color: #8b5b24; background: var(--amber-wash); }
.notice.error { color: #9a3938; background: var(--red-wash); }
.notice.success { color: #347252; background: var(--green-wash); }
.flash-stack { position: fixed; top: 76px; right: 24px; z-index: 50; display: grid; gap: 8px; width: min(400px,calc(100% - 32px)); }
.toast { padding: 13px 15px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; box-shadow: 0 12px 32px rgba(20,48,46,.13); animation: toast-in .28s ease both; font-size: 12px; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast button { border: 0; color: var(--muted); background: transparent; margin-left: auto; }
.key-reveal { font: 11px var(--font-mono); overflow-wrap: anywhere; background: rgba(255,255,255,.6); border-radius: 5px; padding: 5px; margin-top: 6px; user-select: all; }
.preview-phone { width: min(100%,310px); border: 6px solid #23383b; border-radius: 26px; padding: 13px; background: #f8faf9; box-shadow: 0 14px 35px rgba(26,59,57,.14); }
.preview-notch { height: 5px; width: 70px; border-radius: 8px; background: #23383b; margin: 0 auto 15px; }
.preview-notification { display: flex; gap: 10px; background: #fff; padding: 12px; border-radius: 11px; box-shadow: 0 3px 10px rgba(0,0,0,.07); }
.preview-app-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--teal); color: white; display: grid; place-items: center; font: 10px var(--font-mono); flex: none; }
.preview-title { font-size: 11px; font-weight: 700; }
.preview-message { font-size: 10px; color: #617175; margin-top: 3px; }
.preview-now { color: #8a989a; font-size: 9px; margin-left: auto; white-space: nowrap; }
.rule-row { display: grid; grid-template-columns: 1.1fr .8fr 1.2fr 32px; gap: 8px; align-items: center; margin-bottom: 8px; }
.rule-row select,.rule-row input { min-width: 0; }
.seg-logic { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 8px; gap: 3px; }
.seg-logic label { padding: 6px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 11px; font-weight: 700; }
.seg-logic input { display: none; }
.seg-logic label:has(input:checked) { color: var(--teal-dark); background: #fff; box-shadow: 0 1px 4px rgba(30,60,57,.1); }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.login-layout { min-height: 100dvh; display: grid; grid-template-columns: minmax(330px,.95fr) 1.05fr; background: #eef4ef; }
.login-aside { color: #eaf3ed; background: #173d3c; padding: clamp(35px,7vw,90px); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-aside:after { content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%; right: -120px; bottom: -140px; border: 1px solid rgba(198,219,106,.22); box-shadow: 0 0 0 35px rgba(198,219,106,.035),0 0 0 75px rgba(198,219,106,.025),0 0 0 120px rgba(198,219,106,.018); }
.login-aside .brand { padding: 0; position: relative; z-index: 1; }
.login-message { position: relative; z-index: 1; max-width: 440px; }
.login-message .eyebrow { color: var(--lime); }
.login-message h1 { font-size: clamp(32px,4.4vw,54px); line-height: 1.07; letter-spacing: -2px; }
.login-message p { max-width: 355px; color: #b2c8c1; font-size: 14px; margin-top: 17px; }
.login-foot { color: #97b1ab; font: 10px var(--font-mono); position: relative; z-index: 1; }
.login-form-side { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(100%,400px); padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.login-card h2 { font: 800 24px var(--font-display); letter-spacing: -.8px; margin: 0 0 5px; }
.login-card > p { color: var(--muted); font-size: 12px; margin: 0 0 24px; }
.login-card .field { margin-bottom: 15px; }
.login-card .btn { width: 100%; margin-top: 8px; }
.login-security { text-align: center; color: var(--muted); font-size: 10px; margin-top: 17px; }
.login-security svg { width: 14px; height: 14px; vertical-align: middle; margin-right: 5px; }
.detail-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.detail-item { padding: 11px; background: #f4f8f5; border-radius: 8px; }
.detail-item label { display: block; color: var(--muted); font: 9px var(--font-mono); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 5px; }
.detail-item strong { font-size: 11px; overflow-wrap: anywhere; }
.loading-row { height: 44px; background: linear-gradient(90deg,#edf2ee,#f7faf7,#edf2ee); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *,*:before,*:after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
@media (max-width: 1050px) {
  .sidebar { width: 218px; }
  .main { margin-left: 218px; }
  .content { padding-left: 25px; padding-right: 25px; }
  .topbar { padding: 0 25px; }
  .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .sidebar { width: 270px; transform: translateX(-102%); transition: transform .24s ease; box-shadow: 16px 0 40px rgba(12,42,40,.16); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { display: none; position: fixed; inset: 0; background: rgba(13,38,37,.34); z-index: 19; }
  .sidebar-scrim.open { display: block; }
  .main { margin-left: 0; }
  .mobile-menu { display: block; }
  .topbar { padding: 0 16px; height: 58px; }
  .top-meta { gap: 8px; }
  .content { padding: 25px 16px 44px; }
  .page-head { align-items: flex-start; flex-direction: column; margin-bottom: 19px; }
  .head-actions { width: 100%; }
  .stat-grid { gap: 9px; }
  .stat-card { min-height: 102px; padding: 14px; }
  .stat-value { font-size: 24px; }
  .two-col,.split { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .detail-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .login-layout { grid-template-columns: 1fr; }
  .login-aside { min-height: 230px; padding: 25px; }
  .login-message { margin: 36px 0 12px; }
  .login-message h1 { font-size: 34px; }
  .login-foot { display: none; }
  .login-form-side { padding: 22px 16px 42px; }
  .rule-row { grid-template-columns: 1fr 1fr 32px; }
  .rule-row input { grid-column: 1/3; grid-row: 2; }
}
@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-label { font-size: 9px; }
  .toolbar { align-items: stretch; }
  .toolbar-group { width: 100%; }
  .compact-input { flex: 1; min-width: 0; }
}
