/* Peg & Socket — Garage Pegboard Work-Order Rail
   primary #2f3a3f · secondary #e7dfd1 · accent #e0a326 */

:root {
  --slate: #2f3a3f;
  --slate-deep: #232c31;
  --slate-line: #3c4a51;
  --cream: #e7dfd1;
  --cream-soft: #f2ecdf;
  --amber: #e0a326;
  --amber-deep: #b9841c;
  --rust: #c96a3b;
  --steel: #8fb3ba;
  --done: #7d9a6d;
  --ink: #262d31;
  --muted: #7d8a90;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --tabbar-h: 68px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Avenir Next", Avenir, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(circle at 18% 8%, rgba(231, 223, 209, 0.05), transparent 42%),
    radial-gradient(circle at 82% 92%, rgba(224, 163, 38, 0.05), transparent 40%),
    var(--slate-deep);
  color: var(--cream);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- shell ---------- */

#app { min-height: 100vh; }

.view {
  padding: calc(var(--safe-top) + 14px) 14px calc(var(--tabbar-h) + var(--safe-bottom) + 26px);
  max-width: 520px;
  margin: 0 auto;
}

.screen-title {
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 2px 2px 12px;
}

.screen-title strong {
  display: block;
  margin-top: 3px;
  font-size: 21px;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--cream);
}

/* ---------- pegboard rail (Bay) ---------- */

.pegboard {
  border: 1px solid var(--slate-line);
  border-radius: 14px;
  padding: 16px 12px 14px;
  background:
    radial-gradient(circle, rgba(0, 0, 0, 0.35) 2px, transparent 2.5px) 0 0 / 22px 22px,
    linear-gradient(180deg, #2b353a, #273136);
  background-color: #2b353a;
  margin-bottom: 14px;
}

.socket-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.socket-counter {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--slate-line);
  border-radius: 50% 50% 46% 46% / 34% 34% 12% 12%;
  background: linear-gradient(180deg, #35424a, #2a343a);
  min-height: 92px;
  padding: 10px 6px;
}

.socket-counter .hex {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: var(--cream);
}

.socket-counter.due .hex { color: var(--amber); }
.socket-counter.soon .hex { color: var(--steel); }

.socket-counter .lbl {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.add-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 12px;
  min-height: 58px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #edb63a, var(--amber));
  color: #2a2110;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--amber-deep);
}

.add-strip:active { transform: translateY(1px); box-shadow: none; }

/* ---------- work-order slips ---------- */

.slip {
  position: relative;
  background: var(--cream);
  color: var(--ink);
  border-radius: 10px;
  padding: 16px 16px 14px 20px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}

.slip::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 7px;
  background: var(--edge, var(--amber));
}

.slip .slip-kicker {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8a7f68;
  margin-bottom: 6px;
}

.slip .slip-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.slip .slip-meta {
  font-size: 14px;
  color: #5b5344;
}

.slip .slip-meta b { color: var(--ink); }

.nextdue-wrap { position: relative; margin-top: 16px; }

.metal-clip {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 84px;
  height: 22px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #6b7880, #45525a);
  border: 1px solid #55636c;
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

.metal-clip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 5px;
  transform: translateX(-50%);
  width: 34px;
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.3);
}

.nextdue-wrap .slip { padding-top: 26px; }

/* ---------- status ---------- */

.status-word {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-word .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.dot.s-due { background: var(--amber); border: 2px solid var(--amber); }
.dot.s-soon { background: transparent; border: 2px solid var(--amber); }
.dot.s-done { background: var(--done); border: 2px solid var(--done); }

.edge-due { --edge: var(--amber); }
.edge-soon { --edge: var(--amber); }
.edge-done { --edge: var(--done); }

.slip.edge-soon::before { background: repeating-linear-gradient(180deg, var(--amber) 0 10px, #c98f1f 10px 16px); }

.status-label.s-due { color: var(--amber-deep); }
.status-label.s-soon { color: var(--amber-deep); }
.status-label.s-done { color: #5c7a4e; }

/* ---------- task strips ---------- */

.group-head {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 2px 8px;
}

.strip {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 10px;
}

.strip .slip {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 12px 12px 12px 18px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.22);
}

.strip .slip-title { font-size: 16px; margin: 0; }
.strip .slip-meta { font-size: 13px; }

.strip-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 78px;
  flex: 0 0 78px;
  margin-left: 8px;
}

.mini-btn {
  flex: 1;
  border: 1px solid var(--slate-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--cream);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  min-height: 40px;
  cursor: pointer;
}

.mini-btn:active { background: rgba(255, 255, 255, 0.14); }

.mini-btn.cycle { border-color: var(--amber-deep); color: var(--amber); }
.mini-btn.del { color: #e08a6a; border-color: #6b4a3c; }

/* ---------- forms ---------- */

.panel {
  background: var(--cream);
  color: var(--ink);
  border-radius: 12px;
  padding: 18px 16px 16px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b6252;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  min-height: 50px;
  font-size: 16px; /* prevents iOS zoom */
  padding: 10px 12px;
  border: 1.5px solid #c9bfa9;
  border-radius: 8px;
  background: var(--cream-soft);
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}

.field input:focus {
  outline: none;
  border-color: var(--amber-deep);
  box-shadow: 0 0 0 3px rgba(224, 163, 38, 0.25);
}

.field input.invalid { border-color: var(--rust); }

.field .err {
  display: none;
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--rust);
  font-weight: 600;
}

.field.show-err .err { display: block; }

.seg {
  display: flex;
  gap: 8px;
}

.seg button {
  flex: 1;
  min-height: 48px;
  border: 1.5px solid #c9bfa9;
  border-radius: 8px;
  background: var(--cream-soft);
  color: #6b6252;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.seg button[aria-pressed="true"] {
  border-color: var(--amber-deep);
  background: var(--amber);
  color: #2a2110;
}

.btn.primary {
  width: 100%;
  min-height: 54px;
  border: none;
  border-radius: 10px;
  background: var(--slate);
  color: var(--cream);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 2px 0 #1c2428;
}

.btn.primary:active { transform: translateY(1px); box-shadow: none; }

.link-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: none;
  border: none;
  color: #8a7f68;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
  min-height: 44px;
}

/* ---------- find ---------- */

.search-wrap { position: relative; margin-bottom: 14px; }

.search-wrap input {
  width: 100%;
  min-height: 52px;
  font-size: 16px;
  padding: 10px 40px 10px 14px;
  border: 1px solid var(--slate-line);
  border-radius: 10px;
  background: #343f45;
  color: var(--cream);
  -webkit-appearance: none;
  appearance: none;
}

.search-wrap input::placeholder { color: var(--muted); }

.search-wrap input:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(224, 163, 38, 0.2);
}

.search-wrap .clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}

/* ---------- empty states ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--slate-line);
  border-radius: 12px;
}

.empty p { font-size: 14.5px; max-width: 260px; line-height: 1.45; }

.tread {
  width: 84px;
  height: 84px;
  opacity: 0.5;
}

/* ---------- tabbar ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: #20282c;
  border-top: 1px solid var(--slate-line);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: none;
  color: #6d7a80;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tab .wrench {
  width: 26px;
  height: 26px;
  fill: currentColor;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.tab.active { color: var(--cream); }

.tab.active .wrench {
  transform: rotate(-14deg);
  filter: drop-shadow(0 3px 4px rgba(224, 163, 38, 0.45));
}

.tab.active span { color: var(--amber); }

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 20, 22, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--cream);
  color: var(--ink);
  border-radius: 12px;
  padding: 20px 18px 16px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.modal p { font-size: 15px; line-height: 1.4; margin-bottom: 16px; overflow-wrap: anywhere; }

.modal-actions { display: flex; gap: 10px; }

.modal .btn {
  flex: 1;
  min-height: 48px;
  border-radius: 9px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.modal .btn.ghost { background: #d8cfbd; color: #4d4636; }
.modal .btn.danger { background: var(--rust); color: #fff; }

/* ---------- utility ---------- */

.hidden { display: none !important; }
