:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --panel: #ffffff;
    --text: #18202b;
    --muted: #687384;
    --line: #dfe4eb;
    --brand: #126c65;
    --brand-dark: #0d514c;
    --danger: #b42318;
    --warn: #a15c00;
    --ok: #137333;
    --chip: #eef7f6;
    --shadow: 0 12px 30px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.45;
}
a { color: var(--brand); text-decoration: none; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}
.brand { color: var(--text); font-size: 18px; font-weight: 800; }
.nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.nav a {
    flex: 0 0 auto;
    color: var(--muted);
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 700;
}
.nav a.active, .nav a:hover { color: var(--brand-dark); background: var(--chip); }
.page { width: min(1180px, 100%); margin: 0 auto; padding: 18px 14px 36px; }
.page-title { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
h1 { margin: 0; font-size: 24px; letter-spacing: 0; }
h2 { margin: 0 0 12px; font-size: 18px; }
.page-title span, .muted { color: var(--muted); font-size: 14px; }
.panel, .auth-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.panel { padding: 14px; margin-bottom: 14px; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.auth-card { width: min(420px, 100%); padding: 22px; }
.stack { display: grid; gap: 13px; }
.grid { display: grid; gap: 13px; }
label { display: grid; gap: 6px; color: #344054; font-size: 14px; font-weight: 700; }
input, select, textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 10px 11px;
    color: var(--text);
    background: #fff;
    font: inherit;
}
textarea { min-height: 84px; resize: vertical; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    font-weight: 700;
}
.check input { width: 18px; min-height: 18px; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 9px 13px;
    background: #fff;
    color: var(--text);
    font-weight: 800;
    cursor: pointer;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { background: #fff4f2; border-color: #ffd3cc; color: var(--danger); }
.btn.ghost { background: transparent; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.alert { padding: 10px 12px; border-radius: 7px; margin: 0 0 12px; font-weight: 700; }
.alert.success { color: var(--ok); background: #ecfdf3; }
.alert.danger { color: var(--danger); background: #fff4f2; }
.alert.warning { color: var(--warn); background: #fff7e8; }
.filters { display: grid; gap: 10px; }
.summary { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.stat b { display: block; font-size: 18px; }
.cards { display: grid; gap: 10px; }
.work-card {
    display: grid;
    gap: 10px;
    padding: 13px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.work-head { display: flex; justify-content: space-between; gap: 10px; }
.reg { font-size: 18px; font-weight: 900; color: var(--text); }
.status { display: inline-flex; width: max-content; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 900; background: #eef2ff; color: #383b8f; }
.status.Pending { background: #fff7e8; color: var(--warn); }
.status.Approvedfinished { background: #ecfdf3; color: var(--ok); }
.status.DeliveredtoRTO, .status.Verification { background: #eaf5ff; color: #075985; }
.meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; color: var(--muted); font-size: 13px; }
.meta strong { display: block; color: var(--text); font-size: 14px; }
.badge { display: inline-flex; margin: 0 5px 5px 0; padding: 4px 8px; border-radius: 999px; background: var(--chip); color: var(--brand-dark); font-size: 12px; font-weight: 900; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; vertical-align: top; }
th { color: var(--muted); background: #f9fafb; font-size: 12px; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.detail-list { display: grid; gap: 8px; }
.detail-row { display: grid; gap: 3px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.detail-row span { color: var(--muted); font-size: 13px; }
.text-link { display: inline-flex; margin-top: 12px; font-weight: 800; }
.desktop-only { display: none; }

@media (min-width: 720px) {
    .topbar { flex-direction: row; align-items: center; justify-content: space-between; padding: 12px 24px; }
    .page { padding: 24px; }
    h1 { font-size: 30px; }
    .grid.two, .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
    .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .checks { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .cards.mobile-list { display: none; }
    .desktop-only { display: block; }
    .detail-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
