/* Chirawa Safai - Route Plan */
:root {
    --ink: #17231c;
    --muted: #5d6b62;
    --line: #dde4dd;
    --bg: #f3f6f2;
    --card: #ffffff;
    --green: #1f6b45;
    --green-dark: #164d33;
    --green-soft: #e4f1e8;
    --amber: #b45309;
    --amber-soft: #fdf1dc;
    --red: #b42318;
    --red-soft: #fde8e6;
    --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Segoe UI", "Noto Sans", system-ui, -apple-system, Arial, sans-serif; font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 0 0 10px; }
p { margin: 0 0 10px; }
code { background: #eef2ee; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Header */
.top { display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 56px; background: var(--green-dark); color: #fff; position: sticky; top: 0; z-index: 1100; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; line-height: 1.1; }
.brand:hover { text-decoration: none; }
.brand small { display: block; font-weight: 400; font-size: 11px; opacity: .75; letter-spacing: .06em; text-transform: uppercase; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #f2b84b; color: var(--green-dark); font-weight: 800; }
.brand-mark.big { width: 52px; height: 52px; font-size: 26px; border-radius: 14px; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav a { color: #d9e8de; padding: 7px 11px; border-radius: 7px; white-space: nowrap; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.nav a.on { background: #fff; color: var(--green-dark); font-weight: 600; }
.who { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.who a { color: #fff; }
.who form { margin: 0; }

/* Page */
.page { max-width: 1180px; margin: 0 auto; padding: 22px 20px 50px; }
.page-wide { max-width: none; padding: 0; }
.narrow { max-width: 520px; margin: 0 auto; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.head p { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert-ok { background: var(--green-soft); border-color: #b9dcc6; color: var(--green-dark); }
.alert-err { background: var(--red-soft); border-color: #f3bdb7; color: var(--red); }
.alert-warn { background: var(--amber-soft); border-color: #f1d49b; color: #7a3c06; }
.page-wide .alert { margin: 10px 14px 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f1f5f1; text-decoration: none; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-danger { color: var(--red); border-color: #f0c2bd; }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.12); }
.btn-sm { padding: 4px 9px; font-size: 13px; border-radius: 6px; }
.btn-icon { padding: 3px 8px; min-width: 30px; }
.btn-block { width: 100%; }
.inline { display: inline; margin: 0; }

/* Forms */
.form label, .login-card label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
input[type=text], input[type=password], input[type=number], input[type=file], select, textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid #c9d3ca; border-radius: 7px; font: inherit; color: var(--ink); background: #fff; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid #7cc09a; outline-offset: 1px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 14px; }
.check { display: flex !important; align-items: center; gap: 8px; }
.check input { width: auto; margin: 0; }
.hint { font-size: 12px; font-weight: 400; color: var(--muted); display: block; margin-top: 3px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 24px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.stat.warn b { color: var(--amber); }

/* Steps */
.steps { display: grid; gap: 12px; }
.step { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.step-no { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #e9eee9; color: var(--muted); }
.step.done .step-no { background: var(--green); color: #fff; }
.step h2 { margin: 0 0 2px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }
.step .status { font-size: 13px; margin-top: 4px; color: var(--green-dark); font-weight: 600; }
.step .status.pending { color: var(--amber); }
.step-act { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.step-act form { margin: 0; display: flex; gap: 6px; align-items: center; }
.step-act input[type=file] { margin: 0; width: 210px; padding: 4px; font-size: 12px; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #e9eee9; vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f7f9f6; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafcf9; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; background: #f7f9f6; border-top: 2px solid var(--line); border-bottom: 0; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #e9eee9; color: var(--muted); }
.tag-ok { background: var(--green-soft); color: var(--green-dark); }
.tag-warn { background: var(--amber-soft); color: #7a3c06; }
.tag-bad { background: var(--red-soft); color: var(--red); }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* Login */
.login-wrap { min-height: calc(100vh - 80px); display: grid; place-items: center; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 26px 26px 16px; }
.login-head { text-align: center; margin-bottom: 18px; }
.login-head h1 { margin-top: 10px; }
.login-head p { color: var(--muted); margin: 0; }

/* Map page */
.map-page { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: calc(100vh - 56px); }
.map-side { background: var(--card); border-right: 1px solid var(--line); padding: 14px; overflow-y: auto; }
.map-side h2 { margin-top: 14px; }
.map-side h2:first-child { margin-top: 0; }
.map-side label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
#map { height: 100%; min-height: 380px; background: #e8ece8; }
.legend { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.legend i { display: inline-block; width: 26px; height: 0; border-top: 4px solid; }
.legend i.dot { width: 9px; height: 9px; border: 0; border-radius: 50%; margin: 0 8px; }
.draw-box { background: var(--amber-soft); border: 1px solid #f1d49b; border-radius: 8px; padding: 10px; font-size: 13px; }
.draw-box .actions { margin-top: 8px; }
.pop { font-size: 13px; min-width: 210px; }
.pop b { font-size: 14px; }
.pop select { margin: 6px 0; padding: 5px 6px; font-size: 13px; }
.pop .actions { margin-top: 6px; }
.seq-icon { background: #fff; border: 2px solid var(--ink); border-radius: 50%; width: 22px !important; height: 22px !important; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--ink); }
#routeMap { height: 480px; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 16px; }
#pickMap { height: 300px; border-radius: 8px; border: 1px solid var(--line); margin: 6px 0 12px; }

/* Print: route ka parcha */
.print-only { display: none; }
@media print {
    .no-print { display: none !important; }
    .print-only { display: block; }
    body { background: #fff; font-size: 12px; }
    .page { max-width: none; padding: 0; }
    .card, .table-wrap, .stat { border-color: #999; break-inside: avoid; }
    .grid-side { grid-template-columns: 1fr; }
    #routeMap { height: 420px; }
    a { color: inherit; }
}
@media (max-width: 900px) {
    .grid2, .grid-side { grid-template-columns: 1fr; }
    .map-page { grid-template-columns: 1fr; height: auto; }
    .map-side { border-right: 0; border-bottom: 1px solid var(--line); }
    #map { height: 70vh; }
    .step { grid-template-columns: 40px minmax(0, 1fr); }
    .step-act { grid-column: 1 / -1; align-items: flex-start; }
    .top { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
    .nav { order: 3; flex-basis: 100%; }
}
