:root {
  --bg: #0f1216; --panel: #181c22; --panel2: #1f242c; --line: #2a3038;
  --text: #e8eaed; --muted: #9aa3ad; --accent: #b2da08; --accent-ink: #10150a;
  --blue: #3b82f6; --red: #ef4444; --amber: #f59e0b; --green: #22c55e;
  --radius: 10px;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f4f5f7; --panel: #fff; --panel2: #f0f2f5; --line: #dde1e6; --text: #15191f; --muted: #5b6672; }
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--blue); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .5rem; } h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h2 + h2, .card h2:not(:first-child) { margin-top: 1.25rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mono { font-family: ui-monospace, Consolas, monospace; }

header.top { display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--text); font-size: 1.1rem; }
header nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
header nav a { color: var(--muted); padding: .35rem .6rem; border-radius: 6px; }
header nav a.on, header nav a:hover { color: var(--text); background: var(--panel2); text-decoration: none; }
header .right { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
.bell { color: var(--text); font-size: 1.2rem; position: relative; }
.pill { display: inline-block; background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; padding: 0 .4rem; border-radius: 999px; vertical-align: top; }
details.menu { position: relative; }
details.menu summary { cursor: pointer; list-style: none; padding: .35rem .6rem; border-radius: 6px; background: var(--panel2); }
details.menu > div { position: absolute; right: 0; top: 2.4rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem; min-width: 11rem; z-index: 10; display: flex; flex-direction: column; gap: .25rem; }
button.link { background: none; border: 0; color: var(--blue); cursor: pointer; font: inherit; text-align: left; padding: 0; }

main { max-width: 1100px; margin: 0 auto; padding: 1.25rem 16px 3rem; }
main.narrow { max-width: 420px; padding-top: 10vh; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.card.narrow { max-width: 560px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.span2 { grid-column: span 2; }
@media (max-width: 760px) { .grid2, .grid3 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; margin-bottom: .75rem; }
.col { display: flex; flex-direction: column; gap: .5rem; }

label { display: block; margin-bottom: .8rem; font-weight: 600; font-size: .9rem; }
label small { font-weight: 400; display: block; }
input, select, textarea { display: block; width: 100%; margin-top: .3rem; padding: .55rem .65rem; font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
label.check input[type=checkbox] { width: auto; margin: 0; }
label.check input[type=time] { width: auto; margin: 0 0 0 auto; }
.sched { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .4rem 1.5rem; margin-bottom: 1rem; }
.row input { margin-top: 0; width: auto; flex: 1; }

button, .button { display: inline-block; font: inherit; font-weight: 600; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; text-decoration: none; }
button:hover, .button:hover { filter: brightness(1.1); text-decoration: none; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.danger { background: var(--red); color: #fff; border-color: var(--red); }
.big { width: 100%; padding: .8rem; font-size: 1.05rem; }
.huge { width: 100%; padding: 1.4rem; font-size: 1.6rem; border-radius: 14px; }
.huge.in { background: var(--green); color: #052e12; border-color: var(--green); }
.huge.out { background: var(--red); color: #fff; border-color: var(--red); }
.clock { text-align: center; }
.big-status { font-size: 1.3rem; font-weight: 700; margin-bottom: .2rem; }
.big-status.in { color: var(--green); }

table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr.inactive td { opacity: .5; }
td.num, th.num { text-align: right; }
@media (max-width: 640px) { table { font-size: .88rem; } th, td { padding: .45rem .3rem; } }

.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); }
.tag.late, .tag.pending, .tag.open { background: #4a3500; color: #ffd166; border-color: #6b4e00; }
.tag.no_show, .tag.rejected, .tag.loss { background: #4a1414; color: #ff9b9b; border-color: #6b1e1e; }
.tag.on_time, .tag.approved, .tag.received, .tag.resolved { background: #103d21; color: #86efac; border-color: #1b5e33; }
.tag.ordered, .tag.in_progress { background: #10294a; color: #93c5fd; border-color: #1e3f6e; }
.tag.dtf { background: #2d1b4a; color: #d8b4fe; border-color: #44286e; }
.tag.grizzly { background: #0b3a3a; color: #99f6e4; border-color: #145252; }
.tag.shared { background: var(--panel2); }

.flash { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: #103d21; color: #c6f6d5; border-color: #1b5e33; }
.flash.err { background: #4a1414; color: #fecaca; border-color: #6b1e1e; }
.flash.warn { background: #4a3500; color: #fde68a; border-color: #6b4e00; }

ul.plain { list-style: none; padding: 0; margin: 0 0 .75rem; } ul.plain li { padding: .25rem 0; }
dl.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .5rem; margin: 0 0 .75rem; }
dl.stats dt { color: var(--muted); font-size: .8rem; } dl.stats dd { margin: 0; font-size: 1.3rem; font-weight: 700; }
.login h1 { text-align: center; margin-top: .5rem; } .login .muted { text-align: center; margin-bottom: 1.25rem; }
.lowbar { height: 8px; border-radius: 4px; background: var(--panel2); overflow: hidden; }
.lowbar > i { display: block; height: 100%; background: var(--green); }
.lowbar.low > i { background: var(--amber); } .lowbar.out > i { background: var(--red); }
.chat { display: flex; flex-direction: column; gap: .6rem; max-height: 60vh; overflow-y: auto; padding: .5rem; background: var(--panel2); border-radius: 8px; }
.msg { max-width: 85%; padding: .6rem .8rem; border-radius: 12px; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--blue); color: #fff; }
.msg.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.thumbs { display: flex; gap: .5rem; flex-wrap: wrap; }
.thumbs img, .thumbs video { max-width: 160px; max-height: 120px; border-radius: 8px; border: 1px solid var(--line); }
.htmx-request .huge { opacity: .6; }
footer.foot { max-width: 1100px; margin: 0 auto; padding: 1rem 16px 2rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }
.button.small { padding: .35rem .7rem; font-size: .85rem; }
