/* ===============================================
   653 Jacon Residence — Finish Dashboard
   Warm interior-studio design system
   =============================================== */

:root {
  /* warm neutral palette */
  --bg:           #F2EFE7;   /* warm parchment */
  --bg-tint:     #EBE7DC;   /* slightly deeper tone for accents */
  --surface:     #FBFAF6;   /* cards */
  --surface-2:   #F7F5EE;   /* secondary surface */
  --border:      #E2DCCD;   /* hairline */
  --border-strong:#CFC7B3;

  --ink:         #2A2620;   /* primary text — warm near-black */
  --ink-2:       #4B463B;
  --ink-3:       #7A7367;   /* muted */
  --ink-4:       #A39B8B;   /* faint */

  /* one restrained accent — creamy construction brown */
  --accent:      #735F49;
  --accent-2:    #5E4B37;
  --accent-soft: #EEE7DB;
  --accent-tint: #DED2BF;

  /* status palette — restrained, distinguishable */
  --st-not-bg:    #F0E4D2;  --st-not-fg:    #73502B;
  --st-ordered-bg:#E6DED0;  --st-ordered-fg:#5E4B37;
  --st-hand-bg:   #DED9C8;  --st-hand-fg:   #595540;

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-1: 0 1px 2px rgba(60,49,30,.04), 0 1px 1px rgba(60,49,30,.03);
  --shadow-2: 0 6px 20px -8px rgba(60,49,30,.18), 0 2px 6px -2px rgba(60,49,30,.06);
  --shadow-3: 0 20px 50px -20px rgba(40,30,15,.35), 0 8px 24px -12px rgba(40,30,15,.12);

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:    'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --t-fast: 140ms cubic-bezier(.4,0,.2,1);
  --t-med:  220ms cubic-bezier(.4,0,.2,1);
  --t-slow: 380ms cubic-bezier(.16,1,.3,1);
}

* { box-sizing: border-box; min-width: 0; }
html { overflow-x: hidden; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: 'ss01','cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  padding-bottom: 80px;
}
button { font-family: inherit; }

::selection { background: var(--accent-tint); color: var(--accent-2); }

/* =====================================================
   HEADER
   ===================================================== */
.site-header {
  padding: 32px clamp(20px, 4vw, 56px) 0;
  max-width: 1400px;
  margin: 0 auto;
}
.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 32px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  max-width: 100%;
  overflow: hidden;
}
.brand { display: flex; gap: 16px; align-items: center; color: var(--ink); }
.brand-logo {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: var(--accent);
  -webkit-mask: url("kasteler-mark.svg") center / contain no-repeat;
  mask: url("kasteler-mark.svg") center / contain no-repeat;
}
.brand-eyebrow {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500;
}
.brand-project {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--ink);
  line-height: 1.15;
  margin-top: 2px;
}
.header-meta {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 13px; color: var(--ink-3);
  text-align: right;
}
.meta-line { font-variant-numeric: tabular-nums; }
.meta-label {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-4); margin-right: 6px;
}
.header-actions { display: flex; gap: 10px; }

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast),
              transform var(--t-fast), box-shadow var(--t-fast),
              border-color var(--t-fast);
  white-space: nowrap;
}
.btn .icon { width: 16px; height: 16px; }
.btn-primary {
  background: var(--accent);
  color: #F5F2EA;
  box-shadow: var(--shadow-1);
}
.btn-primary:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--border-strong);
}
.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--ink-3);
  color: var(--ink);
}

.icon-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: all var(--t-fast);
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }

/* =====================================================
   SUMMARY CARDS
   ===================================================== */
.summary-section {
  max-width: 1400px;
  margin: 18px auto 0;
  padding: 0 clamp(20px, 4vw, 56px);
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-1);
  transition: transform var(--t-med), box-shadow var(--t-med);
}
.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}
.summary-card-nav {
  cursor: pointer;
}
.summary-card-nav:focus-visible {
  outline: none;
  box-shadow: var(--shadow-2), 0 0 0 3px var(--accent-soft);
  border-color: var(--accent-tint);
}
.summary-card-nav .summary-foot::after {
  content: " →";
  color: var(--accent);
  opacity: 0;
  transition: opacity var(--t-fast);
}
.summary-card-nav:hover .summary-foot::after,
.summary-card-nav:focus-visible .summary-foot::after {
  opacity: 1;
}
.summary-card.accent {
  background: linear-gradient(155deg, #F3ECDD 0%, var(--surface) 100%);
  border-color: var(--accent-tint);
}
.summary-label {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.summary-value {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 500;
  letter-spacing: -.02em;
  color: var(--ink);
  line-height: 1;
  margin-top: 14px;
  font-variant-numeric: tabular-nums;
}
.summary-foot {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-3);
}

/* =====================================================
   TABS + FILTERS
   ===================================================== */
.controls {
  max-width: 1400px;
  margin: 28px auto 0;
  padding: 0 clamp(20px, 4vw, 56px);
}
.tabs {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.tab {
  border: none;
  background: transparent;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  transition: all var(--t-fast);
}
.tab:hover { color: var(--ink); }
.tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.filter-bar {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto 1fr;
  gap: 12px;
  align-items: center;
}
.controls.is-overview .filter-bar {
  display: none;
}

.search {
  position: relative;
  display: flex; align-items: center;
}
.search .icon {
  position: absolute; left: 14px;
  width: 16px; height: 16px;
  color: var(--ink-3);
  pointer-events: none;
}
.search input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 10px 14px 10px 38px;
  font: inherit;
  color: var(--ink);
  transition: all var(--t-fast);
}
.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-2);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.filter-toggle .icon { width: 16px; height: 16px; }
.filter-toggle .filter-count {
  background: var(--accent);
  color: #F5F2EA;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  display: inline-block;
  text-align: center;
}

.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.add-room-filter { display: none; }
.select {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='none' stroke='%237A7367' stroke-width='1.4' stroke-linecap='round' d='M3 4.5l3 3 3-3'/></svg>") no-repeat right 12px center;
  border-radius: 999px;
  padding: 8px 32px 8px 14px;
  font: inherit;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all var(--t-fast);
}
.select:hover { border-color: var(--ink-3); }
.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* =====================================================
   MAIN VIEWS
   ===================================================== */
.main {
  max-width: 1400px;
  margin: 28px auto 0;
  padding: 0 clamp(20px, 4vw, 56px);
}
.view { animation: fadeUp .35s cubic-bezier(.16,1,.3,1); }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === OVERVIEW === */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.panel.panel-wide { grid-column: 1 / -1; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.panel { padding: 24px 26px; }
.panel-head { margin-bottom: 18px; }
.panel-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -.01em;
  margin: 0;
  color: var(--ink);
}
.panel-sub {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 4px;
}

.status-bars { display: flex; flex-direction: column; gap: 14px; }
.status-bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 36px;
  align-items: center;
  gap: 14px;
  font-size: 13px;
}
.status-bar-row .label { color: var(--ink-2); font-weight: 500; }
.status-bar-row .count { color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.status-bar-track {
  height: 8px;
  background: #F0ECE3;
  border-radius: 999px;
  overflow: hidden;
}
.status-bar-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: 999px;
  transition: width .8s cubic-bezier(.16,1,.3,1);
}

.next-list, .activity-list { list-style: none; margin: 0; padding: 0; }
.next-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.next-list li:last-child { border-bottom: none; }
.next-room { font-weight: 500; color: var(--ink); }
.next-count { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.activity-list li {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-list li:last-child { border-bottom: none; }
.activity-date {
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}
.activity-text { font-size: 14px; color: var(--ink); }
.activity-text strong { font-weight: 600; }
.activity-text em { color: var(--ink-3); font-style: normal; }

/* === BY ROOM === */
.rooms-stack { display: flex; flex-direction: column; gap: 18px; }
.room-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.room-head {
  padding: 22px 26px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}
.room-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -.01em;
  margin: 0;
  color: var(--ink);
}
.room-meta {
  font-size: 13px;
  color: var(--ink-3);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.room-meta span { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.room-meta-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-4); }

.item-list { padding: 6px 14px 14px; }
.room-empty {
  margin: 0;
  padding: 22px 18px;
  color: var(--ink-3);
  font-size: 14px;
  border-top: 1px solid var(--border);
}
.item-row {
  display: grid;
  grid-template-columns: 28px 52px 1.6fr 1fr 1fr 0.9fr 110px 24px;
  align-items: center;
  gap: 14px;
  padding: 14px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--t-fast);
  border-bottom: 1px solid var(--border);
}
.item-row:last-child { border-bottom: none; }
.item-row:hover { background: var(--surface-2); }
.item-row .cat-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.item-photo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
}
.item-photo-empty,
.product-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--ink-4);
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.item-photo-empty span { display: none; }
.item-row .product-cell { min-width: 0; }
.item-row .product-name {
  font-weight: 500;
  color: var(--ink);
  font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item-row .product-sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item-row .cell { font-size: 13px; color: var(--ink-2); min-width: 0; }
.item-row .cell-strong { color: var(--ink); font-weight: 500; }
.item-row .cell-muted { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.item-row .qty { text-align: right; font-variant-numeric: tabular-nums; }
.item-row .qty .qty-final {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
}
.item-row .qty .qty-base {
  font-size: 11px;
  color: var(--ink-3);
}
.item-row .chevron {
  width: 18px; height: 18px;
  color: var(--ink-4);
  transition: transform var(--t-med);
}
.item-row.is-open .chevron { transform: rotate(180deg); color: var(--ink-2); }
.item-row.is-open { background: var(--surface-2); }

.item-detail {
  grid-column: 1 / -1;
  padding: 4px 6px 18px 94px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px 28px;
  animation: detailIn .25s cubic-bezier(.16,1,.3,1);
}
.detail-photo {
  grid-row: span 2;
  min-height: 136px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-1);
}
@keyframes detailIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.detail-field { font-size: 13px; color: var(--ink); }
.detail-label {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  margin-bottom: 4px;
  display: block;
}
.detail-field.notes { grid-column: 1 / -1; }
.detail-field.notes .notes-text {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-2);
  line-height: 1.5;
}
.detail-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 14px;
}
.subtle-edit,
.subtle-delete {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-4);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 0;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.subtle-delete:hover {
  color: #8B4D35;
  border-bottom-color: rgba(139, 77, 53, .35);
}
.subtle-edit { color: var(--accent-2); }
.subtle-edit:hover {
  color: var(--accent);
  border-bottom-color: var(--accent-tint);
}
.detail-field a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid var(--accent-tint);
}
.detail-field a:hover { color: var(--accent-2); border-bottom-color: var(--accent); }

/* === STATUS CHIPS === */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
}
.chip::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .7;
}
.chip[data-status="Not Ordered"] { background: var(--st-not-bg);     color: var(--st-not-fg); }
.chip[data-status="Ordered"]     { background: var(--st-ordered-bg); color: var(--st-ordered-fg); }
.chip[data-status="On Hand"]     { background: var(--st-hand-bg);    color: var(--st-hand-fg); }

/* === BY PRODUCT === */
.products-intro {
  margin-bottom: 22px;
}
.products-intro h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -.01em;
  margin: 0 0 4px;
  color: var(--ink);
}
.products-intro p {
  margin: 0;
  color: var(--ink-3);
  max-width: 60ch;
}

.products-stack { display: flex; flex-direction: column; gap: 16px; }

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--t-med);
}
.product-card:hover { box-shadow: var(--shadow-2); }

.product-head {
  display: grid;
  grid-template-columns: 82px 1fr auto;
  gap: 18px;
  align-items: start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.product-photo {
  width: 82px;
  height: 82px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
}
.product-head .left { min-width: 0; }
.product-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0;
  line-height: 1.2;
}
.product-meta {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-3);
  display: flex; flex-wrap: wrap; gap: 14px;
}
.product-meta span { display: inline-flex; align-items: center; gap: 5px; }
.product-total {
  text-align: right;
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 12px 18px;
  border: 1px solid var(--accent-tint);
}
.product-total .label {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-weight: 500;
}
.product-total .value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--accent-2);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.product-total .unit { font-size: 14px; margin-left: 2px; color: var(--accent-2); opacity: .8; }

.product-room-list { padding-top: 6px; }
.product-room-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 110px;
  gap: 14px;
  padding: 12px 4px;
  align-items: center;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}
.product-room-row:last-child { border-bottom: none; }
.product-room-row .room-label { color: var(--ink); font-weight: 500; }
.product-room-row .room-label-sub {
  font-size: 12px; color: var(--ink-3); margin-top: 2px;
}
.product-room-row .cell-muted { color: var(--ink-3); font-size: 13px; }
.product-room-row .qty { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }

/* === EMPTY === */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-3);
}
.empty-state h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink-2);
  margin: 0 0 6px;
}

/* =====================================================
   FAB (mobile add)
   ===================================================== */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #F5F2EA;
  border: none;
  box-shadow: var(--shadow-3);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: transform var(--t-fast);
}
.fab:hover { transform: scale(1.05); }
.fab svg { width: 22px; height: 22px; }

/* =====================================================
   MODAL
   ===================================================== */
[hidden] { display: none !important; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 24, 14, .35);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: backdropIn .2s ease-out;
}
@keyframes backdropIn { from {opacity: 0;} to {opacity: 1;} }
.modal {
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
  animation: modalIn .35s cubic-bezier(.16,1,.3,1);
}
.modal-compact { max-width: 480px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-eyebrow {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  margin-bottom: 4px;
}
.modal-head h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -.01em;
  margin: 0;
  color: var(--ink);
}
.modal-body {
  padding: 22px 28px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-row:has(.field-final) { grid-template-columns: 1fr 1fr 1.2fr; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label {
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--ink-2);
  font-weight: 500;
}
.field-optional { color: var(--ink-4); font-weight: 400; }
.field-helper {
  font-size: 11px;
  color: var(--ink-3);
}
.field input, .field select, .field textarea {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  transition: all var(--t-fast);
  width: 100%;
}
.field select {
  appearance: none;
  background: var(--surface-2) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='none' stroke='%237A7367' stroke-width='1.4' stroke-linecap='round' d='M3 4.5l3 3 3-3'/></svg>") no-repeat right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.field textarea { resize: vertical; font-family: inherit; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.photo-tool {
  display: grid;
  grid-template-columns: 1fr 128px;
  gap: 12px;
  align-items: end;
}
.photo-tool .form-note,
.photo-actions { grid-column: 1 / -1; }
.photo-actions { margin-top: -6px; }
.photo-preview {
  height: 94px;
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  background: var(--surface-2);
  display: flex;
  align-items: end;
  justify-content: center;
  color: var(--ink-4);
  font-size: 12px;
  padding: 10px;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.photo-preview.has-photo {
  border-style: solid;
  justify-content: flex-start;
}
.photo-preview span {
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 999px;
  padding: 4px 8px;
}
.field-final {
  background: var(--accent-soft);
  border: 1px solid var(--accent-tint);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  align-self: stretch;
  justify-content: center;
  margin-bottom: 14px;
  gap: 2px;
}
.field-final .field-label { color: var(--accent-2); }
.field-final .final-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--accent-2);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.form-note {
  margin: -2px 0 0;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.45;
}
.room-manager {
  margin-top: 22px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.room-manager-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}
.room-manager-head span {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 600;
}
.room-manager-head small {
  color: var(--ink-4);
  font-size: 12px;
  text-align: right;
}
.room-manager-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}
.room-manager-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 9px 10px 9px 12px;
}
.room-manager-name {
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
}
.room-manager-count {
  color: var(--ink-3);
  font-size: 12px;
}
.room-delete {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-4);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all var(--t-fast);
}
.room-delete:hover {
  color: #8B4D35;
  background: #F1E6DA;
  border-color: #E1C9B9;
}

/* =====================================================
   TOAST
   ===================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: var(--ink);
  color: #F5F2EA;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-3);
  opacity: 0;
  transition: all var(--t-slow);
  z-index: 200;
  pointer-events: none;
}
.toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1100px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .summary-card:nth-child(4), .summary-card:nth-child(5) { /* keep */ }
}

@media (max-width: 900px) {
  .site-header { padding-left: clamp(16px, 3vw, 40px); padding-right: clamp(16px, 3vw, 40px); }
  .summary-section, .controls, .main { padding-left: clamp(16px, 3vw, 40px); padding-right: clamp(16px, 3vw, 40px); }
  .header-inner {
    grid-template-columns: 1fr auto;
    gap: 18px;
  }
  .header-meta {
    grid-column: 1 / -1;
    flex-direction: row;
    text-align: left;
    gap: 18px;
    border-top: 1px dashed var(--border);
    padding-top: 12px;
  }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }

  .item-row {
    grid-template-columns: 20px 52px minmax(0, 1fr) 0.9fr 110px 24px;
  }
  .item-row .cell-supplier,
  .item-row .cell-sku { display: none; }

  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  /* --- HEADER --- */
  .site-header { padding: 16px 16px 0; }
  .header-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 14px;
  }
  .brand { gap: 12px; }
  .brand-logo { width: 36px; height: 36px; }
  .brand-project { font-size: 20px; }
  .header-meta {
    flex-direction: column;
    gap: 3px;
    text-align: left;
    border-top: none;
    padding-top: 0;
    font-size: 12px;
    color: var(--ink-3);
  }
  .meta-line { white-space: normal; }
  .header-actions { display: none; }
  .fab { display: inline-flex; }

  /* --- SUMMARY CARDS --- */
  .summary-section { margin-top: 16px; padding: 0 16px; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .summary-card { padding: 14px 16px; }
  .summary-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .summary-value { font-size: 30px; margin-top: 6px; }
  .summary-foot { font-size: 12px; }

  /* --- CONTROLS / TABS --- */
  .controls { margin-top: 20px; padding: 0 16px; }
  .tabs { width: 100%; display: flex; }
  .tab { flex: 1; text-align: center; font-size: 13px; padding: 8px 10px; }

  .filter-bar {
    grid-template-columns: 1fr auto;
    align-items: center;
    margin-top: 12px;
  }
  .filter-toggle { display: inline-flex; }
  .filter-group {
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: stretch;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    display: none;
    gap: 10px;
  }
  .filter-group.is-open { display: flex; }
  .filter-group .select { width: 100%; border-radius: var(--radius-sm); }
  .filter-group .btn-ghost { align-self: flex-start; }
  .filter-group .add-room-filter { display: inline-flex; }

  /* --- MAIN --- */
  .main { margin-top: 20px; padding: 0 16px; }

  /* --- ROOM VIEW --- */
  .room-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 16px 16px 12px;
  }
  .room-name { font-size: 19px; }
  .room-meta { font-size: 12px; gap: 10px; }
  .item-list { padding: 0 8px 10px; }

  /* Item rows: photo | name+status | qty then chevron */
  .item-row {
    grid-template-columns: 44px 1fr auto;
    grid-template-rows: auto auto;
    gap: 3px 10px;
    padding: 12px 10px;
  }
  .item-row .cat-dot { display: none; }
  .item-row .item-photo {
    grid-column: 1;
    grid-row: 1 / 3;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    align-self: center;
  }
  .item-row .product-cell { grid-column: 2; grid-row: 1; }
  .item-row .product-name { font-size: 13px; }
  .item-row .product-sub { font-size: 11px; }
  .item-row .cell-supplier,
  .item-row .cell-sku { display: none; }
  .item-row .cell-status { grid-column: 2; grid-row: 2; }
  .item-row .qty {
    grid-column: 3;
    grid-row: 1;
    text-align: right;
  }
  .item-row .qty .qty-final { font-size: 14px; }
  .item-row .chevron {
    grid-column: 3;
    grid-row: 2;
    align-self: end;
    justify-self: end;
    width: 16px;
    height: 16px;
  }
  .item-detail {
    grid-column: 1 / -1;
    padding: 12px 0 4px;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
  }
  .detail-photo { grid-column: 1 / -1; min-height: 160px; }
  .item-detail .detail-field.notes { grid-column: 1 / -1; }
  .detail-actions { justify-content: flex-start; gap: 20px; }

  /* --- OVERVIEW --- */
  .panel { padding: 16px; }
  .panel-title { font-size: 18px; }
  .status-bar-row { grid-template-columns: 90px 1fr 30px; gap: 10px; }
  .activity-list li { grid-template-columns: 1fr; gap: 2px; }
  .activity-date { font-size: 11px; }
  .activity-text { font-size: 13px; }

  /* --- BY PRODUCT --- */
  .products-intro h2 { font-size: 20px; }
  .product-card { padding: 16px; }
  .product-head {
    grid-template-columns: 60px 1fr;
    gap: 12px;
  }
  .product-photo { width: 60px; height: 60px; border-radius: 14px; }
  .product-title { font-size: 17px; }
  .product-meta { font-size: 12px; gap: 10px; }
  .product-total {
    grid-column: 1 / -1;
    text-align: left;
    padding: 10px 14px;
  }
  .product-total .value { font-size: 22px; }
  .product-room-list { padding-top: 4px; }
  .product-room-row {
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
  }
  .product-room-row > div:nth-child(2),
  .product-room-row > div:nth-child(3) { display: none; }
  .product-room-row .room-label { font-size: 13px; }
  .product-room-row .qty { grid-row: 1 / 3; align-self: center; font-size: 14px; }

  /* --- MODALS --- */
  .modal-backdrop { padding: 12px; align-items: flex-end; }
  .modal {
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-sm);
  }
  .modal-body { padding: 16px 18px; }
  .modal-head, .modal-foot { padding-left: 18px; padding-right: 18px; }
  .modal-head h2 { font-size: 19px; }
  .room-manager-head { flex-direction: column; gap: 2px; align-items: flex-start; }
  .room-manager-head small { text-align: left; }
  .form-row, .form-row:has(.field-final) { grid-template-columns: 1fr; }
  .photo-tool { grid-template-columns: 1fr; }
  .photo-preview { height: 140px; }

  /* --- FAB --- */
  .fab { bottom: 20px; right: 16px; width: 52px; height: 52px; }
  body { padding-bottom: 90px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* =====================================================
   LOGIN SCREEN
   ===================================================== */

.login-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.login-backdrop.is-hidden {
  display: none;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: .875rem;
  margin-bottom: 1.5rem;
}

.login-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.login-brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.login-eyebrow {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.login-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink-1);
  line-height: 1.2;
}

.login-project {
  font-size: .8rem;
  color: var(--ink-3);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .35rem .65rem;
  display: inline-block;
  margin-bottom: 1.75rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-btn {
  width: 100%;
  justify-content: center;
  margin-top: .25rem;
  padding: .75rem;
  font-size: .95rem;
}

.login-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: .6rem .85rem;
  font-size: .82rem;
  line-height: 1.4;
}

.login-btn.is-loading {
  opacity: .7;
  pointer-events: none;
}
