/* ============================================================
   ANPR CLOUD v3 — Modern Kurumsal Tema
   Light-first + Dark mode • Top nav + Bottom tabs
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

/* ============ DESIGN TOKENS ============ */
:root {
    /* Light (default) */
    --bg:            #f6f7f9;
    --bg-2:          #eceef2;
    --surface:       #ffffff;
    --surface-2:     #f9fafb;
    --surface-hover: #f3f4f6;
    --border:        #e5e7eb;
    --border-strong: #d1d5db;

    --text:       #0f172a;
    --text-soft:  #475569;
    --text-muted: #94a3b8;

    --primary:      #2563eb;
    --primary-hover:#1d4ed8;
    --primary-soft: #eff6ff;
    --primary-ring: rgba(37, 99, 235, .25);
    --on-primary:   #ffffff;

    --success:      #059669;
    --success-soft: #ecfdf5;
    --danger:       #dc2626;
    --danger-soft:  #fef2f2;
    --warning:      #d97706;
    --warning-soft: #fffbeb;
    --info:         #0891b2;
    --info-soft:    #ecfeff;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow:    0 4px 12px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, .18), 0 4px 10px rgba(15, 23, 42, .06);

    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --topbar-h: 60px;
    --tabbar-h: 64px;
    --container-max: 1360px;

    --font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

    --ease: cubic-bezier(.4, 0, .2, 1);
    --t:    .18s var(--ease);

    --sat: env(safe-area-inset-top,    0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left,   0px);
    --sar: env(safe-area-inset-right,  0px);
}

[data-theme="dark"] {
    --bg:            #0a0a0b;
    --bg-2:          #111113;
    --surface:       #17181c;
    --surface-2:     #1c1d22;
    --surface-hover: #22232a;
    --border:        #26272e;
    --border-strong: #35363f;

    --text:       #f3f4f6;
    --text-soft:  #a1a1aa;
    --text-muted: #6b7280;

    --primary:      #3b82f6;
    --primary-hover:#60a5fa;
    --primary-soft: rgba(59, 130, 246, .12);
    --primary-ring: rgba(59, 130, 246, .35);

    --success:      #10b981;
    --success-soft: rgba(16, 185, 129, .12);
    --danger:       #ef4444;
    --danger-soft:  rgba(239, 68, 68, .12);
    --warning:      #f59e0b;
    --warning-soft: rgba(245, 158, 11, .12);
    --info:         #06b6d4;
    --info-soft:    rgba(6, 182, 212, .12);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, .4);
    --shadow:    0 6px 24px rgba(0, 0, 0, .45);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
}

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    text-rendering: optimizeLegibility;
}
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color .2s ease, color .2s ease;
}

img, svg, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
[hidden] { display: none !important; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Theme icon swap */
.icon-light, .icon-dark { display: none; }
[data-theme="light"] .icon-dark { display: block; }
[data-theme="dark"]  .icon-light { display: block; }

/* ============ AUTH (LOGIN) ============ */
/* ============================================================
   AUTH SCREEN - Modern split layout
   ============================================================ */
.auth-screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    background: var(--bg);
    overflow: hidden;
}

/* Sol panel - brand showcase (desktop) */
.auth-left {
    flex: 1;
    display: none;
    position: relative;
    background:
        radial-gradient(1200px 700px at 80% 10%, rgba(255,255,255,0.15), transparent 55%),
        radial-gradient(900px 500px at 10% 90%, rgba(255,255,255,0.1), transparent 60%),
        linear-gradient(135deg, var(--primary) 0%, #1e40af 60%, #172554 100%);
    color: #fff;
    padding: 48px;
    overflow: hidden;
}
.auth-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    mask-image: radial-gradient(ellipse at top right, #000 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at top right, #000 30%, transparent 70%);
}
.auth-hero {
    position: relative;
    max-width: 440px;
    margin: auto 0;
}
.auth-hero-logo {
    width: 56px; height: 56px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 32px;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
}
.auth-hero-logo svg { width: 56px; height: 56px; }
.auth-left h2 {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.1;
    margin: 0 0 12px;
}
.auth-tagline {
    font-size: 18px;
    color: rgba(255,255,255,0.82);
    margin: 0 0 40px;
    line-height: 1.5;
}
.auth-features {
    list-style: none;
    padding: 0;
    margin: 0 0 64px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.auth-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: rgba(255,255,255,0.92);
}
.af-dot {
    display: inline-flex;
    width: 24px; height: 24px;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.18);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.auth-hero-foot {
    position: absolute;
    bottom: 0;
    font-size: 13px;
    color: rgba(255,255,255,0.55);
}

/* Sağ panel - form */
.auth-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    padding-top:    calc(32px + var(--sat));
    padding-bottom: calc(32px + var(--sab));
    overflow-y: auto;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
}

/* Auth panelleri (login / forgot / reset) aynı kartta geçiş yapar */
.auth-pane {
    animation: authFadeIn 0.25s ease-out;
}
@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-brand-sm {
    margin-bottom: 16px;
}
.auth-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0 0 6px;
    color: var(--text);
}
.auth-sub {
    font-size: 14px;
    color: var(--text-soft);
    margin: 0 0 26px;
}

.auth-back {
    background: none;
    border: none;
    color: var(--text-soft);
    font-size: 13px;
    padding: 0;
    margin-bottom: 18px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: color var(--t);
}
.auth-back:hover { color: var(--primary); }

.auth-submit {
    margin-top: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.auth-submit svg { transition: transform var(--t); }
.auth-submit:hover svg { transform: translateX(3px); }

/* Şifre alanı altındaki satır: Beni hatırla (sol) + Şifremi unuttum (sağ) */
.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.auth-row .checkbox-row { margin-top: 0; }

.auth-link-sm {
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}
.auth-link-sm:hover { text-decoration: underline; }

@media (max-width: 380px) {
    .auth-row { flex-direction: column; align-items: flex-start; gap: 10px; }
}

.auth-foot {
    margin-top: 24px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}
.auth-foot a { color: var(--primary); text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

/* Input with icon */
.input-wrap {
    position: relative;
}
.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
.input-with-icon {
    padding-left: 44px !important;
}
.input-with-action {
    padding-right: 44px !important;
}
.input-action {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    color: var(--text-muted);
    transition: all var(--t);
    padding: 0;
}
.input-action:hover {
    background: var(--bg-soft);
    color: var(--text);
}

/* Checkbox row (Beni hatırla) */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    margin-top: 6px;
    font-size: 13px;
}
.checkbox-row input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.checkbox-visual {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    transition: all var(--t);
    flex-shrink: 0;
    position: relative;
}
.checkbox-row input[type="checkbox"]:checked + .checkbox-visual {
    background: var(--primary);
    border-color: var(--primary);
}
.checkbox-row input[type="checkbox"]:checked + .checkbox-visual::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.checkbox-row:hover .checkbox-visual {
    border-color: var(--primary);
}
.checkbox-label {
    color: var(--text-soft);
}

/* Şifre güç göstergesi */
.pw-strength {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.pw-strength-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-soft);
    border-radius: 3px;
    overflow: hidden;
}
.pw-strength-fill {
    height: 100%;
    width: 0%;
    background: var(--danger);
    transition: all 0.25s ease;
    border-radius: 3px;
}
.pw-strength-fill.ps-weak   { width: 25%; background: var(--danger); }
.pw-strength-fill.ps-fair   { width: 50%; background: var(--warning); }
.pw-strength-fill.ps-good   { width: 75%; background: #10b981; }
.pw-strength-fill.ps-strong { width: 100%; background: var(--success); }
.pw-strength-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 60px;
    text-align: right;
}

/* Desktop: split göster */
@media (min-width: 900px) {
    .auth-left {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .auth-right {
        flex: 0 0 50%;
        max-width: 600px;
    }
}

/* Mobile: sadece form */
@media (max-width: 899px) {
    .auth-screen {
        background:
            radial-gradient(1000px 600px at 20% 0%, var(--primary-soft), transparent 60%),
            var(--bg);
    }
    .auth-card {
        padding: 32px 24px;
        box-shadow: none;
        border: none;
        background: transparent;
    }
    .auth-title { font-size: 24px; }
}

@media (max-width: 480px) {
    .auth-right { padding: 16px; }
    .auth-card { padding: 24px 12px; }
}

/* ============ TOPBAR ============ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 80;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding-top: var(--sat);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
}
.topbar-row {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 32px; height: 32px; flex-shrink: 0; }
.brand-text { min-width: 0; }
.brand-name {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -.2px;
    line-height: 1.15;
    white-space: nowrap;
}
.brand-sub {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: .2px;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    margin-left: 20px;
    overflow-x: auto;
    scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    transition: all var(--t);
    cursor: pointer;
    user-select: none;
}
.topnav-item:hover { color: var(--text); background: var(--surface-hover); }
.topnav-item.active { color: var(--primary); background: var(--primary-soft); }
.topnav-item svg { width: 16px; height: 16px; opacity: .9; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    flex-shrink: 0;
}
.icon-btn {
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-soft);
    transition: all var(--t);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.back-btn { display: none; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 5px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--t);
}
.user-chip:hover { background: var(--surface-hover); }
.avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #60a5fa);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}
.user-chip-text { line-height: 1.1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.user-chip svg { color: var(--text-muted); flex-shrink: 0; }

.menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 200px;
    padding: 6px;
    z-index: 100;
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    transition: background var(--t);
}
.menu-item:hover { background: var(--surface-hover); }
.menu-item-danger { color: var(--danger); }
.menu-item-danger:hover { background: var(--danger-soft); }

/* ============ PAGE HERO ============ */
.page-hero {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.page-hero-inner {
    padding: 20px 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}
.page-hero h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.4px;
    line-height: 1.2;
}
.page-hero p {
    margin-top: 4px;
    color: var(--text-soft);
    font-size: 14px;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ CONTAINER ============ */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}
.main {
    padding: 24px 0 48px;
    padding-bottom: calc(48px + var(--sab));
    min-height: calc(100vh - var(--topbar-h));
    min-height: calc(100dvh - var(--topbar-h));
}

/* ============ TABBAR (mobil) ============ */
.tabbar {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--tabbar-h) + var(--sab));
    padding-bottom: var(--sab);
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 70;
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
}
.tabbar-inner {
    display: flex;
    height: var(--tabbar-h);
    align-items: stretch;
}
.tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    transition: color var(--t);
    cursor: pointer;
    user-select: none;
    padding: 6px 4px;
}
.tabbar-item svg { width: 22px; height: 22px; }
.tabbar-item.active { color: var(--primary); }
.tabbar-item:active { background: var(--surface-hover); }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    transition: all var(--t);
    white-space: nowrap;
    min-height: 38px;
    user-select: none;
    border: 1px solid transparent;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); box-shadow: 0 0 0 3px var(--primary-ring); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.1); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.1); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover:not(:disabled) { filter: brightness(1.05); }
.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.btn-sm { padding: 6px 10px; font-size: 12px; min-height: 32px; }
.btn-lg { padding: 12px 20px; font-size: 15px; min-height: 46px; }
.btn-block { width: 100%; }

/* ============ FORM ============ */
.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}
.field label .optional { color: var(--text-muted); font-weight: 400; font-size: 11px; }
.field-hint {
    display: inline;
    color: var(--text-muted);
    font-weight: 400;
    font-size: 11px;
    margin-left: 4px;
}

/* Form içinde gruplu bölüm (örn. tarih + hızlı seçim) */
.field-section {
    margin-top: 8px;
    padding: 14px 16px;
    background: var(--bg-soft, var(--surface-2));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.field-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-soft);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.field-section .field:last-child { margin-bottom: 0; }

/* Hızlı seçim chip'leri (süre / tarih hızlı butonları) */
.quick-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
}
.chip {
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-soft);
    cursor: pointer;
    transition: all var(--t);
    user-select: none;
}
.chip:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
}
.chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ========== TOGGLE SWITCH LİSTESİ ========== */
.toggle-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toggle-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--t);
    user-select: none;
}
.toggle-row:hover { border-color: var(--primary); background: var(--surface-2); }
.toggle-row input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--text-muted);
    border-radius: 11px;
    transition: background var(--t);
    flex-shrink: 0;
}
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--t);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-row input[type="checkbox"]:checked + .toggle-switch {
    background: var(--primary);
}
.toggle-row input[type="checkbox"]:checked + .toggle-switch::after {
    transform: translateX(18px);
}
.toggle-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}
.toggle-text strong {
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
}
.toggle-sub {
    font-size: 12px;
    color: var(--text-soft);
}
.input, .select, .textarea {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 15px;
    line-height: 1.4;
    transition: all var(--t);
    min-height: 40px;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}
.input::placeholder { color: var(--text-muted); }
.input[readonly] { background: var(--surface-2); opacity: .7; cursor: not-allowed; }

.select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='%2394a3b8'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}
.textarea { resize: vertical; min-height: 90px; }

.grid-2, .grid-3 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
@media (min-width: 640px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* ============ ALERTS ============ */
.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 14px;
    border: 1px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.alert-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning); }
.alert-info    { background: var(--info-soft);    color: var(--info);    border-color: var(--info); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: var(--success); }

/* ============ CARDS ============ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}
.card + .card { margin-top: 16px; }
.card-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }
.card-body.no-pad { padding: 0; }

/* ============ STATS ============ */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}
@media (min-width: 640px) { .stats-grid { gap: 14px; } }
@media (min-width: 900px) {
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-xs);
    transition: all var(--t);
}
.stat:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.stat-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}
.stat-icon.c-blue   { background: var(--primary-soft); color: var(--primary); }
.stat-icon.c-green  { background: var(--success-soft); color: var(--success); }
.stat-icon.c-orange { background: var(--warning-soft); color: var(--warning); }
.stat-icon.c-red    { background: var(--danger-soft);  color: var(--danger); }
.stat-icon.c-purple { background: rgba(139, 92, 246, 0.12); color: #8b5cf6; }
.stat-icon.c-teal   { background: rgba(20, 184, 166, 0.12); color: #14b8a6; }
.stat-val {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.3px;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.stat-label {
    font-size: 12px;
    color: var(--text-soft);
    margin-top: 4px;
    font-weight: 500;
}
@media (min-width: 640px) {
    .stat-val { font-size: 28px; }
}

/* ============ DASHBOARD ROW ============ */
.dash-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
@media (min-width: 960px) {
    .dash-row.split { grid-template-columns: 1fr 1.2fr; }
    .dash-row.half  { grid-template-columns: 1fr 1fr; }
}

.info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-xs);
    display: flex;
    flex-direction: column;
}
.info-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.info-card-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.info-card-kicker {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
}
.info-card-title { font-size: 15px; font-weight: 700; }
.info-card-sub {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.info-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-soft);
    word-break: break-word;
    padding: 6px 0;
}
.info-row-icon {
    width: 28px; height: 28px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

/* License cards */
.license-stack { display: flex; flex-direction: column; gap: 12px; }
.license-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-xs);
}
.license-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}
.license-title { font-size: 14px; font-weight: 700; }
.license-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.progress {
    background: var(--bg-2);
    border-radius: 999px;
    height: 5px;
    overflow: hidden;
    margin-bottom: 8px;
}
.progress-fill { height: 100%; border-radius: 999px; transition: width .8s var(--ease); }
.license-foot {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    gap: 8px;
    flex-wrap: wrap;
}
.license-foot .dates { color: var(--text-muted); font-family: var(--font-mono); font-size: 10px; }
.license-foot .days { font-family: var(--font-mono); font-weight: 700; }

/* Weekly chart */
.chart-weekly {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 160px;
}
.chart-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
    min-width: 0;
}
.chart-bar-val { font-size: 11px; font-weight: 700; font-family: var(--font-mono); color: var(--text-soft); }
.chart-bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.chart-bar-fill {
    width: 100%;
    background: linear-gradient(180deg, var(--primary), var(--primary-soft));
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: height .6s var(--ease);
}
.chart-bar.today .chart-bar-val { color: var(--primary); }
.chart-bar.today .chart-bar-fill { background: linear-gradient(180deg, var(--primary), var(--primary-hover)); }
.chart-bar-label { font-size: 10px; color: var(--text-muted); font-weight: 500; }
.chart-bar.today .chart-bar-label { color: var(--primary); font-weight: 700; }

/* ============ BADGES ============ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info    { background: var(--info-soft);    color: var(--info); }
.validity-text { font-size: 12px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.badge-neutral { background: var(--surface-2);    color: var(--text-soft); }

/* ============ TABLES ============ */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.tbl thead th {
    padding: 11px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--text-muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.tbl tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.plate {
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: .8px;
    font-size: 13px;
}
.tbl a { font-weight: 600; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Mobile cards for tables */
@media (max-width: 640px) {
    .tbl, .tbl thead, .tbl tbody, .tbl tr, .tbl th, .tbl td { display: block; }
    .tbl thead { display: none; }
    .tbl tbody tr {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 14px;
        margin-bottom: 10px;
        box-shadow: var(--shadow-xs);
    }
    .tbl tbody tr:hover td { background: transparent; }
    .tbl tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 7px 0;
        border-bottom: 1px dashed var(--border);
        text-align: right;
    }
    .tbl tbody td:last-child { border-bottom: 0; }
    .tbl tbody td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 600;
        color: var(--text-muted);
        text-align: left;
        flex-shrink: 0;
    }
    .tbl tbody td:not([data-label])::before,
    .tbl tbody td[data-label=""]::before { display: none; }
    .tbl tbody td.td-actions {
        display: block;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--border);
        border-bottom: 0;
    }
    .tbl tbody td.td-actions::before { display: none; }
    .tbl tbody td.td-actions .actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .tbl tbody td.td-actions .btn { width: 100%; }
    .plate { font-size: 14px; }
}

/* ============ TOOLBAR ============ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search {
    position: relative;
    flex: 1 1 220px;
    min-width: 0;
}
.search input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    min-height: 40px;
    transition: all var(--t);
}
.search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}
.search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
.toolbar .filter, .toolbar .date-input {
    min-height: 40px;
    padding: 9px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
}
.toolbar .toolbar-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

@media (max-width: 640px) {
    .search { flex: 1 1 100%; }
    .toolbar .filter, .toolbar .date-input { flex: 1 1 calc(50% - 5px); min-width: 0; }
    .toolbar .btn { flex: 1 1 auto; }
    .toolbar .toolbar-info { flex: 1 1 100%; text-align: right; margin-left: 0; }
    .input, .select, .textarea, .search input, .toolbar .filter, .toolbar .date-input { font-size: 16px; }
}

/* ============ TABS (site detail) ============ */
.seg {
    display: flex;
    gap: 2px;
    padding: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg-btn {
    flex: 1 0 auto;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
    white-space: nowrap;
    transition: all var(--t);
    min-height: 36px;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-xs);
}

/* ============ LIVE VIEW ============ */
.live-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.live-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-soft); }
.dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--warning);
    flex-shrink: 0;
}
.dot.ok { background: var(--success); animation: pulse 2s infinite; }
.dot.err { background: var(--danger); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

.live-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
@media (min-width: 720px) {
    .live-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
}
.live-cam {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}
.live-cam-head {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}
.live-cam-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    min-width: 0;
    flex: 1;
}
.live-cam-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-cam-dir { font-size: 10px; font-weight: 700; flex-shrink: 0; padding: 2px 8px; border-radius: 999px; }
.live-cam-video {
    aspect-ratio: 16/9;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.live-cam-video video, .live-cam-video img {
    width: 100%; height: 100%; object-fit: contain;
}
.live-cam-video img.frame { object-fit: cover; }
.live-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff;
    font-size: 12px;
    background: rgba(0, 0, 0, .7);
}

/* ============ SYSTEM INFO ============ */
.sys-card { margin-bottom: 14px; }
.sys-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.sys-dir {
    width: 34px; height: 34px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}
.sys-sub { font-size: 12px; color: var(--text-muted); }

.sys-grid {
    display: grid;
    grid-template-columns: 1fr;
}
@media (min-width: 900px) {
    .sys-grid { grid-template-columns: 1fr 1fr 1fr; }
}
.sys-col {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}
.sys-col:last-child { border-bottom: 0; }
@media (min-width: 900px) {
    .sys-col { border-bottom: 0; border-right: 1px solid var(--border); }
    .sys-col:last-child { border-right: 0; }
}
.sys-col-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}
.sys-col-title.t-device { color: var(--primary); }
.sys-col-title.t-status { color: var(--success); }
.sys-col-title.t-net    { color: var(--info); }

.sys-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    font-size: 12.5px;
}
.sys-row-k { color: var(--text-muted); flex-shrink: 0; }
.sys-row-v { font-weight: 600; text-align: right; word-break: break-word; min-width: 0; }

.sys-bar { display: flex; align-items: center; gap: 8px; width: 110px; }
.sys-bar-track {
    flex: 1;
    background: var(--bg-2);
    border-radius: 999px;
    height: 6px;
    overflow: hidden;
}
.sys-bar-fill { height: 100%; border-radius: 999px; }
.sys-bar-val { font-family: var(--font-mono); font-size: 10px; min-width: 28px; text-align: right; }

.sys-foot {
    padding: 8px 18px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    font-size: 11px;
    color: var(--text-muted);
}

/* ============ MODAL ============ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-top:    calc(20px + var(--sat));
    padding-bottom: calc(20px + var(--sab));
    animation: fadeIn .15s var(--ease);
}
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slideUp .2s var(--ease);
}
.modal-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.modal-foot:empty { display: none; }

@media (max-width: 640px) {
    .modal-backdrop { padding: 0; align-items: flex-end; }
    .modal {
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: 0;
    }
    .modal-foot .btn { flex: 1 1 0; }
}

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

/* ============ TOAST ============ */
.toasts {
    position: fixed;
    top: calc(16px + var(--sat));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: calc(100vw - 32px);
    width: 420px;
}
@media (max-width: 640px) {
    .toasts { width: auto; left: 12px; right: 12px; transform: none; }
}
.toast {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    background: var(--surface);
    color: var(--text);
    border-left: 3px solid var(--primary);
    box-shadow: var(--shadow);
    animation: toastIn .25s var(--ease);
    pointer-events: auto;
    border: 1px solid var(--border);
}
.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info    { border-left-color: var(--info); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ============ SPINNER / LOADER ============ */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loader-inline { text-align: center; padding: 60px 20px; }
.loader-inline .spinner { width: 28px; height: 28px; border-width: 3px; }

.global-loader {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.global-loader-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 360px;
    width: 100%;
}
.global-loader-box .spinner {
    width: 36px; height: 36px; border-width: 3px;
    display: block; margin: 0 auto 16px;
}
.global-loader-box .big-icon { font-size: 40px; margin-bottom: 12px; }
.global-loader-box p { font-size: 14px; font-weight: 500; color: var(--text); }

/* ============ EMPTY ============ */
.empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-icon { font-size: 44px; margin-bottom: 14px; opacity: .35; }
.empty h4 { font-size: 15px; color: var(--text-soft); font-weight: 600; margin-bottom: 4px; }

/* ============ PAGINATION ============ */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.pager .pg {
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 600;
    min-height: 34px;
    min-width: 34px;
    transition: all var(--t);
}
.pager .pg:hover { border-color: var(--primary); color: var(--primary); }
.pager .pg.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager .info { color: var(--text-muted); font-size: 12px; padding: 0 8px; }
@media (max-width: 640px) {
    .pager .info { flex: 1 1 100%; text-align: center; margin-top: 4px; }
}

/* ============ MISC ============ */
.dir-entry { color: var(--success); font-weight: 600; }
.dir-exit  { color: var(--danger);  font-weight: 600; }
.photo-thumb {
    width: 72px; height: 44px;
    border-radius: 6px;
    object-fit: cover;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all var(--t);
}
.photo-thumb:hover { border-color: var(--primary); transform: scale(1.04); }
.photo-modal-img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--radius-sm);
    display: block;
    margin: 0 auto;
}

/* ============================================================
   PHOTO VIEWER — zoom + pan + fullscreen
   ============================================================ */
.photo-viewer {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.96);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    animation: pv-fade 0.18s ease-out;
    user-select: none;
}
@keyframes pv-fade { from { opacity: 0; } to { opacity: 1; } }

.pv-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    gap: 12px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.pv-title {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100vw - 320px);
}
.pv-actions { display: flex; gap: 6px; }
.pv-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
    padding: 0;
}
.pv-btn:hover { background: rgba(255, 255, 255, 0.18); }
.pv-btn:active { transform: scale(0.94); }
.pv-btn.pv-scale {
    width: auto;
    min-width: 56px;
    font-size: 12px;
    padding: 0 10px;
    font-variant-numeric: tabular-nums;
}
.pv-btn.pv-close {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.4);
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
}
.pv-btn.pv-close:hover { background: rgba(239, 68, 68, 0.4); }

.pv-stage {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none; /* kendi gesture yönetimimiz */
    cursor: default;
}
.pv-img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    transform-origin: center center;
    will-change: transform;
    transition: transform 0.2s ease-out;
    -webkit-user-drag: none;
    pointer-events: none; /* drag event'leri stage'e gitsin */
}

.pv-hint {
    padding: 8px 16px 10px;
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
    font-size: 11px;
    background: rgba(0, 0, 0, 0.35);
    pointer-events: none;
}
.pv-hint-mobile { display: none; }
.pv-hint-desktop { display: inline; }

@media (max-width: 768px) {
    .pv-hint-desktop { display: none; }
    .pv-hint-mobile { display: inline; }
    .pv-toolbar { padding: 8px 10px; }
    .pv-btn { width: 36px; height: 36px; }
    .pv-title { font-size: 12px; max-width: calc(100vw - 290px); }
    .pv-btn.pv-scale { min-width: 52px; font-size: 11px; }
}

/* Fullscreen'de toolbar ve hint opaklığını azalt, immersive olsun */
.photo-viewer:fullscreen { background: #000; }
.photo-viewer:fullscreen .pv-hint { display: none; }

.confirm-box { text-align: center; padding: 4px 0; }
.confirm-box .big-icon { font-size: 44px; margin-bottom: 12px; }
.confirm-box h3 { font-size: 17px; margin-bottom: 8px; }
.confirm-box .danger-line { color: var(--danger); font-weight: 600; margin-bottom: 10px; font-size: 14px; }
.confirm-box .note-line { color: var(--text-soft); font-size: 13px; margin-bottom: 16px; }

/* ============ RESPONSIVE — TOPBAR / TABBAR ============ */
@media (max-width: 900px) {
    .topnav { display: none; }
    .user-chip-text { display: none; }
    .user-chip { padding: 5px; }
    .user-chip svg:last-child { display: none; }
    .brand-sub { display: none; }
}

@media (max-width: 640px) {
    :root { --topbar-h: 56px; }
    .topbar-row { padding: 0 14px; gap: 8px; }
    .container { padding: 0 14px; }
    .page-hero-inner { padding: 16px 0; }
    .page-hero h1 { font-size: 19px; }
    .page-hero p { font-size: 13px; }
    .main { padding: 16px 0 24px; padding-bottom: calc(var(--tabbar-h) + var(--sab) + 20px); }
    .brand-text { display: none; }

    .tabbar { display: block; }
    .back-btn { display: inline-flex; }

    .card-body { padding: 14px; }
    .card-head { padding: 12px 14px; }
    .modal-body { padding: 16px; }
    .modal-head { padding: 14px 16px; }
    .modal-foot { padding: 12px 14px; }

    .btn { min-height: 40px; }
    .btn-sm { min-height: 32px; }
}

@media (display-mode: standalone) {
    body { overscroll-behavior-y: none; }
}

/* ============================================================
   MOBIL ACCORDION LIST (sadece ≤640px)
   Masaüstünde gizli — tablolar kullanılır
   ============================================================ */
.m-list { display: none; }

@media (max-width: 640px) {
    /* Accordion sayfalarında masaüstü tablosunu gizle */
    .has-m-list .tbl-wrap { display: none; }
    .has-m-list .m-list { display: block; }
}

.m-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.m-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px;
    cursor: pointer;
    user-select: none;
    list-style: none;
    min-height: 56px;
}
.m-head::-webkit-details-marker { display: none; }
.m-head::marker { display: none; }

.m-head-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
}
.m-title {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.25;
    color: var(--text);
    word-break: break-word;
}
.m-title.plate {
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: 1px;
    font-size: 15px;
}
.m-title.link {
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.m-title.link:active { color: var(--primary); opacity: .7; }
.m-sub {
    font-size: 12.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.m-sub .dot-sep { color: var(--border-strong); }

.m-chev {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--surface-2);
    transition: all var(--t);
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.m-chev:active { background: var(--surface-hover); }
.m-chev svg { transition: transform .2s var(--ease); }
details[open] .m-chev {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary);
}
details[open] .m-chev svg { transform: rotate(180deg); }

.m-body {
    padding: 4px 14px 14px;
    border-top: 1px solid var(--border);
    animation: mBodyOpen .2s var(--ease);
}
@keyframes mBodyOpen {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.m-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    font-size: 13px;
    border-bottom: 1px dashed var(--border);
}
.m-row:last-child { border-bottom: 0; }
.m-row-k {
    color: var(--text-muted);
    flex-shrink: 0;
    font-weight: 500;
}
.m-row-v {
    color: var(--text);
    font-weight: 500;
    text-align: right;
    word-break: break-word;
    min-width: 0;
    max-width: 65%;
}
.m-row-v.stretch { max-width: 100%; flex: 1; }
.m-row-v .plate { font-family: var(--font-mono); font-weight: 700; letter-spacing: 1px; }

.m-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.m-actions .btn { width: 100%; }
.m-actions .btn.full { grid-column: 1 / -1; }

.m-photo {
    display: flex;
    justify-content: center;
    padding: 10px 0;
}
.m-photo img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
}

/* ============================================================
   MODAL MOBİL DÜZELTMESİ — X butonu safe-area altında + büyük
   ============================================================ */
@media (max-width: 640px) {
    .modal {
        padding-top: var(--sat);
    }
    .modal-head {
        padding: 14px 14px;
        min-height: 56px;
    }
    .modal-head h3 {
        font-size: 16px;
        line-height: 1.3;
    }
    .modal-head .icon-btn {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
        background: var(--surface-2);
        border: 1px solid var(--border);
    }
    .modal-head .icon-btn:active {
        background: var(--surface-hover);
    }
    .modal-head .icon-btn svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 640px) {
    .m-list-padded { padding: 12px; }
}

/* ============================================================
   NATIVE APP HİSSİ — Mobilde tüm scrollbar'lar gizli,
   zoom devre dışı, double-tap zoom engelli, menu sığdır
   ============================================================ */

/* Tüm browserlarda scrollbar tamamen gizli */
::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
    background: transparent !important;
}
::-webkit-scrollbar-thumb,
::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
    display: none !important;
    background: transparent !important;
}
html, body, * {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

/* Double-tap zoom engeli + touch responsive */
html {
    touch-action: manipulation;
    -webkit-touch-callout: none;
}
body {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-overflow-scrolling: touch;
}

/* Metin seçimi sadece input, textarea ve içerik alanlarında olsun */
input, textarea, select,
.m-title, .m-sub, .m-row-v, .m-row-k,
.tbl td, .tbl th,
.data-table td, .data-table th,
.plate, .sys-row-v, .sys-row-k,
p, h1, h2, h3, h4, h5, h6 {
    -webkit-user-select: text;
    user-select: text;
}

/* Pull-to-refresh engeli */
html, body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

/* ============================================================
   KULLANICI MENÜSÜ — Mobilde ekrana sığdır (sağa/sola kaymaz)
   ============================================================ */
@media (max-width: 900px) {
    .menu {
        position: fixed;
        top: calc(var(--topbar-h) + var(--sat) + 4px);
        right: 10px;
        left: auto;
        width: auto;
        max-width: calc(100vw - 20px);
        min-width: 220px;
    }
}

@media (max-width: 640px) {
    .menu {
        top: calc(var(--topbar-h) + var(--sat) + 4px);
        right: 8px;
        min-width: 200px;
        border-radius: var(--radius);
        box-shadow: var(--shadow-lg);
    }
    .menu-item {
        padding: 12px 14px;
        font-size: 14px;
        min-height: 44px;
    }
    .menu-item svg {
        width: 18px;
        height: 18px;
    }
}

/* =====================================================
   LOG İSTATİSTİK KARTLARI - Tanımlı/Tanımsız sayaçlar
   ===================================================== */
.log-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.log-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.log-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.log-stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}
.log-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.log-stat-success {
    border-left: 4px solid #10b981;
}
.log-stat-success .log-stat-value { color: #10b981; }
.log-stat-danger {
    border-left: 4px solid #ef4444;
}
.log-stat-danger .log-stat-value { color: #ef4444; }
.log-stat-info {
    border-left: 4px solid #3b82f6;
}
.log-stat-info .log-stat-value { color: #3b82f6; }

/* Log başlık alanı */
.log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 2px;
}
.log-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 2px;
}
.log-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

/* =====================================================
   KAPI DURUMU BADGE - Yeşil/Kırmızı
   ===================================================== */
.gate-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.gate-open {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.gate-closed {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
[data-theme="dark"] .gate-open {
    color: #34d399;
    background: rgba(16, 185, 129, 0.15);
}
[data-theme="dark"] .gate-closed {
    color: #f87171;
    background: rgba(239, 68, 68, 0.15);
}

/* =====================================================
   LOG SATIR RENKLENDİRME
   ===================================================== */
.log-row-matched {
    /* Tanımlı araç — hafif yeşilimsi background */
}
.log-row-unmatched {
    /* Tanımsız araç — hafif kırmızımsı background */
    background: rgba(239, 68, 68, 0.03);
}
.log-row-unmatched:hover {
    background: rgba(239, 68, 68, 0.06);
}
[data-theme="dark"] .log-row-unmatched {
    background: rgba(239, 68, 68, 0.06);
}
[data-theme="dark"] .log-row-unmatched:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Mobil accordion - tanımsız sol border kırmızı */
.m-item.log-unmatched {
    border-left: 3px solid #ef4444;
}
.m-item.log-matched {
    border-left: 3px solid #10b981;
}

/* =====================================================
   RESPONSIVE - mobilde kartlar dikey dizilsin
   ===================================================== */
@media (max-width: 640px) {
    .log-stats {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .log-stat-card {
        padding: 12px 14px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    .log-stat-value {
        font-size: 22px;
    }
    .log-title {
        font-size: 16px;
    }
    .gate-badge {
        font-size: 11px;
        padding: 3px 8px;
    }
}

/* =====================================================
   MANUEL BARİYER / KAPI AÇ KARTLARI (Panel ana sayfa)
   ===================================================== */
.relay-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.relay-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    transition: border-color .15s, box-shadow .15s;
}
.relay-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}
.relay-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.relay-cam-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.relay-cam-sub {
    font-size: 12px;
    color: var(--text-muted);
}
.relay-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    font-weight: 600;
    transition: transform .08s ease;
}
.relay-btn:active:not(:disabled) {
    transform: scale(0.97);
}
.relay-btn:disabled {
    opacity: .8;
    cursor: wait;
}

/* Canlı izleme kartlarının altına bariyer butonu */
.live-cam-foot {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.live-cam-foot .relay-btn {
    min-height: 36px;
    font-size: 13px;
}

/* Geçiş listelerinde mobil özet satırındaki kamera etiketi */
.cam-label {
    color: var(--text-secondary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
    display: inline-block;
    vertical-align: middle;
}

@media (max-width: 640px) {
    .relay-grid { grid-template-columns: 1fr; }
    .relay-item { padding: 12px; }
    .cam-label { max-width: 110px; font-size: 12px; }
}

/* =====================================================
   ACİL DURUM MODU (alt kullanıcı anasayfa)
   ===================================================== */
.emergency-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    margin-bottom: 14px;
    border-radius: var(--radius);
    border: 2px solid var(--danger);
    background: var(--danger-soft);
    animation: emergency-pulse 2s ease-in-out infinite;
}
.emergency-banner-icon {
    font-size: 32px;
    line-height: 1;
}
.emergency-banner-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--danger);
    letter-spacing: 0.5px;
}
.emergency-banner-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}
@keyframes emergency-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50%      { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

.emergency-list {
    display: flex;
    flex-direction: column;
}
.emergency-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.emergency-row:last-child { border-bottom: none; }
.emergency-row.is-active {
    background: var(--danger-soft);
}
.emergency-row-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.emergency-row-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.emergency-btn {
    min-height: 40px;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 0 18px;
}

@media (max-width: 640px) {
    .emergency-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px;
    }
    .emergency-row-status { justify-self: start; }
    .emergency-btn { width: 100%; }
    .emergency-banner { padding: 14px; }
    .emergency-banner-icon { font-size: 26px; }
    .emergency-banner-title { font-size: 16px; }
}

/* =====================================================
   CANLI İZLEME - çift buton & sürekli açık göstergesi
   ===================================================== */
.live-cam-foot {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.live-cam-foot .relay-btn {
    min-height: 38px;
    font-size: 12px;
    padding: 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Kamera kartı "sürekli açık" durumunda - yeşil çerçeve */
.live-cam.cam-hold-open {
    border-color: var(--warning);
    box-shadow: 0 0 0 2px var(--warning-soft);
}

/* Video üzerine SÜREKLİ AÇIK badge */
.hold-open-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 5px 10px;
    background: rgba(239, 68, 68, 0.92);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 6px;
    z-index: 2;
    animation: hold-open-blink 1.8s ease-in-out infinite;
}
@keyframes hold-open-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

@media (max-width: 520px) {
    .live-cam-foot { grid-template-columns: 1fr; }
}

/* ============================================================ */
/* İSG KAMERA - PPE / İHLAL EKLEMELERİ                          */
/* ============================================================ */

/* Algılama tip etiketleri */
.tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 4px;
    margin-bottom: 4px;
    white-space: nowrap;
}
.tag-red    { background: #fee2e2; color: #dc2626; }
.tag-orange { background: #ffedd5; color: #ea580c; }
.tag-cyan   { background: #cffafe; color: #0891b2; }
.tag-brown  { background: #fed7aa; color: #7c2d12; }
.tag-purple { background: #f3e8ff; color: #9333ea; }

[data-theme="dark"] .tag-red    { background: rgba(220, 38, 38, 0.2); color: #fca5a5; }
[data-theme="dark"] .tag-orange { background: rgba(234, 88, 12, 0.2); color: #fdba74; }
[data-theme="dark"] .tag-cyan   { background: rgba(8, 145, 178, 0.2); color: #67e8f9; }
[data-theme="dark"] .tag-brown  { background: rgba(124, 45, 18, 0.3); color: #fed7aa; }
[data-theme="dark"] .tag-purple { background: rgba(147, 51, 234, 0.2); color: #d8b4fe; }

/* Algılama tipi seçim listesi (form) */
.check-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    margin-top: 6px;
}
.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
    user-select: none;
}
.check-item:hover { border-color: var(--primary); background: var(--bg-hover); }
.check-item input[type="checkbox"] { margin: 0; cursor: pointer; }

/* Filtreleme barı */
/* ─── Filtre çubuğu (İhlaller, Loglar, vs sayfaları için) ─────
   Yatay, kompakt; kameraların yanında bir araç çubuğu görünümünde.
   Mobilde 2'li grid'e düşer. */
/* Yatay filtre çubuğu (sayfanın üstünde tek satırda).
   - Geniş ekran: tek satır, içerik kadar genişlik (auto)
   - 768px altında: 3 kolonluk grid
   - 480px altında: 2 kolonluk grid */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
}
.filter-bar .input,
.filter-bar select.input,
.filter-bar input[type="date"].input {
    flex: 0 1 auto;
    width: auto;
    min-width: 140px;
    max-width: 240px;
    min-height: 38px;
    padding: 8px 12px;
    font-size: 14px;
    margin: 0;
}
.filter-bar select.input {
    /* Site dropdown daha geniş olsun, isim sığsın */
    max-width: 280px;
}
.filter-bar .search {
    flex: 1 1 200px;
    min-width: 160px;
    max-width: 320px;
}
@media (max-width: 768px) {
    .filter-bar {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        padding: 8px;
    }
    .filter-bar .input,
    .filter-bar select.input,
    .filter-bar input[type="date"].input {
        width: 100%;
        max-width: none;
        min-width: 0;
        font-size: 13px;
    }
}
@media (max-width: 480px) {
    .filter-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* İhlal türü dağılımı */
.type-dist {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.type-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}
.type-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.type-icon { font-size: 18px; }
.type-label { flex: 1; color: var(--text); }
.type-count { font-weight: 700; color: var(--text); }
.type-bar {
    height: 8px;
    background: var(--bg-soft);
    border-radius: 4px;
    overflow: hidden;
}
.type-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* İhlal detay sayfası */
.event-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 900px) {
    .event-detail { grid-template-columns: 1fr; }
}

.event-photo-wrap {
    background: var(--bg-soft);
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
}
.event-photo-big {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    background: #000;
}

/* İhlal tipi banner (büyük) */
.event-type-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 10px;
    color: #fff;
    margin-bottom: 18px;
}
.event-type-icon { font-size: 32px; }
.event-type-label { font-size: 18px; font-weight: 700; }
.event-type-time { font-size: 12px; opacity: 0.9; }

/* Detay grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px 16px;
    margin: 14px 0;
}
.info-grid > div { font-size: 13px; padding: 6px 0; border-bottom: 1px dashed var(--border-soft); }
.info-grid code {
    background: var(--bg-soft);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
}

/* İnceleme bölümü */
.review-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.review-section h4 {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--text);
}

/* Sayfalama */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}
.pagination .btn { min-width: 36px; }

/* Mobil uyumlu m-list */
.m-clickable { cursor: pointer; }
.m-clickable:active { background: var(--bg-hover); }
.m-photo-mini {
    width: 64px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}
.m-photo-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Empty state ihlal yok */
.empty .empty-icon {
    font-size: 48px;
    opacity: 0.5;
    margin-bottom: 8px;
}

/* Auth-features (login sol panel) — İSG renkleri */
.auth-left {
    background: linear-gradient(135deg, #dc2626 0%, #ea580c 50%, #f59e0b 100%);
}

/* Brand mark - yedek */
.brand-mark { color: var(--primary); }

/* Kart head action */
.card-head .card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Review note textarea */
textarea.input {
    font-family: var(--font);
    resize: vertical;
    min-height: 60px;
}

/* Tablo num cell */
.tbl td.num, .tbl th.num { text-align: right; }

/* Muted text utility */
.muted { color: var(--text-muted); font-size: 12px; }

/* Optional label */
.optional {
    color: var(--text-muted);
    font-weight: normal;
    font-size: 11px;
}
