/* ================= Design tokens ================= */
:root {
    --bg: #f3f5fb;
    --bg-glow: radial-gradient(1200px 600px at 100% -10%, #e0e7ff 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #fce7f3 0%, transparent 55%);
    --surface: rgba(255, 255, 255, .82);
    --surface-solid: #ffffff;
    --surface-2: #f6f7fb;
    --border: rgba(15, 23, 42, .08);
    --text: #0f172a;
    --muted: #64748b;
    --primary: #6366f1;
    --primary-2: #8b5cf6;
    --primary-soft: rgba(99, 102, 241, .12);
    --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #d946ef 100%);
    --success: #10b981; --success-soft: rgba(16, 185, 129, .13);
    --warning: #f59e0b; --warning-soft: rgba(245, 158, 11, .15);
    --danger: #ef4444;  --danger-soft: rgba(239, 68, 68, .12);
    --info: #0ea5e9;    --info-soft: rgba(14, 165, 233, .13);
    --sidebar-bg: linear-gradient(180deg, #0f1023 0%, #17183a 100%);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .05);
    --shadow: 0 10px 30px -12px rgba(30, 27, 75, .18), 0 2px 6px rgba(15, 23, 42, .04);
    --shadow-lg: 0 24px 60px -20px rgba(79, 70, 229, .45);
    --radius: 18px;
    --radius-sm: 12px;
    --ease: cubic-bezier(.2, .8, .2, 1);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b0c1a;
        --bg-glow: radial-gradient(1000px 600px at 100% -10%, rgba(99, 102, 241, .22) 0%, transparent 60%), radial-gradient(800px 500px at -10% 110%, rgba(217, 70, 239, .14) 0%, transparent 55%);
        --surface: rgba(22, 23, 46, .78);
        --surface-solid: #16172e;
        --surface-2: #1d1e3a;
        --border: rgba(255, 255, 255, .08);
        --text: #e8e9f5;
        --muted: #9a9cc0;
        --primary-soft: rgba(129, 140, 248, .18);
        --success-soft: rgba(16, 185, 129, .18);
        --warning-soft: rgba(245, 158, 11, .18);
        --danger-soft: rgba(239, 68, 68, .18);
        --info-soft: rgba(14, 165, 233, .18);
        --sidebar-bg: linear-gradient(180deg, #08081a 0%, #111232 100%);
        --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
}

/* ================= Base ================= */
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
    margin: 0;
    font-family: Vazirmatn, Tahoma, sans-serif;
    font-size: 14px;
    line-height: 1.75;
    color: var(--text);
    background: var(--bg-glow), var(--bg);
    background-attachment: fixed;
    min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-2); }
::selection { background: var(--primary); color: #fff; }
svg.icon { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ================= Layout ================= */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px; flex-shrink: 0;
    position: sticky; top: 0; height: 100vh;
    background: var(--sidebar-bg);
    color: #a5a8d6;
    padding: 22px 16px;
    display: flex; flex-direction: column;
    box-shadow: -8px 0 40px rgba(0, 0, 0, .12);
    overflow: hidden;
}
.sidebar::before {
    content: ""; position: absolute; inset: -40% -60% auto auto; width: 320px; height: 320px;
    background: radial-gradient(circle, rgba(139, 92, 246, .35), transparent 65%);
    pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 26px; position: relative; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
    background: var(--grad); color: #fff; box-shadow: 0 8px 24px -6px rgba(139, 92, 246, .7);
}
.brand-mark svg.icon { width: 22px; height: 22px; }
.brand-text strong { display: block; color: #fff; font-size: 16px; line-height: 1.3; }
.brand-text span { font-size: 12px; color: #7d80b3; }

.nav-label { font-size: 11px; letter-spacing: .08em; color: #5f6296; padding: 0 12px 8px; }
.sidebar nav { position: relative; }
.sidebar nav a {
    display: flex; align-items: center; gap: 12px;
    color: #a5a8d6; padding: 11px 14px; border-radius: 12px; margin-bottom: 6px;
    transition: background .25s var(--ease), color .25s, transform .25s var(--ease);
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; transform: translateX(-3px); }
.sidebar nav a.active {
    color: #fff; background: var(--grad);
    box-shadow: 0 10px 24px -10px rgba(139, 92, 246, .9);
}

.user-card {
    margin-top: auto; position: relative;
    display: flex; align-items: center; gap: 10px;
    padding: 12px; border-radius: 14px;
    background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .06);
}
.avatar {
    width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
    background: var(--grad); color: #fff; font-weight: 700; flex-shrink: 0;
}
.user-card .who { flex: 1; min-width: 0; line-height: 1.4; }
.user-card .who strong { color: #fff; display: block; font-size: 13px; }
.user-card .who span { font-size: 11px; color: #7d80b3; }
.user-card form { margin: 0; }
.logout-btn {
    width: 34px; height: 34px; border-radius: 10px; border: 0; cursor: pointer;
    display: grid; place-items: center; color: #fca5a5; background: rgba(239, 68, 68, .1);
    transition: background .2s, transform .2s;
}
.logout-btn:hover { background: rgba(239, 68, 68, .25); transform: scale(1.06); }

.main { flex: 1; min-width: 0; padding: 30px 34px 48px; }
.container { max-width: 1280px; margin: 0 auto; animation: rise .5s var(--ease) both; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ================= Page head ================= */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 24px; font-weight: 800; margin: 0; display: flex; align-items: center; gap: 12px; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.date-chip {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border); color: var(--muted); box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

/* ================= Cards ================= */
.card {
    background: var(--surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.card h2 { font-size: 16px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 10px; }
.card h2 .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.card h2 .dot.green { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }
.count-pill { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }

/* ================= Stats ================= */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat {
    position: relative; overflow: hidden;
    background: var(--surface); backdrop-filter: blur(14px);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 16px;
    transition: transform .35s var(--ease), box-shadow .35s var(--ease);
    animation: rise .55s var(--ease) both;
}
.stat:nth-child(2) { animation-delay: .06s; } .stat:nth-child(3) { animation-delay: .12s; } .stat:nth-child(4) { animation-delay: .18s; }
.stat:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.stat::after {
    content: ""; position: absolute; width: 140px; height: 140px; border-radius: 50%;
    left: -40px; bottom: -70px; background: var(--tone-soft); filter: blur(4px);
}
.stat-icon {
    width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; flex-shrink: 0;
    color: #fff; background: var(--tone-grad); box-shadow: 0 10px 22px -8px var(--tone);
}
.stat-icon svg.icon { width: 24px; height: 24px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 30px; font-weight: 800; line-height: 1.2; }
.tone-primary { --tone: #6366f1; --tone-soft: var(--primary-soft); --tone-grad: linear-gradient(135deg, #6366f1, #8b5cf6); }
.tone-success { --tone: #10b981; --tone-soft: var(--success-soft); --tone-grad: linear-gradient(135deg, #10b981, #34d399); }
.tone-info    { --tone: #0ea5e9; --tone-soft: var(--info-soft);    --tone-grad: linear-gradient(135deg, #0ea5e9, #38bdf8); }
.tone-warning { --tone: #f59e0b; --tone-soft: var(--warning-soft); --tone-grad: linear-gradient(135deg, #f59e0b, #fb923c); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-2 + .grid-2 { margin-top: 22px; }

/* ================= Tables ================= */
.table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
th {
    text-align: right; color: var(--muted); font-weight: 600; font-size: 12px;
    padding: 4px 14px 2px; white-space: nowrap;
}
td {
    text-align: right; padding: 12px 14px; vertical-align: middle; white-space: nowrap;
    background: var(--surface-2); transition: background .2s, transform .2s;
}
td:first-child { border-radius: 0 12px 12px 0; }
td:last-child { border-radius: 12px 0 0 12px; }
tbody tr { transition: transform .2s var(--ease); }
tbody tr:hover td { background: var(--primary-soft); }
td.empty { text-align: center; color: var(--muted); padding: 36px 14px; border-radius: 14px; background: transparent; border: 2px dashed var(--border); }
td.empty svg.icon { width: 36px; height: 36px; display: block; margin: 0 auto 8px; opacity: .5; }
tbody tr:hover td.empty { background: transparent; }
.cell-strong { font-weight: 600; }

/* ================= Buttons ================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent; border-radius: 12px; padding: 9px 18px;
    font: inherit; font-weight: 600; cursor: pointer; line-height: 1.5;
    color: #fff; background: var(--grad); background-size: 150% 150%;
    box-shadow: 0 8px 20px -8px rgba(99, 102, 241, .75);
    transition: transform .2s var(--ease), box-shadow .2s, background-position .4s, filter .2s;
}
.btn:hover { color: #fff; transform: translateY(-2px); background-position: 100% 0; box-shadow: 0 12px 26px -8px rgba(139, 92, 246, .8); }
.btn:active { transform: translateY(0) scale(.98); }
.btn svg.icon { width: 16px; height: 16px; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 10px; }
.btn-outline { background: var(--surface-solid); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn-outline:hover { color: var(--primary); background: var(--surface-solid); border-color: var(--primary); box-shadow: 0 6px 16px -8px rgba(99, 102, 241, .5); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 8px 18px -8px rgba(16, 185, 129, .8); }
.btn-success:hover { box-shadow: 0 12px 24px -8px rgba(16, 185, 129, .85); }
.btn-warning { background: linear-gradient(135deg, #f59e0b, #ea580c); box-shadow: 0 8px 18px -8px rgba(245, 158, 11, .8); }
.btn-warning:hover { box-shadow: 0 12px 24px -8px rgba(234, 88, 12, .8); }
.btn-danger { background: linear-gradient(135deg, #f43f5e, #dc2626); box-shadow: 0 8px 18px -8px rgba(239, 68, 68, .8); }
.btn-danger:hover { box-shadow: 0 12px 24px -8px rgba(220, 38, 38, .85); }
.btn-ghost-danger { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
.btn-ghost-danger:hover { background: var(--danger); color: #fff; box-shadow: 0 8px 18px -8px rgba(239, 68, 68, .8); }
.btn-icon { padding: 7px; width: 34px; height: 34px; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }

/* ================= Badges ================= */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-in    { background: var(--success-soft); color: var(--success); }
.badge-out   { background: var(--surface-solid); color: var(--muted); border: 1px solid var(--border); }
.badge-entry { background: var(--info-soft); color: var(--info); }
.badge-exit  { background: var(--warning-soft); color: #d97706; }

/* ================= Iranian plate ================= */
.plate {
    display: inline-flex; align-items: stretch; direction: ltr; unicode-bidi: isolate;
    height: 32px; border: 2px solid #111827; border-radius: 7px; overflow: hidden;
    background: #fff; color: #111827; font-weight: 800; font-size: 15px; line-height: 1;
    box-shadow: 0 3px 8px -3px rgba(0, 0, 0, .35); vertical-align: middle;
    transition: transform .2s var(--ease);
}
a:hover .plate { transform: scale(1.04); }
.plate-flag {
    width: 20px; background: #1e40af; color: #fff; display: flex; flex-direction: column;
    align-items: center; justify-content: space-between; padding: 3px 0 2px; font-size: 5.5px; font-weight: 600; letter-spacing: 0;
}
.plate-flag i { width: 12px; height: 9px; border-radius: 1px; background: linear-gradient(#22a35a 33%, #fff 33% 66%, #da2a2a 66%); }
.plate-num { display: flex; align-items: center; gap: 6px; padding: 0 10px; letter-spacing: .5px; direction: ltr; }
.plate-region {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 0 8px; border-left: 2px solid #111827; font-size: 14px;
}
.plate-region small { font-size: 6px; font-weight: 600; margin-bottom: 1px; }
.plate-lg { height: 44px; font-size: 21px; border-width: 2.5px; border-radius: 9px; }
.plate-lg .plate-flag { width: 26px; font-size: 7px; }
.plate-lg .plate-flag i { width: 16px; height: 11px; }
.plate-lg .plate-num { padding: 0 14px; }
.plate-lg .plate-region { font-size: 19px; padding: 0 11px; border-left-width: 2.5px; }
.plate-lg .plate-region small { font-size: 8px; }

/* ================= Alerts ================= */
.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 16px; border-radius: 14px; margin-bottom: 20px; font-weight: 500;
    border: 1px solid transparent; animation: slide .45s var(--ease) both;
}
@keyframes slide { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.alert-success { background: var(--success-soft); color: var(--success); border-color: rgba(16, 185, 129, .25); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: rgba(239, 68, 68, .25); }

/* ================= Forms ================= */
.form-row { margin-bottom: 18px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.form-row .hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.req { color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=search], textarea, select {
    width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 12px;
    font: inherit; color: var(--text); background: var(--surface-solid);
    transition: border-color .2s, box-shadow .2s, background .2s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input:hover, textarea:hover { border-color: rgba(99, 102, 241, .35); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; vertical-align: middle; margin-left: 6px; }
.error { color: var(--danger); font-size: 12px; margin-top: 5px; font-weight: 500; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }

.search { display: flex; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.search-field { position: relative; flex: 1; max-width: 380px; min-width: 200px; }
.search-field svg.icon { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field input { padding-right: 40px; }

/* ================= Misc ================= */
.muted { color: var(--muted); }
dl.info { display: grid; grid-template-columns: max-content 1fr; gap: 0; margin: 0; }
dl.info dt, dl.info dd { padding: 11px 0; border-bottom: 1px dashed var(--border); margin: 0; }
dl.info dt { color: var(--muted); padding-left: 24px; }
dl.info dt:last-of-type, dl.info dd:last-of-type { border-bottom: 0; }

.movement-box { display: flex; flex-direction: column; gap: 14px; }
.status-hero {
    display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 14px;
    background: var(--surface-2); border: 1px solid var(--border);
}
.status-hero .stat-icon { width: 46px; height: 46px; border-radius: 14px; }
.status-hero strong { display: block; font-size: 15px; }
.movement-form { display: flex; gap: 10px; flex-wrap: wrap; }
.movement-form input { flex: 1; min-width: 180px; }

.timeline-type { display: inline-flex; align-items: center; gap: 10px; }
.timeline-type .ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; }
.timeline-type .ic svg.icon { width: 16px; height: 16px; }
.ic-entry { background: var(--info-soft); color: var(--info); }
.ic-exit { background: var(--warning-soft); color: #d97706; }

/* Pagination (Laravel tailwind markup, styled without Tailwind) */
.pagination { margin-top: 14px; }
.pagination nav { display: flex; justify-content: center; }
.pagination nav > div:first-child { display: none; }
.pagination nav > div:last-child { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 12px; flex-wrap: wrap; }
.pagination p { margin: 0; color: var(--muted); font-size: 13px; }
.pagination span[aria-current] > span, .pagination a, .pagination span[aria-disabled] > span {
    display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 10px;
    margin: 0 2px; border-radius: 10px; background: var(--surface-solid); border: 1px solid var(--border); color: var(--text);
}
.pagination span[aria-current] > span { background: var(--grad); color: #fff; border-color: transparent; }
.pagination svg { width: 16px; height: 16px; }
.pagination span[aria-disabled] > span { opacity: .45; }

/* ================= Login ================= */
.login-page {
    min-height: 100vh; display: grid; place-items: center; padding: 20px; position: relative; overflow: hidden;
    background: #0b0c1f;
}
.login-page .blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .7; animation: float 14s ease-in-out infinite; }
.login-page .b1 { width: 420px; height: 420px; background: #6366f1; top: -120px; right: -100px; }
.login-page .b2 { width: 360px; height: 360px; background: #d946ef; bottom: -120px; left: -80px; animation-delay: -5s; }
.login-page .b3 { width: 260px; height: 260px; background: #0ea5e9; top: 40%; left: 40%; opacity: .35; animation-delay: -9s; }
@keyframes float { 50% { transform: translate(30px, -30px) scale(1.08); } }
.login-card {
    position: relative; width: 100%; max-width: 410px; padding: 36px 32px;
    background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border-radius: 24px; color: #fff; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
    animation: rise .6s var(--ease) both;
}
.login-card .brand-mark { width: 58px; height: 58px; border-radius: 18px; margin: 0 auto 16px; }
.login-card .brand-mark svg.icon { width: 28px; height: 28px; }
.login-card h1 { text-align: center; font-size: 22px; margin: 0 0 4px; }
.login-card .sub { text-align: center; color: rgba(255, 255, 255, .6); margin: 0 0 26px; font-size: 13px; }
.login-card label { color: rgba(255, 255, 255, .85); }
.login-card input[type=text], .login-card input[type=password] {
    background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .14); color: #fff;
}
.login-card input:focus { border-color: #a5b4fc; box-shadow: 0 0 0 4px rgba(165, 180, 252, .2); }
.login-card .error { color: #fca5a5; }
.login-card .btn { width: 100%; padding: 12px; font-size: 15px; }

/* ================= Responsive ================= */
@media (max-width: 1000px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 800px) {
    .layout { flex-direction: column; }
    .sidebar { position: sticky; top: 0; z-index: 10; width: auto; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 10px 14px; }
    .brand { padding: 0; }
    .brand-text, .nav-label, .user-card .who { display: none; }
    .sidebar nav { display: flex; gap: 6px; }
    .sidebar nav a { margin: 0; padding: 8px 12px; }
    .sidebar nav a:hover { transform: none; }
    .user-card { margin: 0 auto 0 0; padding: 6px; background: transparent; border: 0; }
    .user-card .avatar { display: none; }
    .main { padding: 20px 16px 40px; }
    .form-grid { grid-template-columns: 1fr; }
    .page-head h1 { font-size: 20px; }
}

/* ================= Users ================= */
.user-cell { display: inline-flex; align-items: center; gap: 10px; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.badge-admin { background: var(--primary-soft); color: var(--primary); }
.role-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.role-option { position: relative; cursor: pointer; margin: 0; font-weight: normal !important; }
.role-option input { position: absolute; opacity: 0; pointer-events: none; }
.role-option > span {
    display: flex; flex-direction: column; gap: 2px; height: 100%;
    padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface-solid);
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.role-option strong { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.role-option small { color: var(--muted); font-size: 12px; }
.role-option:hover > span { border-color: rgba(99, 102, 241, .4); }
.role-option input:checked + span { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 4px var(--primary-soft); }
.role-option input:checked + span strong { color: var(--primary); }
.role-option input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.tip-card h2 svg.icon { color: var(--primary); }
.steps { margin: 0; padding-right: 20px; display: grid; gap: 8px; }
.steps code { background: var(--surface-2); padding: 2px 8px; border-radius: 6px; font-size: 13px; }
input[type=tel] {
    width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 12px;
    font: inherit; color: var(--text); background: var(--surface-solid); transition: border-color .2s, box-shadow .2s;
}
input[type=tel]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }

/* ================= Phone: tables become cards ================= */
@media (max-width: 700px) {
    .table-wrap:has(table.stack) { overflow: visible; margin: 0; padding: 0; }
    table.stack, table.stack tbody { display: block; }
    table.stack thead { display: none; }
    table.stack tr {
        display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
        background: var(--surface-2); border-radius: 16px; padding: 14px; margin-bottom: 12px;
        border: 1px solid var(--border);
    }
    table.stack td { display: block; background: none !important; padding: 0; border-radius: 0 !important; white-space: normal; }
    table.stack td[data-label] { flex: 1 1 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border-top: 1px dashed var(--border); text-align: left !important; }
    table.stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 500; text-align: right; }
    table.stack td.stack-title { flex: 1 1 auto; padding-bottom: 6px; }
    table.stack td.stack-actions { flex: 1 1 100%; padding-top: 10px; }
    table.stack td.stack-actions .actions { justify-content: stretch; }
    table.stack td.stack-actions .actions > * { flex: 1; }
    table.stack td.stack-actions .actions .btn { width: 100%; padding-block: 10px; }
    table.stack td.stack-actions .actions .btn-icon { height: auto; }
    table.stack td.empty { flex: 1 1 100%; }
    table.stack tr:has(td.empty) { background: none; border: 0; padding: 0; }
    .role-picker { grid-template-columns: 1fr; }
    .page-head .btn { flex: 1; }
    .page-head > div:first-child { flex: 1 1 100%; }
    .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; }
    .stat-icon { width: 44px; height: 44px; border-radius: 13px; }
    .stat .value { font-size: 26px; }
    input, textarea { font-size: 16px !important; } /* jologiri az zoom-e iPhone */
}

/* ================= Phone: app-style bottom tab bar ================= */
@media (max-width: 800px) {
    .sidebar { padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; }
    .brand-text { display: block; }
    .brand-text span { display: none; }
    .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
    .sidebar nav {
        position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
        display: flex; justify-content: space-around; gap: 0;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
        background: rgba(15, 16, 35, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid rgba(255, 255, 255, .08);
    }
    .sidebar nav a {
        flex: 1; flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; text-align: center;
        border-radius: 12px; background: none; box-shadow: none;
    }
    .sidebar nav a svg.icon { width: 22px; height: 22px; }
    .sidebar nav a.active { background: none; box-shadow: none; color: #fff; }
    .sidebar nav a.active svg.icon { color: #a78bfa; filter: drop-shadow(0 0 8px rgba(167, 139, 250, .7)); }
    .main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}

/* ================= SMS settings ================= */
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.hint-box { font-size: 13px; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--border); border-radius: 12px; padding: 12px 14px; line-height: 2; }
.hint-box code { background: var(--primary-soft); color: var(--primary); padding: 1px 8px; border-radius: 6px; direction: ltr; display: inline-block; }
.switch { display: flex !important; align-items: center; gap: 14px; cursor: pointer; font-weight: normal !important; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .slider { position: relative; width: 50px; height: 28px; flex-shrink: 0; border-radius: 999px; background: var(--border); transition: background .25s; box-shadow: inset 0 0 0 1px var(--border); }
.switch .slider::after { content: ""; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .25s var(--ease); }
.switch input:checked + .slider { background: var(--grad); }
.switch input:checked + .slider::after { transform: translateX(-22px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ================= Driver gallery ================= */
.sidebar nav a { position: relative; }
.nav-badge { margin-inline-start: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 800; color: #fff; background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .25); }
.g-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.g-tab { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-weight: 600; font-size: 14px; }
.g-tab span { font-size: 12px; padding: 1px 9px; border-radius: 999px; background: var(--surface-2); }
.g-tab.active { color: #fff; background: var(--grad); border-color: transparent; box-shadow: 0 10px 24px -12px rgba(139, 92, 246, .9); }
.g-tab.active span { background: rgba(255, 255, 255, .22); }
.g-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 16px; margin-bottom: 18px; }
.g-card { padding: 0 !important; overflow: hidden; display: flex; flex-direction: column; margin: 0 !important; }
.g-img { display: block; aspect-ratio: 4 / 3; background: var(--surface-2); }
.g-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-body { padding: 14px 16px 6px; display: grid; gap: 4px; flex: 1; }
.g-who { display: flex; align-items: center; gap: 8px; }
.g-loc { font-size: 13px; font-weight: 600; }
.g-cap { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.9; }
.g-date { font-size: 12px; }
.g-actions { display: flex; gap: 6px; padding: 10px 16px 16px; flex-wrap: wrap; }
.g-actions form { margin: 0; }
.g-actions form:last-child { margin-inline-start: auto; }
.g-empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.g-empty svg.icon { width: 40px; height: 40px; opacity: .5; }
@media (max-width: 800px) {
    .nav-badge { position: absolute; top: 0; left: calc(50% - 22px); min-width: 18px; height: 18px; font-size: 10px; padding: 0 5px; margin: 0; }
}

/* ================= News & announcements ================= */
.level-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.lv { position: relative; cursor: pointer; }
.lv input { position: absolute; opacity: 0; pointer-events: none; }
.lv span { display: inline-block; padding: 8px 16px; border-radius: 12px; border: 2px solid var(--border); font-weight: 700; font-size: 14px; transition: all .2s; }
.lv-danger input:checked + span { border-color: #ef4444; background: rgba(239, 68, 68, .12); color: #dc2626; }
.lv-warning input:checked + span { border-color: #f59e0b; background: rgba(245, 158, 11, .14); color: #b45309; }
.lv-info input:checked + span { border-color: #3b82f6; background: rgba(59, 130, 246, .12); color: #2563eb; }
.lv input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-soft); }
.lvb-danger { background: rgba(239, 68, 68, .14); color: #dc2626; }
.lvb-warning { background: rgba(245, 158, 11, .16); color: #b45309; }
.lvb-info { background: rgba(59, 130, 246, .12); color: #2563eb; }
.ann-list, .news-rows { display: grid; }
.ann-row, .news-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.ann-row:first-child { border-top: 0; }
.ann-row.is-off { opacity: .55; }
.ann-row-body, .news-row-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ann-row-body .muted, .news-row-body .muted { font-size: 12px; }
.ann-row .actions form, .news-row form { margin: 0; }
.news-row-body a { line-height: 1.8; }
.news-row-body a:hover { color: var(--primary); }
.card-head form { margin: 0; }
@media (max-width: 700px) {
    .ann-row { flex-wrap: wrap; }
    .ann-row .actions { width: 100%; justify-content: flex-end; }
}

/* ================= Plate input (shabih-e pelak-e vaghei) ================= */
.plate-field { display: grid; gap: 10px; }
.pf-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pf-head > label { margin: 0; }
.pf-switch { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.pf-switch label { margin: 0; cursor: pointer; font-weight: 600; }
.pf-switch input { position: absolute; opacity: 0; pointer-events: none; }
.pf-switch span { display: block; padding: 6px 12px; border-radius: 9px; font-size: 13px; color: var(--muted); transition: all .2s; }
.pf-switch input:checked + span { background: var(--surface-solid); color: var(--text); box-shadow: 0 2px 8px -2px rgba(15, 23, 42, .25); }
.pf-switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-soft); }
.plate-field[data-type=iran] .pf-foreign, .plate-field[data-type=foreign] .pf-iran { display: none; }
.pf-text { font-size: 18px !important; font-weight: 700; letter-spacing: .05em; }

.pi { display: flex; align-items: stretch; direction: ltr; width: 100%; max-width: 440px; height: 66px; border: 3px solid #111827; border-radius: 12px; overflow: hidden; background: #fff; color: #111827; box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .45); }
.pi:focus-within { box-shadow: 0 0 0 4px var(--primary-soft), 0 8px 20px -10px rgba(0, 0, 0, .45); }
.pi-flag { width: 38px; flex-shrink: 0; background: #1e40af; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 7px 0 5px; font-size: 8px; font-weight: 700; line-height: 1.2; text-align: center; }
.pi-flag i { width: 22px; height: 15px; border-radius: 2px; background: linear-gradient(#22a35a 33%, #fff 33% 66%, #da2a2a 66%); }
.pi input, .pi select { all: unset; box-sizing: border-box; height: 100%; text-align: center; font-family: inherit; font-weight: 900; font-size: 30px; color: #111827; min-width: 0; }
.pi input::placeholder { color: #cbd5e1; font-weight: 700; }
.pi input:focus, .pi select:focus { background: #eef2ff; }
.pi .pi-2, .pi .pi-3, .pi .pi-letter, .pi .pi-region { flex-basis: 0; flex-shrink: 1; min-width: 0; }
.pi input { width: 100%; }
.pi .pi-2 { flex-grow: 2; }
.pi .pi-3 { flex-grow: 3; }
.pi .pi-letter { flex-grow: 1.7; width: 100%; cursor: pointer; text-align-last: center; font-size: 26px !important; }
.pi-letter option { font-size: 16px; font-weight: 600; }
.pi .pi-region { flex-grow: 1.6; display: flex; flex-direction: column; align-items: stretch; border-left: 3px solid #111827; }
.pi-region small { text-align: center; font-size: 11px; font-weight: 700; padding-top: 4px; line-height: 1; }
.pi .pi-region input { font-size: 24px; height: auto; flex: 1; }
@media (max-width: 480px) {
    .pi { height: 58px; }
    .pi-flag { width: 30px; font-size: 6.5px; }
    .pi input, .pi select { font-size: 24px; }
    .pi .pi-letter { font-size: 21px !important; }
    .pi .pi-region input { font-size: 20px; }
}
