:root {
    color-scheme: light;
    --ink: #172332;
    --ink-soft: #526173;
    --muted: #748293;
    --line: #e3e9ee;
    --paper: #ffffff;
    --canvas: #f4f7f8;
    --navy: #122333;
    --navy-soft: #1d3448;
    --teal: #087f8c;
    --teal-deep: #066570;
    --mint: #dff4ef;
    --amber: #a66308;
    --red: #a73939;
    --shadow: 0 12px 30px rgba(23, 35, 50, .06);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 246px minmax(0, 1fr); }
.sidebar { background: var(--navy); color: #e7f0f5; display: flex; flex-direction: column; padding: 27px 18px; min-height: 100vh; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 32px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: linear-gradient(135deg, #21a7a3, #087f8c); font-weight: 800; letter-spacing: -.05em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: .02em; }
.brand small { margin-top: 2px; color: #a9bdc9; font-size: 12px; }
.nav { display: grid; gap: 7px; }
.nav-link { padding: 12px 14px; border-radius: 10px; color: #b9c8d2; font-weight: 600; transition: background .15s, color .15s; }
.nav-link:hover, .nav-link.active { color: #fff; background: var(--navy-soft); }
.nav-link.active { box-shadow: inset 3px 0 #44c6b2; }
.sidebar-foot { margin-top: auto; padding: 15px 12px 4px; border-top: 1px solid #ffffff1c; color: #a9bdc9; font-size: 12px; }
.online-dot { display: inline-block; width: 7px; height: 7px; border-radius: 100%; margin-right: 7px; background: #43c59e; box-shadow: 0 0 0 4px #43c59e24; }
.main { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 27px clamp(22px, 4vw, 56px); background: #fff; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 4px 0 0; font-size: 23px; letter-spacing: -.035em; }
.eyebrow { margin: 0; color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.content { width: min(1380px, 100%); padding: 32px clamp(20px, 4vw, 56px) 48px; margin: 0 auto; }
.footer { padding: 0 clamp(20px, 4vw, 56px) 24px; color: #97a3ae; font-size: 11px; }
.welcome-row, .page-intro, .section-heading, .campaign-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; }
.welcome-row { align-items: center; margin: 8px 0 28px; }
h2 { margin: 5px 0 7px; font-size: clamp(21px, 2.4vw, 28px); letter-spacing: -.04em; }
h3 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
p { line-height: 1.55; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 35px; }
.metric-card, .panel, .table-wrap, .recipient-card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.metric-card { display: flex; flex-direction: column; min-height: 137px; padding: 19px; }
.metric-label { color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.metric-value { margin: 12px 0 5px; font-size: 31px; line-height: 1; letter-spacing: -.05em; }
.metric-note { margin-top: auto; color: var(--muted); font-size: 11px; }
.section-heading { align-items: center; margin: 32px 0 14px; }
.section-heading h2 { font-size: 20px; margin-bottom: 0; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 39px; padding: 9px 14px; border: 1px solid #d3dce3; border-radius: 9px; color: var(--ink); background: #fff; font-size: 12px; font-weight: 750; transition: transform .12s, background .12s, border-color .12s; }
.button:hover { transform: translateY(-1px); border-color: #a9bbc8; }
.button-primary { color: #fff; background: var(--teal); border-color: var(--teal); }
.button-primary:hover { background: var(--teal-deep); border-color: var(--teal-deep); }
.button-quiet { color: var(--ink-soft); background: transparent; border-color: transparent; }
.button-small { min-height: 32px; padding: 6px 10px; font-size: 11px; }
.button-danger { color: #fff; background: #a63f45; border-color: #a63f45; }
.button-danger:hover { background: #873239; border-color: #873239; }
.button-danger:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 18px 0; padding: 18px; border: 1px solid #f0c8c8; border-radius: 12px; background: #fff8f7; }
.danger-zone h3 { margin: 3px 0 5px; color: #873239; font-size: 15px; }
.danger-zone p { margin: 0 0 5px; color: var(--ink-soft); font-size: 11px; }
.danger-zone small { color: var(--muted); font-size: 10px; }
.danger-form { display: grid; grid-template-columns: minmax(190px, 1fr) auto; align-items: end; gap: 8px; min-width: min(460px, 55%); }
.danger-form label { color: #873239; font-size: 10px; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.row-actions form { margin: 0; }
.button-wide { width: 100%; }
.button-whatsapp { color: #fff; background: #168b65; border-color: #168b65; }
.text-link { color: var(--teal); font-size: 12px; font-weight: 750; }
.text-link:hover { text-decoration: underline; }
.back-link { display: inline-block; margin-bottom: 17px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 12px 15px; color: #718090; background: #fbfcfd; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
td { padding: 14px 15px; border-top: 1px solid #edf1f4; color: var(--ink-soft); vertical-align: middle; font-size: 12px; }
td strong { color: var(--ink); font-size: 13px; }
.table-sub { display: block; margin-top: 4px; color: #8794a1; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 8px; background: #edf1f4; color: #5d6c78; font-size: 10px; font-weight: 750; white-space: nowrap; }
.badge-good { background: #e4f5ee; color: #16744e; }
.badge-bad { background: #fdeaea; color: #a73939; }
.status-stack { display: grid; gap: 5px; }
.status-stack span { display: flex; align-items: center; gap: 5px; white-space: nowrap; font-size: 10px; }
.empty-state { display: grid; justify-items: center; text-align: center; padding: 48px 22px; background: #fff; border: 1px dashed #cbd6de; border-radius: 14px; }
.empty-state h3 { margin: 10px 0 0; font-size: 16px; }
.empty-state p { max-width: 420px; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: var(--teal); background: var(--mint); font-size: 22px; }
.info-strip { display: flex; gap: 14px; align-items: center; margin-top: 28px; padding: 16px 18px; border: 1px solid #cbe8e2; border-radius: 12px; background: #f0faf7; color: #45625d; font-size: 12px; }
.info-strip strong { color: #1d655b; white-space: nowrap; }
.notice { padding: 12px 15px; margin-bottom: 16px; border: 1px solid transparent; border-radius: 10px; font-size: 12px; }
.notice-success { color: #176b48; background: #e9f7f0; border-color: #cdebdc; }
.notice-error { color: #8f3838; background: #fff0ef; border-color: #f2d5d3; }
.bulk-authorize-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.import-error-details { margin-top: 8px; }
.import-error-details summary { cursor: pointer; font-size: 11px; font-weight: 700; }
.import-errors { max-height: 420px; overflow: auto; margin: 8px 0 0; padding-left: 22px; }
.import-errors li { margin: 3px 0; }
.page-intro { align-items: center; margin: 7px 0 22px; }
.panel { padding: 20px; }
.import-panel { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 22px; }
.import-panel h3 { margin-bottom: 5px; }
.import-panel p { margin: 0; font-size: 12px; }
.upload-form { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
input[type="file"] { max-width: 280px; font-size: 11px; color: var(--ink-soft); }
input, select, textarea { width: 100%; padding: 10px 11px; border: 1px solid #d4dee5; border-radius: 8px; color: var(--ink); background: #fff; outline: none; font-size: 12px; }
input:focus, select:focus, textarea:focus { border-color: #44a7a5; box-shadow: 0 0 0 3px #1caaa01a; }
textarea { resize: vertical; line-height: 1.5; }
label { display: grid; gap: 7px; color: #374859; font-size: 12px; font-weight: 700; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 18px 0 12px; }
.search-form { display: flex; gap: 8px; width: min(680px, 100%); }
.search-form input { flex: 1; }
.bulk-permissions { display: grid; gap: 14px; margin: 18px 0; border-color: #cde5e1; }
.bulk-permission-heading h3 { margin: 3px 0 5px; font-size: 16px; }
.bulk-permission-heading p { margin: 0; font-size: 11px; }
.bulk-permission-form { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 14px; }
.bulk-scope-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; grid-column: 1 / -1; margin: 0; padding: 0; border: 0; }
.bulk-scope-group legend { flex: 0 0 100%; margin-bottom: 2px; color: #374859; font-size: 11px; font-weight: 700; }
.bulk-scope-choice { display: flex; flex-direction: row; justify-content: flex-start; align-items: center; width: fit-content; gap: 8px; margin: 0; font-size: 12px; font-weight: 600; }
.bulk-scope-choice input { display: block; flex: 0 0 16px; width: 16px; height: 16px; margin: 0; accent-color: var(--teal); }
.table-selection-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 14px 0 8px; }
.table-selection-tools > div { display: flex; flex-wrap: wrap; gap: 7px; }
.select-col { width: 42px; text-align: center; }
.select-col input { width: auto; margin: 0; accent-color: var(--teal); }
.bulk-channel-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; grid-column: 1 / -1; margin: 0; padding: 0; border: 0; }
.bulk-channel-group legend { flex: 0 0 100%; margin-bottom: 2px; color: #374859; font-size: 11px; font-weight: 700; }
.bulk-channel { display: flex; flex-direction: row; justify-content: flex-start; align-items: center; width: fit-content; gap: 8px; margin: 0; font-size: 12px; font-weight: 650; }
.bulk-channel input, .bulk-confirm input { display: block; flex: 0 0 16px; width: 16px; height: 16px; margin: 0; accent-color: var(--teal); }
.bulk-source { width: 100%; }
.bulk-confirm { display: flex; flex-direction: row; justify-content: flex-start; align-items: center; width: 100%; gap: 9px; margin: 0; }
.bulk-confirm span { font-size: 11px; font-weight: 500; line-height: 1.5; }
.bulk-permission-form button { justify-self: start; }
.contact-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding: 23px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.contact-heading h2 { margin-top: 6px; }
.contact-meta { display: grid; justify-items: end; gap: 6px; color: var(--ink-soft); font-size: 12px; }
.permission-grid, .message-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.permission-form { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; align-items: end; }
.compact-label { gap: 5px; color: var(--muted); font-size: 10px; }
.compact-label input, .compact-label select { padding: 8px; font-size: 11px; }
.form-stack { display: grid; gap: 16px; }
.form-panel { display: grid; gap: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.wide-field { grid-column: 1 / -1; }
.form-grid small { color: var(--muted); font-size: 11px; font-weight: 450; }
.recipient-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 340px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.recipient-option { display: flex; grid-template-columns: auto 1fr; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid #edf1f4; border-radius: 9px; cursor: pointer; }
.recipient-option:hover { border-color: #a8d3ce; background: #f8fcfb; }
.recipient-option input { width: auto; margin-top: 2px; accent-color: var(--teal); }
.recipient-option strong, .recipient-option small { display: block; }
.recipient-option small { margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 500; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.campaign-hero { align-items: center; margin-bottom: 20px; }
.campaign-hero h2 { margin: 5px 0 2px; }
.message-grid { margin-bottom: 28px; }
.message-preview { min-height: 90px; max-height: 260px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: #4d5e6d; background: #f7f9fa; border: 1px solid #edf1f4; border-radius: 9px; padding: 13px; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.recipient-list { display: grid; gap: 12px; }
.recipient-card { padding: 17px; }
.recipient-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.recipient-head h3 { font-size: 14px; }
.recipient-head p { margin: 3px 0 0; font-size: 11px; }
.recipient-address { display: grid; gap: 4px; text-align: right; color: var(--muted); font-size: 11px; }
.channel-tracking { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.channel-card { display: grid; align-content: start; gap: 9px; padding: 12px; border: 1px solid #edf1f4; border-radius: 10px; background: #fbfcfd; }
.channel-card .panel-heading { margin-bottom: 0; }
.status-form { display: flex; gap: 7px; }
.status-form select { min-width: 0; flex: 1; padding: 7px 8px; font-size: 10px; }
.error-text { margin: 0; color: var(--red); overflow-wrap: anywhere; }
.login-page { display: grid; min-height: 100vh; place-items: center; padding: 20px; background: radial-gradient(circle at 15% 15%, #d9f3ef, transparent 34%), var(--canvas); }
.login-card { width: min(420px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 22px 70px rgba(23, 35, 50, .12); }
.login-brand { padding: 0 0 24px; color: var(--ink); }
.login-brand small { color: var(--muted); }
.login-card h1 { margin: 6px 0; font-size: 23px; }
.login-card .muted { margin-bottom: 20px; }
.event-history { margin-top: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.event-history summary { color: var(--teal); cursor: pointer; font-size: 11px; font-weight: 750; }
.event-history ol { display: grid; gap: 7px; margin: 11px 0 0; padding: 0; list-style: none; }
.event-history li { display: flex; gap: 12px; color: var(--ink-soft); font-size: 10px; }
.event-history time { color: var(--muted); white-space: nowrap; }
@media (max-width: 1000px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .import-panel { align-items: flex-start; flex-direction: column; }
    .upload-form { justify-content: flex-start; }
}
@media (max-width: 720px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; min-height: 0; padding: 12px 15px; }
    .brand { padding: 0 3px 12px; }
    .brand-mark { width: 36px; height: 36px; }
    .nav { display: flex; overflow-x: auto; }
    .nav-link { white-space: nowrap; padding: 9px 11px; }
    .sidebar-foot { display: none; }
    .topbar { padding: 17px 18px; }
    .topbar h1 { font-size: 19px; }
    .content { padding: 22px 15px 35px; }
    .footer { padding: 0 15px 20px; }
    .welcome-row, .page-intro, .campaign-hero { align-items: flex-start; flex-direction: column; }
    .metric-grid { gap: 9px; }
    .metric-card { min-height: 120px; padding: 14px; }
    .metric-value { font-size: 26px; }
    .permission-grid, .message-grid, .form-grid, .recipient-picker, .channel-tracking { grid-template-columns: 1fr; }
    .permission-form { grid-template-columns: 1fr; }
    .contact-heading, .recipient-head, .danger-zone { align-items: stretch; flex-direction: column; }
    .danger-form { min-width: 0; grid-template-columns: 1fr; }
    .bulk-permission-form { grid-template-columns: minmax(0, 1fr); }
    .bulk-scope-group { align-items: flex-start; gap: 9px 16px; }
    .bulk-scope-choice { width: 100%; }
    .table-selection-tools { align-items: flex-start; flex-direction: column; }
    .contact-meta { justify-items: start; }
    .recipient-address { text-align: left; }
    .toolbar { align-items: flex-start; flex-direction: column; }
    .search-form { flex-wrap: wrap; }
    .search-form input { flex-basis: 100%; }
    .info-strip { align-items: flex-start; flex-direction: column; gap: 4px; }
}
