:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #1d1d1b;
  --muted: #6b6a66;
  --line: #e4e2dc;
  --accent: #0f6b5c;
  --accent-soft: #e3f1ee;
  --warn: #9a4a00;
  --warn-soft: #fbecd9;
  --bad: #a3221b;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.empty { color: var(--muted); padding: 2rem 1rem; text-align: center; list-style: none; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0.25rem 0; }

/* sign-in */
.signin { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.signin-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 2rem; width: min(380px, 100%); }
.signin-card h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.02em; }
.signin-card form { display: grid; gap: 0.6rem; margin-top: 1.5rem; }
.signin-card input { padding: 0.7rem; border: 1px solid var(--line); border-radius: 8px; }
.signin-card button { padding: 0.75rem; border: 0; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 1.5rem; padding: 0.75rem 1.25rem; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.brand { font-weight: 700; letter-spacing: -0.01em; }
.stats { display: flex; gap: 1.5rem; margin-left: auto; }
.stats div { display: flex; flex-direction: column; line-height: 1.1; }
.stats b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.stats span { font-size: 0.75rem; color: var(--muted); }

/* layout */
.layout { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 62px); }
.layout[hidden] { display: none; }
.orders { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.orders-tools { padding: 0.75rem; display: grid; gap: 0.5rem; border-bottom: 1px solid var(--line); }
.orders-tools input { padding: 0.55rem 0.7rem; border: 1px solid var(--line); border-radius: 8px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; white-space: nowrap; border: 0; background: none; padding: 0.4rem 0.8rem; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.order-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.order-list button { width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 0.7rem 0.9rem; cursor: pointer; display: grid; gap: 0.2rem; }
.order-list button:hover { background: #faf9f6; }
.order-list button.sel { background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.row1, .row3 { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.row2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row3 { font-size: 0.8rem; }
.pill { font-size: 0.72rem; padding: 0.1rem 0.5rem; border-radius: 99px; }
.pill.open { background: var(--warn-soft); color: var(--warn); }
.pill.done { background: #eceae4; color: var(--muted); }

/* detail */
.detail { overflow-y: auto; padding: 1.25rem 1.5rem 3rem; min-height: 0; }
.detail-head h2 { margin: 0.2rem 0; font-size: 1.5rem; }
.detail-head p { margin: 0.2rem 0; }
.back { display: none; }
.note { background: var(--warn-soft); color: var(--warn); padding: 0.5rem 0.7rem; border-radius: 8px; margin-top: 0.6rem !important; }
.lines { display: grid; gap: 0.6rem; margin-top: 1.25rem; }
.line { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 0.9rem; display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: start; }
.line-main { display: flex; gap: 0.75rem; }
.qty { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 2ch; }
.name { font-weight: 600; }
.subjig { margin-top: 0.3rem; }
.auto { margin-top: 0.3rem; color: var(--muted); font-style: italic; }
.line-controls { display: grid; gap: 0.4rem; min-width: 210px; }
.line-controls label { display: grid; gap: 0.15rem; font-size: 0.75rem; color: var(--muted); }
.line-controls select { padding: 0.45rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-size: 0.9rem; }

.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 0.55rem 1rem; border-radius: 8px; font-size: 0.9rem; }
.toast.bad { background: var(--bad); }

/* phones */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 0.5rem 1rem; }
  #refresh { margin-left: auto; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .stats { order: 4; width: 100%; margin: 0; justify-content: space-between; }
  .layout { grid-template-columns: 1fr; height: auto; }
  .orders { border-right: 0; }
  .detail { display: none; }
  body.showing-detail .orders { display: none; }
  body.showing-detail .detail { display: block; }
  .back { display: inline-block; }
  .line { grid-template-columns: 1fr; }
  .line-controls { min-width: 0; }
  .page { padding: 0.75rem; }
  .grid th:nth-child(n+5):not(:last-child), .grid td:nth-child(n+5):not(:last-child) { padding-left: 0.3rem; padding-right: 0.3rem; }
  #view-queue .grid th:nth-child(5), #view-queue .grid td:nth-child(5),
  #view-queue .grid th:nth-child(6), #view-queue .grid td:nth-child(6) { display: none; }
  #view-stock .grid th:nth-child(2), #view-stock .grid td:nth-child(2),
  #view-stock .grid th:nth-child(3), #view-stock .grid td:nth-child(3) { display: none; }
  .plate-list { grid-template-columns: 1fr; }
}

/* buttons */
button.primary, button.ghost, button:not(.link).danger { border-radius: 8px; padding: 0.45rem 0.85rem; cursor: pointer; border: 1px solid transparent; font-size: 0.9rem; }
button.primary { background: var(--accent); color: #fff; }
button.primary:disabled { background: #b9c9c5; cursor: default; }
button.ghost { background: var(--panel); border-color: var(--line); color: var(--ink); }
button:not(.link).danger { background: #fff; border-color: #e7c4c1; color: var(--bad); }
.link.danger { color: var(--bad); }

/* tabs */
.tabs { display: flex; gap: 0.25rem; }
.tabs button { border: 0; background: none; padding: 0.45rem 0.8rem; border-radius: 8px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.tabs button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* full-width pages */
.page { padding: 1.1rem 1.5rem 3rem; }
.page[hidden] { display: none; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 0.4rem; }
.toolbar h2 { margin: 0 0.75rem 0 0; font-size: 1.3rem; }
.toolbar input, .toolbar select { padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.toolbar input { min-width: 260px; }
.spacer { flex: 1; }
.hint { margin: 0 0 0.8rem; }

/* tables */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.grid th { text-align: left; font-size: 0.75rem; font-weight: 600; color: var(--muted); padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line); background: #fbfaf8; position: sticky; top: 0; }
.grid td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid tr:last-child td { border-bottom: 0; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid .name { font-weight: 600; text-align: left; padding: 0; }
.grid tr.covered td { color: var(--muted); }
.grid tr.low td:first-child { box-shadow: inset 3px 0 var(--warn); }
.grid td.late { color: var(--bad); font-weight: 600; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .link { margin-left: 0.6rem; font-size: 0.85rem; }
tr.history td { background: #faf9f6; }
.mini { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.mini th, .mini td { padding: 0.25rem 0.5rem; text-align: left; border-bottom: 1px solid var(--line); }
.mini .neg { color: var(--bad); }

/* plates */
.plate-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0.8rem; }
.plate { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 0.9rem; display: grid; gap: 0.5rem; }
.plate.printing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.plate.failed { border-color: #e7c4c1; }
.plate header { display: flex; justify-content: space-between; align-items: center; font-size: 1.05rem; }
.plate ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.plate li { display: flex; justify-content: space-between; gap: 0.5rem; }
.plate footer { display: grid; gap: 0.5rem; }
.plate-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* pills */
.pill { display: inline-block; font-size: 0.72rem; padding: 0.1rem 0.5rem; border-radius: 99px; background: #eceae4; color: var(--muted); }
.pill.warn, .pill.failed { background: #f8dedb; color: var(--bad); }
.pill.planned { background: #e7eefb; color: #2a4f8f; }
.pill.printing { background: var(--accent-soft); color: var(--accent); }
.jobs { margin-top: 0.3rem; }

/* dialog */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(440px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
dialog::backdrop { background: rgba(20, 20, 18, 0.35); }
.dlg { display: grid; gap: 0.75rem; padding: 1.2rem 1.3rem; }
.dlg h3 { margin: 0; }
.dlg label { display: grid; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.dlg input, .dlg select { padding: 0.55rem; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; color: var(--ink); background: #fff; }
.dlg-buttons { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.3rem; }

/* component record */
.panel-dialog { width: min(860px, 96vw); max-height: 92vh; overflow-y: auto; overflow-x: hidden; }
.comp { padding: 1.2rem 1.4rem 1.6rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.comp > * { min-width: 0; }
.comp section { overflow-x: auto; }
.comp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.comp-head h2 { margin: 0; font-size: 1.4rem; }
.comp-head p { margin: 0.25rem 0 0; }
.comp-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
a.button, label.button { display: inline-block; text-decoration: none; cursor: pointer; }
a.button.ghost, label.button.ghost { background: var(--panel); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 0.45rem 0.85rem; font-size: 0.9rem; }
.photos { display: flex; gap: 0.6rem; overflow-x: auto; }
.photos figure { margin: 0; display: grid; gap: 0.2rem; justify-items: start; }
.photos img { height: 160px; width: auto; max-width: 260px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #eee; }
.photos .broken-note { display: none; max-width: 220px; }
.photos figure.broken img { display: none; }
.photos figure.broken .broken-note { display: block; }
.comp-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 1rem; background: #faf9f6; border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem; }
.comp-form label { display: grid; gap: 0.2rem; font-size: 0.8rem; color: var(--muted); }
.comp-form input, .comp-form select, .comp-form textarea { padding: 0.5rem; border: 1px solid var(--line); border-radius: 7px; font-size: 0.95rem; color: var(--ink); background: #fff; font-family: inherit; }
.comp-form .wide { grid-column: 1 / -1; }
.comp-form .dims { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.3rem; }
.comp-form input, .comp-form select { min-width: 0; width: 100%; }
.form-buttons { display: flex; justify-content: flex-end; }
.comp section h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.scan-btn { padding: 0.35rem 0.8rem !important; }

/* scanner */
#scanner { width: min(480px, 96vw); }
.scan { display: grid; gap: 0.6rem; padding: 1rem; }
.scan video { width: 100%; border-radius: 10px; background: #111; aspect-ratio: 4 / 3; object-fit: cover; }
.scan-manual { display: flex; gap: 0.4rem; }
.scan-manual input { flex: 1; padding: 0.5rem; border: 1px solid var(--line); border-radius: 8px; }

@media (max-width: 760px) {
  .comp-form { grid-template-columns: 1fr; }
  .panel-dialog { max-height: 100dvh; height: 100dvh; width: 100vw; max-width: 100vw; margin: 0; border-radius: 0; }
}

/* jigs */
.grid .name.plain { font-weight: 400; }
.comp-form label.check { display: flex; align-items: center; gap: 0.4rem; font-size: 0.95rem; color: var(--ink); }
.comp-form label.check input { width: auto; }
.comp-links input { padding: 0.25rem 0.4rem; border: 1px solid var(--line); border-radius: 6px; font-size: 0.85rem; width: 100%; min-width: 0; }
.comp-links input[type=number] { width: 4.5rem; text-align: right; }
.add-link { display: flex; gap: 0.4rem; margin-top: 0.6rem; }
.add-link input { padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.add-link input[name=pick] { flex: 1; }
.add-link select { flex: 1; min-width: 0; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; }
.add-link input[name=qty] { width: 4.5rem; }
.comp section > .ghost { margin-top: 0.6rem; }
@media (max-width: 760px) {
  #view-jigs .grid th:nth-child(3), #view-jigs .grid td:nth-child(3),
  #view-jigs .grid th:nth-child(n+5), #view-jigs .grid td:nth-child(n+5) { display: none; }
}
.mini a { color: var(--accent); }

/* projects & samples */
.who { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; background: #faf9f6; border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.9rem; }
.comp-form .inline { display: flex; gap: 0.6rem; align-items: center; }
.comp-form .inline input { flex: 1; }
.comp-form .inline .link { white-space: nowrap; font-size: 0.85rem; }
.clip { max-width: 38ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill.warn { background: #f8dedb; color: var(--bad); }
.tabs { overflow-x: auto; }
@media (max-width: 760px) {
  #view-projects .grid th:nth-child(2), #view-projects .grid td:nth-child(2),
  #view-projects .grid th:nth-child(n+5), #view-projects .grid td:nth-child(n+5),
  #view-samples .grid th:nth-child(3), #view-samples .grid td:nth-child(3),
  #view-samples .grid th:nth-child(n+6), #view-samples .grid td:nth-child(n+6) { display: none; }
}
.late { color: var(--bad); font-weight: 600; }
.stats span { white-space: nowrap; }
.who-rows { display: grid; gap: 0.4rem; }
.who-rows > div { display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; }
.who-rows > div > .muted.small { min-width: 4.5rem; }

/* section sub-menu */
.subtabs { display: flex; gap: 0.25rem; padding: 0.35rem 1.25rem; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: 62px; z-index: 1; }
.subtabs[hidden] { display: none; }
.subtabs button { border: 0; background: none; padding: 0.35rem 0.75rem; border-radius: 7px; cursor: pointer; color: var(--muted); white-space: nowrap; font-size: 0.9rem; }
.subtabs button.on { color: var(--accent); font-weight: 600; box-shadow: inset 0 -2px var(--accent); border-radius: 0; }
@media (max-width: 760px) { .subtabs { position: static; padding: 0.3rem 0.75rem; } }
@media (max-width: 760px) {
  #view-customers .grid th:nth-child(n+3), #view-customers .grid td:nth-child(n+3) { display: none; }
  #view-customers .grid th:nth-child(4), #view-customers .grid td:nth-child(4) { display: table-cell; }
}
.comp section h3 .link { margin-left: 0.5rem; font-weight: 400; }
.merge { background: #faf9f6; border: 1px dashed var(--line); border-radius: 10px; padding: 0.7rem 0.9rem; }
.merge p { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: 0 0 0.4rem; }
button.ghost.small { padding: 0.2rem 0.55rem; font-size: 0.8rem; }

/* inbox & tickets */
.grid tr.attention td:first-child { box-shadow: inset 3px 0 var(--bad); }
.clip2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 60ch; }
.nowrap { white-space: nowrap; }
.seg .count { font-size: 0.75rem; opacity: 0.8; margin-left: 0.15rem; }
.msg { border: 1px solid var(--line); border-radius: 10px; padding: 0.55rem 0.75rem; margin: 0.45rem 0; background: var(--panel); }
.msg.out { background: #f3f8f6; border-color: #d4e6df; }
.msg-head { margin-bottom: 0.25rem; }
.msg-body { white-space: pre-wrap; word-wrap: break-word; font: inherit; font-size: 0.9rem; margin: 0; max-height: 22rem; overflow: auto; }
.reply .msg-body { background: #fffdf5; border: 1px dashed #e6d9a8; border-radius: 8px; padding: 0.6rem 0.75rem; }
.decide { background: #fff6ec; border: 1px solid #f1d7b5; border-radius: 10px; padding: 0.7rem 0.9rem; }
.decide.ready { background: #eef6ff; border-color: #c9ddf3; }
.decide p { margin: 0 0 0.5rem; }
.decide select { padding: 0.4rem 0.5rem; border: 1px solid var(--line); border-radius: 8px; max-width: 16rem; }
.linked-box { background: #f3f8f6; border: 1px solid #d4e6df; border-radius: 10px; padding: 0.55rem 0.8rem; font-size: 0.92rem; }
.thread-box { border-top: 1px solid var(--line); padding-top: 0.6rem; margin-top: 0.6rem; }
.thread-head { display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; }
a.button.primary { background: var(--accent); color: #fff; border-radius: 8px; padding: 0.45rem 0.85rem; font-size: 0.9rem; border: 1px solid transparent; }
@media (max-width: 760px) {
  #view-inbox .grid th:nth-child(1), #view-inbox .grid td:nth-child(1),
  #view-inbox .grid th:nth-child(5), #view-inbox .grid td:nth-child(5),
  #view-tickets .grid th:nth-child(3), #view-tickets .grid td:nth-child(3),
  #view-tickets .grid th:nth-child(6), #view-tickets .grid td:nth-child(6) { display: none; }
}

/* Orders section on tickets, projects and customers */
.orders-box .orders-mini td { vertical-align: top; }
.orders-box .decide { margin: .25rem 0 .75rem; }
.inline-add { display: flex; gap: .5rem; margin-top: .5rem; }
.inline-add input { max-width: 16rem; }
.meeting .steps { margin: .3rem 0 0; padding-left: 1.1rem; }
.meeting .steps li { margin-bottom: .15rem; }
.last-word { font-size: .75rem; margin-top: .15rem; font-weight: 500; }
.last-word.us { color: var(--muted, #6b7280); }
.last-word.them { color: #1d4ed8; }
.source { margin: .75rem 0; }
.form-answers { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: .25rem .75rem; margin: .4rem 0; font-size: .9rem; }
.form-answers dt { color: var(--muted, #6b7280); }
.form-answers dd { margin: 0; white-space: pre-wrap; }
.form-files { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.form-files img { width: 120px; height: 120px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line, #e5e7eb); }
.source blockquote { margin: .3rem 0; padding: .4rem .7rem; border-left: 3px solid var(--line, #e5e7eb); background: #fafafa; }

/* Open Order Items board */
.board-tools { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.8rem; }
.board-tools h2 { margin: 0; font-size: 1.2rem; }
.board-tools input { flex: 1; max-width: 420px; padding: 0.45rem 0.7rem; border: 1px solid var(--line); border-radius: 8px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(260px, 1fr)); gap: 0.8rem; align-items: start; overflow-x: auto; }
.bcol { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem; min-height: 8rem; }
.bcol h3 { margin: 0.1rem 0.2rem 0.5rem; font-size: 1.05rem; }
.bgroup { margin: 0.6rem 0.2rem 0.35rem; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.bgroup .count { background: var(--line); border-radius: 10px; padding: 0 0.45rem; font-weight: 500; }
.bcard { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.6rem; margin-bottom: 0.45rem; }
.bcard-top { display: flex; gap: 0.5rem; justify-content: space-between; }
.bcard-name { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bcard-qty { white-space: nowrap; font-size: 0.9rem; }
.bcard-qty.many { color: #c2185b; font-weight: 700; }
.bcard-sub { display: flex; gap: 0.5rem; align-items: baseline; margin: 0.15rem 0; }
.bcard-sub .late { color: #c62828; font-weight: 700; }
.bcard-actions { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.45rem; }
.bcard-actions button { padding: 0.15rem 0.45rem; font-size: 0.78rem; }
.bcard-actions button.done { border-color: var(--accent); color: var(--accent); }
@media (max-width: 760px) { .board { grid-template-columns: 1fr; } }
.bcard .info { border: 0; background: none; padding: 0 0.1rem; color: #5b7a99; cursor: help; font-size: 0.95rem; line-height: 1; align-self: flex-start; }
.bcard-top { align-items: flex-start; }
.bcard-name { flex: 1; }
.bcard-actions button.make { border-color: #8a4b00; color: #8a4b00; }

/* Home */
.home { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; align-items: start; }
.hcard { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem 0.9rem; }
.hcard.wide { grid-column: 1 / -1; }
.hcard h3 { margin: 0 0 0.55rem; font-size: 1.02rem; }
.htiles { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.htile { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; min-width: 128px; padding: 0.55rem 0.75rem; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; text-align: left; }
.htile b { font-size: 1.5rem; line-height: 1.1; }
.htile span { font-size: 0.8rem; color: var(--muted); }
.htile.warn b { color: #c62828; }
.htile:hover { border-color: var(--accent); }
.hlist { list-style: none; margin: 0; padding: 0; }
.hlist li { padding: 0.35rem 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.hlist li:last-child { border-bottom: 0; }
.home .late { color: #c62828; font-weight: 600; }
@media (max-width: 1000px) { .home { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .home { grid-template-columns: 1fr; } .hcard.ship { grid-column: auto; } }
.htile.go { border-color: #2e7d32; background: #e8f5e9; }
.htile.go b { color: #2e7d32; }
.hcard.ship { grid-column: span 2; border-color: #2e7d32; box-shadow: inset 4px 0 0 #2e7d32; }
.unsaved-buttons { flex-wrap: wrap; justify-content: flex-end; }

/* Quick sample, labels */
.quick-sample label { display: block; margin-bottom: 0.55rem; }
.quick-sample input:not([type=checkbox]), .quick-sample select, .quick-sample textarea { width: 100%; box-sizing: border-box; font-size: 1rem; padding: 0.55rem 0.6rem; }
.quick-sample .qs-photo { display: inline-block; text-align: center; width: 100%; box-sizing: border-box; padding: 0.7rem; }
.quick-sample .check { display: flex; gap: 0.5rem; align-items: center; }
.quick-sample .check input { width: auto; }
.qs-thumbs { margin: 0.2rem 0 0.6rem; }
@media (max-width: 760px) { #dialog { width: calc(100vw - 1.5rem); max-width: none; } .quick-sample .dlg-buttons button { flex: 1; padding: 0.7rem; } }
.labels-page { display: grid; gap: 0.8rem; max-width: 900px; }
.labels-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.lrow { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.lrow .lbtns { margin-left: auto; display: flex; gap: 0.3rem; }
.labels-page .auto { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.8rem; font-weight: 600; }
.form-buttons.left { justify-content: flex-start; gap: 0.4rem; flex-wrap: wrap; display: flex; margin-top: 0.4rem; }

/* Email attachments */
.atts { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.35rem; }
.att { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 0.2rem 0.5rem; font-size: 0.8rem; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att:hover { border-color: var(--accent); }
.att.loading { opacity: 0.6; cursor: progress; }
#dialog.wide { width: min(900px, 94vw); }
.att-view { box-sizing: border-box; min-width: 0; }
.att-head { margin-bottom: 0.5rem; word-break: break-all; }
.att-body img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; }
.att-body iframe { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 6px; }

/* Next actions (20 Nov 2026) */
.actions-table .group th { text-align: left; background: #f6f4ef; font-size: 0.9rem; padding: 0.45rem 0.6rem; }
.actions-table .group.overdue th { color: var(--bad); }
.actions-table .group.today th { color: var(--accent); }
.actions-table td.right, .na-none td.right { text-align: right; }
.actions-table .nowrap { white-space: nowrap; }
.who-chip { display: inline-block; font-size: 0.78rem; padding: 0.05rem 0.5rem; border-radius: 99px; background: #e7eefb; color: #2a4f8f; }
.na-none { margin-top: 1.2rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.8rem; }
.na-none summary { cursor: pointer; }
.na-none table { margin-top: 0.5rem; }
#dialog.na { width: min(34rem, 94vw); max-width: none; }
.na-dlg, .na-dlg * { box-sizing: border-box; }
.na-dlg textarea, .na-dlg input:not([type=radio]):not([type=checkbox]), .na-dlg select { width: 100%; }
.na-dlg input[type=radio], .na-dlg input[type=checkbox] { width: auto; margin: 0; }
.na-dlg .na-dates input { width: auto; }
.na-dlg textarea { padding: 0.55rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--ink); }
.na-choices { border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.8rem 0.6rem; display: grid; gap: 0.35rem; }
.na-choices legend { font-size: 0.85rem; color: var(--muted); padding: 0 0.3rem; }
.na-dlg label.radio { display: flex; flex-direction: row; gap: 0.5rem; align-items: center; color: var(--ink); font-size: 0.95rem; }
.na-next { display: grid; gap: 0.6rem; }
.na-dates { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.na-dates button.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.na-dates input { padding: 0.4rem; border: 1px solid var(--line); border-radius: 8px; }
.na-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.na-li { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.steps li { border-left: 3px solid var(--line); padding-left: 0.6rem; }
p.bad { color: var(--bad); margin: 0; }

/* Duplicates report (20 Nov 2026) */
.dup-group { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.8rem; margin-bottom: 0.8rem; }
.dup-group header { margin-bottom: 0.4rem; }
.dup-table td { vertical-align: top; }
.dup-table td.tick { width: 1.6rem; }
.dup-table td.right { text-align: right; white-space: nowrap; }
.dup-table tr.suggested td { background: #f3f8f6; }
.dup-table .nowrap { white-space: nowrap; }
.dup-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 0.4rem; }

/* Shopify SKU check (20 Nov 2026) */
.sku-table td { vertical-align: top; }
.sku-table .nowrap { white-space: nowrap; }
.sku-table td.right, .sku-table th.right, .printer-codes td.right { text-align: right; }
.printer-codes { margin-top: 1.2rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.8rem; }
.printer-codes summary { cursor: pointer; }
.printer-codes input { width: 100%; padding: 0.35rem; border: 1px solid var(--line); border-radius: 6px; }
