/* ── METRICS ────────────────────────────── */
        .metrics {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            border: 1px solid var(--border);
            border-radius: 8px;
            overflow: hidden;
            margin-bottom: 20px;
        }

        .metric {
            padding: 18px 20px;
            background: var(--surface);
            border-right: 1px solid var(--border);
        }

        .metric:last-child {
            border-right: none
        }

        .metric-val {
            font-family: 'Geist Mono', monospace;
            font-size: 1.4286rem;
            font-weight: 500;
            color: var(--text);
            letter-spacing: -.02em;
        }

        .metric-lbl {
            font-size: 0.7857rem;
            color: var(--text2);
            margin-top: 3px
        }

        /* ── PAGE HEADER ────────────────────────── */
        .page-title {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--text);
            margin-bottom: 6px;
            letter-spacing: -0.02em;
        }

        .page-desc {
            font-size: 0.9286rem;
            color: var(--text2);
            line-height: 1.5;
        }

        /* ── BLOCK ──────────────────────────────── */
        .block {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 12px;
            margin-bottom: 24px;
            overflow: hidden;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

        .block:hover {
            box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
        }

        .block-head {
            padding: 11px 18px;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: var(--surface);
        }

        .block-title {
            font-size: 0.7857rem;
            font-weight: 500;
            color: var(--text2);
            letter-spacing: .07em;
            text-transform: uppercase;
        }

        .block-body {
            padding: 18px;
            background: var(--surface2);
        }

        /* ── FORM ───────────────────────────────── */
        .field {
            margin-bottom: 14px
        }

        .field:last-child {
            margin-bottom: 0
        }

        .field-label {
            display: block;
            font-size: 0.7857rem;
            color: var(--text2);
            margin-bottom: 6px;
            letter-spacing: .04em;
        }

        input[type=text],
        input[type=password],
        input[type=tel],
        input[type=datetime-local],
        input[type=number],
        select,
        textarea {
            width: 100%;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 2rem;
            color: var(--text);
            font-family: 'Geist', sans-serif;
            font-size: 0.9286rem;
            padding: 10px 18px;
            outline: none;
            transition: all 0.2s ease;
            -webkit-appearance: none;
            appearance: none;
        }

        textarea {
            border-radius: 1.25rem;
            padding: 14px 18px;
        }

        input:focus,
        select:focus,
        textarea:focus {
            border-color: var(--border2)
        }

        input::placeholder,
        textarea::placeholder {
            color: var(--text3);
            font-size: 0.9286rem;
        }

        textarea {
            resize: vertical;
            min-height: 90px;
            line-height: 1.6
        }

        select {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 10px center;
            padding-right: 30px
        }

        select option {
            background: var(--surface)
        }

        .mono {
            font-family: 'Geist Mono', monospace;
            font-size: 0.8571rem
        }

        .hindi {
            font-size: 1.0714rem;
            line-height: 1.75
        }

        .hint {
            font-size: 0.7857rem;
            color: var(--text3);
            margin-top: 5px
        }

        .flex-between {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 6px
        }

        /* ── LANG PILLS ─────────────────────────── */
        .lang-pills {
            display: inline-flex;
            border: 1px solid var(--border);
            border-radius: 2rem;
            overflow: hidden;
            background: var(--surface);
        }

        .lang-pill {
            padding: 4px 14px;
            font-size: 0.7857rem;
            cursor: pointer;
            color: var(--text2);
            background: transparent;
            border: none;
            font-family: 'Geist', sans-serif;
            transition: all .15s;
        }

        .lang-pill+.lang-pill {
            border-left: 1px solid var(--border)
        }

        .lang-pill.active {
            background: var(--surface2);
            color: var(--text)
        }

        /* ── COST STRIP ─────────────────────────── */
        .cost-strip {
            display: flex;
            flex-wrap: wrap;
            gap: 12px 20px;
            padding: 10px 18px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 1.25rem;
            margin-top: 12px;
        }

        .ci {
            font-size: 0.7857rem;
            color: var(--text2)
        }

        .ci strong {
            color: var(--text);
            font-weight: 500;
            font-family: 'Geist Mono', monospace
        }

        /* ── ROW ITEMS ──────────────────────────── */
        .row-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 12px 0;
            border-bottom: 1px solid var(--border);
            gap: 16px;
        }

        .row-item:last-child {
            border-bottom: none;
            padding-bottom: 0
        }

        .row-item:first-child {
            padding-top: 0
        }

        .row-label {
            font-size: 0.9286rem;
            color: var(--text)
        }

        .row-sub {
            font-size: 0.7857rem;
            color: var(--text2);
            margin-top: 2px
        }

        .row-right {
            flex-shrink: 0
        }

        /* ── TOGGLE ─────────────────────────────── */
        .toggle {
            position: relative;
            width: 36px;
            height: 20px;
            flex-shrink: 0
        }

        .toggle input {
            opacity: 0;
            width: 0;
            height: 0;
            position: absolute
        }

        .tog-track {
            position: absolute;
            inset: 0;
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 20px;
            cursor: pointer
        }

        .tog-thumb {
            position: absolute;
            width: 12px;
            height: 12px;
            background: var(--text3);
            border-radius: 50%;
            top: 3px;
            left: 3px;
            transition: transform .2s, background .2s;
            pointer-events: none
        }

        .toggle input:checked~.tog-track {
            border-color: var(--border2)
        }

        .toggle input:checked~.tog-track .tog-thumb {
            transform: translateX(16px);
            background: var(--text)
        }

        /* ── BUTTON (PREMIUM) ─────────────────────────── */
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            padding: 11px 24px;
            background: var(--text);
            color: var(--bg);
            border: none;
            border-radius: 2rem;
            font-size: 0.9286rem;
            font-weight: 600;
            cursor: pointer;
            width: 100%;
            transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
            user-select: none;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
            font-family: 'Geist', sans-serif;
            letter-spacing: .01em;
            min-height: 44px;
        }

        .btn:hover:not(:disabled) {
            transform: translateY(-2px) scale(1.02);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
            filter: brightness(1.1);
        }

        .btn:active:not(:disabled) {
            transform: translateY(0) scale(0.98);
        }

        .btn:disabled {
            opacity: 0.3;
            cursor: not-allowed;
        }

        .btn-secondary {
            background: var(--surface2);
            color: var(--text);
            border: 1px solid var(--border);
            backdrop-filter: none;
            box-shadow: none;
        }

        .btn-secondary:hover:not(:disabled) {
            background: var(--border);
            border-color: var(--text2);
            transform: translateY(-1px);
        }

        .btn-danger {
            background: rgba(239, 68, 68, 0.1);
            color: #ef4444;
            border: 1px solid rgba(239, 68, 68, 0.2);
            box-shadow: none;
        }

        .btn-danger:hover:not(:disabled) {
            background: #ef4444;
            color: #fff;
            transform: translateY(-1px);
        }

        .btn-sm {
            padding: 7px 16px;
            font-size: 0.8rem;
            width: auto;
            min-height: 36px; /* Still touch-accessible but visibly smaller than main btn */
        }

        /* ── MODAL GLASSMORPHISM ────────────────── */
        .modal-content {
            background: var(--surface) !important;
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
            border: 1px solid var(--border);
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
        }

        /* ── PROGRESS ───────────────────────────── */
        .prog-wrap {
            margin-top: 14px;
            display: none
        }

        .prog-wrap.show {
            display: block
        }

        .prog-track {
            height: 1px;
            background: var(--surface2);
            margin-bottom: 8px;
            overflow: hidden
        }

        .prog-fill {
            height: 100%;
            background: var(--text);
            width: 0%;
            transition: width .3s ease
        }

        .prog-lbl {
            font-size: 0.7857rem;
            color: var(--text2);
            font-family: 'Geist Mono', monospace
        }

        /* ── LOG ─────────────────────────────────── */
        .log {
            margin-top: 12px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 12px 14px;
            max-height: 150px;
            overflow-y: auto;
            display: none;
            -webkit-overflow-scrolling: touch;
        }

        .log.show {
            display: block
        }

        .log-line {
            font-size: 0.7857rem;
            padding: 2px 0;
            color: var(--text2);
            font-family: 'Geist Mono', monospace;
            border-bottom: 1px solid var(--border);
        }

        .log-line:last-child {
            border-bottom: none
        }

        .log-line.ok {
            color: var(--success)
        }

        .log-line.err {
            color: var(--error)
        }

        /* ── BADGE ──────────────────────────────── */
        .badge {
            font-size: 0.7143rem;
            padding: 2px 8px;
            border-radius: 4px;
            font-weight: 500;
            font-family: 'Geist Mono', monospace;
            background: rgba(62, 207, 142, .08);
            color: var(--success);
            border: 1px solid rgba(62, 207, 142, .15);
            white-space: nowrap;
        }

        /* ── HISTORY ─────────────────────────────── */
        .hist-row {
            padding: 14px 18px;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 14px;
        }

        .hist-row:last-child {
            border-bottom: none
        }

        .hist-msg {
            font-size: 0.9286rem;
            color: var(--text);
            margin-bottom: 3px;
            line-height: 1.5
        }

        .hist-meta {
            font-size: 0.7857rem;
            color: var(--text2);
            font-family: 'Geist Mono', monospace
        }

        .empty {
            padding: 40px 20px;
            text-align: center;
            color: var(--text3);
            font-size: 0.9286rem
        }

        /* ── TABS (content sections) ────────────── */
        .tab-section {
            display: none !important;
            flex: 1;
            overflow-y: auto;
            padding: 40px 48px 80px;
            -webkit-overflow-scrolling: touch;
        }

        @media (max-width: 599px) {
            .tab-section {
                padding: 20px 20px 100px;
            }
        }

        .tab-section.active {
            display: block !important;
        }

        /* ── CONTACTS TABLE ─────────────────────── */
        .table-wrap {
            overflow-x: auto;
            overflow-y: auto;
            max-height: calc(100vh - 240px);
            border: 1px solid var(--border);
            border-radius: 8px;
            background: var(--surface);
            -webkit-overflow-scrolling: touch;
        }

        .table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.9286rem;
            text-align: left;
        }

        .table th, .table td {
            padding: 12px 16px;
            border-bottom: 1px solid var(--border);
            white-space: nowrap;
        }

        .table th {
            position: sticky;
            top: 0;
            z-index: 10;
            font-weight: 500;
            color: var(--text2);
            background: var(--surface2);
            text-transform: uppercase;
            font-size: 0.7857rem;
            letter-spacing: .05em;
        }

        .table tr:last-child td {
            border-bottom: none;
        }

        .table tr:hover td {
            background: var(--surface2);
        }

        .checkbox {
            width: 16px;
            height: 16px;
            accent-color: var(--text);
            cursor: pointer;
        }

        .controls-row {
            display: flex;
            gap: 10px;
            margin-bottom: 14px;
            flex-wrap: wrap;
        }

        .controls-row > * {
            flex: 1;
            min-width: 150px;
        }


        .search-wrap {
            position: relative;
            margin-bottom: 16px;
        }

        .search-input {
            width: 100%;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 2rem;
            padding: 12px 20px 12px 48px;
            color: var(--text);
            font-size: 0.9286rem;
            outline: none;
            transition: all 0.2s ease;
        }

        .search-input:focus {
            border-color: var(--text2);
            background: var(--surface2);
            box-shadow: 0 0 20px rgba(255, 255, 255, 0.05);
        }

        .search-icon {
            position: absolute;
            left: 18px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text3);
            pointer-events: none;
            opacity: 0.7;
        }

        .file-drop {
            display: block;
            border: 1px dashed var(--border2);
            border-radius: 1.25rem;
            padding: 30px 20px;
            text-align: center;
            background: var(--surface);
            transition: border-color 0.2s;
            cursor: pointer;
        }

        .file-drop:hover, .file-drop.dragover {
            border-color: var(--text3);
        }

        .file-drop input {
            display: none;
        }

        .file-drop p {
            color: var(--text2);
            font-size: 0.9286rem;
            margin-bottom: 4px;
        }

        /* ── RESPONSIVE OVERRIDES ───────────────── */
        @media(max-width: 599px) {
            input[type=text], input[type=password], select, textarea {
                font-size: 1.1429rem !important;
            }
            .btn {
                min-height: 44px;
            }
            .metric-val {
                font-size: 1.1rem !important;
            }
            .metric {
                padding: 10px 5px !important;
            }
            .block-body {
                padding: 12px !important;
            }
            .block-head {
                padding: 10px 12px !important;
            }
            .controls-row {
                flex-direction: column;
                align-items: stretch;
            }
            .controls-row > * {
                width: 100%;
            }
            #fab-settings {
                bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + 10px) !important;
            }
            #theme-pop {
                bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + 60px) !important;
            }
            .block-head {
                flex-direction: column !important;
                align-items: flex-start !important;
                gap: 12px !important;
                padding: 14px !important;
            }
            .block-head > * {
                width: 100% !important;
                margin: 0 !important;
            }
            .lang-pills {
                display: flex !important;
                width: 100% !important;
            }
            .lang-pill {
                flex: 1 !important;
                text-align: center !important;
            }
            .metrics {
                display: flex !important;
                flex-direction: column !important;
                border: none !important;
                gap: 10px !important;
                grid-template-columns: none !important;
            }
            .metric {
                width: 100% !important;
                padding: 14px 18px !important;
                border: 1px solid var(--border) !important;
                border-radius: 8px !important;
                border-right: 1px solid var(--border) !important;
                background: var(--surface) !important;
            }
            .metric:last-child {
                border-right: 1px solid var(--border) !important;
            }
            .form-row {
                flex-direction: column !important;
                gap: 12px !important;
            }
            .form-row > * {
                width: 100% !important;
            }
            .header-actions {
                display: flex !important;
                flex-wrap: wrap !important;
                gap: 8px !important;
                width: 100% !important;
            }
            .header-actions .btn {
                flex: 1 !important;
                white-space: nowrap !important;
                justify-content: center !important;
            }
            .table-wrap {
                margin: 0 -14px !important;
                padding: 0 14px !important;
                width: calc(100% + 28px) !important;
                overflow-x: auto !important;
                -webkit-overflow-scrolling: touch !important;
            }
            #contacts-table th, #contacts-table td {
                min-width: 100px !important;
                white-space: nowrap !important;
            }
            #contacts-table td:nth-child(2) { /* Phone column */
                min-width: 140px !important;
            }
        }

        /* ── HISTORY REDESIGN ───────────────────── */
        .hist-date-group {
            margin-bottom: 24px;
        }

        .hist-date-label {
            font-size: 0.7857rem;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: var(--text3);
            margin-bottom: 12px;
            padding-left: 4px;
        }

        .hist-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 16px;
            margin-bottom: 12px;
            transition: transform .2s, border-color .2s, box-shadow .2s;
            cursor: default;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }

        .hist-card:hover {
            border-color: var(--border2);
            transform: translateY(-2px);
            box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
        }

        .hist-card-hd {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 12px;
        }

        .hist-card-time {
            font-size: 0.8571rem;
            color: var(--text2);
        }

        .hist-card-op {
            font-size: 0.7857rem;
            color: var(--text3);
        }

        .hist-card-msg {
            font-size: 1rem;
            color: var(--text);
            line-height: 1.5;
            margin-bottom: 16px;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .status-rail {
            height: 4px;
            background: var(--surface2);
            border-radius: 2px;
            overflow: hidden;
            margin-bottom: 16px;
            display: flex;
        }

        .status-bar-ok {
            height: 100%;
            background: #10b981; /* Success Green */
        }

        .status-bar-err {
            height: 100%;
            background: #ef4444; /* Error Red */
        }

        .hist-card-stats {
            display: flex;
            gap: 16px;
            align-items: center;
        }

        .hist-stat-item {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 0.8571rem;
            color: var(--text2);
        }

        .hist-stat-val {
            font-weight: 500;
            color: var(--text);
            font-family: 'Geist Mono', monospace;
        }

        .hist-card-actions {
            margin-top: 16px;
            padding-top: 16px;
            border-top: 1px solid var(--border);
            display: flex;
            justify-content: flex-end;
        }

        /* ── MODAL ──────────────────────────────── */
        .modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.8);
            backdrop-filter: blur(4px);
            z-index: 2000;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .modal {
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 16px;
            width: 100%;
            max-width: 500px;
            max-height: 90vh;
            display: flex;
            flex-direction: column;
            box-shadow: 0 20px 50px rgba(0,0,0,0.5);
            animation: modalUp 0.3s ease-out;
        }

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

        .modal-hd {
            padding: 20px;
            border-bottom: 1px solid var(--border);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .modal-title {
            font-size: 1.1429rem;
            font-weight: 500;
            color: var(--text);
        }

        .modal-close {
            background: none;
            border: none;
            color: var(--text3);
            cursor: pointer;
            padding: 5px;
        }

        .modal-close:hover {
            color: var(--text);
        }

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

        .modal-ft {
            padding: 16px 20px;
            border-top: 1px solid var(--border);
            display: flex;
            gap: 12px;
            justify-content: flex-end;
            background: var(--surface2);
            border-bottom-left-radius: 2rem;
            border-bottom-right-radius: 2rem;
        }

        .empty {
            text-align: center;
            padding: 40px 20px;
            color: var(--text3);
            font-size: 0.9286rem;
            display: flex;
            flex-direction: column;
            gap: 12px;
            align-items: center;
        }

        .detail-item {
            margin-bottom: 20px;
        }

        .detail-label {
            font-size: 0.7143rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text3);
            margin-bottom: 6px;
        }

        .detail-val {
            font-size: 1rem;
            color: var(--text);
            line-height: 1.5;
        }

        .recipient-list {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 12px;
            max-height: 200px;
            overflow-y: auto;
            font-family: 'Geist Mono', monospace;
            font-size: 0.9286rem;
            line-height: 1.6;
            color: var(--text2);
        }

/* ── TOAST ──────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9286rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: auto;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    border-left: 4px solid var(--error);
}

.toast.success {
    border-left: 4px solid var(--success);
}

/* EOF */

@media (min-width: 769px) and (max-width: 1024px) {
    .nav-section-label,
    .sidebar-footer .status-row,
    .sidebar-footer button span {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .bn-item span {
        display: none !important;
    }
}

