/* Grimmway Appointments — internal warehouse scheduling console.
   Dense ops console: clean tables, status color chips, dark green top bar. */
:root {
  --bg: #f3f5f6; --card: #fff; --ink: #1c2923; --muted: #6f7c75;
  --line: #dce2e0; --nav: #103722; --nav-ink: #dfe9e3;
  --accent: #194f32; --accent-hover: #143f28;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); margin: 0; color: var(--ink); }
a { color: var(--accent); }

/* ---- top nav ---- */
.topnav { background: var(--nav); color: var(--nav-ink); display: flex; align-items: center;
  padding: 0 20px; height: 56px; position: sticky; top: 0; z-index: 40; gap: 18px; }
.topnav .brand { color: #fff; font-weight: 800; font-size: 16px; text-decoration: none; white-space: nowrap; }
.topnav .brand span { font-weight: 400; opacity: .7; font-size: 13px; }
.topnav nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; }
.topnav nav a { color: var(--nav-ink); text-decoration: none; font-size: 13px; padding: 8px 12px;
  border-radius: 6px; white-space: nowrap; opacity: .85; }
.topnav nav a:hover { background: rgba(255,255,255,.1); opacity: 1; }
.topnav nav a.active { background: rgba(255,255,255,.16); opacity: 1; font-weight: 700; }
.topnav .who { font-size: 12px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.topnav .who .btn { margin: 0; padding: 5px 10px; font-size: 12px; }

/* ---- layout ---- */
.main { padding: 24px; max-width: 1400px; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px;
  flex-wrap: wrap; gap: 10px; }
.topbar h1 { margin: 0; font-size: 22px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---- cards / tables ---- */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
  box-shadow: 0 4px 18px rgba(0,0,0,.06); }
.card h2 { margin: 0 0 12px; font-size: 17px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: .04em; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid #edf0ef; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f7faf8; }
.muted { color: var(--muted); font-size: 13px; }
.right { text-align: right; }
.center { text-align: center; }

/* ---- chips / badges ---- */
.chip { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px;
  font-weight: 700; white-space: nowrap; }
.st-NEW { background: #fff4e0; color: #b26a00; }
.st-CONFIRMED { background: #e6f4ea; color: #1a7f37; }
.st-CANCELLED { background: #fdecec; color: #b93b3b; }
.st-CHECKED_IN { background: #e8f0fe; color: #1a56db; }
.st-BACKED_INTO_DOOR { background: #e7f6fd; color: #0b6fa4; }
.st-WAITING_ON_PRODUCT { background: #fff8dd; color: #8a6d1a; }
.st-INSPECTION { background: #f1e8fd; color: #6d28d9; }
.st-BILLING_OUT { background: #fdeee4; color: #b45309; }
.st-LOADED { background: #dcf5f1; color: #0b7c6b; }
.st-DEPARTED { background: #eef0f1; color: #5f6b6d; }
.role-viewer { background: #eef2f0; color: #56645d; }
.role-coordinator { background: #e8f0fe; color: #1a56db; }
.role-admin { background: #fff4e0; color: #b26a00; }
.exc-badge { background: #f3e8ff; color: #6d28d9; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; white-space: nowrap; }

/* ---- forms / buttons ---- */
.btn { font-size: 13px; font-weight: 700; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; margin-right: 6px; text-decoration: none; display: inline-block; color: var(--ink); }
.btn.primary { background: var(--accent); color: #fff; border: none; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: #b93b3b; border-color: #f0caca; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:active { transform: scale(.97); }
label { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin: 10px 0 4px;
  text-transform: uppercase; letter-spacing: .04em; }
input, select, textarea { width: 100%; font-size: 14px; padding: 9px; border: 1px solid var(--line);
  border-radius: 6px; font-family: inherit; background: #fff; color: var(--ink); }
input[type="checkbox"] { width: auto; }
input[type="time"] { padding: 7px; }
textarea { min-height: 70px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 16px; }
.err { color: #b93b3b; font-size: 13px; margin-top: 8px; }
.okmsg { color: #194f32; font-size: 13px; margin-top: 8px; }
.checkline { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 14px; }
.checkline input { margin: 0; }

/* ---- filters ---- */
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.filters > div { display: flex; flex-direction: column; }
.filters label { margin: 0 0 4px; }
.filters input, .filters select { width: auto; min-width: 130px; }
.statbox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.statbox label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  text-transform: none; letter-spacing: 0; margin: 0 8px 0 0; color: var(--ink); }
.statbox input[type="checkbox"] { margin: 0; }

/* ---- day board ---- */
.daynav { display: flex; align-items: center; gap: 6px; }
.daynav input[type="date"] { width: auto; }
.viewtoggle { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.viewtoggle button { border: none; background: #fff; padding: 8px 14px; font-size: 13px; font-weight: 700;
  cursor: pointer; color: var(--muted); }
.viewtoggle button.on { background: var(--accent); color: #fff; }
.board { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 8px; }
.loc-col { min-width: 250px; flex: 1; background: var(--card); border-radius: var(--radius);
  box-shadow: 0 4px 18px rgba(0,0,0,.06); overflow: hidden; }
.loc-col .lc-head { padding: 12px 14px; border-bottom: 1px solid var(--line); background: #f7faf8; }
.loc-col .lc-head b { font-size: 14px; }
.loc-col .lc-head .cnt { font-size: 12px; color: var(--muted); }
.hour-row { display: flex; border-bottom: 1px solid #f0f2f1; min-height: 34px; }
.hour-row:last-child { border-bottom: none; }
.hour-lbl { width: 64px; flex-shrink: 0; font-size: 11px; color: var(--muted); padding: 8px 4px 8px 10px;
  border-right: 1px solid #f0f2f1; }
.hour-body { flex: 1; padding: 4px 6px; display: flex; flex-direction: column; gap: 4px; }
.bk { border-left: 4px solid #999; background: #fbfcfb; border-radius: 0 6px 6px 0; padding: 6px 8px;
  font-size: 12px; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.bk:hover { filter: brightness(.97); }
.bk .bk-t { font-weight: 800; font-size: 12px; }
.bk .bk-c { font-weight: 600; margin-top: 1px; }
.bk .bk-x { color: var(--muted); font-size: 11px; }
.bk-NEW { border-color: #e8930c; background: #fffaf0; }
.bk-CONFIRMED { border-color: #1a7f37; background: #f2faf4; }
.bk-CANCELLED { border-color: #b93b3b; background: #fdf2f2; opacity: .75; }
.bk-CHECKED_IN { border-color: #1a56db; background: #f2f6fe; }
.bk-BACKED_INTO_DOOR { border-color: #0b6fa4; background: #f0f9fe; }
.bk-WAITING_ON_PRODUCT { border-color: #d9a400; background: #fffdf0; }
.bk-INSPECTION { border-color: #6d28d9; background: #faf6ff; }
.bk-BILLING_OUT { border-color: #b45309; background: #fff8f1; }
.bk-LOADED { border-color: #0b7c6b; background: #effaf8; }
.bk-DEPARTED { border-color: #8a9496; background: #f4f6f6; opacity: .8; }
.empty-hour { color: #c9d2ce; font-size: 11px; }

/* ---- customer track portal (/track) ---- */
.track-hero { background: var(--nav); color: #fff; padding: 28px 20px; text-align: center; }
.track-hero h1 { margin: 0 0 6px; font-size: 24px; }
.track-hero p { margin: 0; opacity: .8; font-size: 14px; }
.track-wrap { max-width: 760px; margin: 0 auto; padding: 20px 14px 40px; }
.track-search { display: flex; gap: 8px; }
.track-search input { flex: 1; font-size: 16px; padding: 12px; text-transform: uppercase; }
.track-search .btn { margin: 0; padding: 12px 20px; font-size: 15px; }
.track-hint { margin-top: 8px; }
.track-card-head { display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.track-code { font-size: 22px; font-weight: 800; letter-spacing: .06em; }
.vtl { position: relative; margin: 10px 0 0; padding-left: 30px; list-style: none; }
.vtl::before { content: ''; position: absolute; left: 10px; top: 10px; bottom: 10px;
  width: 2px; background: var(--line); }
.vtl-ev { position: relative; padding: 9px 0; }
.vtl-ev .dot { position: absolute; left: -30px; top: 13px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; border: 2px solid var(--line); }
.vtl-ev.done .dot { background: var(--accent); border-color: var(--accent); }
.vtl-ev.now .dot { background: #fff; border-color: var(--accent);
  box-shadow: 0 0 0 5px rgba(25,79,50,.15); }
.vtl-ev.pending { opacity: .5; }
.vtl-ev .st-name { font-weight: 700; font-size: 14px; }
.vtl-ev time { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.autorefresh { display: flex; align-items: center; gap: 6px; }
.autorefresh .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ---- staff status board ---- */
.door-sel { width: auto; min-width: 76px; padding: 5px 8px; font-size: 12px; }
.board-actions { white-space: nowrap; }
.board-actions .btn { margin: 2px 4px 2px 0; }
@media (max-width: 900px) {
  .track-search { flex-direction: column; }
  .track-search .btn { width: 100%; }
}

/* ---- week table ---- */
.week-table td { text-align: center; }
.week-cell { cursor: pointer; padding: 10px 6px; border-radius: 8px; }
.week-cell:hover { background: #f2f7f4; }
.week-cell .n { font-size: 18px; font-weight: 800; }
.week-cell .s { font-size: 11px; color: var(--muted); }

/* ---- slot picker ---- */
.slots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.slot { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13px;
  cursor: pointer; background: #fff; text-align: center; min-width: 108px; }
.slot b { display: block; font-size: 13px; }
.slot .rem { font-size: 11px; color: var(--muted); }
.slot:hover { border-color: var(--accent); }
.slot.sel { background: var(--accent); color: #fff; border-color: var(--accent); }
.slot.sel .rem { color: #dfe9e3; }
.slot.full { opacity: .4; cursor: not-allowed; background: #f5f6f5; }
.slot .exc { display: block; margin-top: 3px; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid var(--line); }
.tabs button { border: none; background: none; font-size: 14px; font-weight: 700; padding: 10px 16px;
  cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.tabpage { display: none; }
.tabpage.on { display: block; }

/* ---- timeline ---- */
.timeline { border-top: 1px solid var(--line); margin-top: 8px; }
.ev { padding: 10px 0; border-bottom: 1px solid #f0f2f1; font-size: 13px; }
.ev time { color: var(--muted); font-size: 11px; display: block; }

/* ---- modal ---- */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: none;
  align-items: center; justify-content: center; z-index: 50; }
.modal-back.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); padding: 24px; width: 560px; max-width: 94vw;
  max-height: 90vh; overflow-y: auto; }
.modal h2 { margin-top: 0; }

/* ---- auth pages ---- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { background: #fff; border-radius: var(--radius); padding: 36px; width: 400px; max-width: 94vw;
  box-shadow: 0 8px 30px rgba(0,0,0,.1); }
.auth-card h1 { margin: 0 0 4px; font-size: 22px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.auth-card .btn.primary { width: 100%; margin: 14px 0 8px; padding: 11px; font-size: 15px; }

/* ---- report ---- */
.report-loc { page-break-inside: avoid; margin-bottom: 28px; }
.report-loc h2 { font-size: 18px; margin: 0 0 4px; }
.report-loc .rdate { color: var(--muted); font-size: 13px; margin-bottom: 10px; }

/* ---- misc ---- */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.kv dd { margin: 0; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.bulkbar { display: none; align-items: center; gap: 10px; background: #fff8e6; border: 1px solid #f0dfae;
  border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; }
.bulkbar.show { display: flex; }
.section-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 18px 0 8px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }

@media (max-width: 900px) {
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .main { padding: 14px; }
  .topnav { flex-wrap: wrap; height: auto; padding: 8px 12px; }
}

/* ---- print: reservation report ---- */
@media print {
  body { background: #fff; }
  .topnav, .no-print { display: none !important; }
  .main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ccc; padding: 12px; }
  .report-loc { page-break-after: auto; }
  table { font-size: 11px; }
  th, td { padding: 5px 6px; }
  a { color: #000; text-decoration: none; }
}

/* ---- drag-and-drop reschedule ---- */
.bk[draggable="true"] { cursor: grab; }
.bk.dragging { opacity: .45; cursor: grabbing; }
.hour-body { min-height: 34px; border-radius: 6px; transition: background .12s; }
.hour-body.drop-ok { background: #f2f7ff; }
.hour-body.drop-hint { outline: 2px dashed var(--accent); background: #e6f4ea; }
