/* RL DNS Manager V2.1.1 — Mobile-First Stylesheet */
/* RogerLe Design System: Outfit + Inter, #e67e22 accent, dark/light */

:root {
    --acc: #e67e22;
    --acc-dark: #d35400;
    --acc-light: #f39c12;
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
    --navbar-h: 56px;
    --sidebar-w: 280px;
    --font-head: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="dark"] {
    --bg: #0f1117; --bg-card: #1a1c25; --bg-input: #242633;
    --bg-hover: #2a2d3a; --bg-sidebar: #151720;
    --tx: #e4e4e8; --tx-dim: #b0b2c5; --tx-icon: #c8c9d8; --tx-bright: #ffffff;
    --brd: #363850; --brd-focus: #e67e22;
    --shadow: 0 2px 12px rgba(0,0,0,0.4); --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --danger: #ef5350; --success: #4caf50; --warning: #ffb74d; --info: #42a5f5;
    --type-a: #64b5f6; --type-aaaa: #ce93d8; --type-cname: #4db6ac;
    --type-mx: #ffb74d; --type-txt: #b0bec5; --type-ns: #ef5350;
    --type-srv: #ffd54f; --type-caa: #66bb6a;
    --overlay: rgba(0,0,0,0.6);
    --badge-alpha: 0.2;
}

[data-theme="light"] {
    --bg: #f5f5f7; --bg-card: #ffffff; --bg-input: #f0f0f3;
    --bg-hover: #eaeaef; --bg-sidebar: #ffffff;
    --tx: #2c2c30; --tx-dim: #5a5a68; --tx-icon: #4a4a58; --tx-bright: #111115;
    --brd: #d0d0d8; --brd-focus: #e67e22;
    --shadow: 0 2px 12px rgba(0,0,0,0.08); --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --danger: #c62828; --success: #2e7d32; --warning: #e65100; --info: #1565c0;
    --type-a: #1565c0; --type-aaaa: #7b1fa2; --type-cname: #00796b;
    --type-mx: #e65100; --type-txt: #546e7a; --type-ns: #c62828;
    --type-srv: #ef6c00; --type-caa: #2e7d32;
    --overlay: rgba(0,0,0,0.35);
    --badge-alpha: 0.12;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); background: var(--bg); color: var(--tx); line-height: 1.6; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; color: var(--tx-bright); }
a { color: var(--acc); text-decoration: none; }
a:hover { color: var(--acc-light); }

/* === Login === */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.login-card { background: var(--bg-card); border: 1px solid var(--brd); border-radius: var(--radius-lg); padding: 2rem; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); animation: fadeIn 0.4s ease; }
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo i { font-size: 2.5rem; color: var(--acc); margin-bottom: 0.5rem; }
.login-logo h1 { font-size: 1.5rem; margin: 0.5rem 0 0.25rem; }
.login-sub { color: var(--tx-dim); font-size: 0.85rem; }
.login-footer { text-align: center; margin-top: 1.5rem; color: var(--tx-dim); font-size: 0.75rem; }

/* === Forms === */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--tx-dim); margin-bottom: 0.4rem; }
.form-group label i { width: 16px; margin-right: 4px; }
input[type="text"], input[type="password"], input[type="number"], input[type="email"], select, textarea {
    width: 100%; padding: 0.65rem 0.8rem; background: var(--bg-input); border: 1px solid var(--brd);
    border-radius: var(--radius); color: var(--tx); font-family: var(--font-body); font-size: 16px; /* prevents iOS zoom */
    transition: border-color var(--transition);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brd-focus); box-shadow: 0 0 0 3px rgba(230,126,34,0.15); }
.form-row { display: flex; gap: 0.75rem; }
.form-row .form-group { flex: 1; }

/* === Buttons === */
.btn {
    display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 1rem;
    border: 1px solid var(--brd); border-radius: var(--radius); background: var(--bg-card);
    color: var(--tx); font-family: var(--font-body); font-size: 0.85rem; font-weight: 500;
    cursor: pointer; transition: all var(--transition); text-decoration: none;
    min-height: 44px; /* touch target */
}
.btn:hover { background: var(--bg-hover); border-color: var(--tx-dim); }
.btn:active { transform: scale(0.97); }
.btn-primary, .btn-accent { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn-primary:hover, .btn-accent:hover { background: var(--acc-dark); border-color: var(--acc-dark); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #c0392b; }
.btn-icon { padding: 0.5rem 0.65rem; background: transparent; border: none; color: var(--tx-icon); min-height: 44px; min-width: 44px; justify-content: center; }
.btn-icon:hover { color: var(--acc); background: transparent; }

/* Navbar icons — visible buttons, not ghost icons */
.nav-actions .btn-icon {
    background: var(--bg-input); border: 1px solid var(--brd); border-radius: var(--radius);
    color: var(--tx); padding: 0.4rem 0.7rem; min-width: auto; gap: 0.35rem; font-size: 0.8rem;
}
.nav-actions .btn-icon:hover { background: var(--bg-hover); border-color: var(--acc); color: var(--acc); }
.nav-actions .btn-icon .nav-label { display: none; }
@media (min-width: 1100px) {
    .nav-actions .btn-icon .nav-label { display: inline; }
}
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; min-height: 36px; }
.btn-xs { padding: 0.3rem 0.5rem; font-size: 0.75rem; min-height: 32px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* === Alerts === */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.85rem; display: flex; align-items: center; gap: 0.5rem; }
.alert-error { background: rgba(231,76,60,0.12); color: var(--danger); border: 1px solid rgba(231,76,60,0.3); }
.alert-success { background: rgba(39,174,96,0.12); color: var(--success); border: 1px solid rgba(39,174,96,0.3); }
.alert-info { background: rgba(52,152,219,0.12); color: var(--info); border: 1px solid rgba(52,152,219,0.3); }

/* === Navbar === */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; height: var(--navbar-h);
    background: var(--bg-card); border-bottom: 1px solid var(--brd);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1rem; z-index: 100; box-shadow: var(--shadow);
}
.nav-left { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.nav-brand { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-head); font-weight: 600; font-size: 1.1rem; color: var(--tx-bright); }
.nav-brand i { color: var(--acc); font-size: 1.2rem; }
.nav-actions { display: flex; align-items: center; gap: 0.15rem; }
.nav-hamburger, .nav-zones-toggle {
    display: none; background: var(--bg-input); border: 1px solid var(--brd);
    color: var(--tx-icon); font-size: 1.1rem; cursor: pointer;
    border-radius: var(--radius); min-height: 40px; min-width: 40px;
    align-items: center; justify-content: center; padding: 0 0.5rem;
    transition: all var(--transition);
}
.nav-hamburger:hover, .nav-zones-toggle:hover { color: var(--acc); border-color: var(--acc); }
.nav-zones-toggle:active, .nav-hamburger:active { transform: scale(0.96); }

/* === Layout === */
.app-layout { display: flex; margin-top: var(--navbar-h); min-height: calc(100vh - var(--navbar-h)); }

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-w); background: var(--bg-sidebar); border-right: 1px solid var(--brd);
    display: flex; flex-direction: column; position: fixed;
    top: var(--navbar-h); bottom: 0; left: 0; z-index: 50;
}
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1rem 0.5rem; gap: 0.5rem; }
.sidebar-header h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--tx-dim); }
.sidebar-header-actions { display: flex; align-items: center; gap: 0.4rem; }
.sidebar-close {
    display: none; background: var(--bg-input); border: 1px solid var(--brd);
    color: var(--tx-icon); border-radius: var(--radius);
    width: 36px; height: 36px; align-items: center; justify-content: center;
    cursor: pointer; font-size: 0.9rem;
}
.sidebar-close:hover { color: var(--danger); border-color: var(--danger); }
.sidebar-search { padding: 0.5rem 0.75rem; }
.sidebar-search input { padding: 0.5rem 0.7rem; font-size: 0.85rem; }
.sidebar-list { flex: 1; overflow-y: auto; padding: 0.25rem 0.5rem; -webkit-overflow-scrolling: touch; }
.sidebar-footer { padding: 0.6rem 1rem; border-top: 1px solid var(--brd); font-size: 0.75rem; color: var(--tx-dim); text-align: center; }
.sidebar-backdrop { display: none; }

/* Zone list items */
.zone-item {
    display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.75rem;
    border-radius: var(--radius); cursor: pointer; font-size: 0.85rem;
    color: var(--tx); transition: all var(--transition); user-select: none;
    min-height: 44px; /* touch target */
}
.zone-item:hover { background: var(--bg-hover); }
.zone-item.active { background: rgba(230,126,34,0.12); color: var(--acc); font-weight: 500; }
.zone-item i { color: var(--tx-icon); font-size: 0.7rem; }
.zone-item.active i { color: var(--acc); }

/* === Main Content === */
.main-content { flex: 1; margin-left: var(--sidebar-w); padding: 1.25rem; min-width: 0; }

/* Welcome / Dashboard */
.welcome-screen { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; min-height: 60vh; color: var(--tx-dim); text-align: center; padding: 2rem; }
.dashboard-header { display: flex; flex-direction: column; align-items: center; margin-bottom: 1.5rem; }
.welcome-icon { color: var(--accent); margin-bottom: 0.75rem; }
.welcome-screen h2 { color: var(--tx); font-size: 1.4rem; margin-bottom: 0; }
.dashboard-stats { max-width: 480px; width: 100%; margin-bottom: 1.5rem; }
.dashboard-stats .stat-value { font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.dashboard-recent { width: 100%; max-width: 640px; text-align: left; }
.dashboard-recent h4 { font-size: 0.85rem; color: var(--tx-dim); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }
.dash-audit-row { display: flex; gap: 0.5rem; align-items: baseline; padding: 0.3rem 0; border-bottom: 1px solid var(--brd); font-size: 0.82rem; overflow: hidden; }
.dash-audit-row:last-child { border-bottom: none; }
.dash-audit-time { color: var(--tx-dim); white-space: nowrap; flex-shrink: 0; }
.dash-audit-domain { font-family: var(--font-mono); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* === Zone Editor === */
.zone-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: 0.75rem; }
.zone-title h2 { font-size: 1.3rem; }
.zone-serial { font-family: var(--font-mono); font-size: 0.78rem; color: var(--tx-dim); background: var(--bg-input); padding: 0.15rem 0.5rem; border-radius: 4px; margin-left: 0.5rem; }
.zone-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* Zone type badges */
.zone-type-badge { display: inline-block; font-size: 0.7rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.03em; margin-left: 0.5rem; vertical-align: middle; }
.badge-master { background: rgba(76,175,80,var(--badge-alpha)); color: var(--success); }
.badge-slave { background: rgba(66,165,245,var(--badge-alpha)); color: var(--info); }
.badge-native { background: rgba(176,178,197,var(--badge-alpha)); color: var(--tx-dim); }
.zone-type-icon { font-size: 0.65rem; margin-right: 0.35rem; }
.zone-type-master { color: var(--success); }
.zone-type-slave { color: var(--info); }
.zone-type-native { color: var(--tx-dim); }

/* SOA */
.zone-section { background: var(--bg-card); border: 1px solid var(--brd); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1.25rem; }
.zone-section h3 { font-size: 0.95rem; margin-bottom: 1rem; color: var(--tx-dim); }
.zone-section h3 i { color: var(--acc); margin-right: 0.4rem; }
.soa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; }
.soa-field { display: flex; flex-direction: column; gap: 0.2rem; }
.soa-field label { font-size: 0.75rem; color: var(--tx-dim); text-transform: uppercase; letter-spacing: 0.03em; }
.soa-field input { padding: 0.4rem 0.6rem; font-size: 0.85rem; font-family: var(--font-mono); }

/* Records */
.records-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; }
.records-header h3 { margin-bottom: 0; }
.records-filters { display: flex; align-items: center; gap: 0.5rem; }
.records-filters select { width: auto; padding: 0.4rem 0.6rem; font-size: 0.85rem; }
.records-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.records-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.records-table th { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 2px solid var(--brd); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--tx-dim); font-weight: 600; white-space: nowrap; }
.records-table td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--brd); vertical-align: middle; }
.records-table tr:hover td { background: var(--bg-hover); }
.records-table .col-name { min-width: 100px; }
.records-table .col-ttl { min-width: 60px; color: var(--tx-dim); }
.records-table .col-type { min-width: 55px; }
.records-table .col-value { min-width: 150px; word-break: break-all; max-width: 400px; }
.records-table .col-actions { white-space: nowrap; width: 100px; }

/* Record type badges */
.type-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.72rem; font-weight: 600; font-family: var(--font-mono); letter-spacing: 0.03em; }
.type-A { background: rgba(100,181,246,var(--badge-alpha)); color: var(--type-a); }
.type-AAAA { background: rgba(206,147,216,var(--badge-alpha)); color: var(--type-aaaa); }
.type-CNAME { background: rgba(77,182,172,var(--badge-alpha)); color: var(--type-cname); }
.type-MX { background: rgba(255,183,77,var(--badge-alpha)); color: var(--type-mx); }
.type-TXT { background: rgba(176,190,197,var(--badge-alpha)); color: var(--type-txt); }
.type-NS { background: rgba(239,83,80,var(--badge-alpha)); color: var(--type-ns); }
.type-SRV { background: rgba(255,213,79,var(--badge-alpha)); color: var(--type-srv); }
.type-CAA { background: rgba(102,187,106,var(--badge-alpha)); color: var(--type-caa); }

/* === Modal === */
.modal-overlay { display: none; position: fixed; inset: 0; background: var(--overlay); z-index: 200; align-items: center; justify-content: center; padding: 1rem; backdrop-filter: blur(4px); }
.modal-overlay.active { display: flex; }
.modal { background: var(--bg-card); border: 1px solid var(--brd); border-radius: var(--radius-lg); width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: slideUp 0.25s ease; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--brd); position: sticky; top: 0; background: var(--bg-card); z-index: 1; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.modal-header h3 { font-size: 1.05rem; }
.modal-body { padding: 1.25rem; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; padding: 0.75rem 1.25rem; border-top: 1px solid var(--brd); position: sticky; bottom: 0; background: var(--bg-card); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* === Toast === */
.toast-container { position: fixed; bottom: 1rem; right: 1rem; left: 1rem; z-index: 300; display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; pointer-events: none; }
.toast { padding: 0.75rem 1.25rem; border-radius: var(--radius); font-size: 0.85rem; display: flex; align-items: center; gap: 0.5rem; box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease; max-width: 380px; pointer-events: auto; }
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--info); color: #fff; }

/* === Utilities === */
.loading { display: flex; align-items: center; justify-content: center; padding: 2rem; color: var(--tx-dim); font-size: 0.9rem; gap: 0.5rem; }
.mono { font-family: var(--font-mono); font-size: 0.85em; }
.record-preview { background: var(--bg-input); border: 1px solid var(--brd); border-radius: 6px; padding: 0.75rem 1rem; margin-top: 0.75rem; font-size: 0.88rem; }
.raw-zone { background: var(--bg-input); border: 1px solid var(--brd); border-radius: 6px; padding: 1rem; font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.5; overflow-x: auto; white-space: pre; max-height: 400px; overflow-y: auto; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.stat-card { background: var(--bg-input); border: 1px solid var(--brd); border-radius: 8px; padding: 0.75rem; text-align: center; }
.stat-label { font-size: 0.72rem; color: var(--tx-dim); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.25rem; }
.stat-value { font-size: 1.1rem; font-weight: 600; font-family: var(--font-mono); color: var(--tx); }

/* Dig */
.dig-results { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.dig-card { background: var(--bg-input); border: 1px solid var(--brd); border-radius: 8px; padding: 0.75rem; }
.dig-server { font-size: 0.78rem; color: var(--tx-dim); margin-bottom: 0.5rem; font-weight: 600; }
.dig-answer { font-family: var(--font-mono); font-size: 0.82rem; white-space: pre-wrap; word-break: break-all; }
.dig-empty { color: var(--tx-dim); font-style: italic; }

/* Bulk */
.bulk-controls label { display: inline-flex; align-items: center; gap: 0.4rem; }
.bulk-check { width: 18px; height: 18px; accent-color: var(--acc); cursor: pointer; }

/* Audit */
.audit-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.audit-table th { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 2px solid var(--brd); font-size: 0.72rem; text-transform: uppercase; color: var(--tx-dim); }
.audit-table td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--brd); vertical-align: top; }
.audit-action { display: inline-block; padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.72rem; font-weight: 600; font-family: var(--font-mono); }

/* Import preview */
.import-preview { margin-top: 1rem; }
.import-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--brd); font-size: 0.82rem; }
.import-row:last-child { border-bottom: none; }
.import-row.import-error { background: rgba(231,76,60,0.08); color: var(--danger); }
.import-row .mono { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-count { font-size: 0.85rem; color: var(--tx-dim); margin-bottom: 0.5rem; }

/* === Animations === */
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ══════════════════════════════════════════
   RESPONSIVE — Tablet (768px)
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
    .navbar { padding: 0 0.6rem; }
    .nav-brand span { display: none; } /* icon only on mobile, saves space */
    .nav-actions { display: none; }
    .nav-actions.open {
        display: flex; position: fixed; top: var(--navbar-h); right: 0.5rem;
        background: var(--bg-card); border: 1px solid var(--brd); border-radius: var(--radius-lg);
        padding: 0.5rem; flex-direction: column; box-shadow: var(--shadow-lg); gap: 0;
        min-width: 220px; z-index: 60;
    }
    .nav-actions.open .btn-icon {
        justify-content: flex-start; padding: 0.6rem 0.75rem; width: 100%;
        border-radius: var(--radius); background: var(--bg-card); border-color: var(--brd);
    }
    .nav-actions.open .btn-icon .nav-label { display: inline; }
    .nav-actions.open .btn-icon:hover { background: var(--bg-hover); }
    .nav-hamburger, .nav-zones-toggle { display: flex; }
    .sidebar-close { display: flex; }

    .sidebar {
        transform: translateX(-100%); transition: transform 0.25s ease;
        width: min(var(--sidebar-w), 85vw);
        box-shadow: none;
    }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }

    .sidebar-backdrop { display: none; position: fixed; inset: 0; top: var(--navbar-h); background: var(--overlay); z-index: 40; }
    .sidebar-backdrop.active { display: block; }

    .main-content { margin-left: 0; padding: 1rem; }

    .zone-header { flex-direction: column; align-items: flex-start; }
    .zone-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
    .zone-title h2 { font-size: 1.1rem; word-break: break-all; }
    .zone-serial { margin-left: 0; }
    .zone-type-badge { margin-left: 0; }
    .zone-actions {
        width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap; padding-bottom: 0.35rem;
        scroll-snap-type: x proximity;
        mask-image: linear-gradient(to right, black 0, black calc(100% - 24px), transparent 100%);
        -webkit-mask-image: linear-gradient(to right, black 0, black calc(100% - 24px), transparent 100%);
    }
    .zone-actions .btn-sm { flex-shrink: 0; scroll-snap-align: start; }

    .records-header { flex-direction: column; align-items: stretch; }
    .records-filters { justify-content: space-between; }

    .soa-grid { grid-template-columns: 1fr 1fr; }
    .dig-results { grid-template-columns: 1fr; }

    .modal { max-width: 100%; margin: 0; border-radius: var(--radius-lg); }
}

/* ══════════════════════════════════════════
   RESPONSIVE — Mobile (480px)
   ══════════════════════════════════════════ */
@media (max-width: 480px) {
    :root { --navbar-h: 52px; }

    .login-card { padding: 1.5rem; }

    .soa-grid { grid-template-columns: 1fr; }
    .records-filters { flex-direction: column; align-items: stretch; }
    .records-filters select { width: 100%; }
    .form-row { flex-direction: column; gap: 0.5rem; }

    /* Card-based records on small screens */
    .records-table-wrap { overflow-x: visible; }
    .records-table, .records-table thead, .records-table tbody, .records-table th, .records-table tr, .records-table td {
        display: block;
    }
    .records-table thead { display: none; }
    .records-table tr {
        background: var(--bg-input); border: 1px solid var(--brd); border-radius: var(--radius);
        margin-bottom: 0.5rem; padding: 0.75rem; display: flex; flex-wrap: wrap;
        align-items: center; gap: 0.25rem 0.5rem;
    }
    .records-table tr:hover td { background: transparent; }
    .records-table td { padding: 0; border: none; }
    .records-table .col-name { font-weight: 600; order: 1; }
    .records-table .col-type { order: 2; }
    .records-table .col-ttl { order: 3; font-size: 0.75rem; }
    .records-table .col-value { order: 4; width: 100%; flex-basis: 100%; font-size: 0.8rem; margin-top: 0.25rem; word-break: break-all; max-width: none; }
    .records-table .col-actions { order: 5; width: 100%; flex-basis: 100%; display: flex; gap: 0.5rem; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--brd); }
    .records-table .col-actions .btn-xs { flex: 1; justify-content: center; min-height: 36px; }

    .zone-section { padding: 1rem; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    /* Full-screen modal on small phones */
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal { max-height: 95vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; animation: slideUpFull 0.3s ease; }

    .toast-container { left: 0.75rem; right: 0.75rem; bottom: 0.75rem; align-items: stretch; }
    .toast { max-width: none; }
}

@keyframes slideUpFull { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* === iOS install hint === */
.ios-install-hint {
    position: fixed; left: 0.75rem; right: 0.75rem; bottom: 0.75rem;
    background: var(--bg-card); border: 1px solid var(--acc);
    border-radius: var(--radius-lg); padding: 0.75rem 1rem;
    display: flex; align-items: center; gap: 0.75rem;
    box-shadow: var(--shadow-lg); z-index: 250;
    font-size: 0.85rem; color: var(--tx);
    animation: slideUp 0.3s ease;
}
.ios-install-hint i.fa-arrow-up-from-bracket { color: var(--acc); margin: 0 0.15rem; }
.ios-install-hint .ios-hint-close {
    background: transparent; border: none; color: var(--tx-dim);
    cursor: pointer; font-size: 1rem; padding: 0.3rem 0.5rem;
    min-height: 36px; min-width: 36px;
}
.ios-install-hint .ios-hint-close:hover { color: var(--danger); }
@supports (padding: env(safe-area-inset-bottom)) {
    .ios-install-hint { bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
}

/* === Safe area (iPhone notch) === */
@supports (padding: env(safe-area-inset-bottom)) {
    .modal-footer { padding-bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
    .toast-container { bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
    .sidebar { padding-bottom: env(safe-area-inset-bottom); }
}
