/* TRIPBOT site theme: black ground, orange top bar, orange buttons and headings.
   every page loads this file (see pwa.js); pages style with these variables only. */
:root {
  color-scheme: dark;
  --bg: #000000;          /* page background */
  --card: #141414;        /* cards, panels */
  --card2: #262626;       /* secondary buttons, tabs, inner chips */
  --line: #333333;        /* borders */
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --accent: #ff7a00;      /* orange: top bar, primary buttons, headings */
  --accent-hover: #ff9533;
  --accent-soft: #ffa24d;   /* links */
  --on-accent: #000000;     /* text on orange */
  --ok: #4ade80;
  --ok-strong: #16a34a;
  --ok-bg: #0f2a18;
  --danger: #dc2626;
  --danger-text: #f87171;
  --danger-bg: #3b0d0d;
  --info: #38bdf8;
}

[hidden] { display: none !important; }
body { background: var(--bg); color: var(--text); }
h1, h2 { color: var(--accent); }
a { color: var(--accent-soft); }

button, a.btn { background: var(--accent); color: var(--on-accent); font-weight: 700; }
button:hover, a.btn:hover { background: var(--accent-hover); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.red { background: var(--danger); color: #fff; }
button.gray, button.sm { background: var(--card2); color: var(--text); }
button.green { background: var(--ok-strong); color: #fff; }
button.red:hover { background: #ef4444; }
button.gray:hover, button.sm:hover { background: #333333; }
button.green:hover { background: #22c55e; }
button:disabled { opacity: .5; }

input, select, textarea { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
input::placeholder, textarea::placeholder { color: var(--muted); }
input[type=checkbox] { accent-color: var(--accent); }

.tag.first { color: var(--on-accent); }

/* logo */

/* page header: logo above the screen name */
.ttl { display: flex; flex-direction: column; gap: 6px; }
.nav a.on, .tab.on { color: var(--on-accent); font-weight: 700; }
.top { flex-wrap: wrap; gap: 8px 12px; align-items: flex-start; }

/* tab bar (admin and dispatcher screens); scrolls sideways on narrow phones */
.nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px 14px; padding: 0 14px; }
.nav::-webkit-scrollbar { display: none; }
.nav a { flex: 1 0 auto; text-align: center; padding: 10px 12px; border-radius: 10px; background: var(--card2); color: var(--text); text-decoration: none; font-size: 15px; white-space: nowrap; }
.nav a.on { background: var(--accent); color: var(--on-accent); font-weight: 700; }
a.btn.gray { background: var(--card2); color: var(--text); }

/* collapsible card: rarely used forms stay folded */
details.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--accent); font-weight: 700; font-size: 17px; min-height: 28px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s; margin-inline-end: 6px; }
details.fold[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
details.fold[open] > summary { margin-bottom: 10px; }
@media (prefers-reduced-motion: reduce) { details.fold > summary::after { transition: none; } }

/* payments rows */
.pill { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--card2); color: var(--text); }
.pill.good { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--danger-bg); color: var(--danger-text); }
.row.pay { display: flex; flex-direction: column; gap: 8px; }
.phead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.phead .name { flex-grow: 1; min-width: 0; }
.pmain { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pmain .amt { display: flex; align-items: center; gap: 4px; background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding-inline-start: 10px; }
.pmain .amt input { width: 90px; margin: 0; border: 0; background: transparent; }
.pmain button { height: 44px; }
.psec { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 8px; }
.psec button, .psec a button { height: 36px; padding: 0 12px; font-size: 14px; }
button.sm.danger-text { color: var(--danger-text); }

/* orange top bar on every screen: title at the side, logo in the middle, user at the other side */
.topbar { background: var(--accent); color: var(--on-accent); margin: -14px -14px 14px; padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px; }
.tb-in { max-width: 960px; margin: 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.tb-title { font-weight: 800; font-size: 17px; white-space: nowrap; justify-self: start; }
.tb-logo { display: flex; justify-self: center; border-radius: 10px; }
.tb-logo .logo { box-shadow: 0 1px 4px rgba(0, 0, 0, .25); border-radius: 9px; }
.tb-user { justify-self: end; font-size: 14px; text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-user a { color: var(--on-accent); font-weight: 700; }
.logo { display: block; flex: none; }
/* login card header: logo, "מוקד סדרנים", "כניסה למערכת" */
.login-head { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 18px; text-align: center; }
.login-head .logo { border-radius: 20px; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
.login-head h1 { margin: 6px 0 0; font-size: 24px; }
.login-head p { margin: 0; color: var(--muted); }

/* shared base for all screens (a page's own <style> may refine these) */
.wrap { max-width: 640px; margin: 0 auto; }
.card { background: var(--card); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.card > h2:first-child { margin: 0 0 10px; font-size: 18px; }
.row { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.sub { color: var(--muted); font-size: 14px; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ok, .on { color: var(--ok); } .bad, .off { color: var(--danger-text); }
input, select, textarea { box-sizing: border-box; width: 100%; padding: 11px; margin: 5px 0; border-radius: 8px; font-size: 16px; font-family: inherit; }
textarea { min-height: 84px; resize: vertical; }
button, a.btn { border: 0; border-radius: 10px; padding: 10px 16px; font-size: 16px; font-family: inherit; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; box-sizing: border-box; }
button.toggle { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
button.toggle[aria-pressed="true"] { background: #3b1f00; color: var(--accent); border-color: var(--accent); }
button.big { font-size: 18px; min-height: 52px; }
.banner { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; background: var(--danger-bg); color: var(--text); }
.banner a { color: var(--accent-soft); font-weight: 700; }
.link:hover, .link:focus { background: none; text-decoration: underline; }

/* admin: dispatchers and stations */
.addf { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px; }
.addf select, .addf button { grid-column: 1 / -1; }
.addf button { margin-top: 6px; }
.drow { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.dl1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dl1 .name { font-weight: 700; }
.dl1 .pill { margin-inline-start: auto; }
.dl2 { display: flex; align-items: center; gap: 8px; }
.dl2 .sub { flex: none; direction: ltr; }
.dl2 form { flex-grow: 1; }
.dl2 select { margin: 0; padding: 6px 8px; font-size: 14px; }
.dl3 { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.dl3 > form button, .btn-like { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-like { display: inline-flex; align-items: center; border-radius: 10px; background: var(--card2); color: var(--text); cursor: pointer; list-style: none; font-weight: 700; }
.btn-like::-webkit-details-marker { display: none; }
details.reset[open] { flex-basis: 100%; order: 3; }
details.reset[open] > summary { margin-bottom: 6px; }
.switch { background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 999px; gap: 8px; padding: 0 12px 0 8px; }
.switch::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); }
.switch[aria-checked="true"] { background: #3b1f00; color: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::before { background: var(--accent); }
.switch:hover { background: var(--card2); }
.switch[aria-checked="true"]:hover { background: #4a2800; }
.srow { background: var(--bg); border-radius: 10px; padding: 8px 12px; margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.srow .name { font-weight: 700; flex-grow: 1; }
.srow button { min-height: 34px; padding: 0 10px; font-size: 13px; }
form.inline { display: flex; gap: 8px; align-items: center; }
form.inline input { margin: 0; }
form.inline button { flex: none; }
@media (max-width: 520px) { .addf { grid-template-columns: minmax(0, 1fr); } }

/* settings screens: changed rows and the green confirm bar */
[data-row].changed, .g.changed { outline: 2px solid var(--ok); }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--card); border-top: 1px solid var(--line); padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 10px; justify-content: center; align-items: center; }
.savebar button.green { flex: 1; max-width: 360px; }
body.has-bar { padding-bottom: 96px; }
/* the active switch is now a checkbox inside a label */
label.switch { display: inline-flex; align-items: center; min-height: 36px; cursor: pointer; position: relative; font-weight: 700; font-size: 14px; }
label.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
label.switch:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
label.switch .on-t { display: none; }
label.switch:has(input:checked) .on-t { display: inline; }
label.switch:has(input:checked) .off-t { display: none; }
label.switch:has(input:checked) { background: #3b1f00; color: var(--accent); border-color: var(--accent); }
label.switch:has(input:checked)::before { background: var(--accent); }
button.link { background: none; border: 0; color: var(--accent-soft); padding: 4px 8px; min-height: auto; font-size: 15px; font-weight: 600; }
button.link.danger { color: var(--danger-text); }
/* the confirm button is always there on settings screens: grey until something changes */
.savebar button.green:disabled { background: var(--card2); color: var(--muted); opacity: 1; cursor: default; }

/* admin alert rows with a "טופל" button */
.alrow { display: flex; align-items: flex-start; gap: 10px; margin-top: 8px; }
.alrow span { flex-grow: 1; min-width: 0; }
.alrow button { flex: none; min-height: 32px; padding: 0 10px; font-size: 13px; }

/* site dialogs (public/ui.js) instead of the browser's alert/confirm/prompt */
.ui-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .65); display: flex; align-items: center; justify-content: center; padding: 16px; }
.ui-dialog { background: var(--card); color: var(--text); border-top: 4px solid var(--accent); border-radius: 16px; width: 100%; max-width: 380px; padding: 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); display: flex; flex-direction: column; gap: 12px; }
.ui-title { margin: 0; font-size: 19px; color: var(--accent); }
.ui-text { white-space: pre-line; line-height: 1.5; }
.ui-input { margin: 0; }
.ui-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.ui-btn { flex: 1 1 auto; min-height: 46px; }
.ui-btn.danger { background: var(--danger); color: #fff; }
.ui-btn.danger:hover { background: #ef4444; }
.ui-btn.cancel { background: var(--card2); color: var(--text); }
.ui-btn.cancel:hover { background: #333333; }
@media (prefers-reduced-motion: no-preference) { .ui-dialog { animation: ui-in .12s ease-out; } @keyframes ui-in { from { transform: translateY(8px); opacity: 0; } } }

/* monthly report preview */
pre.report { white-space: pre-wrap; word-break: break-word; background: var(--bg); border-radius: 10px; padding: 10px 12px; font-family: inherit; font-size: 14px; line-height: 1.6; margin: 8px 0; }

/* payments tracking */
.ptiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.ptile { background: var(--bg); border-radius: 10px; padding: 10px 6px; text-align: center; }
.ptile b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.ptile span { color: var(--muted); font-size: 12px; }
.ptile.good b { color: var(--ok); } .ptile.bad b { color: var(--danger-text); }
.pill.warn { background: #3b2a00; color: #fbbf24; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.chip { padding: 6px 12px; border-radius: 999px; background: var(--card2); color: var(--text); text-decoration: none; font-size: 14px; }
.chip.on { background: var(--accent); color: var(--on-accent); font-weight: 700; }
@media (max-width: 380px) { .ptiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
