/* =====================================================
   FIRESAFE AUTOPILOT — Industrial Dark Theme
   ===================================================== */

:root {
    /* ── User palette ── */
    --bg:             #0f172a;
    --card:           #1e293b;
    --primary:        #ef4444;
    --text:           #f8fafc;
    --accent-green:   #10b981;

    /* ── Mapped to system vars ── */
    --bg-base:        var(--bg);
    --bg-surface:     #000;
    --bg-card:        var(--card);
    --bg-card-hover:  #263248;
    --bg-input:       var(--bg);

    --border:         #334155;
    --border-focus:   var(--primary);

    --text-primary:   var(--text);
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;

    --accent:         var(--primary);
    --accent-glow:    rgba(239, 68, 68, 0.25);
    --accent-dim:     rgba(239, 68, 68, 0.08);

    --orange:         var(--primary);
    --yellow:         #f5a623;
    --green:          var(--accent-green);
    --red:            var(--primary);
    --blue:           #3b82f6;

    --font-display:   'Bebas Neue', sans-serif;
    --font-mono:      'DM Mono', monospace;
    --font-body:      'DM Sans', sans-serif;

    --radius-sm:      4px;
    --radius-md:      8px;
    --radius-lg:      12px;

    --sidebar-w:      64px;
    --transition:     0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── LAYOUT ── */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-w);
    background: #000;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 32px;
}

.logo-icon {
    width: 38px; height: 38px;
    background: var(--accent);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    box-shadow: 0 0 20px var(--accent-glow);
}

.logo-icon svg { width: 20px; height: 20px; }

.logo-text {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--text-muted);
}

.nav-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border);
    width: 100%;
    display: flex;
    justify-content: center;
}

.nav-item {
    position: relative;
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition);
}

.nav-item:hover {
    background: var(--accent-dim);
    color: var(--accent);
}

.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
    box-shadow: inset 2px 0 0 var(--accent);
}

.nav-item svg { width: 18px; height: 18px; }

.nav-tooltip {
    position: absolute;
    left: calc(100% + 12px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 11px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-4px);
    transition: all var(--transition);
}

.nav-item:hover .nav-tooltip {
    opacity: 1;
    transform: translateX(0);
}

/* ── MAIN CONTENT ── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 28px 32px;
    max-width: calc(100vw - var(--sidebar-w));
    animation: fadeIn 0.4s ease;
}

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

/* ── HEADER ── */
header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.header-sub {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

header h1 {
    font-family: var(--font-display);
    font-size: 36px;
    letter-spacing: 1px;
    line-height: 1;
    color: var(--text-primary);
}

header h1 .accent { color: var(--accent); }

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    padding: 8px 16px;
    border-radius: 20px;
}

.dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    display: inline-block;
}

.dot.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0px rgba(16, 185, 129, 0.4); }
    100% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
}

.clock {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* ── STATS ROW ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition);
    animation: slideUp 0.4s ease both;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.10s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.20s; }

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

.stat-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255,255,255,0.08);
    transform: translateY(-1px);
}

.stat-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 18px; height: 18px; }

.stat-icon.orange { background: rgba(255, 77, 26, 0.12); color: var(--orange); }
.stat-icon.yellow { background: rgba(245, 166, 35, 0.12); color: var(--yellow); }
.stat-icon.green  { background: rgba(34, 197, 94, 0.12);  color: var(--green);  }
.stat-icon.red    { background: rgba(239, 68, 68, 0.12);  color: var(--red);    }

.stat-val {
    font-family: var(--font-display);
    font-size: 28px;
    line-height: 1;
    color: var(--text-primary);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── DASHBOARD GRID ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    grid-template-rows: auto auto;
    gap: 16px;
}

/* ── CARD ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    animation: slideUp 0.4s ease 0.2s both;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.card-header h3 svg { width: 15px; height: 15px; color: var(--accent); }

.badge {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    background: var(--accent-dim);
    border: 1px solid rgba(255, 77, 26, 0.2);
    color: var(--accent);
    letter-spacing: 0.5px;
}

.btn-clear {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px 8px;
    display: flex; align-items: center;
    transition: all var(--transition);
}

.btn-clear:hover { border-color: var(--red); color: var(--red); }
.btn-clear svg { width: 13px; height: 13px; }

/* ── FORM ── */
.registration-form { grid-row: 1 / 2; }

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
}

.input-group input,
.input-group select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13px;
    padding: 12px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
}

.input-group input::placeholder { color: var(--text-muted); }

.input-group input:focus,
.input-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a7f8e' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.input-prefix-wrap {
    display: flex;
    align-items: stretch;
}

.input-prefix {
    background: var(--border);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.input-prefix-wrap input {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn-submit {
    width: 100%;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-family: var(--font-display);
    font-size: 16px;
    letter-spacing: 2px;
    padding: 15px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    transition: all var(--transition);
    margin-top: 10px;
    font-weight: bold;
}

.btn-submit svg { width: 16px; height: 16px; }

.btn-submit:hover {
    background: #f87171;
    box-shadow: 0 6px 28px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-submit:active { transform: translateY(0); }

/* ── LOG LIST ── */
.automation-status { grid-row: 1 / 2; }

.log-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 4px;
}

.log-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 12px;
    line-height: 1.5;
    animation: logIn 0.3s ease;
    position: relative;
    overflow: hidden;
}

@keyframes logIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.log-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--accent-green);
    border-radius: 0 2px 2px 0;
}

.log-item.status-sent::before   { background: var(--accent-green); }
.log-item.status-pending::before { background: var(--yellow); }
.log-item.status-overdue::before { background: var(--primary); }
.log-item.status-new::before     { background: var(--blue); }

.log-item.empty {
    justify-content: center;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    border-style: dashed;
    background: transparent;
}

.log-item.empty::before { display: none; }
.log-item.empty svg { width: 28px; height: 28px; margin-bottom: 8px; opacity: 0.4; }

.log-body { flex: 1; }

.log-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.log-detail { color: var(--text-muted); }

.log-time {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    padding-top: 2px;
}

.log-icon { flex-shrink: 0; margin-top: 1px; }
.log-icon svg { width: 14px; height: 14px; }

.log-item.status-sent .log-icon    { color: var(--green); }
.log-item.status-pending .log-icon { color: var(--yellow); }
.log-item.status-overdue .log-icon { color: var(--red); }
.log-item.status-new .log-icon     { color: var(--blue); }

/* ── UNIT TABLE ── */
.unit-table-card {
    grid-column: 1 / -1;
    animation-delay: 0.3s;
}

.table-wrap { overflow-x: auto; }

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

.unit-table thead th {
    padding: 8px 14px;
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.unit-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background var(--transition);
}

.unit-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.unit-table td {
    padding: 12px 14px;
    color: var(--text-primary);
    vertical-align: middle;
}

.unit-table .empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 32px;
    font-style: italic;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 3px 10px;
    border-radius: 99px;
    text-transform: uppercase;
}

.status-chip.active   { background: rgba(34,197,94,0.12);  color: var(--green);  border: 1px solid rgba(34,197,94,0.25); }
.status-chip.pending  { background: rgba(245,166,35,0.12); color: var(--yellow); border: 1px solid rgba(245,166,35,0.25); }
.status-chip.overdue  { background: rgba(239,68,68,0.12);  color: var(--red);    border: 1px solid rgba(239,68,68,0.25); }

.status-chip .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.btn-action {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 11px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-body);
}

.btn-action:hover { border-color: var(--red); color: var(--red); }

.client-cell { font-weight: 500; }
.serial-cell { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); }

/* ── TOAST ── */
.toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    padding: 14px 20px;
    min-width: 280px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    transform: translateY(8px);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.toast-icon { flex-shrink: 0; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }

/* ── DATE INPUT FIX ── */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.5);
    cursor: pointer;
}

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .main-content { padding: 20px 16px; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    header { flex-direction: column; align-items: flex-start; gap: 12px; }
    header h1 { font-size: 28px; }
}

/* ══════════════════════════════════════════════════════
   MULTI-PAGE NAVIGATION
══════════════════════════════════════════════════════ */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

/* ── EXPORT BUTTON ── */
.btn-export {
    display: flex; align-items: center; gap: 6px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    padding: 8px 14px;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-export svg { width: 14px; height: 14px; }
.btn-export:hover { border-color: var(--green); color: var(--green); }
.btn-export.danger:hover { border-color: var(--red); color: var(--red); }

/* ── ICON BUTTON ── */
.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px 8px;
    display: flex; align-items: center;
    transition: all var(--transition);
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon svg { width: 13px; height: 13px; }

/* ── UNIT TABLE: expiry column ── */
.unit-table th, .unit-table td { padding: 11px 14px; }

/* ══════════════════════════════════════════════════════
   DATABASE PAGE
══════════════════════════════════════════════════════ */
.storage-card { margin-bottom: 16px; }

.storage-info {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
}
.storage-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.storage-sub   { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.storage-right span {
    font-family: var(--font-mono);
    font-size: 22px;
    color: var(--accent);
}

.storage-bar {
    background: var(--bg-input);
    border-radius: 99px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 16px;
}
.storage-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--yellow));
    border-radius: 99px;
    transition: width 0.8s ease;
}

.storage-keys { display: flex; gap: 24px; flex-wrap: wrap; }
.storage-key  { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.key-dot {
    width: 8px; height: 8px; border-radius: 50%;
    flex-shrink: 0;
}
.key-dot.orange { background: var(--orange); }
.key-dot.blue   { background: var(--blue); }
.key-dot.green  { background: var(--green); }
.key-size { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); margin-left: auto; }

.db-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 16px;
}

.json-viewer {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--green);
    line-height: 1.6;
    max-height: 420px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ══════════════════════════════════════════════════════
   HISTORY PAGE
══════════════════════════════════════════════════════ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 99px;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 12px;
    padding: 6px 14px;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.filter-btn:hover  { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.filter-search {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 6px 14px;
    margin-left: auto;
    transition: border-color var(--transition);
}
.filter-search:focus-within { border-color: var(--accent); }
.filter-search svg { width: 13px; height: 13px; color: var(--text-muted); flex-shrink: 0; }
.filter-search input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
    width: 160px;
    font-family: var(--font-body);
}
.filter-search input::placeholder { color: var(--text-muted); }

.history-card { animation: slideUp 0.3s ease; }

.history-table td { vertical-align: middle; }

/* Category chips */
.cat-chip {
    display: inline-flex; align-items: center;
    font-size: 10px; font-weight: 600;
    padding: 3px 10px; border-radius: 99px;
    white-space: nowrap;
}
.cat-register { background: rgba(59,130,246,0.12); color: var(--blue);   border: 1px solid rgba(59,130,246,0.25); }
.cat-delete   { background: rgba(239,68,68,0.12);  color: var(--red);    border: 1px solid rgba(239,68,68,0.25); }
.cat-whatsapp { background: rgba(34,197,94,0.12);  color: var(--green);  border: 1px solid rgba(34,197,94,0.25); }
.cat-status   { background: rgba(245,166,35,0.12); color: var(--yellow); border: 1px solid rgba(245,166,35,0.25); }
.cat-login    { background: rgba(139,92,246,0.12); color: #a78bfa;       border: 1px solid rgba(139,92,246,0.25); }
.cat-settings { background: rgba(107,114,128,0.12);color: #9ca3af;       border: 1px solid rgba(107,114,128,0.25); }
.cat-data     { background: rgba(245,166,35,0.12); color: var(--yellow); border: 1px solid rgba(245,166,35,0.25); }

/* ══════════════════════════════════════════════════════
   SETTINGS PAGE
══════════════════════════════════════════════════════ */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.setting-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.setting-row:last-of-type { border-bottom: none; }
.setting-label { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.setting-desc  { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border);
    border-radius: 99px;
    transition: .3s;
}
.slider::before {
    content: '';
    position: absolute;
    height: 16px; width: 16px;
    left: 3px; bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: .3s;
}
.toggle input:checked + .slider { background: var(--accent); }
.toggle input:checked + .slider::before { transform: translateX(18px); }

.danger-zone {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--radius-md);
    background: rgba(239,68,68,0.04);
}
.danger-title {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600;
    color: var(--red);
    margin-bottom: 12px;
}
.danger-title svg { width: 14px; height: 14px; }

.btn-danger {
    display: flex; align-items: center; gap: 6px;
    background: transparent;
    border: 1px solid var(--red);
    border-radius: var(--radius-sm);
    color: var(--red);
    font-size: 12px; font-weight: 600;
    padding: 8px 14px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-body);
}
.btn-danger:hover { background: rgba(239,68,68,0.1); }
.btn-danger svg { width: 13px; height: 13px; }

.info-rows { display: flex; flex-direction: column; gap: 0; }
.info-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}
.info-row:last-child { border-bottom: none; }
.info-row .mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-primary); }

/* ══════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(4px);
}
.modal-overlay.show { opacity: 1; pointer-events: all; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 380px;
    text-align: center;
    transform: scale(0.95);
    transition: transform 0.25s ease;
}
.modal-overlay.show .modal { transform: scale(1); }

.modal-icon {
    width: 48px; height: 48px;
    background: rgba(239,68,68,0.12);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    color: var(--red);
}
.modal-icon svg { width: 22px; height: 22px; }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.modal-body  { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; line-height: 1.6; }

.modal-actions { display: flex; gap: 10px; }
.btn-modal {
    flex: 1; padding: 11px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid var(--border);
}
.btn-modal.cancel  { background: transparent; color: var(--text-secondary); }
.btn-modal.cancel:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.btn-modal.confirm { background: var(--red); border-color: var(--red); color: white; }
.btn-modal.confirm:hover { background: #f87171; }

/* ── RESPONSIVE UPDATES ── */
@media (max-width: 1024px) {
    .db-grid        { grid-template-columns: 1fr; }
    .settings-grid  { grid-template-columns: 1fr; }
}
