/* =============================================================
   House Tasks — Reusable components (Apple-native), token-driven.
   Loaded AFTER styles.css so it restyles the shared primitives.
   Screen-specific layout (progress card, charts, calendar cells,
   map) keeps its current styling until its screen phase.
   Only visuals/typography here — no layout geometry that #main
   depends on (topbar/bottomnav positions & heights are untouched).
   ============================================================= */

/* ---------- Typography helpers ---------- */
.muted{ color:var(--ht-label-2); }
h3,h4{ color:var(--ht-label); font-weight:600; }
.list-label{ font-size:13px; font-weight:600; color:var(--ht-label-2); letter-spacing:0; text-transform:none; }
.section-head h2,.section-head h3{ font-size:20px; font-weight:700; }

/* ---------- Top bar (visual only) ---------- */
#topbar{ background:var(--ht-bg); border-bottom:1px solid var(--ht-separator); }
#page-title{ font-size:17px; font-weight:600; color:var(--ht-label); letter-spacing:-.01em; }
.brand-icon{ color:var(--ht-accent); }
.icon-btn{ color:var(--ht-label-2); border-radius:var(--ht-r-md); }
.icon-btn:active{ background:var(--ht-fill); }
.who-chip{ background:var(--ht-fill); border:none; border-radius:var(--ht-r-full); color:var(--ht-label); font-size:15px; font-weight:600; padding:7px 12px; }
.who-dot{ box-shadow:0 0 0 3px var(--ht-accent-tint); }

/* ---------- Bottom tab bar (visual only) ---------- */
#bottomnav{ background:var(--ht-bg); border-top:1px solid var(--ht-separator); }
.nav-btn{ color:var(--ht-label-3); }
.nav-btn .nav-icon{ font-size:24px; }
.nav-btn .nav-label{ font-size:10px; font-weight:500; letter-spacing:0; text-transform:none; }
.nav-active{ color:var(--ht-accent); font-weight:600; }
.nav-active .nav-icon{ font-variation-settings:'FILL' 1; }

/* ---------- Buttons ---------- */
.btn{ display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:50px; padding:0 20px; border:none; border-radius:var(--ht-r-md);
  background:var(--ht-accent); color:var(--ht-on-accent); font-size:17px; font-weight:600;
  transition:background .15s, transform .06s; }
.btn:active{ background:var(--ht-accent-pressed); transform:scale(.98); }
.btn[disabled],.btn.disabled{ background:var(--ht-disabled-bg); color:var(--ht-disabled-text); }
.btn-small{ min-height:40px; padding:0 14px; font-size:15px; }
.btn-ghost,.btn-outline{ background:var(--ht-accent-tint); color:var(--ht-accent); border:none; }
.btn-ghost:active,.btn-outline:active{ background:var(--ht-accent-tint); filter:brightness(.96); }
.btn-danger{ background:var(--ht-error); color:#fff; border:none; }
.btn-block{ display:flex; width:100%; }
.btn-active{ background:var(--ht-accent); color:var(--ht-on-accent); }
.fab{ width:56px; height:56px; border-radius:var(--ht-r-full); border:none;
  background:var(--ht-accent); color:var(--ht-on-accent); box-shadow:var(--ht-shadow-float);
  display:flex; align-items:center; justify-content:center; font-size:26px; }

/* ---------- Chips + segmented ---------- */
.chip{ border:none; background:var(--ht-fill); color:var(--ht-label-2); border-radius:var(--ht-r-full);
  padding:7px 14px; font-size:14px; font-weight:500; }
.chip-active{ background:var(--ht-accent); color:var(--ht-on-accent); }
.chip-sub{ font-size:13px; padding:6px 12px; }
.tabs,.seg{ background:var(--ht-fill); border:none; border-radius:var(--ht-r-md); padding:3px; gap:2px; display:flex; }
.tab,.seg button{ border:none; background:none; color:var(--ht-label-2); border-radius:calc(var(--ht-r-md) - 3px);
  font-size:14px; font-weight:500; padding:7px 12px; flex:1; }
.tab-active,.seg .seg-active{ background:var(--ht-surface); color:var(--ht-label); box-shadow:0 1px 3px rgba(0,0,0,.12); font-weight:600; }

/* ---------- Inputs / forms ---------- */
.form-field{ margin:14px 0; }
.form-field label{ display:block; font-size:13px; font-weight:500; color:var(--ht-label-2); margin-bottom:6px; text-transform:none; letter-spacing:0; }
.input-full,.select-full,.textarea-full,#task-search{
  width:100%; padding:13px 14px; border:1.5px solid transparent; border-radius:var(--ht-r-md);
  background:var(--ht-fill); color:var(--ht-label); outline:none; transition:.15s; font-size:16px; }
.input-full::placeholder,.textarea-full::placeholder,#task-search::placeholder{ color:var(--ht-label-3); }
.input-full:focus,.select-full:focus,.textarea-full:focus,#task-search:focus{
  background:var(--ht-surface); border-color:var(--ht-accent); box-shadow:0 0 0 4px var(--ht-accent-tint); }
.textarea-full{ min-height:76px; resize:vertical; }
.search-box .search-icon{ color:var(--ht-label-3); }
.color-swatch{ border:2px solid var(--ht-surface); box-shadow:0 0 0 1px var(--ht-separator); }

/* ---------- Cards / lists (grouped) ---------- */
.task-list,.card-list{ display:flex; flex-direction:column; gap:12px; }
.task-card,.card,.member-card,.object-card,.room-card,.activity-row,.exp-room{
  background:var(--ht-surface); border:1px solid var(--ht-separator); border-radius:var(--ht-r-lg);
  padding:16px; display:flex; gap:14px; align-items:center; box-shadow:var(--ht-shadow-card); }
.task-title,.card-info-title,.member-name,.object-title,.room-card-title{ font-size:17px; font-weight:600; color:var(--ht-label); }
.task-sub,.card-info-sub,.member-sub,.object-sub,.room-row-sub,.task-meta,.activity-sub,.room-card-sub{ color:var(--ht-label-2); font-size:15px; }
.task-checkbox{ width:26px; height:26px; border:2px solid var(--ht-separator); border-radius:var(--ht-r-full);
  background:none; color:transparent; flex:none; display:flex; align-items:center; justify-content:center; }
.task-card.done{ opacity:.55; }
.task-card.done .task-checkbox{ background:var(--ht-accent); border-color:var(--ht-accent); color:#fff; }
.task-card.done .task-title{ text-decoration:line-through; }
.task-badge,.role-badge,.room-card-tag{ display:inline-block; background:var(--ht-fill); color:var(--ht-label-2);
  border:none; border-radius:var(--ht-r-full); padding:2px 9px; font-size:12px; font-weight:600; margin-right:5px; }
.assignee-avatar,.member-avatar,.activity-icon,.card-icon,.object-icon,.room-row-icon{
  width:40px; height:40px; border:none; border-radius:var(--ht-r-md); background:var(--ht-accent-tint);
  color:var(--ht-accent); display:inline-flex; align-items:center; justify-content:center; font-size:15px; font-weight:600; flex:none; }
.task-actions button,.card-actions button,.member-actions button,.object-actions button,.room-row-actions button{
  border:none; background:none; color:var(--ht-label-2); border-radius:var(--ht-r-sm); padding:6px; }

/* ---------- Empty state ---------- */
.empty{ color:var(--ht-label-2); padding:48px 20px; text-align:center; }
.empty-icon{ font-size:44px; }

/* ---------- Sheet / modal ---------- */
.modal-backdrop{ background:var(--ht-overlay); -webkit-backdrop-filter:blur(2px); backdrop-filter:blur(2px); }
.modal-card{ background:var(--ht-surface); color:var(--ht-label); border-top:none;
  border-radius:var(--ht-r-lg) var(--ht-r-lg) 0 0; box-shadow:var(--ht-shadow-sheet); padding-top:8px; }
.modal-card::before{ content:""; display:block; width:36px; height:5px; border-radius:var(--ht-r-full);
  background:var(--ht-separator); margin:6px auto 12px; }
.modal-title{ font-size:20px; font-weight:700; color:var(--ht-label); }
.modal-actions{ border-top:1px solid var(--ht-separator); }

/* ---------- Side menu ---------- */
.sidemenu-backdrop{ background:var(--ht-overlay); -webkit-backdrop-filter:blur(2px); backdrop-filter:blur(2px); }
.sidemenu-panel{ background:var(--ht-surface); border-right:none; box-shadow:var(--ht-shadow-elevated); }
.sidemenu-panel h3{ color:var(--ht-label-2); font-size:13px; font-weight:600; }
.menu-item{ color:var(--ht-label); font-size:17px; border-bottom:1px solid var(--ht-separator); border-radius:var(--ht-r-md); }
.menu-item:active{ background:var(--ht-fill); }

/* ---------- Toast (dark material regardless of theme) ---------- */
.toast{ background:#1C1C1E; color:#fff; border-radius:var(--ht-r-full); padding:12px 20px;
  font-size:15px; font-weight:500; box-shadow:var(--ht-shadow-elevated); }

/* ---------- Auth (login / signup / confirm / household) ---------- */
.auth-gate{ background:var(--ht-bg); }
.auth-card{ background:var(--ht-surface); border:1px solid var(--ht-separator); border-radius:var(--ht-r-xl);
  box-shadow:var(--ht-shadow-elevated); padding:28px 24px; max-width:480px; width:100%; }
.pass-toggle{ color:var(--ht-label-3); border-radius:var(--ht-r-md); }
.fp-label{ background:var(--ht-surface); border:1px solid var(--ht-separator); color:var(--ht-label);
  border-radius:var(--ht-r-full); box-shadow:var(--ht-shadow-card); }
#fp-toolbar{ background:var(--ht-surface); border:1px solid var(--ht-separator);
  border-radius:var(--ht-r-lg); box-shadow:var(--ht-shadow-elevated); }
.fp-hint{ color:var(--ht-label-2); }
.pass-toggle.is-on{ color:var(--ht-accent); }
.field-error{ color:var(--ht-error); font-weight:500; }
.input-invalid{ border-color:var(--ht-error) !important; }
.input-otp{ color:var(--ht-label); }
.auth-logo{ color:var(--ht-accent); display:flex; justify-content:center; }
.auth-logo .icon{ width:44px; height:44px; }
.auth-title{ font-size:28px; font-weight:700; color:var(--ht-label); }
.auth-sub{ color:var(--ht-label-2); }
.auth-btn{ width:100%; margin-top:10px; }
.auth-switch{ color:var(--ht-label-2); }
.auth-switch a{ color:var(--ht-accent); font-weight:600; }
.auth-msg{ background:var(--ht-accent-tint); color:var(--ht-accent-pressed); border:none; border-radius:var(--ht-r-md); }
.auth-or{ color:var(--ht-label-3); }
.invite-code{ background:var(--ht-accent-tint); color:var(--ht-accent-pressed); border:none; border-radius:var(--ht-r-md); font-weight:700; }

/* ---------- Chrome: line icons in top bar / tab bar / side menu ---------- */
#topbar .icon-btn .icon{ color:var(--ht-label-2); }
.brand-icon.icon{ width:26px; height:26px; color:var(--ht-accent); }
#bottomnav .nav-btn .nav-icon{ width:26px; height:26px; }
.menu-item{ display:flex; align-items:center; gap:14px; }
.menu-item .icon{ width:22px; height:22px; color:var(--ht-label-2); flex:none; }
.menu-item span{ flex:1; }
.menu-item:active .icon{ color:var(--ht-accent); }

/* ---------- Today: date banner + progress card ---------- */
.date-banner{ padding:var(--ht-s2) 0 var(--ht-s3); }
.date-day{ font-size:13px; font-weight:500; color:var(--ht-label-2); }
.date-full{ font-size:24px; font-weight:700; color:var(--ht-label); letter-spacing:-.02em; }
.progress-card{ background:var(--ht-surface); border:1px solid var(--ht-separator);
  border-radius:var(--ht-r-lg); box-shadow:var(--ht-shadow-card); padding:var(--ht-s4); margin:0 0 var(--ht-s3); }
.progress-head{ display:flex; justify-content:space-between; align-items:center; gap:var(--ht-s3); }
.progress-title{ font-size:15px; font-weight:600; color:var(--ht-label); }
.progress-sub{ font-size:13px; color:var(--ht-label-2); margin-top:2px; }
.progress-pct{ font-size:20px; font-weight:700; color:var(--ht-accent); font-variant-numeric:tabular-nums; }
.progress-bar{ height:6px; background:var(--ht-fill); border:none; border-radius:var(--ht-r-full); overflow:hidden; margin-top:var(--ht-s3); }
.progress-fill{ height:100%; background:var(--ht-accent); border-radius:var(--ht-r-full); transition:width .3s ease; }
.filter-row{ display:flex; flex-wrap:wrap; gap:var(--ht-s2); margin:var(--ht-s2) 0 var(--ht-s3); }

/* ---------- Task card (shared Today + Tasks): row layout + line icons ---------- */
.task-card{ align-items:flex-start; }
.task-checkbox{ margin-top:1px; }
.task-checkbox .icon{ width:18px; height:18px; }
.task-top{ display:flex; justify-content:space-between; align-items:baseline; gap:var(--ht-s3); }
.task-duration{ font-size:13px; font-weight:500; color:var(--ht-label-2); flex:none; }
.task-meta{ display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-top:6px; }
.task-badge{ margin-right:0; }
.task-badge .icon{ width:13px; height:13px; margin-right:3px; vertical-align:-2px; }
.task-foot{ display:flex; justify-content:space-between; align-items:center; margin-top:10px; }
.task-assignee{ display:inline-flex; align-items:center; gap:8px; min-width:0; }
.assignee-avatar .icon{ width:18px; height:18px; }
.assignee-avatar.unassigned{ background:var(--ht-fill); color:var(--ht-label-3); }
.task-assignee .assignee-avatar:not(.unassigned){ font-weight:700; }
.assignee-name{ font-size:14px; font-weight:500; color:var(--ht-label-2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.assignee-name.unassigned{ color:var(--ht-label-3); }
.task-actions button .icon{ width:20px; height:20px; }

/* ---------- Empty state: line icon (not emoji) ---------- */
.empty-icon{ display:flex; justify-content:center; margin-bottom:var(--ht-s2); }
.empty-icon .icon{ width:44px; height:44px; color:var(--ht-label-3); }

/* ---------- Tasks: filter rows + search + fab icon ---------- */
.filter-row.scroll-x{ gap:var(--ht-s2); margin:6px 0; scrollbar-width:none; -webkit-overflow-scrolling:touch; }
.filter-row.scroll-x::-webkit-scrollbar{ display:none; }
.search-box{ margin:var(--ht-s3) 0; }
.search-box .search-icon{ width:20px; height:20px; left:14px; color:var(--ht-label-3); }
.search-box #task-search{ padding-left:42px; }
.fab .icon{ width:26px; height:26px; }

/* ---------- House: rooms + objects ---------- */
.section-head{ margin:var(--ht-s4) 0 var(--ht-s3); }
.head-actions{ display:flex; gap:var(--ht-s2); }
.btn .icon{ width:20px; height:20px; }
.room-card-body,.object-info{ flex:1; min-width:0; }
.room-tile{ width:44px; height:44px; border-radius:var(--ht-r-md); flex:none;
  display:flex; align-items:center; justify-content:center; font-size:18px; font-weight:700; }
.object-icon{ background:var(--ht-fill); color:var(--ht-label-2); font-weight:600; }
.room-title-row{ display:flex; align-items:center; gap:var(--ht-s2); flex-wrap:wrap; }
.room-card-tag{ background:var(--ht-accent-tint); color:var(--ht-accent-pressed); }
.room-card-actions{ display:flex; gap:2px; flex:none; }
.room-card-actions button{ border:none; background:none; color:var(--ht-label-2); border-radius:var(--ht-r-sm); padding:6px; }
.room-card-actions .icon,.object-actions .icon{ width:20px; height:20px; }
select.select-full{ margin:var(--ht-s2) 0 var(--ht-s3); }

/* ---------- Team: member cards + activity ---------- */
.member-left{ display:flex; align-items:center; gap:var(--ht-s3); flex:1; min-width:0; }
.member-avatar{ font-size:16px; }
.member-name-row{ display:flex; align-items:center; gap:var(--ht-s2); flex-wrap:wrap; }
.member-actions{ display:flex; gap:2px; flex:none; }
.member-actions .icon,.activity-icon .icon{ width:20px; height:20px; }
.role-badge.maid{ background:var(--ht-accent-tint); color:var(--ht-accent-pressed); }
.role-badge.resident{ background:var(--ht-fill); color:var(--ht-label-2); }
.activity-list{ display:flex; flex-direction:column; gap:var(--ht-s3); }

/* ============ Stats (analytics) ============ */
.an-metric-head{ border-bottom:1px solid var(--ht-separator); padding-bottom:14px; margin-bottom:16px; align-items:center; }
.an-caps{ font-size:12px; letter-spacing:.04em; text-transform:uppercase; color:var(--ht-label-2); font-weight:600; }
.an-h2{ font-size:20px; font-weight:700; color:var(--ht-label); margin-top:4px; }
.an-big{ font-size:40px; font-weight:700; line-height:1; color:var(--ht-accent); letter-spacing:-.02em; font-variant-numeric:tabular-nums; }
.an-chart{ gap:var(--ht-s2); height:160px; }
.an-bar-track{ border:none; background:var(--ht-fill); border-radius:var(--ht-r-sm); overflow:hidden; }
.an-bar-fill{ background:var(--ht-accent); border-radius:var(--ht-r-sm) var(--ht-r-sm) 0 0; min-height:3px; transition:height .3s ease; }
.an-bar-lab{ font-size:11px; color:var(--ht-label-2); font-weight:500; }
.an-bar-lab.an-today{ color:var(--ht-accent); font-weight:700; }
.an-section{ border-top:1px solid var(--ht-separator); padding-top:18px; margin-top:20px; }
.an-eff-name{ font-weight:600; color:var(--ht-label); }
.an-line{ height:6px; border:none; background:var(--ht-fill); border-radius:var(--ht-r-full); overflow:hidden; }
.an-line-fill{ background:var(--ht-accent); border-radius:var(--ht-r-full); }
.an-cat-row{ border-bottom:1px solid var(--ht-separator); padding:12px 0; color:var(--ht-label); }
.an-cat-n{ font-weight:700; color:var(--ht-label); }

/* ============ Calendar ============ */
.cal-nav{ gap:var(--ht-s2); margin-bottom:var(--ht-s3); }
.cal-nav #cal-label{ font-weight:600; color:var(--ht-label); }
.cal-cell{ border:1px solid var(--ht-separator); border-radius:var(--ht-r-sm); min-height:52px; background:var(--ht-surface); }
.cal-cell.cal-today-cell{ outline:2px solid var(--ht-accent); outline-offset:-1px; border-color:transparent; }
.cal-cell-num{ color:var(--ht-label); font-weight:600; }
.cal-cell.cal-out{ opacity:.4; }
.cal-cell-count{ border:none; background:var(--ht-accent); color:var(--ht-on-accent); border-radius:var(--ht-r-full); font-weight:700; min-width:16px; text-align:center; }
.cal-mhead>div{ font-size:11px; font-weight:600; color:var(--ht-label-2); text-align:center; text-transform:uppercase; letter-spacing:.03em; }
.cal-week{ gap:var(--ht-s2); }
.cal-wday{ flex:0 0 140px; border:1px solid var(--ht-separator); border-radius:var(--ht-r-md); background:var(--ht-surface); padding:8px; }
.cal-wday.cal-today-col{ border-color:var(--ht-accent); }
.cal-wday-head{ font-weight:600; color:var(--ht-label); font-size:14px; margin-bottom:6px; }
.cal-task{ border:1px solid var(--ht-separator); border-left:3px solid var(--ht-accent); border-radius:var(--ht-r-sm); background:var(--ht-surface); padding:7px 9px; font-size:13px; color:var(--ht-label); margin-bottom:6px; }
.cal-section{ margin-bottom:16px; }
.cal-section h5{ font-size:12px; font-weight:600; color:var(--ht-label-2); text-transform:uppercase; letter-spacing:.03em; margin:0 0 8px; }

/* ============ Map ============ */
#map-controls{ gap:var(--ht-s2); margin-bottom:var(--ht-s3); }
#map-controls .btn{ padding:8px 12px; font-size:14px; min-height:38px; }
#map-controls .btn .icon{ width:18px; height:18px; }
#map-stage{ border:1px solid var(--ht-separator); border-radius:var(--ht-r-lg); background:var(--ht-bg-2); min-height:55vh; }
#map-stage.has-plan{ min-height:0; }
@media (max-width:520px){
  #map-stage.has-plan{ border-radius:0; border-left:none; border-right:none; }
}
.marker{ border:2px solid #fff; box-shadow:0 1px 4px rgba(0,0,0,.35); width:32px; height:32px; font-size:13px; font-weight:700; }
.marker-object{ background:var(--ht-surface); color:var(--ht-label-2); }
.marker-label{ background:var(--ht-label); color:var(--ht-bg); border:none; border-radius:var(--ht-r-sm); padding:1px 6px; font-size:10px; font-weight:600; margin-top:3px; }
.rooms-expanded{ gap:var(--ht-s3); }
.exp-room{ display:block; padding:0; overflow:hidden; }
.exp-room-head{ gap:var(--ht-s3); padding:14px; }
.exp-room-icon{ width:40px; height:40px; border-radius:var(--ht-r-md); display:flex; align-items:center; justify-content:center; font-weight:700; flex:none; }
.exp-room-info{ flex:1; min-width:0; }
.exp-room-name{ font-size:17px; font-weight:600; color:var(--ht-label); display:block; }
.exp-room-sub{ font-size:14px; color:var(--ht-label-2); }
.exp-room-chev{ color:var(--ht-label-3); transition:transform .2s; flex:none; }
.exp-room-head.open .exp-room-chev{ transform:rotate(90deg); }
.exp-tasks{ padding:0 14px 8px; }
.exp-task{ border-bottom:1px solid var(--ht-separator); padding:12px 0; }
.exp-task-check{ width:24px; height:24px; border:2px solid var(--ht-separator); border-radius:var(--ht-r-full); display:flex; align-items:center; justify-content:center; flex:none; color:transparent; }
.exp-task.done .exp-task-check{ background:var(--ht-accent); border-color:var(--ht-accent); color:#fff; }
.exp-task.done .exp-task-title{ text-decoration:line-through; color:var(--ht-label-2); }
.exp-task-body{ flex:1; min-width:0; }
.exp-task-title{ font-size:15px; color:var(--ht-label); display:block; }
.exp-task-meta{ display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-top:4px; }
.exp-assignee{ display:inline-flex; align-items:center; gap:5px; font-size:13px; color:var(--ht-label-2); }
.assignee-dot{ width:10px; height:10px; border-radius:var(--ht-r-full); display:inline-block; flex:none; }
.exp-task-go{ color:var(--ht-label-3); flex:none; }
.exp-task-check .icon,.exp-task-go.icon,.exp-room-chev.icon{ width:18px; height:18px; }

/* ============ Settings ============ */
.settings-card{ background:var(--ht-surface); border:1px solid var(--ht-separator); border-radius:var(--ht-r-lg);
  box-shadow:var(--ht-shadow-card); padding:16px; margin-bottom:14px; }
.settings-card.danger{ border-color:rgba(255,59,48,.32); }
.settings-head{ display:flex; gap:12px; align-items:flex-start; margin-bottom:14px; }
.settings-icon{ width:40px; height:40px; border-radius:var(--ht-r-md); flex:none;
  display:flex; align-items:center; justify-content:center; background:var(--ht-accent-tint); color:var(--ht-accent); }
.settings-icon .icon{ width:22px; height:22px; }
.settings-icon.c-error{ background:rgba(255,59,48,.14); color:var(--ht-error); }
.settings-title{ font-size:16px; font-weight:600; color:var(--ht-label); }
.settings-desc{ font-size:13px; color:var(--ht-label-2); margin-top:3px; line-height:1.4; }
.settings-foot{ text-align:center; color:var(--ht-label-3); font-size:13px; padding:16px 0 8px; }
.settings-card .btn{ margin-top:8px; }
.settings-card .btn .icon{ width:20px; height:20px; }
#theme-seg button{ display:flex; align-items:center; justify-content:center; gap:6px; }
#theme-seg .icon{ width:18px; height:18px; }
.card-icon .icon{ width:20px; height:20px; }
.card-actions button .icon{ width:19px; height:19px; }
