/* ============================================================
   Rentspect — Doorframe Clipboard Strip theme
   Palette: slate #3b4a54 · mist #dce4e8 · brass #c26a3a
   Area bands: hall blue · kitchen amber · exterior sage
   ============================================================ */

:root {
  --slate: #3b4a54;
  --slate-deep: #2c3941;
  --slate-soft: #55666f;
  --mist: #dce4e8;
  --mist-pale: #eef2f4;
  --paper: #f8f6f1;
  --brass: #c26a3a;
  --brass-deep: #a4552b;
  --band-hall: #3f6f9e;
  --band-kitchen: #c98a2d;
  --band-exterior: #6d8a63;
  --band-other: #7a8a92;
  --danger: #a83c3c;
  --ink: #24313a;
  --ink-soft: #5b6b73;
  --card-radius: 14px;
  --tap: 48px;
  --tab-h: calc(62px + env(safe-area-inset-bottom, 0px));
  --shadow-active: 0 6px 14px rgba(44, 57, 65, 0.35);
  font-size: 16px;
}

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

html, body {
  height: 100%;
  background: var(--mist);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { overscroll-behavior-y: none; }

.app-shell {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(var(--tab-h) + 16px);
  position: relative;
}

.view { padding: 0 16px; animation: view-in 200ms ease-out; }
.view[hidden] { display: none; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- shared type ---------- */
.view-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--slate-deep);
}
.view-sub { color: var(--ink-soft); font-size: 0.85rem; margin-top: 3px; }
.view-head { padding: 18px 2px 14px; }
.rail-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--slate-soft);
  margin: 22px 2px 10px;
  font-weight: 700;
}

/* ---------- Walkthrough hinge header ---------- */
.hinge-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--slate);
  margin: 0 -16px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 16px;
  color: var(--mist);
}
.hinge-rivet {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--brass);
  border: 3px solid rgba(220, 228, 232, 0.35);
  flex: none;
}
.hinge-text { flex: 1; min-width: 0; }
.app-wordmark {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.05;
}
.hinge-sub { font-size: 0.78rem; color: rgba(220, 228, 232, 0.75); margin-top: 2px; }

.week-counter {
  flex: none;
  width: 62px; height: 62px;
  border-radius: 50%;
  border: 3px solid var(--brass);
  background: var(--slate-deep);
  color: var(--mist);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1px;
  cursor: pointer;
}
.week-count-num { font-size: 1.35rem; font-weight: 800; line-height: 1; color: #fff; }
.week-count-cap {
  font-size: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-align: center;
  color: var(--brass);
}

/* ---------- CTA strip ---------- */
.cta-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  margin-top: 16px;
  padding: 10px 18px;
  border: none;
  border-radius: 12px;
  background: var(--slate);
  color: var(--mist);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 2px 0 var(--slate-deep);
}
.cta-strip:active { transform: translateY(1px); box-shadow: none; }
.cta-plus {
  width: 34px; height: 34px;
  flex: none;
  border-radius: 50%;
  background: var(--brass);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.cta-label { font-size: 1.05rem; font-weight: 700; flex: 1; }
.cta-hint { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: rgba(220,228,232,0.6); }

/* ---------- clipboard cards ---------- */
.clip-card {
  position: relative;
  display: flex;
  align-items: stretch;
  background: var(--paper);
  border: 1px solid #e2ddd2;
  border-radius: var(--card-radius);
  overflow: hidden;
  cursor: pointer;
  min-height: 64px;
  box-shadow: 0 1px 2px rgba(44, 57, 65, 0.08);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.clip-card:active { transform: scale(0.985); box-shadow: 0 1px 4px rgba(44,57,65,0.18); }

.band {
  width: 10px;
  flex: none;
  background: var(--band-other);
}
.band-hall { background: var(--band-hall); }
.band-kitchen { background: var(--band-kitchen); }
.band-exterior { background: var(--band-exterior); }
.band-other { background: var(--band-other); }

.clip-text { flex: 1; min-width: 0; }

.rivet {
  width: 34px; height: 34px;
  flex: none;
  align-self: center;
  margin-left: 12px;
  border-radius: 50%;
  background: var(--slate);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--mist);
}
.rivet-brass { background: var(--brass); }

.clip-body { flex: 1; min-width: 0; padding: 10px 12px; }
.clip-title {
  font-size: 0.95rem; font-weight: 700; color: var(--slate-deep);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.clip-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 3px; font-size: 0.78rem; color: var(--ink-soft);
}
.chip-area {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--band-other);
  white-space: nowrap;
}
.chip-hall { background: var(--band-hall); }
.chip-kitchen { background: var(--band-kitchen); }
.chip-exterior { background: var(--band-exterior); }
.clip-note {
  margin-top: 5px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* focus card (large) */
.walk-focus-wrap { margin-top: 16px; }
.clip-card.focus-card { flex-direction: column; }
.focus-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 0; }
.focus-head .rivet { width: 44px; height: 44px; font-size: 1.05rem; margin-left: 2px; }
.focus-text { flex: 1; min-width: 0; }
.focus-title { font-size: 1.15rem; font-weight: 800; color: var(--slate-deep); }
.focus-date { font-size: 0.8rem; color: var(--brass-deep); font-weight: 600; margin-top: 2px; }
.focus-card .band { width: auto; height: 6px; order: 3; margin: 12px 14px 0; border-radius: 999px; }
.focus-note {
  padding: 10px 16px 14px;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.45;
}
.focus-tag {
  display: inline-block; margin: 0 16px 4px;
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--slate-soft);
}

/* two-row queue */
.queue-two-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.queue-two-row .clip-card { flex-direction: column; }
.queue-two-row .clip-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 0; }
.queue-two-row .rivet { margin-left: 0; width: 30px; height: 30px; font-size: 0.75rem; }
.queue-two-row .clip-body { padding: 8px 10px 12px; }
.queue-two-row .clip-title { white-space: normal; font-size: 0.85rem; }
.queue-two-row .clip-note { -webkit-line-clamp: 1; margin-top: 2px; font-size: 0.75rem; }
.queue-two-row .band { width: auto; height: 5px; order: 3; margin: 0 10px 10px; border-radius: 999px; }
.queue-empty-note {
  grid-column: 1 / -1;
  padding: 14px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  background: var(--mist-pale);
  border-radius: 12px;
}

/* ---------- By Area rail ---------- */
.area-rail { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.area-block { display: flex; align-items: stretch; gap: 10px; }
.area-spine {
  width: 26px;
  flex: none;
  border-radius: 8px;
  background: var(--band-other);
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  padding: 10px 0;
}
.area-spine-count { color: #fff; font-weight: 800; font-size: 1rem; }
.area-spine-cap {
  color: rgba(255,255,255,0.8);
  font-size: 0.55rem; text-transform: uppercase; letter-spacing: 0.1em;
  margin-top: 4px; writing-mode: vertical-rl; text-orientation: mixed;
}
.area-block .area-spine { cursor: pointer; }
.area-group { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.area-name {
  font-size: 0.78rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--slate-soft);
  padding-left: 2px;
}
.area-name .area-count-pill {
  display: inline-block; margin-left: 6px;
  padding: 1px 8px; border-radius: 999px;
  background: var(--mist); color: var(--slate-deep);
  font-size: 0.68rem;
}

/* ---------- empty states ---------- */
.empty {
  margin-top: 18px;
  padding: 26px 20px 30px;
  background: var(--mist-pale);
  border-radius: 16px;
  text-align: left;
  border: 1px dashed #c3cfd5;
}
.empty-door {
  width: 46px; height: 74px;
  border: 5px solid var(--slate-soft);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  position: relative;
  margin-bottom: 14px;
}
.empty-door::after {
  content: "";
  position: absolute; right: 5px; top: 50%;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brass);
}
.empty-door-tall { height: 88px; border-color: var(--band-other); }
.empty-door-small { height: 58px; width: 38px; border-width: 4px; }
.empty-head { font-weight: 800; font-size: 1rem; color: var(--slate-deep); }
.empty-body { margin-top: 6px; font-size: 0.85rem; color: var(--ink-soft); line-height: 1.5; }
.walk-empty .empty-door { margin-left: 4px; }
.find-empty { border-style: solid; border-color: #d4dde1; }

/* ---------- form ---------- */
.head-form { display: flex; align-items: center; gap: 12px; padding-top: 22px; }
.form-badge {
  width: 42px; height: 42px; flex: none;
  border-radius: 10px;
  background: var(--slate);
  position: relative;
}
.form-badge::before {
  content: ""; position: absolute; top: -4px; left: 50%;
  transform: translateX(-50%);
  width: 16px; height: 6px; border-radius: 999px;
  background: var(--brass);
}
.form-badge::after {
  content: ""; position: absolute; inset: 10px 8px;
  border: 2px solid var(--mist); border-radius: 3px;
}

.clip-panel {
  background: var(--paper);
  border: 1px solid #e2ddd2;
  border-radius: 16px;
  padding: 18px 16px 20px;
  box-shadow: 0 2px 8px rgba(44, 57, 65, 0.08);
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--slate-soft);
  margin-bottom: 6px;
}
.req { color: var(--brass-deep); }
.opt {
  font-weight: 600; text-transform: none; letter-spacing: 0;
  color: var(--band-other); font-size: 0.72rem;
}
.field input, .field textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border: 1.5px solid #cfd8dc;
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(194, 106, 58, 0.15);
}
.field.invalid input, .field.invalid textarea {
  border-color: var(--danger);
  background: #fdf5f5;
}
.field-err { margin-top: 5px; font-size: 0.78rem; font-weight: 600; color: var(--danger); }

.form-actions {
  display: flex; gap: 10px; margin-top: 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.btn-primary {
  flex: 1;
  min-height: var(--tap);
  border: none;
  border-radius: 10px;
  background: var(--brass);
  color: #fff;
  font: inherit; font-size: 1rem; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--brass-deep);
}
.btn-primary:active { transform: translateY(1px); box-shadow: none; }
.btn-ghost {
  min-height: var(--tap);
  padding: 0 18px;
  border: 1.5px solid #c3cfd5;
  border-radius: 10px;
  background: #fff;
  color: var(--slate-deep);
  font: inherit; font-size: 0.92rem; font-weight: 700;
  cursor: pointer;
}
.btn-ghost.small { min-height: 40px; padding: 0 14px; font-size: 0.8rem; }
.btn-ghost.danger { color: var(--danger); border-color: #dcb9b9; }
.form-status { margin-top: 10px; font-size: 0.82rem; font-weight: 600; color: var(--band-exterior); min-height: 1.2em; }

/* ---------- Find ---------- */
.head-find { padding-bottom: 10px; }
.search-drawer {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--mist);
  padding: 6px 0 10px;
  margin: 0 -16px;
  padding-left: 16px; padding-right: 16px;
}
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: #fff;
  border: 1.5px solid #cfd8dc;
  border-radius: 999px;
  padding: 4px 12px;
}
.search-box:focus-within { border-color: var(--brass); }
.search-glyph {
  width: 16px; height: 16px; flex: none;
  border: 2.5px solid var(--slate-soft);
  border-radius: 50%;
  position: relative;
}
.search-glyph::after {
  content: ""; position: absolute;
  width: 7px; height: 2.5px; background: var(--slate-soft);
  bottom: -2px; right: -4px; transform: rotate(45deg); border-radius: 2px;
}
#search-input {
  flex: 1; min-height: 44px;
  border: none; outline: none;
  font: inherit; font-size: 1rem;
  color: var(--ink);
  background: transparent;
}
.search-clear {
  width: 32px; height: 32px; flex: none;
  border: none; border-radius: 50%;
  background: var(--mist);
  color: var(--slate-deep);
  font-size: 1.1rem; line-height: 1;
  cursor: pointer;
}
.search-results { display: flex; flex-direction: column; gap: 10px; }
.search-results .clip-card { flex-direction: column; }
.search-results .clip-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 0; }
.search-results .rivet { margin-left: 0; width: 32px; height: 32px; font-size: 0.78rem; }
.search-results .clip-body { padding: 8px 12px 12px; }
.search-results .band { width: auto; height: 5px; order: 3; margin: 0 12px 10px; border-radius: 999px; }
mark.hit { background: rgba(201, 138, 45, 0.35); color: inherit; border-radius: 2px; padding: 0 1px; }

/* ---------- About / Settings ---------- */
.about-settings { margin-top: 26px; }
.about-card {
  background: var(--slate);
  color: var(--mist);
  border-radius: 16px;
  padding: 18px 16px;
}
.about-name { font-weight: 800; font-size: 1.05rem; color: #fff; }
.about-line { margin-top: 6px; font-size: 0.84rem; line-height: 1.5; color: rgba(220,228,232,0.85); }
.about-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid rgba(220,228,232,0.15);
  font-size: 0.84rem;
}
.about-k { color: rgba(220,228,232,0.7); }
.about-v { font-weight: 700; color: #fff; }
.about-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.about-actions .btn-ghost {
  background: transparent; color: var(--mist);
  border-color: rgba(220,228,232,0.4);
  flex: 1; min-width: 140px;
}
.about-actions .btn-ghost.danger { color: #e8b0b0; border-color: rgba(232,176,176,0.5); }

/* ---------- detail sheet ---------- */
.detail-overlay {
  position: fixed; inset: 0;
  background: rgba(36, 49, 58, 0.55);
  z-index: 40;
  display: flex; align-items: flex-end;
  animation: fade-in 160ms ease-out;
}
.detail-overlay[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.detail-sheet {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  max-height: 86dvh;
  overflow-y: auto;
  padding: 8px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  animation: sheet-up 220ms cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.detail-grip {
  width: 44px; height: 5px; border-radius: 999px;
  background: #cfd8dc; margin: 6px auto 12px;
}
.detail-band-top { height: 8px; border-radius: 999px; margin-bottom: 14px; }
.detail-head { display: flex; align-items: center; gap: 12px; }
.detail-head .rivet { width: 46px; height: 46px; font-size: 1.05rem; margin-left: 0; }
#detail-title { font-size: 1.25rem; font-weight: 800; color: var(--slate-deep); line-height: 1.15; }
.detail-sub { font-size: 0.82rem; color: var(--brass-deep); font-weight: 600; margin-top: 2px; }
.detail-rows { margin-top: 16px; display: flex; flex-direction: column; gap: 0; }
.detail-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 11px 0;
  border-top: 1px solid #e7e2d7;
  font-size: 0.9rem;
}
.detail-row:first-child { border-top: none; }
.detail-k { color: var(--ink-soft); flex: none; }
.detail-v { font-weight: 700; color: var(--slate-deep); text-align: right; word-break: break-word; }
.detail-note-box {
  margin-top: 14px;
  background: var(--mist-pale);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.9rem; line-height: 1.5;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}
.detail-note-cap {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--slate-soft); margin-bottom: 5px;
}
.detail-actions { display: flex; gap: 10px; margin-top: 20px; }
.detail-actions .btn-ghost { flex: 1; }
.btn-delete {
  flex: 1;
  min-height: var(--tap);
  border: none; border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font: inherit; font-size: 0.92rem; font-weight: 700;
  cursor: pointer;
}
.btn-delete:active { transform: translateY(1px); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + 14px);
  transform: translateX(-50%);
  background: var(--slate-deep);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 60;
  max-width: 90vw;
  text-align: center;
  animation: toast-in 200ms ease-out;
}
.toast[hidden] { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- bottom tab bar (door corners) ---------- */
.tab-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  max-width: 520px;
  margin: 0 auto;
  height: var(--tab-h);
  padding: 0 6px env(safe-area-inset-bottom, 0px);
  background: var(--slate);
  display: flex;
  box-shadow: 0 -4px 16px rgba(44, 57, 65, 0.28);
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: rgba(220, 228, 232, 0.55);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  padding-top: 9px;
  min-height: var(--tap);
}
.tab-label {
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
/* flat door-corner silhouette: an L-shaped corner bracket */
.tab-corner {
  width: 22px; height: 18px;
  border-left: 3px solid currentColor;
  border-top: 3px solid currentColor;
  border-top-left-radius: 5px;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.tab.active {
  color: #fff;
}
.tab.active .tab-corner {
  color: var(--brass);
  transform: translateY(-4px) scale(1.12);
  box-shadow: var(--shadow-active);
  border-radius: 6px 0 0 0;
}
.tab.active.tab-find .tab-corner { transform: translateY(-4px) scale(-1.12, 1.12); border-radius: 0 6px 0 0; }
.tab.active.tab-areas .tab-corner { transform: translateY(-4px) scale(1, -1.12); border-radius: 0 0 0 6px; }
.tab.active.tab-form .tab-corner { transform: translateY(-4px) scale(-1, -1.12); border-radius: 0 0 6px 0; }

/* ---------- misc ---------- */
@media (max-width: 340px) {
  .queue-two-row { grid-template-columns: 1fr; }
  .week-counter { width: 54px; height: 54px; }
}
button { -webkit-tap-highlight-color: transparent; }
