:root {
    --bg: #f2f4f7;
    --card: #ffffff;
    --primary: #0f6b9e;
    --primary-dark: #0b547c;
    --text: #1c2430;
    --muted: #667085;
    --border: #d9dee6;
    --danger: #c0392b;
    --ok: #1e8e3e;
    --nav-h: 60px;
    --radius: 12px;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/vazirmatn/Vazirmatn-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/vazirmatn/Vazirmatn-Medium.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/vazirmatn/Vazirmatn-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/vazirmatn/Vazirmatn-Black.woff2") format("woff2");
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Vazirmatn", Tahoma, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,107,158,.15); }
.input[readonly] { background: #f7f8fa; color: var(--muted); }
.input.center { text-align: center; }

.btn {
    border: 0;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

.btn-link {
    background: none;
    border: 0;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    opacity: .9;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: 0 1px 3px rgba(16,24,40,.08);
}

.card-title { margin: 0 0 4px; font-size: 17px; }

.field { margin: 14px 0; }

.field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; color: #344054; }

.hint { font-weight: 400; color: var(--muted); font-size: 12px; }

/* ---------- Login ---------- */
.login-wrap {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card { width: 100%; max-width: 380px; padding: 24px; }

.login-title { margin: 0; font-size: 20px; text-align: center; }
.login-sub { margin: 4px 0 18px; text-align: center; color: var(--muted); font-size: 13px; }

.captcha-box { display: flex; gap: 10px; align-items: center; }
.captcha-box input { flex: 1; }
.captcha-box img { height: 46px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }

.alert-error {
    background: #fdecea;
    color: var(--danger);
    border: 1px solid #f5c6c0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 12px;
}

/* ---------- App shell ---------- */
.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; }

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
}

.app-header h1 { margin: 0; font-size: 16px; }

.app-main {
    padding: 16px 12px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom, 0px));
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 20;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-btn {
    flex: 1;
    border: 0;
    background: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--muted);
    border-top: 3px solid transparent;
}

.nav-btn.active { color: var(--primary); border-top-color: var(--primary); }

/* ---------- Plate (LTR) ---------- */
.plate-row { display: flex; gap: 6px; align-items: center; direction: ltr; }
.plate-part { flex: 1; letter-spacing: 1px; direction: ltr; }
.plate-letter { width: 74px; flex: 0 0 74px; padding: 11px 2px; }
.plate-dash { font-weight: 700; color: var(--muted); direction: ltr; }

/* ---------- Car combo ---------- */
.car-combo { position: relative; }

.car-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 260px;
    overflow-y: auto;
    z-index: 30;
    box-shadow: 0 6px 16px rgba(16,24,40,.12);
}

.car-list li { padding: 9px 12px; cursor: pointer; }
.car-list li:hover, .car-list li.hl { background: #eef5fa; }
.car-list li.no-match { color: var(--muted); cursor: default; }

/* ---------- Radios ---------- */
.radio-row { display: flex; gap: 24px; padding: 4px 2px; }

.radio-item { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.radio-item input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }

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

.table th, .table td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    white-space: nowrap;
}

.table th { color: var(--muted); font-weight: 600; }

.table .empty-row td { color: var(--muted); padding: 18px 6px; }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    background: #232b36;
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
    z-index: 50;
    max-width: 90vw;
    text-align: center;
}

.toast.show { opacity: 1; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }

@media (min-width: 720px) {
    .app-main { padding: 24px; }
}
