/* Inventory-specific component styles. Tokens (:root vars, reset, .app
   shell) live in shared/tokens.css — this file only holds markup that's
   genuinely specific to this app, per the brief's design-system split. */

/* ---------- Header / search / chips ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(243,236,225,0.92);
  backdrop-filter: blur(8px);
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.wordmark {
  display: flex; align-items: center; gap: 8px;
  font-size: 22px; letter-spacing: 0.2px;
  margin: 0 0 12px;
  text-decoration: none;
}
.wordmark .underline { position: relative; }
.wordmark .underline::after {
  content: ""; position: absolute; left: 2px; right: -4px; bottom: -4px;
  height: 6px; background: var(--timber); opacity: 0.28;
  border-radius: var(--r-pill); transform: rotate(-0.6deg);
}

.header-row { display: flex; align-items: center; justify-content: space-between; }
.subtitle-row { display: flex; align-items: baseline; justify-content: flex-end; margin: 0 0 10px; }
.subtitle-row .link { font-size: 12px; color: var(--timber); font-weight: 600; text-decoration: none; }

.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--cream-card); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 10px 16px; box-shadow: var(--shadow-sm);
}
.search-bar input {
  border: none; background: transparent; outline: none;
  font-family: var(--font-body); font-size: 15px; color: var(--ink); flex: 1;
}
.search-bar input::placeholder { color: var(--ink-soft); }

.chip-row {
  display: flex; gap: 7px; overflow-x: auto;
  margin-top: 10px; padding-bottom: 2px; scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--border); background: var(--cream-card);
  color: var(--ink-soft); font-size: 12.5px; font-weight: 600;
  padding: 7px 13px; border-radius: var(--r-pill); white-space: nowrap;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.chip.active { background: var(--timber); color: #fff; border-color: var(--timber); }
.chip-hint { font-size: 11.5px; color: var(--ink-soft); margin: 6px 2px 0; }

/* ---------- Section scaffolding ---------- */
main { padding: 20px; display: flex; flex-direction: column; gap: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.section-head h2 { font-size: 17px; margin: 0; }
.section-head .link { font-size: 13px; color: var(--timber); font-weight: 600; text-decoration: none; background: none; border: none; padding: 0; }

/* ---------- Dashboard stats ---------- */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-card { background: var(--cream-card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 12px; box-shadow: var(--shadow-sm); text-align: left; }
.stat-card .num { font-family: var(--font-display); font-size: 22px; font-weight: 700; display: block; }
.stat-card .label { font-size: 12px; color: var(--ink-soft); }
.stat-card.alert .num { color: var(--cat-terracotta); }

/* ---------- Recent items — horizontal scroll ---------- */
.scroll-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.scroll-row::-webkit-scrollbar { display: none; }

.item-card {
  background: var(--cream-card); border: 1px solid var(--border); border-radius: var(--r-md);
  overflow: hidden; box-shadow: var(--shadow-sm); text-align: left; text-decoration: none; display: block;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease); color: inherit;
}
.item-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.scroll-row .item-card { flex: 0 0 148px; }
.item-card .thumb { height: 100px; background: var(--timber-tint); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.item-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-card .thumb svg { opacity: 0.55; }
.item-card .meta { padding: 10px 12px 12px; }
.item-card .name { font-size: 13.5px; font-weight: 600; margin: 0 0 2px; }
.item-card .room { font-size: 11.5px; color: var(--ink-soft); }
.tag-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }

/* ---------- Rooms — floorplan-style tiles ----------
   Data-driven variant of the mockup's hand-tuned per-room grid: tile
   "wobble" (radius + rotation), tint, and size all cycle deterministically
   by index so any household's real room list still reads as hand-drawn/
   irregular rather than a uniform grid, without hardcoding specific room
   names the way the mockup's fixed shed/lounge/etc grid does. */
.floorplan {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px; background: var(--cream-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow-sm);
}
.room-cell {
  min-height: 72px; border-radius: var(--r-sm); display: flex; flex-direction: column;
  justify-content: flex-end; padding: 8px 10px; position: relative;
  border: 1.5px solid transparent; cursor: pointer; text-decoration: none; color: inherit;
  transition: transform var(--fast) var(--ease);
}
.room-cell.size-wide { grid-column: span 2; }
.room-cell.size-tall { min-height: 108px; }
.room-cell:hover { transform: scale(1.015); }
.room-cell .rname { font-family: var(--font-display); font-weight: 600; font-size: 12.5px; }
.room-cell .rcount { font-size: 10.5px; opacity: 0.75; }
.room-cell.wobble-0 { border-radius: 16px 6px 14px 4px; transform: rotate(-0.4deg); }
.room-cell.wobble-1 { border-radius: 6px 18px 6px 12px; transform: rotate(0.3deg); }
.room-cell.wobble-2 { border-radius: 14px 14px 4px 16px; }
.room-cell.wobble-3 { border-radius: 4px 12px 14px 8px; transform: rotate(-0.3deg); }
.room-cell.wobble-4 { border-radius: 18px 8px 20px 6px; }
.room-cell.tint-sage       { background: var(--cat-sage-tint); border-color: var(--cat-sage); }
.room-cell.tint-terracotta { background: var(--cat-terracotta-tint); border-color: var(--cat-terracotta); }
.room-cell.tint-ochre      { background: var(--cat-ochre-tint); border-color: var(--cat-ochre); }
.room-cell.tint-blue       { background: var(--cat-blue-tint); border-color: var(--cat-blue); }
.room-cell.tint-plum       { background: var(--cat-plum-tint); border-color: var(--cat-plum); }
.room-cell.virtual {
  border-style: dashed; background: var(--cream-card); border-color: var(--border);
  border-radius: var(--r-md); transform: none;
}

/* ---------- Full inventory — card / table toggle ---------- */
.view-toggle { display: inline-flex; background: var(--cream-card); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 3px; box-shadow: var(--shadow-sm); }
.view-toggle button { border: none; background: transparent; padding: 6px 14px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 600; color: var(--ink-soft); transition: background var(--fast) var(--ease), color var(--fast) var(--ease); }
.view-toggle button.active { background: var(--timber); color: #fff; }

.inv-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
@media (min-width: 900px) { .inv-cards { grid-template-columns: repeat(3, 1fr); } }

.inv-table { width: 100%; border-collapse: collapse; margin-top: 14px; display: none; }
.inv-table th, .inv-table td { text-align: left; padding: 9px 8px; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.inv-table th { color: var(--ink-soft); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.mode-table .inv-cards { display: none; }
.mode-table .inv-table { display: table; }

/* ---------- Empty state ---------- */
.empty-state { border: 1.5px dashed var(--border); border-radius: var(--r-md); padding: 22px 16px; text-align: center; color: var(--ink-soft); }
.empty-state svg { margin-bottom: 8px; opacity: 0.6; }
.empty-state .headline { font-family: var(--font-display); font-weight: 600; color: var(--ink); font-size: 14px; margin-bottom: 4px; }
.empty-state .sub { font-size: 12.5px; }

/* ---------- FAB + bottom nav ---------- */
.fab {
  position: fixed; right: 20px; bottom: 76px; width: 56px; height: 56px; border-radius: var(--r-pill);
  background: var(--timber); color: #fff; border: none; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg); transition: transform var(--fast) var(--ease), background var(--fast) var(--ease);
  z-index: 30; text-decoration: none;
}
.fab:hover { transform: translateY(-2px) scale(1.03); background: var(--timber-dark); }

.bottom-nav {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 4px;
  background: rgba(251,247,240,0.95); backdrop-filter: blur(8px); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 6px; box-shadow: var(--shadow-md); z-index: 30;
  width: calc(100% - 40px); max-width: 440px;
}
.bottom-nav button, .bottom-nav a {
  flex: 1; border: none; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; border-radius: var(--r-pill); color: var(--ink-soft); font-size: 10.5px; font-weight: 600;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease); text-decoration: none;
}
.bottom-nav button.active, .bottom-nav a.active { background: var(--timber-tint); color: var(--timber-dark); }

/* ---------- Person picker ---------- */
.person-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--border);
  background: var(--cream-card); display: flex; align-items: center; justify-content: center; color: var(--timber);
}
.person-sheet {
  position: fixed; inset: 0; background: rgba(58,46,36,0.35); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.person-sheet[hidden] { display: none; }
.person-sheet .panel {
  background: var(--cream-card); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 20px;
  width: 100%; max-width: 480px; box-shadow: var(--shadow-lg);
}
.person-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.person-option {
  display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: var(--r-md);
  border: 1.5px solid var(--border); background: var(--cream-bg); text-align: left;
}
.person-option.selected { border-color: var(--timber); background: var(--timber-tint); }
.person-option .avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #fff; }

/* ---------- Forms (add item) ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.field input[type="text"], .field select, .field textarea {
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px;
  font-family: var(--font-body); font-size: 14px; background: var(--cream-card); color: var(--ink);
}
.field textarea { resize: vertical; min-height: 70px; }
.segmented { display: inline-flex; align-self: flex-start; border: 1px solid var(--border); border-radius: var(--r-pill); overflow: hidden; }
.segmented button { border: none; background: var(--cream-card); padding: 8px 16px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.segmented button.active { background: var(--timber); color: #fff; }
.btn-primary { background: var(--timber); color: #fff; border: none; border-radius: var(--r-pill); padding: 12px 20px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--timber-dark); }
.form-note { font-size: 11.5px; color: var(--ink-soft); margin-top: -8px; margin-bottom: 16px; }
.banner {
  border-radius: var(--r-md); padding: 10px 14px; font-size: 12.5px; margin-bottom: 16px;
  background: var(--cat-ochre-tint); color: var(--ink); border: 1px solid var(--cat-ochre);
}

.back-link { font-size: 13px; color: var(--timber); font-weight: 600; text-decoration: none; display: inline-block; margin-bottom: 8px; }

.mock-note { font-size: 11px; color: var(--ink-soft); text-align: center; padding: 10px 20px 0; }

/* ---------- Notification bell + global search (step 9) ----------
   Same "icon button opens a panel" interaction shape for both, sitting
   next to the person picker in the header. Duplicated verbatim into
   every app's app.css, same convention as the JS modules behind them. */
.header-actions { display: flex; align-items: center; gap: 8px; }

.notif-btn {
  position: relative;
  width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--border);
  background: var(--cream-card); display: flex; align-items: center; justify-content: center;
  color: var(--timber); cursor: pointer;
}
.notif-badge {
  position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 3px;
  border-radius: var(--r-pill); background: var(--cat-terracotta); color: #fff;
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0; width: 300px; max-height: 380px;
  overflow-y: auto; background: var(--cream-card); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg); z-index: 60; padding: 4px 0;
}
.notif-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 8px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.notif-panel-head .link { font-size: 11.5px; text-transform: none; letter-spacing: 0; font-weight: 600; }
.notif-empty { padding: 16px 14px; font-size: 12.5px; color: var(--ink-soft); text-align: center; }
.notif-row { display: flex; align-items: flex-start; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }
.notif-row-body { flex: 1; }
.notif-title { font-size: 13px; font-weight: 600; margin: 0 0 2px; }
.notif-body { font-size: 12px; color: var(--ink-soft); margin: 0 0 2px; }
.notif-when { font-size: 10.5px; color: var(--ink-soft); margin: 0; opacity: 0.8; }
.notif-dismiss { border: none; background: transparent; color: var(--ink-soft); font-size: 11px; cursor: pointer; padding: 2px 4px; border-radius: 50%; }
.notif-dismiss:hover { background: var(--timber-tint); color: var(--timber); }

.search-panel { width: 300px; padding: 10px; }
.search-panel .search-box {
  display: flex; align-items: center; gap: 8px; background: var(--cream-bg);
  border: 1px solid var(--border); border-radius: var(--r-pill); padding: 8px 12px; color: var(--ink-soft);
}
.search-panel .search-box input {
  border: none; background: transparent; outline: none; font-family: var(--font-body);
  font-size: 14px; color: var(--ink); flex: 1;
}
.search-panel .search-box input::placeholder { color: var(--ink-soft); }
#global-search-results { max-height: 300px; overflow-y: auto; margin-top: 6px; }
.search-empty { padding: 10px 4px; font-size: 12.5px; color: var(--ink-soft); text-align: center; }
.search-hit { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: var(--r-sm); text-decoration: none; color: inherit; }
.search-hit:hover { background: var(--timber-tint); }
.search-hit-icon { font-size: 16px; }
.search-hit-body { display: flex; flex-direction: column; }
.search-hit-title { font-size: 13px; font-weight: 600; }
.search-hit-sub { font-size: 11px; color: var(--ink-soft); }
