* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f4f6f8;
    color: #172033;
    font-family: Tahoma, Arial, sans-serif;
    line-height: 1.7;
}

a {
    color: #1264a3;
    text-decoration: none;
}

.sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: 245px;
    background: #152238;
    color: #fff;
    padding: 24px 18px;
}

.brand {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 28px;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar a {
    color: #e8eef7;
    padding: 10px 12px;
    border-radius: 6px;
}

.sidebar a:hover {
    background: #233956;
}

.content {
    margin-inline-start: 245px;
    padding: 28px;
}

.auth-content {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-box,
.panel-form,
.filter-box,
.table-wrap,
.stats > div,
.sub-panel {
    background: #fff;
    border: 1px solid #dde4ec;
    border-radius: 8px;
    box-shadow: 0 8px 26px rgba(30, 42, 62, 0.05);
}

.login-box {
    width: min(420px, 100%);
    padding: 28px;
}

h1,
h2 {
    margin: 0 0 12px;
    line-height: 1.35;
}

h1 {
    font-size: 26px;
}

h2 {
    font-size: 18px;
}

.hint,
.page-head p {
    color: #64748b;
    margin: 0;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.stack-form,
.panel-form {
    display: grid;
    gap: 18px;
}

.panel-form {
    padding: 22px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.two-cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.sub-panel {
    padding: 18px;
    display: grid;
    gap: 14px;
}

label {
    position: relative;
    display: grid;
    gap: 6px;
    color: #314158;
    font-size: 14px;
    font-weight: 700;
}

label.required::after {
    content: " *";
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: -12px;
    color: #dc2626;
    font-weight: 900;
}

input,
select,
button,
.button {
    min-height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 12px;
    font: inherit;
}

input,
select {
    width: 100%;
    background: #fff;
    color: #172033;
}

input:disabled,
input[readonly] {
    background: #eef2f7;
    color: #475569;
}

.jalali-picker {
    display: grid;
    grid-template-columns: 1.2fr 0.9fr 0.9fr;
    gap: 8px;
}

.plate-input,
.insurance-input {
    min-height: 42px;
    display: grid;
    align-items: center;
    gap: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 8px;
    background: #f8fafc;
}

.plate-input {
    grid-template-columns: auto 64px auto minmax(120px, 1fr);
}

.insurance-input {
    grid-template-columns: minmax(160px, 1fr) auto 76px;
}

.plate-input input,
.insurance-input input,
.insurance-input select {
    min-height: 30px;
    padding: 4px 8px;
    background: #fff;
}

.plate-input span,
.insurance-input span {
    color: #172033;
    font-weight: 700;
}

.plate-iran {
    text-align: center;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #172033;
    cursor: pointer;
}

.primary {
    background: #147a7e;
    border-color: #147a7e;
    color: #fff;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.messages {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.message {
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #fff;
}

.message.error {
    color: #9f1239;
    border-color: #fecdd3;
    background: #fff1f2;
}

.message.success {
    color: #166534;
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.stats > div {
    padding: 22px;
    display: grid;
    gap: 6px;
}

.stats strong {
    font-size: 32px;
}

.stats span {
    color: #64748b;
}

.filter-box {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.filter-date {
    display: grid;
    gap: 4px;
}

.filter-date small {
    color: #64748b;
    font-weight: 700;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
}

th {
    background: #eef3f7;
    color: #334155;
}

tr.draft-row td {
    background: #fff4e5;
}

tr.draft-row td:first-child {
    border-inline-start: 4px solid #f97316;
}

tr.collected-row td {
    background: #ecfdf5;
}

tr.collected-row td:first-child {
    border-inline-start: 4px solid #22c55e;
}

.inline-form {
    display: inline;
    margin: 0;
}

.inline-form button {
    min-height: 34px;
}

.muted {
    color: #94a3b8;
}

.table-button.primary {
    background: #147a7e;
    border-color: #147a7e;
    color: #fff;
}

.row-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.table-button {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border: 1px solid #b7c7d8;
    border-radius: 6px;
    background: #fff;
    color: #17456b;
    font-size: 13px;
    font-weight: 700;
}

.table-button:hover {
    background: #eaf3fb;
    border-color: #8db4d6;
}

.empty {
    text-align: center;
    color: #64748b;
    padding: 28px;
}

.info-strip {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 12px;
    background: #eef7f7;
    border: 1px solid #cde8e8;
    border-radius: 6px;
}

.print-page {
    background: #fff;
    max-width: 920px;
    min-height: 1120px;
    margin: 0 auto;
    padding: 46px;
    border: 1px solid #dde4ec;
    box-shadow: 0 8px 26px rgba(30, 42, 62, 0.08);
}

.print-page h1 {
    text-align: center;
    margin-bottom: 26px;
}

.print-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 28px;
}

.print-table {
    margin: 20px 0;
    border: 1px solid #222;
}

.print-table th,
.print-table td {
    border: 1px solid #222;
}

.signatures {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 70px;
    text-align: center;
}

.signatures span {
    padding-top: 42px;
    border-top: 1px solid #222;
}

.print-actions {
    text-align: left;
    margin-bottom: 20px;
}

@media (max-width: 980px) {
    .sidebar {
        position: static;
        width: auto;
    }

    .content {
        margin-inline-start: 0;
        padding: 18px;
    }

    .form-grid,
    .two-cols,
    .stats,
    .filter-box,
    .print-meta,
    .jalali-picker {
        grid-template-columns: 1fr;
    }

    .plate-input,
    .insurance-input {
        grid-template-columns: 1fr;
    }

    .page-head {
        align-items: stretch;
        flex-direction: column;
    }
}

@media print {
    body {
        background: #fff;
    }

    .sidebar,
    .messages,
    .print-actions {
        display: none !important;
    }

    .content,
    .auth-content {
        margin: 0;
        padding: 0;
    }

    .print-page {
        border: 0;
        box-shadow: none;
        max-width: none;
        min-height: auto;
        padding: 0;
    }
}
