  :root{
    --bg:#eeebe3;
    --surface:#ffffff;
    --ink:#23262b;
    --ink-soft:#5b6168;
    --ink-faint:#8a8f95;
    --steel:#3d5a73;
    --steel-dark:#2b4356;
    --steel-light:#e7edf1;
    --safety:#e8b23a;
    --safety-dark:#b8891c;
    --rivet:#b9b2a0;
    --border:#d7d2c4;
    --danger:#b4432f;
    --danger-light:#f6e4e0;
    --radius:10px;
  }
  *{box-sizing:border-box;}
  html,body{margin:0;padding:0;}
  body{
    background:var(--bg);
    background-image:
      linear-gradient(var(--border) 1px, transparent 1px),
      linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 28px 28px;
    background-attachment: fixed;
    color:var(--ink);
    font-family:'IBM Plex Sans', sans-serif;
    min-height:100vh;
    -webkit-font-smoothing:antialiased;
  }
  h1,h2,h3,.display{
    font-family:'Barlow Condensed', sans-serif;
    letter-spacing:0.02em;
    text-transform:uppercase;
    font-weight:700;
    margin:0;
  }
  .mono{font-family:'IBM Plex Mono', monospace;}
  #app{max-width:520px;margin:0 auto;min-height:100vh;background:var(--bg);position:relative;padding-bottom:40px;}
  /* Top bar */
  .topbar{
    background:var(--steel-dark);
    color:#fff;
    padding:14px 16px;
    display:flex;
    align-items:center;
    gap:10px;
    position:sticky;
    top:0;
    z-index:20;
    box-shadow:0 2px 8px rgba(0,0,0,0.15);
  }
  .topbar .back{
    background:none;border:none;color:#fff;font-size:20px;cursor:pointer;
    padding:4px 8px;line-height:1;border-radius:6px;
  }
  .topbar .back:active{background:rgba(255,255,255,0.15);}
  .topbar .titles{flex:1;min-width:0;}
  .topbar .crumb{font-size:11px;color:#b9c6cf;text-transform:uppercase;letter-spacing:0.08em;font-family:'IBM Plex Mono',monospace; white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .topbar h1{font-size:20px;color:#fff; white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}

  .content{padding:16px;}
  /* Buttons */
  .btn{
    font-family:'IBM Plex Sans',sans-serif;
    font-weight:600;
    font-size:14px;
    border-radius:8px;
    padding:12px 16px;
    border:1.5px solid transparent;
    cursor:pointer;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    transition:transform 0.05s ease;
  }
  .btn:active{transform:scale(0.98);}
  .btn-primary{background:var(--safety);color:var(--steel-dark);border-color:var(--safety-dark);}
  .btn-steel{background:var(--steel);color:#fff;}
  .btn-outline{background:transparent;color:var(--steel-dark);border-color:var(--steel-dark);}
  .btn-danger{background:transparent;color:var(--danger);border-color:var(--danger);}
  .btn-block{width:100%;}
  .btn-sm{padding:8px 12px;font-size:13px;}
  /* Cards */
  .plate{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius);
    padding:14px;
    position:relative;
    margin-bottom:12px;
    box-shadow:0 1px 2px rgba(0,0,0,0.04);
  }
  .plate::before,.plate::after,.plate .rivet-l,.plate .rivet-r{
    content:'';
    position:absolute;
    width:5px;height:5px;
    border-radius:50%;
    background:var(--rivet);
    box-shadow:inset 0 1px 1px rgba(0,0,0,0.3);
  }
  .plate::before{top:7px;left:7px;}
  .plate::after{top:7px;right:7px;}
  .plate .rivet-l{bottom:7px;left:7px;}
  .plate .rivet-r{bottom:7px;right:7px;}
  .empty-state{
    text-align:center;
    padding:40px 20px;
    color:var(--ink-soft);
  }
  .empty-state .icon{font-size:36px;margin-bottom:10px;opacity:0.5;}
  .empty-state h3{font-size:20px;color:var(--ink);margin-bottom:6px;}
  .empty-state p{font-size:13px;margin:0 0 16px;}
  /* Forms */
  label{
    display:block;
    font-family:'IBM Plex Mono',monospace;
    font-size:11px;
    text-transform:uppercase;
    letter-spacing:0.06em;
    color:var(--ink-soft);
    margin-bottom:5px;
    margin-top:14px;
  }
  label:first-child{margin-top:0;}
  input[type=text],input[type=number],input[type=date],select,textarea{
    width:100%;
    padding:11px 12px;
    border:1.5px solid var(--border);
    border-radius:7px;
    background:#fff;
    font-family:'IBM Plex Sans',sans-serif;
    font-size:15px;
    color:var(--ink);
  }
  input:focus,select:focus,textarea:focus{outline:2px solid var(--steel);outline-offset:1px;}
  .row2{display:grid;grid-template-columns:1fr 1fr;gap:10px;}
  /* Business gate */
  .gate{
    min-height:100vh;
    display:flex;
    flex-direction:column;
    justify-content:center;
    padding:24px;
  }
  .gate-hero{text-align:center;margin-bottom:28px;}
  .gate-hero .tag{
    display:inline-block;
    background:var(--steel-dark);color:#fff;
    font-family:'IBM Plex Mono',monospace;
    font-size:11px; letter-spacing:0.1em;
    padding:4px 10px;border-radius:5px;margin-bottom:14px;
  }
  .gate-hero h1{font-size:44px;color:var(--steel-dark);line-height:0.95;}
  .gate-hero .sub{color:var(--ink-soft);font-size:14px;margin-top:8px;}
  /* Dashboard summary */
  .summary-row{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:16px;}
  .stat{
    background:var(--steel-dark);color:#fff;border-radius:var(--radius);padding:14px;
  }
  .stat .num{font-family:'Barlow Condensed';font-size:28px;font-weight:700;}
  .stat .lbl{font-family:'IBM Plex Mono';font-size:10px;text-transform:uppercase;letter-spacing:0.08em;color:#b9c6cf;}
  .section-head{display:flex;justify-content:space-between;align-items:center;margin:22px 0 10px;}
  .section-head h2{font-size:20px;color:var(--steel-dark);}
  .list-item{
    background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
    padding:14px;margin-bottom:10px;display:flex;align-items:center;gap:12px;cursor:pointer;
  }
  .list-item:active{background:var(--steel-light);}
  .list-item .icon-box{
    width:38px;height:38px;border-radius:8px;background:var(--steel-light);color:var(--steel-dark);
    display:flex;align-items:center;justify-content:center;font-size:18px;flex-shrink:0;
  }
  .list-item .info{flex:1;min-width:0;}
  .list-item .title{font-weight:600;font-size:15px;}
  .list-item .meta{font-size:12px;color:var(--ink-soft);font-family:'IBM Plex Mono',monospace;}
  .list-item .chev{color:var(--ink-faint);font-size:18px;}
  /* Appliance grid cards */
  .app-card{
    background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
    padding:12px;margin-bottom:10px;display:flex;gap:12px;cursor:pointer;position:relative;
  }
  .app-card .thumb{
    width:56px;height:56px;border-radius:7px;background:var(--steel-light);
    object-fit:cover;flex-shrink:0;border:1px solid var(--border);
  }
  .app-card .thumb-placeholder{
    width:56px;height:56px;border-radius:7px;background:var(--steel-light);
    display:flex;align-items:center;justify-content:center;font-size:20px;color:var(--steel);flex-shrink:0;
  }
  .app-card .info{flex:1;min-width:0;}
  .app-card .make{font-weight:600;font-size:14px;}
  .app-card .model{font-family:'IBM Plex Mono';font-size:12px;color:var(--ink-soft);}
  .app-card .serial{font-family:'IBM Plex Mono';font-size:11px;color:var(--ink-faint);margin-top:2px;}
  .app-card .repl{font-family:'IBM Plex Mono';font-size:13px;color:var(--steel-dark);font-weight:600;margin-top:4px;}
  /* Modal / overlay screens are just pushed views, full width */
  .field-note{font-size:11px;color:var(--ink-faint);margin-top:4px;}
  .photo-well{
    border:2px dashed var(--border);border-radius:var(--radius);
    padding:18px;text-align:center;background:var(--steel-light);
    margin-bottom:6px;
  }
  .photo-well img{max-width:100%;max-height:220px;border-radius:7px;display:block;margin:0 auto 10px;}
  .photo-actions{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;}
  .hidden-input{display:none;}
  .scan-status{
    display:flex;align-items:center;gap:8px;
    background:var(--steel-light);color:var(--steel-dark);
    padding:10px 12px;border-radius:7px;font-size:13px;margin:10px 0;
  }
  .spinner{
    width:14px;height:14px;border:2px solid var(--steel);border-top-color:transparent;
    border-radius:50%;animation:spin 0.7s linear infinite;
  }
  @keyframes spin{to{transform:rotate(360deg);}}
  .footer-actions{
    position:sticky;bottom:0;background:var(--bg);
    padding:14px 16px calc(14px + env(safe-area-inset-bottom));
    border-top:1px solid var(--border);
    display:flex;gap:10px;
  }
  .toast{
    position:fixed;bottom:20px;left:50%;transform:translateX(-50%);
    background:var(--ink);color:#fff;padding:10px 18px;border-radius:20px;
    font-size:13px;z-index:100;box-shadow:0 4px 14px rgba(0,0,0,0.25);
    max-width:90%;text-align:center;
  }
  .type-chip{
    display:inline-block;background:var(--steel-light);color:var(--steel-dark);
    font-family:'IBM Plex Mono';font-size:10px;text-transform:uppercase;letter-spacing:0.05em;
    padding:2px 7px;border-radius:5px;margin-left:6px;
  }
  .detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:14px;}
  .detail-field{background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:10px 12px;}
  .detail-field .k{font-family:'IBM Plex Mono';font-size:10px;text-transform:uppercase;color:var(--ink-faint);letter-spacing:0.05em;}
  .detail-field .v{font-size:15px;font-weight:600;margin-top:2px;}
  .detail-field .v.mono{font-family:'IBM Plex Mono';font-size:13px;font-weight:500;word-break:break-all;}
  .link-btn{background:none;border:none;color:var(--steel);font-weight:600;font-size:13px;cursor:pointer;padding:6px;}

/* --- additions beyond the prototype --- */
.repl-status { font-family: 'IBM Plex Mono', monospace; font-size: 11px; margin-top: 3px; }
.repl-status.ok { color: var(--ink-faint); }
.repl-status.due-soon { color: var(--safety-dark); font-weight: 600; }
.repl-status.past-due { color: var(--danger); font-weight: 600; }
.stat .num.warn { color: var(--safety); }
.search-input { margin-bottom: 14px; }
.search-row { display: flex; gap: 8px; margin-bottom: 14px; }
.search-row .search-input { flex: 1; min-width: 0; margin-bottom: 0; }
.search-row .btn { flex-shrink: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  background: var(--steel-light); color: var(--steel-dark);
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  padding: 3px 8px; border-radius: 5px;
}
.chip b { text-transform: uppercase; font-size: 9px; letter-spacing: 0.05em; color: var(--ink-soft); }
.spec-row { display: grid; grid-template-columns: 1fr 1fr 34px; gap: 6px; margin-bottom: 6px; }
.spec-row input { padding: 8px 10px; font-size: 13px; }
.spec-row .rm { background: none; border: none; color: var(--danger); font-size: 16px; cursor: pointer; }
.estimate-note { font-size: 12px; color: var(--ink-soft); background: var(--steel-light);
  border-radius: 7px; padding: 8px 10px; margin-top: 6px; }
.year-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.year-bar .yr { font-family: 'IBM Plex Mono', monospace; font-size: 12px; width: 64px; color: var(--ink-soft); }
.year-bar .bar { height: 18px; background: var(--steel); border-radius: 4px; min-width: 2px; }
.year-bar.overdue .bar { background: var(--danger); }
.year-bar .amt { font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 600; }
/* The overdue bucket is headed by a phrase, not a year, so it takes a line of
   its own and the bar below it keeps the shape every other row has. */
.year-bar.overdue { flex-wrap: wrap; }
.year-bar.overdue .yr { width: 100%; color: var(--danger); font-weight: 600; }
.forecast-prop { font-size: 12px; color: var(--ink-soft); margin: 2px 0 0 74px; }

/* --- inline editing on the detail screen --- */
.detail-field .v input, .detail-field .v select, .detail-field .v textarea {
  width: 100%; border: none; background: transparent; padding: 0; margin: 0;
  font-family: 'IBM Plex Sans', sans-serif; font-size: 15px; font-weight: 600;
  color: var(--ink); border-radius: 3px; appearance: none; -webkit-appearance: none;
}
.detail-field .v input.mono { font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 500; }
/* Date fields keep their native control: with appearance stripped, iOS renders an
   empty date input as nothing at all, so it looks uneditable and has no tap target. */
.detail-field .v input[type=date] {
  font-size: 14px; appearance: auto; -webkit-appearance: auto;
  min-height: 30px; padding: 2px 6px; border: 1px solid var(--border); background: #fff;
}
.detail-field .v input[type=date]::-webkit-date-and-time-value { text-align: left; min-height: 1.2em; }
.detail-field .v textarea { font-weight: 400; resize: vertical; }
.detail-field .v input:focus, .detail-field .v select:focus, .detail-field .v textarea:focus {
  outline: 2px solid var(--steel); outline-offset: 2px;
}
.detail-field:focus-within { border-color: var(--steel); }
.footer-actions .btn[disabled] { opacity: 0.45; cursor: default; }

/* --- full-screen photo overlay --- */
.photo-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 18, 22, 0.94);
  display: flex; flex-direction: column;
}
.photo-overlay .bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px calc(10px + env(safe-area-inset-top));
}
.photo-overlay .bar button {
  background: rgba(255,255,255,0.12); color: #fff; border: none;
  font-family: 'IBM Plex Sans', sans-serif; font-size: 15px; font-weight: 600;
  padding: 8px 14px; border-radius: 7px; cursor: pointer; margin-left: 6px;
}
.photo-overlay .bar button:active { background: rgba(255,255,255,0.25); }
.photo-overlay .zoom-btns { display: flex; }
.photo-overlay .scroll {
  flex: 1; overflow: auto; -webkit-overflow-scrolling: touch;
  display: flex; align-items: flex-start; justify-content: center; padding: 8px;
}
.photo-overlay img { display: block; max-width: none; height: auto; border-radius: 4px; }

/* --- forecast drill-down --- */
.forecast-detail { margin: -2px 0 12px 74px; }
.forecast-item {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.forecast-item:active { background: var(--steel-light); }

/* --- service history --- */
.svc-banner {
  font-size: 13px; color: var(--ink-soft); background: var(--steel-light);
  border-radius: 7px; padding: 10px 12px; margin-bottom: 10px;
}
.svc-banner.watch { color: var(--safety-dark); background: #f7efd8; }
.svc-banner.replace { color: var(--danger); background: var(--danger-light); font-weight: 500; }
.svc-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px;
}
.svc-row .info { flex: 1; min-width: 0; }
.svc-row .k { font-family: 'IBM Plex Mono', monospace; font-size: 10px; text-transform: uppercase; color: var(--ink-faint); letter-spacing: 0.05em; }
.svc-row .v { font-size: 14px; margin-top: 2px; }
.svc-row .cost { font-weight: 600; font-size: 14px; }
.svc-row .rm { background: none; border: none; color: var(--danger); font-size: 15px; cursor: pointer; padding: 4px; }

/* --- service estimates --- */
.svc-badge {
  background: #f7efd8; color: var(--safety-dark);
  font-family: 'IBM Plex Mono', monospace; font-size: 9px; font-weight: 600;
  padding: 1px 6px; border-radius: 4px; letter-spacing: 0.06em; vertical-align: 1px;
}
.svc-row.estimate { border-style: dashed; border-color: var(--safety-dark); }

/* --- offline sync pill --- */
.sync-pill {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  background: var(--safety); color: var(--steel-dark);
  padding: 3px 8px; border-radius: 5px; letter-spacing: 0.03em; white-space: nowrap;
}

/* --- printing tag sheets: the screen, the preview, and the printed page --- */
.tag-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 18, 22, 0.94);
  display: flex; flex-direction: column;
}
.tag-overlay [hidden] { display: none !important; }
.tag-overlay .bar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
}
.tag-overlay .bar h2 { font-size: 18px; color: #fff; }
.tag-overlay .bar button {
  background: rgba(255,255,255,0.12); color: #fff; border: none;
  font-family: 'IBM Plex Sans', sans-serif; font-size: 14px; font-weight: 600;
  padding: 8px 12px; border-radius: 7px; cursor: pointer; margin-left: 6px;
}
.tag-overlay .bar button:active { background: rgba(255,255,255,0.25); }
/* a write in flight: one at a time (Close still works) */
.tag-overlay.busy button:not([data-tp="close"]) { opacity: 0.55; pointer-events: none; }
.tag-overlay .scroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 0 12px 24px; }
.tag-overlay .hint {
  color: rgba(255,255,255,0.75); font-size: 13px; text-align: center;
  margin: 2px auto 12px; max-width: 520px;
}
.tag-overlay .hint:empty { display: none; }
.tp-card {
  background: var(--surface); color: var(--ink); border-radius: var(--radius);
  padding: 14px; max-width: 520px; margin: 0 auto 12px;
}
.tp-card h3 { font-size: 16px; margin-bottom: 8px; }
.tp-card p { font-size: 14px; line-height: 1.4; margin: 0 0 10px; }
.tp-card .tp-q { font-size: 16px; font-weight: 600; }
.tp-card .tp-warn { color: var(--danger); font-weight: 600; }
.tp-card .tp-result { margin: 10px 0 0; }
.tp-card .tp-some { margin-top: 14px; }
.tp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tp-actions .btn { flex: 1 1 auto; }
.tp-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); }
.tp-row .what { flex: 1; min-width: 0; font-family: 'IBM Plex Mono', monospace; font-size: 14px; font-weight: 600; }
.tp-row .what .field-note { font-family: 'IBM Plex Sans', sans-serif; font-weight: 400; }
/* the app's messages stay readable over this screen */
body:has(.tag-overlay) .toast, body:has(.tag-overlay) .notice-bar { z-index: 210; }
.tag-sheet {
  position: relative; width: min(100%, 520px); aspect-ratio: 8.5 / 11;
  margin: 0 auto 16px; background: #fff; border-radius: 3px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.4);
}
/* One 2.625in x 1in tag. cqw = 1% of the tag's width, so type scales with the
   tag itself (container units resolve for DESCENDANTS only, so every size is on
   a child); the px line before each is a fallback for engines without them. */
.tag-cell {
  position: absolute; display: flex; align-items: center;
  container-type: inline-size; color: #000; overflow: hidden;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.tag-cell .qr { flex: none; width: 32cqw; margin-left: 3cqw; } /* about 0.84in, quiet zone included */
.tag-cell .qr svg { display: block; width: 100%; height: auto; }
.tag-cell .cap { flex: 1; min-width: 0; padding: 0 3cqw 0 2cqw; line-height: 1.15; }
.tag-cell .n {
  font-family: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace; font-weight: 600;
  font-size: 20px; font-size: 13cqw; line-height: 1; white-space: nowrap;
}
/* Helvetica/Arial: a q that cannot be read as a g */
.tag-cell .co, .tag-cell .h { font-family: Helvetica, Arial, sans-serif; }
.tag-cell .co {
  font-size: 8px; font-size: 5.2cqw; font-weight: 700; line-height: 1.1; margin-top: 1.5cqw; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.tag-cell .h { font-size: 7px; font-size: 4.6cqw; margin-top: 1cqw; white-space: nowrap; }
/* a tag voided before its run printed: a blank label but for a small grey VOID */
.tag-cell.void { justify-content: center; }
.tag-cell.void span {
  font-family: Helvetica, Arial, sans-serif; font-size: 6px; font-size: 3.5cqw;
  letter-spacing: 0.15em; color: #888;
}

@media print {
  /* Scoped with :has so browser-menu printing of normal screens is unaffected */
  body:has(.tag-overlay) > *:not(.tag-overlay) { display: none !important; }
  body:has(.tag-overlay) { background: #fff; }
  .tag-overlay { position: static; background: none; display: block; }
  .tag-overlay .bar, .tag-overlay .hint, .tag-overlay .tp-panel { display: none !important; }
  .tag-overlay .scroll { overflow: visible; padding: 0; }
  .tag-sheet {
    width: 8.5in; height: 11in; aspect-ratio: auto;
    margin: 0; box-shadow: none; border-radius: 0; break-after: page;
  }
  .tag-sheet:last-child { break-after: auto; }
}

/* --- in-app QR scanner (camera view) --- */
.scan-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: #0f1216; color: #fff;
  display: flex; flex-direction: column;
}
.scan-overlay [hidden] { display: none !important; }
.scan-overlay .bar {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
}
.scan-overlay .bar h2 { font-size: 20px; color: #fff; }
.scan-overlay button {
  background: rgba(255,255,255,0.12); color: #fff; border: none;
  font-family: 'IBM Plex Sans', sans-serif; font-size: 15px; font-weight: 600;
  padding: 10px 14px; border-radius: 7px; cursor: pointer;
}
.scan-overlay button:active { background: rgba(255,255,255,0.25); }
.scan-overlay .scan-view {
  flex: 1; min-height: 0; overflow: hidden; background: #000;
  display: flex; align-items: center;
}
.scan-overlay video { display: block; width: 100%; max-height: 100%; object-fit: cover; }
.scan-overlay.no-camera .scan-view { display: none; }
.scan-overlay .scan-foot { padding: 12px 14px calc(16px + env(safe-area-inset-bottom)); text-align: center; }
.scan-overlay .scan-msg { margin: 0 0 10px; min-height: 1.3em; font-size: 14px; color: rgba(255,255,255,0.8); }
.scan-overlay .scan-typed { display: flex; gap: 8px; max-width: 360px; margin: 0 auto; }
.scan-overlay .scan-typed input { flex: 1; min-width: 0; font-size: 20px; }
.scan-overlay .scan-typed button { background: var(--safety); color: var(--steel-dark); }

/* --- property code chip + CSV import preview --- */
.chip-code {
  display: inline-block; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; font-weight: 600;
  background: var(--steel-light); color: var(--steel-dark); padding: 1px 6px; border-radius: 4px;
  letter-spacing: 0.06em; vertical-align: 1px;
}
.imp-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px;
}
.imp-row.off { opacity: 0.6; }
.imp-row input[type=checkbox] { width: 18px; height: 18px; flex-shrink: 0; margin: 0; }
.imp-row .imp-nocheck { width: 18px; text-align: center; color: var(--ink-faint); flex-shrink: 0; }
.imp-row .info { flex: 1; min-width: 0; }
.imp-row .title { font-weight: 600; font-size: 14px; }
.imp-row .meta { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.imp-status {
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 4px; white-space: nowrap; flex-shrink: 0;
}
.imp-status.new { background: #e3efe5; color: #2f6b3a; }
.imp-status.have { background: var(--steel-light); color: var(--steel-dark); }
.imp-status.skip { background: #f1eee6; color: var(--ink-faint); }

/* --- dashboard portfolio list: views, town groups, compact rows --- */
.view-switch { display: flex; border: 1.5px solid var(--steel-dark); border-radius: 8px; overflow: hidden; margin: 0 0 10px; }
.view-switch button {
  flex: 1; background: transparent; border: none; padding: 8px 0; cursor: pointer;
  font-family: 'IBM Plex Sans', sans-serif; font-weight: 600; font-size: 13px; color: var(--steel-dark);
}
.view-switch button + button { border-left: 1.5px solid var(--steel-dark); }
.view-switch button.on { background: var(--steel-dark); color: #fff; }
.town-chips {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; margin-bottom: 4px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.town-chips::-webkit-scrollbar { display: none; }
.town-chip {
  flex-shrink: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 4px 10px; font-family: 'IBM Plex Sans', sans-serif; font-size: 12px; color: var(--steel-dark); cursor: pointer;
}
.town-chip b { font-family: 'IBM Plex Mono', monospace; font-weight: 600; margin-left: 3px; }
.town-chip.on { background: var(--steel-dark); color: #fff; border-color: var(--steel-dark); }
.prop-group { margin-bottom: 8px; }
.prop-group-head {
  position: sticky; top: var(--topbar-h, 60px); z-index: 5; background: var(--bg);
  display: flex; align-items: center; gap: 8px; padding: 8px 4px 6px; border-bottom: 1px solid var(--border);
  cursor: pointer; font-family: 'Barlow Condensed', sans-serif; font-size: 17px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.02em; color: var(--steel-dark);
}
.prop-group-head .tri { color: var(--ink-faint); font-size: 13px; width: 12px; }
.prop-group-head .cnt {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600; color: var(--ink-soft);
  background: var(--steel-light); padding: 1px 7px; border-radius: 9px;
}
.prop-group.collapsed .prop-group-rows { display: none; }
.prop-row {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; margin: 6px 0; cursor: pointer;
}
.prop-row:active { background: var(--steel-light); }
.prop-row .l1 { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; min-width: 0; }
.prop-row .nick { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prop-row .l2 {
  font-size: 11.5px; color: var(--ink-soft); font-family: 'IBM Plex Mono', monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px;
}
.prop-badge {
  margin-left: auto; flex-shrink: 0; font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600;
  letter-spacing: 0.04em; padding: 2px 7px; border-radius: 4px; white-space: nowrap;
}
.prop-badge.overdue { background: var(--danger-light); color: var(--danger); }
.prop-badge.due { background: #f7efd8; color: var(--safety-dark); }
.prop-group-head .prop-badge { margin-left: 0; }
.section-head .cnt-h { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-soft); margin-left: 6px; vertical-align: middle; }
.search-label {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint); margin: 8px 0 2px;
}
.town-chips { -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent); }
/* review fixes: the town name yields before badges on narrow phones; the chip strip
   can scroll its last chip clear of the fade, and loses the fade when nothing overflows */
.prop-group-head .name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.town-chips { padding-right: 40px; }
.town-chips.no-fade { -webkit-mask-image: none; mask-image: none; padding-right: 0; }

/* --- "a newer version is live" banner --- */
.update-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 150;
  display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px);
  background: var(--steel-dark); color: #fff; border-radius: 9px; padding: 10px 14px;
  font-family: 'IBM Plex Sans', sans-serif; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.update-bar button {
  background: var(--safety); color: var(--steel-dark); border: none; border-radius: 6px;
  padding: 6px 12px; font-family: 'IBM Plex Sans', sans-serif; font-weight: 600; font-size: 13px; cursor: pointer;
}

/* --- a message that waits to be dismissed (refused saves) --- */
.notice-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 160;
  display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px);
  background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger);
  border-radius: 9px; padding: 12px 14px; line-height: 1.4;
  font-family: 'IBM Plex Sans', sans-serif; font-size: 14px; font-weight: 500; box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.notice-bar button {
  flex: none; background: var(--danger); color: #fff; border: none; border-radius: 6px;
  padding: 7px 12px; font-family: 'IBM Plex Sans', sans-serif; font-weight: 600; font-size: 13px; cursor: pointer;
}

/* --- appliance photo gallery --- */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 4px; }
.photo-tile { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.photo-tile img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--steel-light); cursor: zoom-in; }
.photo-tile .cap {
  font-size: 11px; color: var(--ink-soft); padding: 4px 6px 0; min-height: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo-tile .tile-actions { display: flex; justify-content: space-between; align-items: center; padding: 2px 2px 4px 4px; }
.photo-tile .tile-actions .link-btn { font-size: 11px; padding: 4px 2px; }
.photo-tile .tile-pending { position: absolute; top: 4px; right: 6px; font-size: 12px; }
.photo-tile .rm { background: none; border: none; color: var(--danger); font-size: 15px; cursor: pointer; padding: 2px 6px; line-height: 1; }
.photo-tile .tile-actions .link-btn { white-space: nowrap; font-size: 10.5px; padding: 4px 0; }
/* 320px phones: date inputs have an intrinsic minimum width that pushed the
   two-column detail grid 6px past the viewport */
.detail-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.detail-field { min-width: 0; }
.detail-field .v input, .detail-field .v select { min-width: 0; max-width: 100%; }

/* --- inventory workflow: status strip, missing-type hints, view pills --- */
.inv-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--safety);
  border-radius: 8px; padding: 8px 10px 8px 12px; margin-bottom: 12px; font-size: 13px; color: var(--ink);
}
.inv-strip.complete { border-left-color: #3a7d44; color: #2f6b3a; }
.inv-strip .link-btn { padding: 4px 6px; }
.missing-types { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.missing-types .lbl { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); margin-right: 2px; }
.type-chip-btn {
  background: var(--surface); border: 1px dashed var(--steel); color: var(--steel-dark); border-radius: 14px;
  padding: 4px 10px; font-family: 'IBM Plex Sans', sans-serif; font-size: 12px; font-weight: 600; cursor: pointer;
}
.type-chip-btn:active { background: var(--steel-light); }
.inv-pill {
  flex-shrink: 0; font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
  padding: 2px 7px; border-radius: 4px; white-space: nowrap; background: #f1eee6; color: var(--ink-soft);
}
.inv-pill.complete { background: #e3efe5; color: #2f6b3a; }
.inv-pill.in_progress { background: #f7efd8; color: var(--safety-dark); }
.inv-check { color: #3a7d44; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.unpriced-note { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: var(--safety-dark); font-weight: 600; }
.post-save {
  background: #e3efe5; border: 1px solid #b9d9be; color: #2f6b3a; border-radius: 8px;
  padding: 8px 12px; margin-bottom: 12px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.post-save .link-btn { padding: 2px 4px; color: #2f6b3a; }
.scan-kept { margin-top: 6px; }
.cost-src {
  font-family: 'IBM Plex Mono', monospace; font-size: 9px; font-weight: 600; letter-spacing: 0.04em;
  background: #f7efd8; color: var(--safety-dark); padding: 1px 5px; border-radius: 4px; margin-left: 4px;
  text-transform: uppercase; vertical-align: 1px;
}
.svc-row.audit { background: var(--steel-light); border-style: dotted; }
.type-chip-btn.on { background: var(--steel-dark); color: #fff; border-style: solid; border-color: var(--steel-dark); }

/* Dashboard: crew-first actions, coverage under the money, tools tucked away */
.action-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.action-strip { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.action-strip .btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 10px; line-height: 1.2; min-width: 0; }
.action-strip .sub { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: 0.04em; text-transform: none; font-weight: 500; opacity: 0.85; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-strip.done { grid-template-columns: 1fr; font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-soft); text-align: center; padding: 6px 0; }
.cov-line { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-soft); margin-top: 4px; }
.more-tools { margin-bottom: 16px; }
.more-tools summary { cursor: pointer; font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--steel); padding: 8px 0; list-style: none; }
.more-tools summary::-webkit-details-marker { display: none; }
.more-tools summary::before { content: '▸ '; }
.more-tools[open] summary::before { content: '▾ '; }
.more-tools .btn { margin-top: 8px; }
.code-reveal { font-size: 12px; color: var(--steel-dark); background: var(--surface-2, #e7edf1); padding: 3px 8px; border-radius: 5px; letter-spacing: 0.05em; }

/* Environment ribbon: staging must never be mistaken for the crew's workspace */
.env-ribbon { position: fixed; top: 0; left: 0; right: 0; z-index: 60; text-align: center;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.12em;
  background: var(--safety); color: var(--steel-dark); padding: 3px 0; pointer-events: none; }
body:has(.env-ribbon) .topbar { padding-top: 22px; }

/* --- Sync screen: needs-attention items and the three-state pill --- */
.sync-pill.attention { background: var(--safety); color: var(--steel-dark); }
.sync-item .l1 { display: flex; gap: 8px; align-items: baseline; }
.sync-item .l2 { font-size: 13px; color: var(--ink-soft); margin: 4px 0 8px; }
.sync-item .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-state { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: 0.06em; padding: 1px 7px; border-radius: 4px; background: var(--safety); color: var(--steel-dark); }
.pill-state.blocked { background: var(--surface-2, #e7edf1); color: var(--ink-soft); }
.pill-state.queued { background: var(--surface-2, #e7edf1); color: var(--steel-dark); }

/* Where an asset is, on the add form: a fixed line with a Change link. */
.holder-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px; background: #fff; font-size: 14px; }
.holder-line .link-btn { padding: 0; }
/* Category headings inside a mixed asset list. */
.cat-head { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); margin: 14px 0 6px; }

/* Stock rows on a holder's page. */
.stock-row { border: 1.5px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.stock-row.low { border-color: var(--safety-dark); }
.stock-row .k { font-weight: 600; font-size: 14px; }
.stock-row .v { font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.stock-row .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.svc-badge.low { background: var(--safety-dark); color: #fff; }

/* Rows in the Asset types tool. */
.type-row { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; background: #fff; }
.type-row .info { flex: 1; min-width: 0; }
.type-row .k { font-weight: 600; font-size: 14px; }
.type-row .v { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.type-row .actions { display: flex; gap: 2px; align-items: center; flex-shrink: 0; }
.type-row .actions .link-btn { padding: 4px 5px; }
.type-row .actions .link-btn[disabled] { opacity: 0.3; }
.type-row .rm { background: none; border: none; color: var(--danger); font-size: 15px; cursor: pointer; padding: 4px; }

/* --- moving to the new address (spec section 7) --- */
/* "SpecDeck has a new address.": a strip in the page's own flow, directly under
   the top bar (at the top of the gate), on any origin but the canonical one.
   Never fixed: no sticky footer, Save button or toast can sit under it. */
.move-bar {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 12px;
  background: var(--safety); color: var(--steel-dark); padding: 9px 16px;
  border-bottom: 1px solid var(--safety-dark);
  font-family: 'IBM Plex Sans', sans-serif; font-size: 14px; font-weight: 600; text-align: center;
}
.move-bar a {
  background: var(--steel-dark); color: #fff; border-radius: 6px; padding: 6px 12px;
  font-weight: 600; font-size: 13px; text-decoration: none;
}
.move-bar .wait { font-size: 13px; font-weight: 500; }
/* "Still on the old address: Jason (yesterday)" on the owner's home screen. */
.old-address-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1.5px solid var(--safety-dark); border-radius: 8px; padding: 6px 6px 6px 12px;
  margin-bottom: 6px; background: #fff; font-size: 14px;
}
