:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #eef1f4;
    --ink: #17202a;
    --muted: #66717f;
    --border: #d8dde3;
    --accent: #246bfe;
    --accent-2: #0d8b62;
    --danger: #b42318;
    --warning: #a15c00;
    --radius: 6px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
    --sidebar: #111820;
}

* {
    box-sizing: border-box;
}

html {
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.45;
}

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

a:hover {
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 10px;
    color: var(--ink);
    background: #fff;
}

textarea {
    resize: vertical;
}

label {
    display: grid;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #3e4854;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

th,
td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

th {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0;
    background: #fafbfc;
}

pre,
code {
    font-family: Consolas, Monaco, monospace;
}

.app-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar);
    color: #fff;
    padding: 18px 14px;
}

.brand,
.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 800;
    font-size: 18px;
}

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

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: #f5c542;
    color: #111820;
    font-weight: 900;
}

.nav-list {
    display: grid;
    gap: 4px;
    margin-top: 28px;
}

.nav-list a {
    color: #dce3ea;
    padding: 9px 10px;
    border-radius: var(--radius);
}

.nav-list a:hover {
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

.main-panel {
    min-width: 0;
}

.topbar {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 22px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.topbar div {
    display: grid;
    gap: 1px;
}

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

.content {
    display: grid;
    gap: 18px;
    padding: 22px;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.page-heading h1,
.panel h2 {
    margin: 0;
}

.page-heading h1 {
    font-size: 24px;
    line-height: 1.2;
}

.page-heading p,
.panel > p {
    margin: 4px 0 0;
    color: var(--muted);
}

.panel,
.metric,
.phone-panel,
.login-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel {
    overflow-x: auto;
    padding: 16px;
}

.panel.narrow,
.narrow {
    max-width: 760px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(120px, 1fr));
    gap: 10px;
}

.metric {
    padding: 14px;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.metric strong {
    display: block;
    margin-top: 6px;
    font-size: 26px;
}

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

.toolbar,
.button-row,
.form-grid {
    display: flex;
    gap: 10px;
    align-items: center;
}

.toolbar input {
    max-width: 360px;
}

.toolbar select {
    max-width: 200px;
}

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

.stack {
    display: grid;
    gap: 12px;
}

.compact {
    gap: 8px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 14px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

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

.button.secondary {
    color: var(--ink);
    background: #fff;
    border-color: var(--border);
}

.button.success {
    background: var(--accent-2);
    border-color: var(--accent-2);
}

.button.danger {
    background: var(--danger);
    border-color: var(--danger);
}

.button.full {
    width: 100%;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    color: #344054;
    font-size: 12px;
    font-weight: 700;
}

.alert {
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid;
}

.alert.error {
    color: #7a271a;
    border-color: #f4b5ad;
    background: #fff2f0;
}

.alert.success {
    color: #05603a;
    border-color: #a6f4c5;
    background: #ecfdf3;
}

.guest {
    display: grid;
    place-items: center;
    min-height: 100vh;
    background: var(--sidebar);
}

.guest-shell {
    width: min(420px, calc(100vw - 32px));
}

.login-panel {
    padding: 24px;
}

.login-brand {
    color: var(--ink);
    margin-bottom: 20px;
}

.login-brand h1 {
    margin: 0;
}

.timeline {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.timeline article {
    border-left: 3px solid var(--border);
    padding-left: 10px;
}

.timeline time {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.timeline p {
    margin: 4px 0 0;
}

.dialer-layout {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 18px;
}

.phone-panel {
    padding: 16px;
    display: grid;
    gap: 14px;
}

.dialer-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    background: #fafbfc;
}

.dialer-status span {
    color: var(--muted);
    font-weight: 700;
}

.number-field input {
    font-size: 20px;
    min-height: 48px;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.keypad button {
    min-height: 52px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
}

.keypad button:hover {
    background: var(--surface-2);
}

.event-log {
    display: grid;
    gap: 8px;
    max-height: 460px;
    overflow: auto;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
}

.event-log p {
    margin: 0;
    padding: 8px;
    background: #fafbfc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.script-box {
    white-space: pre-wrap;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fafbfc;
}

.setting-list {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 8px 12px;
    margin: 0 0 18px;
}

.setting-list dt {
    color: var(--muted);
    font-weight: 700;
}

.form-result {
    margin: 0;
    min-height: 20px;
    color: var(--muted);
}

.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--surface-2);
    font-size: 12px;
    font-weight: 600;
}

/* ─── Conversation Layout ─── */
.conversation-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    min-height: calc(100vh - 160px);
}

.conversation-sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: #fafbfc;
}

.conversation-header {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.conversation-search {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid var(--border);
    background: none;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    transition: background 0.15s;
}

.conversation-item:hover,
.conversation-item.active {
    background: var(--surface-2);
}

.conversation-item:hover {
    text-decoration: none;
}

.conversation-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 700;
}

.conversation-info {
    min-width: 0;
}

.conversation-info strong {
    display: block;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-preview {
    display: block;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.conversation-meta {
    text-align: right;
    display: grid;
    gap: 3px;
}

.conversation-meta time {
    font-size: 11px;
    color: var(--muted);
}

.conversation-count {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 999px;
    font-weight: 700;
    justify-self: end;
}

.conversation-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.conversation-empty {
    display: grid;
    place-items: center;
    align-content: center;
    flex: 1;
    color: var(--muted);
    gap: 4px;
}

.conversation-empty-icon {
    font-size: 48px;
    opacity: 0.3;
}

.conversation-empty h3 {
    margin: 0;
    color: var(--ink);
}

.conversation-topbar {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ─── Message Thread ─── */
.message-thread {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-bubble {
    max-width: 75%;
    display: grid;
    gap: 3px;
}

.message-bubble.inbound {
    align-self: flex-start;
}

.message-bubble.outbound {
    align-self: flex-end;
    text-align: right;
}

.message-bubble .bubble-body {
    padding: 9px 13px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-bubble.inbound .bubble-body {
    background: var(--surface-2);
    border-bottom-left-radius: 4px;
}

.message-bubble.outbound .bubble-body {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message-bubble .bubble-meta {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
    padding: 0 4px;
}

.message-bubble.outbound .bubble-meta {
    justify-content: flex-end;
}

.bubble-status {
    text-transform: uppercase;
    font-weight: 600;
}

/* ─── Composer ─── */
.conversation-composer {
    border-top: 1px solid var(--border);
    padding: 10px 14px;
    background: #fafbfc;
}

.composer-form {
    display: grid;
    gap: 6px;
}

.composer-input-wrapper {
    display: grid;
    gap: 6px;
}

.composer-input-wrapper textarea {
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 14px;
    resize: none;
    min-height: 42px;
    max-height: 120px;
}

.composer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.char-counter {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    min-width: 60px;
}

.media-input {
    flex: 1;
    font-size: 12px;
    padding: 5px 8px;
    min-height: 30px;
}

.new-convo-btn { margin-top: 8px; }

/* ─── Dialer Status Colors ─── */
.dialer-status[data-call-state="idle"] .status-indicator { background: var(--accent-2); }
.dialer-status[data-call-state="connecting"] .status-indicator { background: var(--warning); }
.dialer-status[data-call-state="dialing"] .status-indicator { background: var(--warning); animation: pulse 1s infinite; }
.dialer-status[data-call-state="ringing"] .status-indicator { background: var(--warning); animation: pulse 0.6s infinite; }
.dialer-status[data-call-state="active"] .status-indicator,
.dialer-status[data-call-state="connected"] .status-indicator { background: var(--accent-2); }
.dialer-status[data-call-state="held"] .status-indicator { background: var(--warning); }
.dialer-status[data-call-state="failed"] .status-indicator,
.dialer-status[data-call-state="ended"] .status-indicator { background: var(--danger); }

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

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

.status-info {
    display: grid;
    gap: 1px;
}

.status-info strong {
    text-transform: capitalize;
}

.status-info span {
    font-size: 13px;
    font-family: monospace;
    color: var(--muted);
}

.contact-hint {
    display: block;
    font-size: 12px;
    color: var(--accent-2);
    margin-top: 2px;
    font-weight: 600;
}

/* ─── Status Badge Colors ─── */
.status-answered { background: #d1fae5; color: #065f46; }
.status-missed  { background: #fee2e2; color: #991b1b; }
.status-failed  { background: #fee2e2; color: #991b1b; }
.status-sent    { background: #dbeafe; color: #1e40af; }
.status-delivered { background: #d1fae5; color: #065f46; }
.status-received { background: #ede9fe; color: #5b21b6; }

/* ─── Status colors ─── */
.status-ok { background: #d1fae5; color: #065f46; }
.status-fail { background: #fee2e2; color: #991b1b; }
.status-info { background: #dbeafe; color: #1e40af; }
.status-new { background: #ede9fe; color: #5b21b6; }

/* ─── Toast notifications ─── */
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    font-size: 13px;
    animation: slideIn 0.25s ease-out;
    transition: opacity 0.3s, transform 0.3s;
}

.toast-icon {
    width: 22px; height: 22px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 11px; font-weight: 800;
    flex-shrink: 0;
}

.toast-success .toast-icon { background: var(--accent-2); color: #fff; }
.toast-error .toast-icon { background: var(--danger); color: #fff; }
.toast-info .toast-icon { background: var(--accent); color: #fff; }

.toast strong { display: block; font-size: 12px; line-height: 1.2; margin-bottom: 1px; }
.toast p { margin: 0; font-size: 11px; color: var(--muted); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ─── Keyboard shortcut hints ─── */
[data-shortcut]::after {
    content: attr(data-shortcut);
    margin-left: auto;
    font-size: 10px;
    color: var(--muted);
    font-weight: 600;
    opacity: 0.6;
}

/* ─── Message empty hint ─── */
.message-empty-hint {
    text-align: center;
    color: var(--muted);
    padding: 40px 20px;
    font-size: 13px;
}

@media (max-width: 1100px) {
    .metric-grid {
        grid-template-columns: repeat(3, minmax(120px, 1fr));
    }

    .split-grid,
    .dialer-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .nav-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: 14px;
    }

    .topbar,
    .page-heading,
    .toolbar,
    .button-row {
        align-items: stretch;
        flex-direction: column;
    }

    .content {
        padding: 14px;
    }

    .metric-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .conversation-layout {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .conversation-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 280px;
    }

    .dialer-layout {
        grid-template-columns: 1fr;
    }
}

/* ─── Monospace Utilities ─── */
.mono {
    font-family: Consolas, "SF Mono", Monaco, "Cascadia Code", "Fira Code", monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

/* ─── Traffic Light Status System ─── */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-green,
.status-dot.status-green,
.status-available,
.status-dot.status-available,
.status-ok,
.status-dot.status-ok,
.status-success,
.status-dot.status-success,
.status-connected,
.status-dot.status-connected {
    background: #16a34a;
    color: #16a34a;
}

.status-yellow,
.status-dot.status-yellow,
.status-warn,
.status-dot.status-warn,
.status-warning,
.status-dot.status-warning,
.status-paused,
.status-dot.status-paused,
.status-pending,
.status-dot.status-pending,
.status-hold,
.status-dot.status-hold,
.status-waiting,
.status-dot.status-waiting {
    background: #ca8a04;
    color: #ca8a04;
}

.status-red,
.status-dot.status-red,
.status-danger,
.status-dot.status-danger,
.status-error,
.status-dot.status-error,
.status-failed,
.status-dot.status-failed,
.status-busy,
.status-dot.status-busy,
.status-disconnected,
.status-dot.status-disconnected {
    background: #dc2626;
    color: #dc2626;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 20px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.status-badge.status-green,
.status-badge.status-available,
.status-badge.status-ok,
.status-badge.status-success,
.status-badge.status-connected,
.status-badge.status-answered,
.status-badge.status-delivered {
    background: #dcfce7;
    color: #166534;
}

.status-badge.status-yellow,
.status-badge.status-warn,
.status-badge.status-warning,
.status-badge.status-paused,
.status-badge.status-pending,
.status-badge.status-hold,
.status-badge.status-waiting,
.status-badge.status-retry {
    background: #fef9c3;
    color: #854d0e;
}

.status-badge.status-red,
.status-badge.status-danger,
.status-badge.status-error,
.status-badge.status-failed,
.status-badge.status-busy,
.status-badge.status-disconnected,
.status-badge.status-missed {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.status-blue,
.status-badge.status-info,
.status-badge.status-sent,
.status-badge.status-new,
.status-badge.status-queued {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.status-gray,
.status-badge.status-muted,
.status-badge.status-idle,
.status-badge.status-ended {
    background: #f3f4f6;
    color: #374151;
}

/* ─── Dense Tables ─── */
.table-dense th,
.table-dense td {
    padding: 6px 10px;
    font-size: 13px;
}

.table-hover tbody tr:hover {
    background: #f8fafc;
}

.table-striped tbody tr:nth-child(even) {
    background: #fafbfc;
}

/* ─── Drawer / Slide-over ─── */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(520px, 90vw);
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    z-index: 50;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease-out;
}

.drawer.open {
    transform: translateX(0);
}

.drawer-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.drawer-header h2 {
    margin: 0;
    font-size: 16px;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.drawer-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--muted);
    padding: 4px;
    line-height: 1;
}

.drawer-close:hover {
    color: var(--ink);
}

/* ─── Form States ─── */
input.is-error,
select.is-error,
textarea.is-error {
    border-color: var(--danger);
    background: #fff2f0;
}

input.is-success,
select.is-success,
textarea.is-success {
    border-color: var(--accent-2);
    background: #ecfdf3;
}

.field-hint {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

.field-error {
    font-size: 11px;
    color: var(--danger);
    margin-top: 2px;
    font-weight: 600;
}

/* ─── Inline Audio Player ─── */
.audio-player {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fafbfc;
}

.audio-player audio {
    width: 220px;
    height: 28px;
}

/* ─── Campaign Status ─── */
.campaign-status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    background: var(--surface-2);
    font-size: 13px;
}

/* ─── Pagination ─── */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 0;
    font-size: 13px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    padding: 4px 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: #fff;
    color: var(--ink);
}

.pagination a:hover {
    background: var(--surface-2);
    text-decoration: none;
}

.pagination .current {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 700;
}

/* ─── Accessibility: Focus/Hover ─── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.conversation-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button:active,
.button:active {
    transform: translateY(1px);
}

/* ─── Small Button ─── */
.button.small {
    min-height: 28px;
    padding: 4px 10px;
    font-size: 12px;
}

/* ─── Contact Checkbox List ─── */
.contact-checkbox-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.contact-checkbox-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 13px;
    font-weight: 400;
}

.contact-checkbox-list label:last-child {
    border-bottom: none;
}

.contact-checkbox-list label:hover {
    background: #f8fafc;
}

.contact-checkbox-list input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* ─── Bulk recipients textarea ─── */
.bulk-recipients {
    font-family: Consolas, "SF Mono", Monaco, monospace;
    font-size: 13px;
    line-height: 1.5;
}

/* ─── Timeline improvements ─── */
.timeline-item {
    display: grid;
    gap: 2px;
    padding-left: 12px;
    border-left: 3px solid var(--border);
}

.timeline-item.is-call {
    border-left-color: var(--accent);
}

.timeline-item.is-message {
    border-left-color: var(--accent-2);
}

.timeline-item.is-note {
    border-left-color: var(--warning);
}

/* ─── Topbar improvements ─── */
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.global-search {
    position: relative;
}

.global-search input {
    width: 280px;
    padding-left: 32px;
    background: var(--bg);
    border-color: var(--border);
}

.global-search::before {
    content: "🔍";
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    opacity: 0.5;
}

/* ─── Sidebar nav active state ─── */
.nav-list a.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-weight: 700;
}

/* ─── Section headings ─── */
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.section-heading h2 {
    margin: 0;
    font-size: 16px;
}

/* ─── Empty state ─── */
.empty-state {
    display: grid;
    place-items: center;
    gap: 8px;
    padding: 48px 24px;
    color: var(--muted);
    text-align: center;
}

.empty-state-icon {
    font-size: 40px;
    opacity: 0.35;
}

.empty-state h3 {
    margin: 0;
    color: var(--ink);
    font-size: 15px;
}

/* ─── Detail grid inside drawer ─── */
.detail-grid {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px 16px;
    font-size: 13px;
}

.detail-grid dt {
    color: var(--muted);
    font-weight: 700;
}

.detail-grid dd {
    margin: 0;
}

/* ─── Scrollbar styling ─── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c1c8d1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ba3ad;
}

/* ─── Utility helpers ─── */
.gap-2 { gap: 2px; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }

.w-full { width: 100%; }
.max-w-md { max-width: 448px; }
.max-w-lg { max-width: 512px; }
.max-w-xl { max-width: 576px; }

.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }

.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.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;
}
