* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --brand: #b3261e;
  --brand-dark: #8c1d17;
  --bg: #faf7f5;
  --card: #ffffff;
  --text: #1f1a17;
  --muted: #7a6f6a;
  --ok: #1b7f3b;
  --warn: #b3261e;
  --amber: #9a6a00;
  --blue: #33507a;
  --line: #e8e0dc;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh; font-size: 15px;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 60px; }
.wrap.wide { max-width: 1180px; }
header.app {
  background: var(--brand); color: #fff; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
header.app h1 { font-size: 17px; font-weight: 700; }
header.app .sub { font-size: 12px; opacity: .85; }
header.app .who { font-size: 12px; text-align: right; opacity: .95; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; margin-top: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card.tight { padding: 12px; }
h2 { font-size: 16px; margin-bottom: 4px; }
h3 { font-size: 14px; margin-bottom: 6px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; padding: 11px; font-size: 16px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--text); font-family: inherit;
}
textarea { resize: vertical; min-height: 56px; }
button {
  width: 100%; padding: 13px; margin-top: 12px; font-size: 15px; font-weight: 700;
  color: #fff; background: var(--brand); border: 0; border-radius: 12px; cursor: pointer;
}
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary { background: #fff; color: var(--brand); border: 2px solid var(--brand); }
button.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); font-weight: 600; }
button.small { width: auto; padding: 8px 13px; font-size: 13px; margin: 0; }
button.danger { background: #fff; color: var(--warn); border: 1px solid var(--warn); }
button.go { background: var(--ok); }
.status { margin-top: 10px; font-size: 14px; padding: 10px 12px; border-radius: 10px;
          display: none; white-space: pre-wrap; }
.status.show { display: block; }
.status.ok { background: #e6f4ea; color: var(--ok); }
.status.err { background: #fdeaea; color: var(--warn); }
.status.info { background: #eef2f8; color: var(--blue); }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }
.row.tight { gap: 6px; }
.right { text-align: right; }
a { color: var(--brand); }

.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.pill.ok { background: #e6f4ea; color: var(--ok); }
.pill.bad { background: #fdeaea; color: var(--warn); }
.pill.mut { background: #f0ece9; color: var(--muted); }
.pill.warn { background: #fdf3e0; color: var(--amber); }
.pill.info { background: #eef2f8; color: var(--blue); }

.tabs { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.tabs button { width: auto; margin: 0; padding: 9px 14px; font-size: 13.5px;
               background: #fff; color: var(--text); border: 1px solid var(--line); font-weight: 600; }
.tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.seg { display: flex; gap: 6px; margin-top: 8px; }
.seg button { margin: 0; padding: 10px 6px; font-size: 13px; background: #fff;
              color: var(--text); border: 1px solid var(--line); font-weight: 600; }
.seg button.active { background: var(--brand); color: #fff; border-color: var(--brand); }

table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; font-size: 12px; }
.tablewrap { overflow-x: auto; }
tr.bad td { background: #fdeaea; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #faf7f5; }

/* the countdown strip at the top of the staff app */
.clockbar { display: flex; align-items: center; justify-content: space-between; gap: 10px;
            padding: 10px 14px; border-radius: 12px; margin-top: 12px; font-size: 13px; font-weight: 600; }
.clockbar.ok { background: #e6f4ea; color: var(--ok); }
.clockbar.warn { background: #fdf3e0; color: var(--amber); }
.clockbar.bad { background: #fdeaea; color: var(--warn); }
.clockbar .big { font-size: 18px; font-weight: 800; }

/* one task in a list */
.task { border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-top: 9px; background: #fff; }
.task.done { border-left: 5px solid var(--ok); }
.task.miss { border-left: 5px solid var(--warn); }
.task.move { border-left: 5px solid var(--amber); }
.task.cancel { border-left: 5px solid var(--muted); opacity: .75; }
.task.open { border-left: 5px solid var(--blue); }
.task.gate { border: 2px solid var(--warn); background: #fffafa; }
.task .t-title { font-weight: 700; font-size: 14.5px; line-height: 1.35; }
.task .t-meta { font-size: 12px; color: var(--muted); margin-top: 5px; display: flex;
                gap: 8px; flex-wrap: wrap; align-items: center; }
.task .t-reason { font-size: 12.5px; margin-top: 6px; padding: 6px 8px; border-radius: 8px;
                  background: #f7f3f1; color: #5c534f; }
.task .acts { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 9px; }
.task .acts button { width: auto; margin: 0; padding: 7px 10px; font-size: 12.5px;
                     background: #fff; color: var(--text); border: 1px solid var(--line); font-weight: 600; }
.task .acts button.sel { background: var(--brand); color: #fff; border-color: var(--brand); }
.task .acts button.done.sel { background: var(--ok); border-color: var(--ok); }

.meter { height: 9px; border-radius: 999px; background: #efe9e6; overflow: hidden; margin-top: 6px; }
.meter > span { display: block; height: 100%; background: var(--ok); }
.meter.mid > span { background: var(--amber); }
.meter.low > span { background: var(--warn); }

.totals { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.totals .box { flex: 1; min-width: 108px; background: #fff; border: 1px solid var(--line);
               border-radius: 12px; padding: 11px; text-align: center; }
.totals .box .n { font-size: 21px; font-weight: 800; }
.totals .box .l { font-size: 11.5px; color: var(--muted); }
.totals .box.bad .n { color: var(--warn); }
.totals .box.ok .n { color: var(--ok); }

/* simple horizontal bar chart used for categories + last-14-days */
.bars { margin-top: 8px; }
.bars .b { display: flex; align-items: center; gap: 8px; margin-top: 5px; font-size: 12.5px; }
.bars .b .lab { width: 118px; color: var(--muted); flex: 0 0 auto; }
.bars .b .track { flex: 1; height: 14px; background: #f2ecea; border-radius: 4px; overflow: hidden; }
.bars .b .track > span { display: block; height: 100%; background: var(--brand); }
.bars .b .v { width: 34px; text-align: right; font-weight: 700; flex: 0 0 auto; }
.days { display: flex; gap: 3px; align-items: flex-end; height: 66px; margin-top: 8px; }
.days .d { flex: 1; background: #f2ecea; border-radius: 3px 3px 0 0; position: relative; min-height: 3px; }
.days .d > span { position: absolute; bottom: 0; left: 0; right: 0; background: var(--ok); border-radius: 3px 3px 0 0; }

/* warehouse grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.item { border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; text-align: center; }
.item .ph { width: 100%; height: 96px; object-fit: contain; background:
   repeating-conic-gradient(#f4f0ee 0% 25%, #fff 0% 50%) 50% / 14px 14px; border-radius: 8px; }
.item .nm { font-size: 12.5px; font-weight: 700; margin-top: 6px; line-height: 1.3; }
.item .qt { font-size: 11.5px; color: var(--muted); }
.item.low { border-color: var(--warn); }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.thumbs img { width: 74px; height: 74px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.thumbs a { font-size: 11px; }

/* cutout tool */
.cutout { display: none; }
.cutout.show { display: block; }
.cutout canvas { width: 100%; max-height: 320px; object-fit: contain; border-radius: 10px;
  background: repeating-conic-gradient(#f4f0ee 0% 25%, #fff 0% 50%) 50% / 16px 16px; border: 1px solid var(--line); }

.issue { font-size: 12.5px; padding: 6px 9px; border-radius: 8px; margin-top: 5px; }
.issue.critical { background: #fdeaea; color: var(--warn); font-weight: 600; }
.issue.warn { background: #fdf3e0; color: var(--amber); }

.ev { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 8px; background: #fff; }
.ev.soon { border-left: 5px solid var(--amber); }
.ev.risk { border-left: 5px solid var(--warn); }
.ev .when { font-size: 12px; color: var(--muted); }
.ev .what { font-weight: 700; font-size: 14px; margin-top: 2px; }

/* month calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.cal .hd { font-size: 11px; color: var(--muted); text-align: center; font-weight: 700; }
.cal .cell { min-height: 74px; background: #fff; border: 1px solid var(--line); border-radius: 8px;
             padding: 4px; font-size: 11px; overflow: hidden; }
.cal .cell.off { background: transparent; border: 0; }
.cal .cell .dn { font-weight: 700; color: var(--muted); }
.cal .cell.today { border-color: var(--brand); border-width: 2px; }
.cal .cell .ce { display: block; border-radius: 4px; padding: 1px 4px; margin-top: 2px;
                 background: #eef2f8; color: #33507a; white-space: nowrap; overflow: hidden;
                 text-overflow: ellipsis; cursor: pointer; }
.cal .cell .ce.risk { background: #fdeaea; color: var(--warn); font-weight: 700; }
.calnav { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.calnav b { font-size: 15px; }

dialog { border: 0; border-radius: 16px; padding: 0; max-width: 640px; width: 94%; }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog .dlg { padding: 18px; max-height: 84vh; overflow: auto; }
.hide { display: none !important; }
.nowrap { white-space: nowrap; }
