/* © Capra. App styles: one clean light theme with a dark mode, phone-first. */
:root {
  --brand: #c2410c; --brand-2: #9a3412; --ink: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --bg: #f8fafc; --card: #ffffff; --ok: #15803d; --warn: #b45309; --err: #b91c1c; --soft: #fff7ed;
  --radius: 10px; --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #e2e8f0; --muted: #94a3b8; --line: #1e293b; --bg: #0b1220; --card: #111a2e; --soft: #1f1610; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; } h2 { font-size: 1.15rem; margin: 0 0 .5rem; } h3 { font-size: 1rem; margin: 0 0 .4rem; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .tiny { font-size: .78rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; } .row.end { justify-content: flex-end; } .grow { flex: 1; }
.grid { display: grid; gap: .8rem; } .g2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); } .g4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

button, .btn { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: .5rem .9rem; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; }
button:hover, .btn:hover { border-color: var(--muted); }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--brand-2); }
button.danger { color: var(--err); border-color: currentColor; } button.ghost { background: transparent; }
button.sm { padding: .3rem .6rem; font-size: .86rem; } button.icon { border: 0; background: none; font-size: 1.4rem; padding: 0 .4rem; }
button:disabled { opacity: .55; cursor: wait; }

.field { display: flex; flex-direction: column; gap: .25rem; font-size: .86rem; color: var(--muted); }
.field input, .field select, .field textarea, input.search { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus, input.search:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }

.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 1rem .7rem; display: flex; flex-direction: column; gap: .2rem; position: sticky; top: 0; height: 100vh; }
.side .logo { font-weight: 800; font-size: 1.05rem; padding: .2rem .6rem 1rem; }
.side .logo small { display: block; font-weight: 500; color: var(--muted); font-size: .75rem; }
.side a { display: flex; gap: .55rem; align-items: center; padding: .5rem .6rem; border-radius: 8px; color: var(--ink); text-decoration: none; }
.side a.on, .side a:hover { background: var(--soft); color: var(--brand); }
.side .sp { flex: 1; } .side .by { font-size: .75rem; color: var(--muted); padding: .4rem .6rem; }
main.page { padding: 1.4rem 1.6rem 4rem; max-width: 1200px; width: 100%; }
.top { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.top .sp { flex: 1; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.card + .card { margin-top: .8rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.stat b { display: block; font-size: 1.6rem; } .stat span { color: var(--muted); font-size: .85rem; }
.stat.warn b { color: var(--warn); } .stat.err b { color: var(--err); }

table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th, table.list td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--bg); }
table.list tr.click { cursor: pointer; } table.list tr.click:hover td { background: var(--soft); }
td.num, th.num { text-align: right; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .76rem; font-weight: 600; background: var(--bg); border: 1px solid var(--line); }
.badge.ok { color: var(--ok); border-color: currentColor; } .badge.warn { color: var(--warn); border-color: currentColor; } .badge.err { color: var(--err); border-color: currentColor; } .badge.brand { color: var(--brand); border-color: currentColor; }

.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: .5rem .8rem; color: var(--muted); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.modal-wrap { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.modal { background: var(--card); border-radius: 12px; width: min(520px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; } .modal-body { padding: 1rem; display: grid; gap: .8rem; }

#toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: grid; gap: .4rem; z-index: 60; }
.toast { background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 8px; box-shadow: var(--shadow); max-width: 90vw; }
.toast.err { background: var(--err); color: #fff; }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth .card { width: min(420px, 100%); display: grid; gap: .8rem; }
.auth .brandline { font-weight: 800; font-size: 1.3rem; } .auth .brandline small { display: block; font-weight: 500; color: var(--muted); font-size: .85rem; }

.banner { background: var(--soft); border: 1px solid var(--line); border-left: 4px solid var(--brand); padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.banner.err { border-left-color: var(--err); }

#map { height: 460px; border-radius: var(--radius); border: 1px solid var(--line); }
.jobcard { display: grid; gap: .4rem; }
.jobcard .addr { font-weight: 600; font-size: 1.05rem; }
.qrgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.qrgrid .lbl { border: 1px dashed var(--line); padding: .5rem; text-align: center; border-radius: 8px; }
.qrgrid img { width: 120px; height: 120px; }
video.scan { width: 100%; border-radius: 8px; background: #000; max-height: 50vh; }

.mobnav { display: none; }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side { display: none; }
  main.page { padding: 1rem 1rem 5.5rem; }
  .mobnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line); z-index: 40; overflow-x: auto; }
  .mobnav a { flex: 1; min-width: 72px; text-align: center; padding: .55rem .2rem; font-size: .72rem; color: var(--muted); text-decoration: none; }
  .mobnav a.on { color: var(--brand); font-weight: 600; }
  table.list th.hide-m, table.list td.hide-m { display: none; }
}
