/* HADAdmin — mobile-first styles. Colors are tokens; change them here. */
:root {
  --bg: #f2f4f7; --surface: #ffffff; --ink: #131820; --muted: #5a6476; --line: #d9dee7;
  --accent: #1d4ed8; --accent-ink: #ffffff; --soft: #e6ecf8;
  --done: #15803d; --done-soft: #e3f3e8; --pending: #b45309; --pending-soft: #fdf1e2;
  --danger: #b91c1c; --hatch: #c7ceda;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1218; --surface: #161b24; --ink: #e6eaf1; --muted: #9aa4b6; --line: #2a3241;
    --accent: #7097ff; --accent-ink: #0a0e15; --soft: #1a2337;
    --done: #4ade80; --done-soft: #14281c; --pending: #fbbf24; --pending-soft: #2b2112;
    --danger: #f87171; --hatch: #3a4354;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); }
body { padding-bottom: env(safe-area-inset-bottom, 0px); -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top {
  position: sticky; top: 0; z-index: 5; background: var(--accent); color: var(--accent-ink);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) max(14px, env(safe-area-inset-right, 0px)) 10px max(14px, env(safe-area-inset-left, 0px));
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.top h1 { margin: 0; font-size: 20px; font-weight: 750; letter-spacing: -.01em; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.16);
  color: inherit; font-size: 26px; line-height: 1; cursor: pointer;
}
.stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; }
.stats span { background: rgba(255,255,255,.16); padding: 3px 10px; border-radius: 99px; }

main { padding: 12px max(14px, env(safe-area-inset-right, 0px)) 40px max(14px, env(safe-area-inset-left, 0px)); max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

.banner { background: var(--pending-soft); color: var(--ink); border: 1px solid var(--pending); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; }

.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.dow, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dow span { text-align: center; font-size: 11px; color: var(--muted); padding-bottom: 4px; }
.cell {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; padding: 0; min-width: 0;
}
.cell.blank { border: 0; background: none; cursor: default; }
.cell.past { opacity: .5; }
.cell.today { border-color: var(--ink); }
.cell.sel { box-shadow: 0 0 0 2px var(--accent); }
.cell.blocked { background: repeating-linear-gradient(135deg, transparent 0 5px, var(--hatch) 5px 6px); }
.cell.has-booked { background: var(--soft); }
.cell.has-done { background: var(--done-soft); }
.dots { display: flex; gap: 3px; height: 6px; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot.booked { background: var(--accent); } .dot.done { background: var(--done); }
.dot.pending { background: var(--pending); } .dot.blocked { background: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); padding: 10px 2px 0; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

.day { display: flex; flex-direction: column; gap: 10px; }
.day h2 { margin: 4px 0 0; font-size: 18px; }
.muted { color: var(--muted); font-size: 14px; margin: 0; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%; cursor: pointer;
}
.card .row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card b { font-size: 16px; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.pill.booked { color: var(--accent); } .pill.done { color: var(--done); } .pill.pending { color: var(--pending); } .pill.cancelled { color: var(--muted); }

.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  min-height: 44px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--ink);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.good { background: var(--done); border-color: var(--done); color: var(--surface); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.grow { flex: 1 1 140px; }
.btn { position: relative; }
.btn input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

dialog {
  border: 0; padding: 0; width: min(560px, 100vw); max-height: 92vh; border-radius: 16px;
  background: var(--surface); color: var(--ink);
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
@media (max-width: 600px) {
  dialog { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
}
dialog form, .job { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
dialog h2 { margin: 0; font-size: 20px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font-size: 16px; width: 100%;
}
textarea { resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }

.job .info { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 15px; }
.job .info dt { color: var(--muted); }
.job .info dd { margin: 0; overflow-wrap: anywhere; }
.job h3 { margin: 6px 0 0; font-size: 16px; }
.check { display: flex; flex-direction: column; gap: 4px; }
.check label { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); font-size: 15px; min-height: 36px; }
.check input { width: 22px; height: 22px; min-height: 0; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.ph { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); display: flex; flex-direction: column; }
.ph img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.ph .bar { display: flex; justify-content: space-between; align-items: center; gap: 4px; padding: 6px; font-size: 12px; }
.ph button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 8px; cursor: pointer; font-size: 12px; }
.ph button.on { background: var(--done); border-color: var(--done); color: var(--surface); }
.ph button.star.on { background: var(--pending); border-color: var(--pending); }
.ph .kind { color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-size: 10px; }
.uploading { font-size: 13px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 99px; font-size: 14px; z-index: 50; max-width: calc(100vw - 32px);
}
@media (prefers-reduced-motion: no-preference) { .toast { transition: opacity .2s; } }
