/* ============================================================================
   WhatsAppSender - application stylesheet
   Self contained: no external fonts, icons or CSS frameworks are required, so
   the interface also works on a server without internet access.
   ========================================================================= */

:root {
    --ink: #0a1220;
    --ink-2: #111b2d;
    --ink-3: #1b2740;
    --brand: #25d366;
    --brand-600: #1eb457;
    --brand-dark: #128c7e;
    --bg: #f3f5f9;
    --card: #ffffff;
    --text: #17202e;
    --text-2: #435066;
    --muted: #6b7a90;
    --line: #e4e9f0;
    --line-2: #eef1f6;
    --green: #067647;
    --green-bg: #ecfdf3;
    --red: #b42318;
    --red-bg: #fef3f2;
    --amber: #b54708;
    --amber-bg: #fffaeb;
    --blue: #175cd3;
    --blue-bg: #eff8ff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow: 0 6px 24px rgba(16, 24, 40, .08);
    --sidebar: 264px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand-dark);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3, h4 {
    margin: 0;
    font-weight: 650;
    letter-spacing: -.01em;
}

p {
    margin: 0 0 10px;
}

code, .mono {
    font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
    font-size: 12.5px;
}

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.strong { font-weight: 650; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------------------
   Shell
   ------------------------------------------------------------------------- */

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

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar);
    background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
    color: #cfd8e6;
    display: flex;
    flex-direction: column;
    z-index: 40;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 20px 20px 16px;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.brand:hover { text-decoration: none; }

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: linear-gradient(150deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #04240f;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(37, 211, 102, .28);
    flex: 0 0 auto;
}

.brand-mark svg { display: block; }

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}

.brand-text strong {
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.brand-text em {
    font-style: normal;
    font-size: 11.5px;
    color: #8fa1bb;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.nav {
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.nav-group {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #6c7f9c;
    padding: 14px 10px 6px;
    font-weight: 650;
}

.nav-group:first-child { padding-top: 2px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    border-radius: 9px;
    color: #c3cee0;
    font-weight: 500;
    text-decoration: none;
    transition: background .12s ease, color .12s ease;
}

.nav-link svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
    opacity: .85;
    flex: 0 0 auto;
}

.nav-link:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
    text-decoration: none;
}

.nav-link.is-active {
    background: linear-gradient(90deg, rgba(37, 211, 102, .18), rgba(37, 211, 102, .06));
    color: #fff;
    box-shadow: inset 2px 0 0 var(--brand);
}

.nav-link.is-active svg { opacity: 1; color: var(--brand); }

.sidebar-foot {
    padding: 14px 18px 18px;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.worker-state {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: #93a4bd;
    line-height: 1.35;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: #64748b;
}

.dot-ok { background: var(--brand); box-shadow: 0 0 0 3px rgba(37, 211, 102, .16); }
.dot-warn { background: #f79009; box-shadow: 0 0 0 3px rgba(247, 144, 9, .16); }
.dot-busy { background: #53b1fd; box-shadow: 0 0 0 3px rgba(83, 177, 253, .16); animation: pulse 1.4s infinite; }
.dot-idle { background: #7a8699; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}

.main-col {
    margin-left: var(--sidebar);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 13px 26px;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.topbar-title { min-width: 0; flex: 1; }

.topbar-title h1 {
    font-size: 19px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-title p {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.content {
    padding: 24px 26px 8px;
    flex: 1;
    width: 100%;
    max-width: 1440px;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 26px 22px;
    color: var(--muted);
    font-size: 12px;
    max-width: 1440px;
    width: 100%;
}

.sidebar-toggle {
    display: none;
}

/* ---------------------------------------------------------------------------
   User menu
   ------------------------------------------------------------------------- */

.icon-btn {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 9px;
    padding: 6px;
    cursor: pointer;
    color: var(--text-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
}

.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.icon-btn:hover { background: var(--line-2); }

.user-menu { position: relative; }

.user-menu summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 9px 5px 5px;
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    background: #fff;
}

.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--line-2); }

.user-menu-name {
    font-weight: 600;
    font-size: 13px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu .chev { width: 16px; height: 16px; fill: var(--muted); }

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(150deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #04240f;
    font-weight: 700;
    font-size: 11.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: .02em;
    flex: 0 0 auto;
}

.user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 208px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 6px;
    z-index: 50;
}

.user-menu-panel a {
    display: block;
    padding: 8px 10px;
    border-radius: 7px;
    color: var(--text);
    font-size: 13px;
}

.user-menu-panel a:hover { background: var(--line-2); text-decoration: none; }

.user-menu-head {
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--line-2);
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
}

.user-menu-head span { font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------------------
   Cards and layout helpers
   ------------------------------------------------------------------------- */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
    overflow: hidden;
}

.card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
    background: #fcfdfe;
}

.card-head h2, .card-head h3 {
    font-size: 14.5px;
    font-weight: 650;
}

.card-head .card-sub {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 1px;
}

.card-head-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-foot {
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    background: #fcfdfe;
    display: flex;
    align-items: center;
    gap: 10px;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-end { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.spacer { flex: 1; }

/* ---------------------------------------------------------------------------
   Statistics
   ------------------------------------------------------------------------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 17px;
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 13px;
    align-items: flex-start;
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--line-2);
    color: var(--brand-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.stat-icon svg { width: 19px; height: 19px; fill: currentColor; }

/* Small colour marker used by the statistic tiles that are generated in code. */
.stat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 7px;
    flex: 0 0 auto;
    background: var(--line);
}

.stat-dot.is-green { background: var(--brand); }
.stat-dot.is-blue { background: #53b1fd; }
.stat-dot.is-amber { background: #f79009; }
.stat-dot.is-red { background: #f97066; }
.stat-icon.is-green { background: var(--green-bg); color: var(--green); }
.stat-icon.is-blue { background: var(--blue-bg); color: var(--blue); }
.stat-icon.is-amber { background: var(--amber-bg); color: var(--amber); }
.stat-icon.is-red { background: var(--red-bg); color: var(--red); }

.stat-body { min-width: 0; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; }
.stat-foot { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 15px;
    border-radius: 9px;
    border: 1px solid transparent;
    background: #fff;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.35;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; }
.btn svg { width: 15px; height: 15px; fill: currentColor; }

.btn-primary {
    background: linear-gradient(180deg, var(--brand) 0%, var(--brand-600) 100%);
    border-color: var(--brand-600);
    color: #04240f;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
}

.btn-primary:hover { background: var(--brand-600); color: #fff; }

.btn-dark {
    background: var(--ink-3);
    border-color: var(--ink-3);
    color: #fff;
}

.btn-dark:hover { background: var(--ink-2); color: #fff; }

.btn-outline {
    border-color: var(--line);
    color: var(--text-2);
    background: #fff;
}

.btn-outline:hover { background: var(--line-2); color: var(--text); }

.btn-danger {
    background: #fff;
    border-color: #f5c6c2;
    color: var(--red);
}

.btn-danger:hover { background: var(--red-bg); }

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-2);
    padding: 6px 9px;
}

.btn-ghost:hover { background: var(--line-2); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; }

/* ---------------------------------------------------------------------------
   Tables
   ------------------------------------------------------------------------- */

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

table.table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    font-weight: 700;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--line-2);
    vertical-align: middle;
}

table.table tbody tr:last-child td { border-bottom: none; }
table.table tbody tr:hover { background: #fbfcfe; }

table.table td.num, table.table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.table .actions { display: flex; gap: 6px; justify-content: flex-end; }

.cell-strong { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--muted); }

.avatar-sm {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--line-2);
    color: var(--text-2);
    font-weight: 700;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 9px;
    vertical-align: middle;
}

.person { display: flex; align-items: center; }

/* ---------------------------------------------------------------------------
   Badges and pills
   ------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 650;
    line-height: 1.6;
    letter-spacing: .01em;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-green { background: var(--green-bg); color: var(--green); border-color: #abefc6; }
.badge-blue { background: var(--blue-bg); color: var(--blue); border-color: #b2ddff; }
.badge-amber { background: var(--amber-bg); color: var(--amber); border-color: #fedf89; }
.badge-red { background: var(--red-bg); color: var(--red); border-color: #fecdca; }
.badge-grey { background: #f2f4f7; color: var(--text-2); border-color: var(--line); }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 650;
    padding: 3px 10px;
    border-radius: 999px;
}

.status-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.as-positive { color: var(--green); background: var(--green-bg); }
.as-negative { color: var(--red); background: var(--red-bg); }
.as-outline { color: var(--text-2); background: #f2f4f7; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f2f4f7;
    border: 1px solid var(--line);
    font-size: 12px;
    color: var(--text-2);
}

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------------------------------------------------------------------
   Forms
   ------------------------------------------------------------------------- */

.field { margin-bottom: 15px; }

.field > label, .label {
    display: block;
    font-size: 12.5px;
    font-weight: 650;
    color: var(--text-2);
    margin-bottom: 5px;
}

.label .req { color: var(--red); margin-left: 2px; }

.input, .select, .textarea, input[type=text], input[type=password], input[type=email],
input[type=number], input[type=date], input[type=time], input[type=file], select, textarea {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color .12s ease, box-shadow .12s ease;
    box-shadow: var(--shadow-sm);
}

textarea, .textarea {
    resize: vertical;
    min-height: 96px;
    line-height: 1.55;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-600);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, .16);
}

input[type=file] { padding: 7px 9px; background: #fbfcfe; }

input[type=checkbox], input[type=radio] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand-600);
    vertical-align: -2px;
    margin: 0 7px 0 0;
}

.hint {
    font-size: 12px;
    color: var(--muted);
    margin-top: 5px;
    line-height: 1.45;
}

.field-error {
    font-size: 12px;
    color: var(--red);
    margin-top: 5px;
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fcfdfe;
    margin-bottom: 8px;
    cursor: pointer;
}

.check-row:hover { background: #f8fafc; }

.check-row input { margin-top: 2px; }
.check-row .check-main { min-width: 0; }
.check-row .check-title { display: block; font-weight: 600; font-size: 13.5px; }
.check-row .check-sub { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
}

.form-grid .span-2 { grid-column: 1 / -1; }

.fieldset-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    font-weight: 700;
    margin: 4px 0 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--line-2);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
}

.char-counter {
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.char-counter.is-over { color: var(--red); font-weight: 650; }

/* ---------------------------------------------------------------------------
   Flash messages
   ------------------------------------------------------------------------- */

.flash {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: #fff;
    margin-bottom: 14px;
    font-size: 13.5px;
    box-shadow: var(--shadow-sm);
}

.flash-text { flex: 1; }

.flash-close {
    border: none;
    background: transparent;
    color: inherit;
    opacity: .5;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    padding: 0 2px;
}

.flash-close:hover { opacity: 1; }

.flash-success { background: var(--green-bg); border-color: #abefc6; color: #054f31; }
.flash-error { background: var(--red-bg); border-color: #fecdca; color: #7a271a; }
.flash-warning { background: var(--amber-bg); border-color: #fedf89; color: #7a2e0e; }
.flash-info { background: var(--blue-bg); border-color: #b2ddff; color: #194185; }

/* ---------------------------------------------------------------------------
   Empty state
   ------------------------------------------------------------------------- */

.empty {
    text-align: center;
    padding: 42px 20px;
    color: var(--muted);
}

.empty svg {
    width: 38px;
    height: 38px;
    fill: #c8d2e0;
    margin-bottom: 10px;
}

.empty strong {
    display: block;
    color: var(--text);
    font-size: 14.5px;
    margin-bottom: 4px;
}

.empty p { font-size: 13px; margin: 0 0 14px; }

/* ---------------------------------------------------------------------------
   Progress bars
   ------------------------------------------------------------------------- */

.progress {
    height: 7px;
    border-radius: 999px;
    background: #eef1f6;
    overflow: hidden;
    display: flex;
}

.progress span { display: block; height: 100%; }
.progress .bar-delivered { background: var(--brand); }
.progress .bar-sent { background: #7cd4a0; }
.progress .bar-failed { background: #f97066; }

.progress-legend {
    display: flex;
    gap: 14px;
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 7px;
    flex-wrap: wrap;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
    margin-right: 5px;
}

/* ---------------------------------------------------------------------------
   Pager
   ------------------------------------------------------------------------- */

.pager {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    background: #fcfdfe;
    flex-wrap: wrap;
}

.pager-info { font-size: 12.5px; color: var(--muted); }
.pager-info strong { color: var(--text); font-weight: 650; }

.pager-links {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pager-btn, .pager-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 9px;
    border-radius: 7px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 600;
}

.pager-btn:hover, .pager-num:hover { background: var(--line-2); text-decoration: none; }
.pager-num.is-active { background: var(--ink-3); border-color: var(--ink-3); color: #fff; }
.pager-btn.is-disabled { opacity: .45; }
.pager-gap { color: var(--muted); padding: 0 3px; }

/* ---------------------------------------------------------------------------
   WhatsApp message preview
   ------------------------------------------------------------------------- */

.wa-frame {
    background: #e9edde;
    background-image: radial-gradient(rgba(0, 0, 0, .035) 1px, transparent 1px);
    background-size: 16px 16px;
    border-radius: var(--radius);
    padding: 20px 18px;
    min-height: 150px;
}

.wa-bubble {
    position: relative;
    max-width: 340px;
    background: #dcf8c6;
    border-radius: 10px 10px 10px 2px;
    padding: 9px 11px 20px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
    font-size: 13.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #111b21;
}

.wa-time {
    position: absolute;
    right: 9px;
    bottom: 4px;
    font-size: 10.5px;
    color: #667781;
}

.wa-time svg { width: 14px; height: 12px; fill: #53bdeb; vertical-align: -1px; margin-left: 3px; }

.wa-empty { color: #7b8a6d; font-size: 13px; text-align: center; padding: 26px 0; }

.placeholder-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12.5px;
}

.placeholder-list li { display: flex; gap: 8px; align-items: baseline; }
.placeholder-list code {
    background: #f2f4f7;
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 1px 6px;
    color: var(--brand-dark);
    font-size: 11.5px;
    white-space: nowrap;
}
.placeholder-list span { color: var(--muted); }

/* ---------------------------------------------------------------------------
   List picker (multi select of contact lists)
   ------------------------------------------------------------------------- */

.picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 8px;
}

.picker-item {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    cursor: pointer;
    transition: border-color .12s ease, box-shadow .12s ease;
}

.picker-item:hover { border-color: #cbd5e1; }

.picker-item input { margin-top: 2px; }

.picker-item .name { font-weight: 600; font-size: 13.5px; }
.picker-item .meta { font-size: 11.5px; color: var(--muted); }

/* ---------------------------------------------------------------------------
   Definition lists / detail blocks
   ------------------------------------------------------------------------- */

.dl {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 9px 14px;
    font-size: 13.5px;
    margin: 0;
}

.dl dt { color: var(--muted); font-size: 12.5px; }
.dl dd { margin: 0; font-weight: 550; word-break: break-word; }

.kv-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 13.5px;
}

.kv-row:last-child { border-bottom: none; }
.kv-row .k { color: var(--muted); }
.kv-row .v { font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   Login screen
   ------------------------------------------------------------------------- */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(900px 500px at 10% -10%, rgba(37, 211, 102, .18), transparent 60%),
        radial-gradient(700px 500px at 100% 100%, rgba(18, 140, 126, .18), transparent 55%),
        var(--ink);
}

.login-card {
    width: 100%;
    max-width: 404px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
    padding: 30px 30px 26px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.login-brand .brand-mark { width: 44px; height: 44px; border-radius: 12px; }
.login-brand strong { display: block; font-size: 17px; }
.login-brand span { font-size: 12.5px; color: var(--muted); }

.login-card h2 { font-size: 20px; margin-bottom: 4px; }
.login-card .login-sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }

.login-foot {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line-2);
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

/* ---------------------------------------------------------------------------
   Misc
   ------------------------------------------------------------------------- */

.alert-inline {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    font-size: 13px;
    margin-bottom: 14px;
    background: #fcfdfe;
}

.alert-inline.is-warn { background: var(--amber-bg); border-color: #fedf89; color: #7a2e0e; }
.alert-inline.is-info { background: var(--blue-bg); border-color: #b2ddff; color: #194185; }

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.tab {
    padding: 8px 13px;
    border-radius: 8px 8px 0 0;
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
    border-bottom: 2px solid transparent;
}

.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--text); border-bottom-color: var(--brand); }

.filters {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filters .field { margin-bottom: 0; min-width: 150px; }
.filters .field.is-wide { min-width: 240px; }

.tiny { font-size: 11.5px; }
.truncate { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

pre.log {
    background: var(--ink);
    color: #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 11.5px;
    line-height: 1.6;
    overflow-x: auto;
    max-height: 220px;
    margin: 0;
}

/* ---------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------- */

@media (max-width: 1180px) {
    .split { grid-template-columns: minmax(0, 1fr); }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .18s ease;
        box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
    }

    .sidebar.is-open { transform: translateX(0); }

    .main-col { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; }
    .content { padding: 16px 14px 8px; }
    .topbar { padding: 11px 14px; }
    .footer { padding: 12px 14px 18px; flex-direction: column; gap: 4px; }
    .form-grid, .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .user-menu-name { display: none; }
    .dl { grid-template-columns: 120px minmax(0, 1fr); }
}

@media (max-width: 560px) {
    .stat-grid { grid-template-columns: minmax(0, 1fr); }
    .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .topbar-title h1 { font-size: 16px; }
    .card-body { padding: 14px; }
}

@media print {
    .sidebar, .topbar-actions, .footer, .pager, .btn { display: none !important; }
    .main-col { margin-left: 0; }
    .card { box-shadow: none; border-color: #ccc; }
}
