/* Trep Operator App — desktop-first app shell, degrades to a phone app.
   Layered on styles.css (tokens, buttons, pills, tables stay shared). */

body.op { padding-top: 0; background: var(--bg); }

.op-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

/* ---- sidebar (desktop) ---- */
.op-side {
  background: var(--ink-950); color: #fff; padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
}
.op-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.op-brand img { width: 30px; }
.op-brand .t { font-weight: 700; font-size: 14px; letter-spacing: .04em; }
.op-brand .t span { color: var(--lime); }
.op-nav-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; font-family: inherit; font-size: 14px; font-weight: 500;
  color: rgba(255,255,255,.66); padding: 9px 10px; border-radius: var(--r-ctl); cursor: pointer; text-align: left;
}
.op-nav-btn:hover { color: #fff; background: rgba(255,255,255,.07); }
.op-nav-btn.active { color: #fff; background: rgba(255,255,255,.14); font-weight: 600; }
.op-nav-btn .badge {
  margin-left: auto; background: var(--warn-600); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px;
}
.op-side .spacer { flex: 1; }
.op-side .who { padding: 10px; font-size: 12px; color: rgba(255,255,255,.5); border-top: 1px solid rgba(255,255,255,.12); }

/* ---- main ---- */
.op-main { min-width: 0; display: flex; flex-direction: column; }
.op-topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.op-topbar h1 { font-size: 19px; }
.op-topbar .sub { font-size: 13px; color: var(--ink-500); }
.op-body { padding: 24px 28px 64px; max-width: 1240px; }
.op-view { display: none; }
.op-view.active { display: block; }

/* ---- cards / sections ---- */
.op-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }
.op-grid > * { min-width: 0; }
.sec-h { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-500); margin: 0 0 10px; }
.sec-h.mt { margin-top: 28px; }

.banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--warn-100); border: 1px solid #f4d9c0; color: var(--warn-600);
  border-radius: var(--r-card); padding: 14px 18px; margin-bottom: 18px; font-weight: 600; font-size: 14px;
}
.banner .btn { margin-left: auto; }

/* ---- month calendar grid ---- */
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cal-head .month { font-size: 18px; font-weight: 700; min-width: 190px; }
.cal-dows { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-dows span { font-size: 11px; font-weight: 600; color: var(--ink-500); text-transform: uppercase; letter-spacing: .06em; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  min-height: 92px; padding: 8px; text-align: left; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.cal-cell:hover { border-color: var(--ink-400); }
.cal-cell.out { opacity: .35; }
.cal-cell.today { border-color: var(--ink-950); box-shadow: 0 0 0 1px var(--ink-950); }
.cal-cell.selected { background: #f1eff5; }
.cal-cell .d { font-size: 13px; font-weight: 700; }
.cal-cell .jobs { font-size: 12px; color: var(--ink-700); font-weight: 600; }
.cal-cell .amt { font-size: 12px; color: var(--accent-600); font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-cell .pend { font-size: 11px; color: var(--warn-600); font-weight: 600; }
.cal-cell .blocked { font-size: 11px; color: var(--ink-500); font-weight: 600; }
.cal-cell.isblocked { background: repeating-linear-gradient(45deg, #f4f2f6, #f4f2f6 6px, #ebe8ef 6px, #ebe8ef 12px); }
.cal-legend { display: flex; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--ink-500); flex-wrap: wrap; }

/* ---- jobs toolbar ---- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input[type="text"] { max-width: 280px; }
.toolbar select { width: auto; }
.day-head {
  font-size: 12px; font-weight: 700; color: var(--ink-500); text-transform: uppercase;
  letter-spacing: .06em; margin: 18px 0 8px;
}
.load-more { display: block; margin: 16px auto 0; }

/* ---- job sheet ---- */
.sheet-back { background: none; border: none; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink-700); cursor: pointer; padding: 0; margin-bottom: 12px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--ink-500); }
.kv dd { margin: 0; font-weight: 500; }
.trail { position: relative; margin-left: 6px; }
.trail-item { position: relative; padding: 0 0 14px 22px; font-size: 13px; }
.trail-item::before {
  content: ""; position: absolute; left: 0; top: 4px; width: 9px; height: 9px;
  border-radius: 999px; background: var(--accent-500);
}
.trail-item::after {
  content: ""; position: absolute; left: 4px; top: 13px; bottom: 0; width: 1px; background: var(--border-strong);
}
.trail-item:last-child::after { display: none; }
.trail-item .when { color: var(--ink-500); font-size: 12px; }

/* ---- mobile: sidebar becomes bottom tab bar ---- */
@media (max-width: 900px) {
  .op-shell { grid-template-columns: 1fr; }
  .op-side {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto;
    flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    gap: 0; z-index: 50; border-top: 1px solid rgba(255,255,255,.1);
  }
  .op-brand, .op-side .spacer, .op-side .who { display: none; }
  .op-nav-btn {
    flex-direction: column; gap: 3px; align-items: center; justify-content: center;
    font-size: 10px; padding: 7px 2px; text-align: center;
  }
  .op-nav-btn .ico { font-size: 17px; line-height: 1; }
  .op-nav-btn .badge { position: absolute; transform: translate(14px, -6px); margin: 0; }
  .op-body { padding: 16px 16px 96px; }
  .op-topbar { padding: 12px 16px; }
  .op-grid { grid-template-columns: 1fr; }
  .cal-cell { min-height: 62px; padding: 5px; }
  .cal-cell .amt, .cal-cell .blocked { display: none; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { font-size: 12px; margin-top: 8px; }
}


/* ===== audit fixes: thumb-sized targets, mobile parity, no overlap ===== */
@media (max-width: 900px) {
  /* every real action clears 44px */
  .btn, .chip, .window-row, .op-nav-btn { min-height: 44px; }
  .btn-sm { min-height: 44px; padding: 11px 14px; font-size: 14px; }
  .sheet-back { min-height: 44px; font-size: 15px; display: inline-flex; align-items: center; }
  .sheet .textlink { min-height: 44px; }
  .cal-cell { min-height: 74px; }
  /* the phone must show money and blocked state too (was display:none) */
  .cal-cell .amt { display: block; font-size: 11px; }
  .cal-cell .blocked { display: block; font-size: 10px; }
  .notes-box textarea { min-height: 88px; font-size: 16px; }
  input[type="checkbox"] { width: 26px; height: 26px; }
  /* toast must never sit under the tab bar */
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  /* money table: card rows instead of a cut-off table */
  table.terr.pay { display: none; }
}
.pay-cards { display: none; }
@media (max-width: 900px) {
  .pay-cards { display: block; }
}
.pay-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 12px 14px; margin-bottom: 8px;
}
.pay-card .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.pay-card .keep { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pay-card .sub { font-size: 12px; color: var(--ink-500); margin-top: 2px; }

/* action bar: primary work actions grouped and obvious */
.action-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.action-bar .btn-danger { color: var(--red-600); border-color: #e8cdd3; }
.btn-big { font-size: 16px; padding: 14px 22px; min-height: 52px; }
.btn-done { background: var(--accent-600); color: #fff; }
.btn-done:hover { background: var(--accent-500); }

/* offline / stale banner */
.offline-note {
  background: #efedf2; border: 1px solid var(--border-strong); color: var(--ink-700);
  border-radius: var(--r-ctl); padding: 10px 14px; font-size: 13px; font-weight: 600; margin-bottom: 14px;
}

/* styled file inputs */
input[type="file"] {
  width: 100%; font-family: inherit; font-size: 13px; color: var(--ink-700);
  border: 1px dashed var(--border-strong); border-radius: var(--r-ctl); padding: 10px 12px; background: var(--card);
}

/* checklist step: undo-able, bigger */
.addon-row[data-step] { min-height: 52px; font-size: 15px; }
.addon-row[data-step].selected .name { color: var(--accent-600); font-weight: 700; }
.step-hint { font-size: 12px; color: var(--ink-500); margin-top: 6px; }


/* ===== round-2 fixes ===== */
.cal-grid, .cal-dows { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-cell { min-width: 0; overflow: hidden; }
.cal-cell > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cal-head { flex-wrap: wrap; }
.cal-head .month { min-width: 0; flex: 1; }
@media (max-width: 900px) {
  .op-body { padding-bottom: 130px; overflow-x: hidden; }
  .cal-cell { padding: 4px; }
}
/* landscape phones: nav still needs clearance */
@media (max-height: 500px) {
  .op-body { padding-bottom: 140px; }
}
/* customer + job rows are obviously tappable */
#custList .job { cursor: pointer; }
/* hours grid: usable checkboxes, scrollable, on-brand */
#view-settings input[type="checkbox"] { width: 30px; height: 30px; accent-color: var(--accent-600); }
#view-settings .table-scroll { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
/* photo buttons show what's done */
.btn.photo-done { border-color: var(--accent-600); color: var(--accent-600); background: var(--accent-100); }

/* blocked window: clearly OFF, not "selected" */
.chip-off {
  background: var(--bg); color: var(--ink-400); border-style: dashed;
  text-decoration: line-through; text-decoration-thickness: 1px;
}
