/* Dark, high-contrast and big targets: used with greasy hands under a work light. */
:root {
  --bg: #121417; --panel: #1d2026; --line: #2e333b; --text: #f2f3f5; --muted: #a3aab5;
  --accent: #ff8a1f; --on-accent: #1a1006; --ok: #47c97a; --danger: #ff5c5c;
  --r: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
main { max-width: 640px; margin: 0 auto; padding: 0 14px 40px; }
a { color: inherit; text-decoration: none; }
h1 { font-size: 21px; margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }
.empty.small { padding: 18px 6px; font-size: 16px; grid-column: 1 / -1; }

/* top bar */
.bar {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: calc(12px + env(safe-area-inset-top)) 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 14px;
}
.back { color: var(--accent); font-weight: 600; flex-basis: 100%; padding: 4px 0; min-height: 36px; display: flex; align-items: center; }
.icon { background: none; border: 0; color: var(--text); font-size: 28px; width: 52px; height: 52px; border-radius: var(--r); }
.icon:active { background: var(--panel); }

/* buttons and inputs */
.btn {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 54px; padding: 10px 16px; width: 100%;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn:active { filter: brightness(1.25); }
.btn:disabled { opacity: .4; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #1a0505; }
.btn.danger-text { background: none; border: 0; color: var(--danger); margin-top: 8px; }
.btn.big { min-height: 62px; font-size: 20px; }
.row { display: flex; gap: 10px; margin: 10px 0; }
.row > * { flex: 1; }
label { display: block; margin: 14px 0 6px; font-weight: 600; }
input:not([type=file]), textarea {
  display: block; width: 100%; margin-top: 6px; padding: 14px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--r);
  font: inherit; font-weight: 400;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; }
.form > .btn { margin-top: 10px; }

/* jobs */
.new-job, .new-todo { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.new-job input, .new-todo input { margin: 0; flex: 1; min-width: 0; }
.new-job .btn, .new-todo .btn { width: auto; white-space: nowrap; }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.card { display: flex; flex-direction: column; gap: 2px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.card:active { filter: brightness(1.2); }

/* tabs */
.tabs { display: flex; gap: 6px; background: var(--panel); padding: 5px; border-radius: var(--r); margin-bottom: 14px; }
.tabs a { flex: 1; text-align: center; padding: 12px 4px; border-radius: 10px; font-weight: 600; font-size: 16px; color: var(--muted); white-space: nowrap; }
.tabs a.on { background: var(--accent); color: var(--on-accent); }

/* removal log */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.step { display: flex; gap: 12px; align-items: center; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.step:active { filter: brightness(1.2); }
.step img, .nophoto { width: 76px; height: 76px; flex: none; border-radius: 10px; object-fit: cover; }
.nophoto { display: flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; color: var(--muted); border: 1px dashed var(--line); }
.step .txt { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.num {
  flex: none; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 17px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1px solid var(--line); font-weight: 700;
}
.sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 30%);
}
.sticky .btn { max-width: 612px; margin: 0 auto; }

/* refit */
.progress { height: 10px; background: var(--panel); border-radius: 5px; overflow: hidden; margin-top: 4px; }
.progress div { height: 100%; background: var(--ok); }
.refit { padding: 14px; background: var(--panel); border: 2px solid var(--accent); border-radius: var(--r); margin-bottom: 12px; scroll-margin-top: 150px; overflow-wrap: anywhere; }
.refit header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.refit.done { border-color: var(--line); opacity: .7; }
.refit.done p { color: var(--muted); }
.refit.done .toggle { min-height: 44px; color: var(--ok); }
.note { color: var(--accent); }
.strip { display: flex; gap: 8px; overflow-x: auto; margin: 4px 0 12px; }
.strip img { height: 150px; border-radius: 10px; flex: none; }

/* step photos */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid figure { margin: 0; position: relative; }
.grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.grid .x {
  position: absolute; top: 4px; right: 4px; width: 40px; height: 40px; border-radius: 20px;
  border: 0; background: rgba(0,0,0,.7); color: #fff; font-size: 24px; line-height: 1;
}

/* pop-ups */
.sheet-bg { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 640px; background: var(--panel); border-radius: 18px 18px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 10px; }
.sheet label { margin-top: 0; }
.sheet .row { margin: 0; }
.viewer { position: fixed; inset: 0; z-index: 30; background: #000; display: flex; align-items: center; justify-content: center; }
.viewer img { max-width: 100%; max-height: 100%; }
.viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 60px; height: 90px; border: 0; background: rgba(0,0,0,.5); color: #fff; font-size: 44px; }
.viewer .prev { left: 0; border-radius: 0 12px 12px 0; }
.viewer .next { right: 0; border-radius: 12px 0 0 12px; }
.viewer .count { position: absolute; bottom: calc(18px + env(safe-area-inset-bottom)); color: #fff; background: rgba(0,0,0,.6); padding: 4px 12px; border-radius: 12px; }

/* room for the fixed Add button */
#body { padding-bottom: 96px; }

/* refit card controls */
.refit .spacer { flex: 1; }
.icon.sm { width: 48px; height: 48px; font-size: 24px; border: 1px solid var(--line); }
.icon:disabled { opacity: .3; }
.edit { color: var(--accent); font-weight: 600; padding: 12px 8px 12px 12px; }
.stored { font-weight: 600; }

/* dictation */
.mic-wrap { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; }
.mic-wrap > input, .mic-wrap > textarea { margin-top: 0 !important; flex: 1; min-width: 0; }
.new-job .mic-wrap, .new-todo .mic-wrap { flex: 1; margin-top: 0; min-width: 0; }
.mic {
  flex: none; width: 54px; height: 54px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.mic.on { background: var(--danger); border-color: var(--danger); color: #1a0505; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .65; } }
.mic-hint { display: block; color: var(--accent); font-weight: 400; min-height: 0; margin-top: 4px; }
.mic-hint:empty { display: none; }
.new-job .mic-hint, .new-todo .mic-hint { order: 3; flex-basis: 100%; margin: 0; }

/* to-do */
.todos { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.todo { display: flex; align-items: stretch; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.tick { flex: none; width: 64px; min-height: 60px; border: 0; background: none; padding: 0; display: flex; align-items: center; justify-content: center; }
.tick span {
  width: 34px; height: 34px; border: 2px solid var(--accent); border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: #0b2414;
}
.todo-text { flex: 1; min-width: 0; text-align: left; background: none; border: 0; color: var(--text); font: inherit; padding: 14px 14px 14px 0; overflow-wrap: anywhere; }
.todo.done { opacity: .7; }
.todo.done .tick span { background: var(--ok); border-color: var(--ok); }
.todo.done .todo-text { color: var(--muted); text-decoration: line-through; }
.done-head { font-size: 17px; color: var(--muted); margin: 24px 0 10px; }
