/* Layout: bus-ticket motif — tours shown as ticket stubs with a date block and perforation;
   admin uses a quiet sidebar + dense tables. Flag green as the brand, red sun as the one accent. */
:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #eaefeb;
  --ink: #13251e;
  --muted: #5a6b63;
  --line: #d6dfd9;
  --brand: #0a5c45;
  --brand-ink: #ffffff;
  --brand-soft: #dcede5;
  --sun: #d93a26;
  --sun-soft: #fbe3de;
  --ok: #17784f;
  --ok-soft: #dcf1e6;
  --warn: #9a6200;
  --warn-soft: #fbefd5;
  --bad: #b3261e;
  --bad-soft: #f8dedb;
  --shadow: 0 1px 2px rgba(10, 40, 30, .06), 0 6px 20px rgba(10, 40, 30, .06);
  --f-display: "Inter", "Hind Siliguri", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-body: "Inter", "Hind Siliguri", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1613; --surface: #13211c; --surface-2: #1a2b25; --ink: #e5eee9; --muted: #95a79e;
    --line: #26392f; --brand: #3dbb8c; --brand-ink: #06231a; --brand-soft: #173a2d; --sun: #ff6b54;
    --sun-soft: #3a1d18; --ok: #4fd09c; --ok-soft: #163a2b; --warn: #f0b350; --warn-soft: #3a2c12;
    --bad: #ff8a80; --bad-soft: #3d1a17; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1613; --surface: #13211c; --surface-2: #1a2b25; --ink: #e5eee9; --muted: #95a79e;
  --line: #26392f; --brand: #3dbb8c; --brand-ink: #06231a; --brand-soft: #173a2d; --sun: #ff6b54;
  --sun-soft: #3a1d18; --ok: #4fd09c; --ok-soft: #163a2b; --warn: #f0b350; --warn-soft: #3a2c12;
  --bad: #ff8a80; --bad-soft: #3d1a17; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--f-body); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; font-feature-settings: "cv11", "ss01"; }
h1, h2, h3, h4 { font-family: var(--f-display); line-height: 1.2; margin: 0; text-wrap: balance; letter-spacing: -.02em; color: var(--ink); }
h1 { font-size: clamp(1.875rem, 3.6vw, 2.75rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--brand); }
img { max-width: 100%; }
[hidden] { display: none !important; }
.boot { padding: 40px 16px; color: var(--muted); }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding-inline: 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mono { font-family: var(--f-mono); }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 .95rem/1 var(--f-body); padding: 11px 16px; border-radius: 8px; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.sun { background: var(--sun); border-color: var(--sun); color: #fff; }
.btn.danger { color: var(--bad); border-color: var(--bad-soft); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 7px 11px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: .875rem; font-weight: 600; color: var(--ink); min-width: 0; }
label .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
input, select, textarea { font: 400 1rem/1.4 var(--f-body); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.err { color: var(--bad); background: var(--bad-soft); padding: 10px 12px; border-radius: 8px; font-size: .9rem; }

/* site header */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 700 1.15rem/1 var(--f-display); }
.brand-mark { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--sun); left: 9px; top: 9px; }


.prices { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; }
.price b { font: 700 1.35rem/1 var(--f-display); font-variant-numeric: tabular-nums; }
.price small { color: var(--muted); font-size: .8rem; margin-left: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--ink); padding: 4px 9px; border-radius: 99px; }
.meter { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.meter.hot i { background: var(--sun); }
.seats { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); gap: 8px; }
.seats b { color: var(--ink); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; letter-spacing: .02em; white-space: nowrap; }
.badge.open, .badge.confirmed { background: var(--ok-soft); color: var(--ok); }
.badge.full, .badge.cancelled, .badge.departed { background: var(--bad-soft); color: var(--bad); }
.badge.pending, .badge.draft { background: var(--warn-soft); color: var(--warn); }
.badge.closed { background: var(--surface-2); color: var(--muted); }

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; counter-reset: s; }
.steps li { list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; counter-increment: s; }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font: 700 1rem/1 var(--f-display); margin-bottom: 10px; }
.steps { padding: 0; margin: 0; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }

.empty { text-align: center; padding: 40px 16px; border: 1px dashed var(--line); border-radius: var(--r); color: var(--muted); }

/* tour detail */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; padding-block: 28px 48px; }
@media (max-width: 920px) { .detail { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.book-panel { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 76px); }
@media (max-width: 920px) { .book-panel { position: static; } }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.facts div { background: var(--surface); padding: 12px 14px; }
.facts b { display: block; font-size: 1rem; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist li::before { content: ""; flex: none; width: 18px; height: 18px; margin-top: 3px; border-radius: 50%; background: var(--ok-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3 3 7-7' fill='none' stroke='%2317784f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat; }
.checklist.no li::before { background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 6l8 8M14 6l-8 8' fill='none' stroke='%23889890' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") center/12px no-repeat; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.timeline b { font-family: var(--f-display); color: var(--brand); }
.counter { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.counter .ctl { display: flex; align-items: center; gap: 10px; }
.counter button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 700 1.2rem/1 var(--f-body); cursor: pointer; }
.counter button:hover { border-color: var(--brand); color: var(--brand); }
.counter output { min-width: 22px; text-align: center; font: 700 1.1rem/1 var(--f-display); }
.total-line { display: flex; justify-content: space-between; align-items: baseline; padding-block: 10px; }
.total-line b { font: 700 1.6rem/1 var(--f-display); }
.pay-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pay-opts label { flex-direction: row; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 6px; cursor: pointer; font-size: .85rem; text-align: center; }
.pay-opts input { width: auto; margin: 0; accent-color: var(--brand); }
.pay-opts label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.notice { background: var(--brand-soft); border-radius: 8px; padding: 12px 14px; font-size: .9rem; }
.notice b.big { font-family: var(--f-mono); font-size: 1rem; }

.confirm-code { font: 700 clamp(2rem, 7vw, 3rem)/1 var(--f-mono); letter-spacing: .14em; color: var(--brand); padding: 16px 0 8px; word-break: break-all; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }


.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
td.r, th.r { text-align: right; }
td .sub { color: var(--muted); font-size: .8rem; }
.due { color: var(--sun); font-weight: 700; }

.banner { background: var(--warn-soft); color: var(--ink); border-radius: var(--r); padding: 12px 16px; margin-bottom: 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 8px; font-weight: 600; z-index: 100; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
#toast.bad { background: var(--bad); color: #fff; }
@media (max-width: 820px) { .table-wrap table { min-width: 760px; } }

/* Django additions */
.field-error { color: var(--bad); font-size: .82rem; font-weight: 500; }
.errorlist { list-style: none; margin: 0; padding: 0; }
.messages { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.messages li { background: var(--brand-soft); border-radius: 8px; padding: 10px 14px; font-weight: 500; }
.messages li.error { background: var(--bad-soft); color: var(--bad); }
.messages li.warning { background: var(--warn-soft); }
.counter input[type=number] { width: 56px; text-align: center; font: 700 1.05rem/1 var(--f-display); padding: 6px; -moz-appearance: textfield; }
.counter input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
.inline-form { display: inline; margin: 0; }
.pagination { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.btn-link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.check-row { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.check-row input { width: auto; }
