/* ============================================================
   GharCheck — App stylesheet
   Aesthetic: warm editorial, deep green + ochre on aged paper,
   serif display + sturdy sans body. Mobile-first.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg:        #f6f1e7;       /* warm paper */
  --bg-elev:   #ffffff;
  --bg-soft:   #efe8d8;
  --ink:       #1a1a17;
  --ink-soft:  #5b574e;
  --ink-mute:  #8a857a;
  --line:      #e2dccb;

  --brand:     #0f4c3a;       /* deep forest green */
  --brand-2:   #1b6a52;
  --accent:    #c4642d;       /* terracotta */
  --accent-2:  #d98a55;
  --warning:   #b8551f;
  --danger:    #a4302c;
  --ok:        #2d6a4f;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --shadow-sm: 0 1px 2px rgba(20,15,8,.04), 0 1px 3px rgba(20,15,8,.06);
  --shadow:    0 4px 14px rgba(20,15,8,.08);
  --shadow-lg: 0 12px 36px rgba(20,15,8,.12);

  --display: 'Fraunces', Georgia, serif;
  --body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 18% 12%, rgba(196,100,45,.06) 0, transparent 40%),
    radial-gradient(circle at 88% 88%, rgba(15,76,58,.05) 0, transparent 35%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,h2,h3 { font-family: var(--display); font-weight: 700; letter-spacing: -.01em; margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: 16px; }

/* ============== AUTH ============== */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
}
.auth-shell { width: 100%; max-width: 420px; }
.auth-brand { text-align: center; margin-bottom: 28px; }
.brand-mark {
  width: 72px; height: 72px;
  margin: 0 auto 14px;
  background: var(--brand);
  color: #f6e8c8;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display);
  font-size: 38px; font-weight: 700;
  box-shadow: var(--shadow);
  position: relative;
}
.brand-mark::after {
  content: '';
  position: absolute; inset: -6px;
  border: 1px solid var(--brand);
  border-radius: 50%;
  opacity: .25;
}
.brand-mark.sm { width: 38px; height: 38px; font-size: 20px; margin: 0; }
.brand-mark.sm::after { inset: -3px; }
.brand-name {
  font-family: var(--display);
  font-size: 34px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink);
}
.brand-tag {
  color: var(--ink-mute);
  font-size: 14px;
  margin: 0;
  font-style: italic;
}
.auth-card {
  background: var(--bg-elev);
  border-radius: var(--r-lg);
  padding: 24px 22px 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.auth-tabs {
  display: flex;
  background: var(--bg-soft);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 22px;
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-soft);
  transition: all .2s;
}
.auth-tab.is-active {
  background: var(--bg-elev);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.auth-tab:hover { text-decoration: none; }
.auth-foot {
  text-align: center;
  color: var(--ink-mute);
  font-size: 13px;
  margin: 16px 0 0;
}
.auth-legal {
  text-align: center;
  color: var(--ink-mute);
  font-size: 12px;
  margin: 24px 0 0;
}

/* ============== FORMS ============== */
.auth-form, .form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: .01em;
}
.field-hint { color: var(--ink-mute); font-weight: 400; }
.field input, .field textarea, .field select {
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px 14px;
  font-size: 15px;
  color: var(--ink);
  transition: border-color .15s, background .15s;
  width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--bg-elev);
}
.field textarea { resize: vertical; min-height: 70px; font-family: var(--body); }

.btn-primary {
  background: var(--brand);
  color: #f6e8c8;
  border: 0;
  padding: 15px 22px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: .01em;
  transition: transform .08s, background .15s;
}
.btn-primary:hover { background: var(--brand-2); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1.5px solid var(--line);
  padding: 13px 18px;
  border-radius: var(--r-md);
  font-weight: 500;
  cursor: pointer;
}
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1.5px solid #e6c8c6;
  padding: 13px 18px;
  border-radius: var(--r-md);
  font-weight: 500;
  cursor: pointer;
}
.btn-pill {
  background: var(--accent);
  color: white;
  border: 0;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: .01em;
  box-shadow: 0 2px 6px rgba(196,100,45,.3);
}
.btn-pill:hover { background: var(--accent-2); }

.alert { padding: 12px 14px; border-radius: var(--r-md); font-size: 14px; margin-bottom: 14px; }
.alert-error { background: #fce8e6; color: #7a1f1c; border: 1px solid #f1c6c2; }
.alert-info  { background: #e8f0ec; color: #1b4d3a; border: 1px solid #c8dbd2; }

/* ============== APP SHELL ============== */
.app-body { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 12px;
  max-width: 640px; margin: 0 auto;
}
.brand-row { display: flex; align-items: center; gap: 12px; }
.topbar-title {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
}
.topbar-sub {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 1px;
}
.icon-btn {
  background: transparent;
  border: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-soft);
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-soft); }

.stage { max-width: 640px; margin: 0 auto; }
.screen { animation: fade .25s ease; }
.screen-pad {
  padding: 20px 18px calc(120px + env(safe-area-inset-bottom));
}
.screen-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.screen-h {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.muted { color: var(--ink-mute); font-size: 14px; margin: 4px 0 18px; }
.small { font-size: 13px; }
.empty {
  text-align: center;
  color: var(--ink-mute);
  padding: 40px 20px;
  background: var(--bg-elev);
  border-radius: var(--r-lg);
  border: 1.5px dashed var(--line);
}
.empty strong { display: block; font-family: var(--display); font-size: 18px; color: var(--ink); margin-bottom: 6px; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============== TAB BAR ============== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  display: flex;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
}
.tabbar .tab {
  flex: 1;
  background: transparent;
  border: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 4px;
  color: var(--ink-mute);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: color .15s;
}
.tabbar .tab svg { width: 22px; height: 22px; }
.tabbar .tab.is-active { color: var(--brand); }
.tabbar .tab.is-active span { font-weight: 600; }

/* ============== PROPERTIES LIST ============== */
.prop-list { display: flex; flex-direction: column; gap: 14px; }
.prop-card {
  background: var(--bg-elev);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform .12s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}
.prop-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--brand);
}
.prop-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.prop-card .prop-title {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 4px;
  padding-left: 8px;
}
.prop-card .prop-addr {
  font-size: 13px;
  color: var(--ink-mute);
  padding-left: 8px;
  margin-bottom: 12px;
}
.prop-stats {
  display: flex; gap: 16px;
  padding-left: 8px;
  font-size: 12px;
  color: var(--ink-soft);
}
.prop-stats b { color: var(--brand); font-weight: 700; }
.prop-actions {
  position: absolute; top: 14px; right: 14px;
  display: flex; gap: 6px;
}
.prop-actions .icon-btn { width: 32px; height: 32px; }
.prop-actions .icon-btn svg { width: 16px; height: 16px; }

.prop-meta {
  background: var(--bg-elev);
  padding: 14px 16px;
  border-radius: var(--r-lg);
  margin-bottom: 16px;
  border: 1px solid var(--line);
}
.prop-meta .prop-title {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
}
.prop-meta .prop-addr {
  font-size: 13px;
  color: var(--ink-mute);
  margin-top: 4px;
}

/* ============== ROOMS GRID ============== */
.rooms-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 520px) {
  .rooms-grid { grid-template-columns: repeat(3, 1fr); }
}
.room-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  transition: transform .12s, border-color .15s;
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px;
}
.room-card:hover { transform: translateY(-2px); border-color: var(--brand); }
.room-card .icon { font-size: 32px; line-height: 1; }
.room-card .label {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.15;
}
.room-card .photo-badge {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--brand);
  color: #f6e8c8;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .03em;
}
.room-card .dims {
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 2px;
}

/* ============== ROOM DETAIL ============== */
.back-btn {
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 8px;
}
.back-btn:hover { color: var(--brand); }

.room-detail-head {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 18px 14px;
  margin-bottom: 18px;
}
.room-detail-head .icon-line {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px;
}
.room-detail-head .room-icon { font-size: 30px; }
.room-detail-head h2 {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
  flex: 1;
}
.dim-display {
  display: flex; gap: 14px;
  font-size: 13px;
  color: var(--ink-soft);
  padding-top: 12px;
  margin-top: 8px;
  border-top: 1px dashed var(--line);
}
.dim-display .dim {
  display: flex; flex-direction: column; gap: 2px;
}
.dim-display .dim b { color: var(--brand); font-size: 16px; font-weight: 700; }
.dim-display .dim span { color: var(--ink-mute); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }

.section-h {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  margin: 24px 0 12px;
  letter-spacing: -.01em;
}

.dim-grid {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.dim-grid .field-label { font-size: 12px; }
.dim-conv-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--ink-mute);
  display: flex; flex-wrap: wrap; gap: 8px 14px;
}
.dim-conv-row b { color: var(--ink); font-weight: 600; }

.rate-row {
  display: flex; gap: 8px;
  margin-top: 6px;
}
.rate-star {
  font-size: 22px;
  cursor: pointer;
  color: #d8cbb0;
  transition: color .12s;
}
.rate-star.is-on { color: var(--accent); }

.photos-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.photo-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile .del-btn {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,.55);
  color: white;
  border: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 13px;
}
.photo-tile .del-btn:hover { background: var(--danger); }
.photo-add {
  aspect-ratio: 4 / 3;
  border: 1.5px dashed var(--line);
  border-radius: var(--r-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink-mute);
  font-size: 13px;
  cursor: pointer;
  background: var(--bg-elev);
  transition: border-color .15s, color .15s;
}
.photo-add:hover { border-color: var(--brand); color: var(--brand); }
.photo-add .plus { font-size: 28px; line-height: 1; font-weight: 200; }

.btn-row { display: flex; gap: 10px; margin-top: 18px; }
.btn-row > * { flex: 1; }

/* ============== CHECKLIST ============== */
.progress-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.progress-card .progress-top {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 10px;
}
.progress-card .progress-num {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 700;
  color: var(--brand);
}
.progress-card .progress-num small {
  font-family: var(--body);
  color: var(--ink-mute);
  font-size: 14px;
  font-weight: 500;
}
.progress-card .progress-label {
  font-size: 12px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.progress-bar {
  height: 8px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  border-radius: 999px;
  transition: width .4s ease;
}

.check-list { display: flex; flex-direction: column; gap: 12px; }
.cat-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.cat-head {
  padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  user-select: none;
  background: var(--bg-elev);
  border-bottom: 1px solid transparent;
  transition: background .15s;
}
.cat-head:hover { background: var(--bg); }
.cat-head.is-open { border-bottom-color: var(--line); }
.cat-name {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
  flex: 1;
}
.cat-progress {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 600;
  background: var(--bg-soft);
  padding: 3px 9px;
  border-radius: 999px;
}
.cat-progress.is-done { background: #d8ebde; color: var(--ok); }
.cat-chevron {
  color: var(--ink-mute);
  transition: transform .2s;
}
.cat-head.is-open .cat-chevron { transform: rotate(90deg); }
.cat-head .cat-actions {
  display: flex; gap: 4px;
}
.cat-head .cat-actions .icon-btn { width: 28px; height: 28px; }
.cat-head .cat-actions svg { width: 14px; height: 14px; }
.cat-body { padding: 0; }
.cat-body.is-collapsed { display: none; }
.cat-desc { padding: 0 16px 12px; font-size: 13px; color: var(--ink-mute); }

.check-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  transition: background .15s;
}
.check-item:first-child { border-top: 0; }
.check-item.is-done .item-title { text-decoration: line-through; color: var(--ink-mute); }
.check-item:hover { background: var(--bg); }
.check-box {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  background: var(--bg-elev);
  cursor: pointer;
  display: grid; place-items: center;
  margin-top: 1px;
  transition: all .15s;
}
.check-box.is-done {
  background: var(--brand);
  border-color: var(--brand);
}
.check-box.is-done::after {
  content: '✓';
  color: #f6e8c8;
  font-size: 14px;
  font-weight: 700;
}
.item-body { flex: 1; min-width: 0; }
.item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}
.item-title.critical::before {
  content: '★';
  color: var(--accent);
  margin-right: 4px;
}
.item-desc {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 4px;
  line-height: 1.45;
}
.item-actions { display: flex; gap: 4px; align-items: flex-start; }
.item-actions .icon-btn { width: 28px; height: 28px; color: var(--ink-mute); }
.item-actions .icon-btn svg { width: 14px; height: 14px; }

.add-item-row {
  padding: 10px 16px 14px;
  display: flex; gap: 8px;
}
.add-item-row input {
  flex: 1;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 14px;
}
.add-item-row button {
  background: var(--brand);
  color: #f6e8c8;
  border: 0;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

/* ============== CONVERTER ============== */
.conv-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  margin-top: 14px;
}
.conv-h {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--brand);
}
.conv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.lw-result {
  margin-top: 14px;
  padding: 14px;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  color: var(--brand);
  text-align: center;
  letter-spacing: -.01em;
}

/* ============== MODAL ============== */
/* Global: respect the HTML `hidden` attribute even when author CSS sets display */
[hidden] { display: none !important; }

.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(20,15,8,.5);
  backdrop-filter: blur(2px);
  animation: fadeIn .2s;
}
.modal-card {
  position: relative;
  background: var(--bg-elev);
  width: 100%;
  max-width: 640px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .25s cubic-bezier(.2,.7,.3,1);
  box-shadow: var(--shadow-lg);
}
.modal-card::before {
  content: '';
  display: block;
  width: 40px; height: 4px;
  background: var(--line);
  border-radius: 2px;
  margin: -8px auto 14px;
}
.modal-h {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (min-width: 560px) {
  .modal { align-items: center; padding: 24px; }
  .modal-card { border-radius: var(--r-xl); max-height: 80vh; }
  .modal-card::before { display: none; }
}

/* ============== TOAST ============== */
.toast {
  position: fixed;
  bottom: 100px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  z-index: 200;
  animation: toastIn .25s;
  box-shadow: var(--shadow-lg);
}
@keyframes toastIn { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ============== ROOM PICKER ============== */
.room-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px;
}
.room-picker .pick {
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
  transition: all .12s;
}
.room-picker .pick:hover { border-color: var(--brand); background: var(--bg-elev); }
.room-picker .pick.is-sel { border-color: var(--brand); background: #e8f0ec; }
.room-picker .pick .ico { font-size: 22px; }

.divider {
  height: 1px; background: var(--line);
  margin: 16px 0;
}
.muted-link {
  background: transparent;
  border: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
}
.muted-link:hover { text-decoration: underline; }

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-weight: 600;
  letter-spacing: .02em;
  margin-left: 6px;
}
.tag.tag-sys { background: #e8f0ec; color: var(--ok); }

/* ============== VAASTU COMPASS ============== */
.sensor-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
}
.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-mute);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #c2bfb6;
  flex: 0 0 auto;
}
.status-dot.warn { background: #d8a23a; box-shadow: 0 0 0 3px rgba(216,162,58,.15); }
.status-dot.good { background: #2f9d6c; box-shadow: 0 0 0 3px rgba(47,157,108,.15); }
.status-dot.bad  { background: #b14a3f; box-shadow: 0 0 0 3px rgba(177,74,63,.15); }

.perm-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 14px;
  text-align: center;
}
.perm-card p { margin-bottom: 10px; font-size: 14px; color: var(--ink-mute); }

.compass-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-width: 320px;
  margin: 6px auto 18px;
}
.compass-wrap.small { max-width: 240px; }
.compass-bg, .compass-dial {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.compass-dial {
  transition: transform .4s cubic-bezier(.22,1,.36,1);
  transform-origin: center;
  will-change: transform;
}
.center-readout {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
  text-align: center;
}
.center-readout .deg {
  font-family: var(--display);
  font-size: 30px; font-weight: 700;
  color: var(--ink); line-height: 1;
}
.center-readout .facing {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ink-mute);
  margin-top: 4px;
}

.zone-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.zone-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 10px;
}
.zone-name {
  font-family: var(--display);
  font-size: 17px; font-weight: 700;
  color: var(--ink);
}
.zone-lord { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }
.zone-tip  { font-size: 14px; line-height: 1.55; color: var(--ink); margin-top: 6px; }
.element-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .5px;
  flex: 0 0 auto;
  background: #f1ede4; color: #4a4538;
}

/* ============== VAASTU PANEL (inside room detail) ============== */
.vaastu-panel { margin-top: 6px; }
.vaastu-empty {
  border: 1.5px dashed var(--line);
  border-radius: var(--r-md);
  padding: 18px;
  text-align: center;
  background: var(--bg-elev);
}
.vaastu-empty p { color: var(--ink-mute); margin-bottom: 12px; font-size: 14px; }

.vaastu-result {
  border-radius: var(--r-md);
  padding: 16px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink-mute);
}
.vaastu-result.vaastu-ideal   { border-left-color: #2f9d6c; }
.vaastu-result.vaastu-ok      { border-left-color: #5994d8; }
.vaastu-result.vaastu-bad     { border-left-color: #b14a3f; }
.vaastu-result.vaastu-neutral { border-left-color: #c2bfb6; }

.vaastu-result-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 8px;
}
.vaastu-dir {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.vaastu-deg {
  font-family: var(--body, inherit);
  font-size: 13px; font-weight: 500;
  color: var(--ink-mute);
  margin-left: 4px;
}
.vaastu-zone {
  font-size: 12px; color: var(--ink-mute); margin-top: 2px;
}
.vaastu-verdict { font-size: 14px; line-height: 1.55; color: var(--ink); margin-bottom: 8px; }
.vaastu-remedy {
  font-size: 13px; line-height: 1.55;
  background: rgba(196,100,45,.07);
  border: 1px solid rgba(196,100,45,.18);
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--ink);
  margin-top: 8px;
}
.vaastu-remedy b { color: var(--accent, #c4642d); }

.vaastu-badge {
  font-size: 11px; font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.vaastu-badge.vaastu-ideal   { background: #e3f3eb; color: #1b6a52; }
.vaastu-badge.vaastu-ok      { background: #e6f1fb; color: #0c447c; }
.vaastu-badge.vaastu-bad     { background: #faece7; color: #993c1d; }
.vaastu-badge.vaastu-neutral { background: #f1ede4; color: #4a4538; }

/* Direction-picker grid inside capture modal */
.manual-dir-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.dir-pick {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 0;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.dir-pick:hover { border-color: var(--brand); color: var(--brand); }
.dir-pick:active { transform: scale(.97); }

@media (max-width: 380px) {
  .manual-dir-grid { grid-template-columns: repeat(4, 1fr); }
  .dir-pick { padding: 9px 0; font-size: 13px; }
}

.room-card-meta {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
  align-items: center;
}
.dir-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-soft);
}

/* ============== TOP BAR ACTIONS ============== */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============== SETTINGS PANEL ============== */
.settings-section {
  border-top: 1px solid var(--line);
  padding: 16px 0 4px;
  margin-top: 4px;
}
.settings-section:first-of-type { border-top: 0; padding-top: 0; }
.settings-h {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}
.settings-section .muted.small {
  font-size: 13px;
  line-height: 1.55;
}
.settings-section code {
  background: var(--bg-soft);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* ============== COMPASS LOCK BUTTON ============== */
.btn-primary.is-locked {
  background: var(--danger, #b14a3f);
}
.btn-primary.is-locked:hover {
  background: #99403a;
}

/* ============== IN-APP CAMERA ============== */
.no-scroll { overflow: hidden !important; height: 100%; }

.camera-overlay {
  position: fixed; inset: 0;
  background: #000;
  z-index: 1000;
  display: flex; flex-direction: column;
}
.camera-overlay video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: #000;
}
.camera-top {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 16px 0;
}
.camera-bottom {
  position: relative; z-index: 2;
  margin-top: auto;
  display: flex; justify-content: center;
  padding: 0 16px calc(28px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
}
.cam-icon-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,.45);
  border: 0;
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.cam-icon-btn:active { transform: scale(.94); }
.cam-shutter {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: rgba(255,255,255,.16);
  border: 4px solid #fff;
  padding: 0;
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .1s;
}
.cam-shutter:active { transform: scale(.92); }
.cam-shutter span {
  width: 58px; height: 58px;
  border-radius: 50%;
  background: #fff;
  display: block;
  transition: background .1s;
}
.cam-shutter:active span { background: #eee; }

/* ============== LIGHTBOX ============== */
.lightbox-overlay {
  position: fixed; inset: 0;
  background: rgba(10,8,5,.94);
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 16px;
  animation: lbIn .2s ease;
}
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
.lb-stage {
  position: relative;
  max-width: 100%; max-height: 100%;
  display: grid; place-items: center;
}
.lb-stage img {
  max-width: 100%;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,.4);
}
.lb-icon-btn {
  position: absolute;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 0;
  display: grid; place-items: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background .15s;
}
.lb-icon-btn:hover { background: rgba(255,255,255,.22); }
.lb-icon-btn:active { transform: scale(.94); }
.lb-close { top: calc(14px + env(safe-area-inset-top)); right: 16px; }
.lb-prev  { left: 16px;  top: 50%; transform: translateY(-50%); }
.lb-next  { right: 16px; top: 50%; transform: translateY(-50%); }
.lb-counter {
  position: absolute;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,.7);
  font-size: 13px;
  font-weight: 500;
  background: rgba(0,0,0,.4);
  padding: 4px 12px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
@media (max-width: 480px) {
  .lb-prev, .lb-next { width: 40px; height: 40px; }
  .lb-prev  { left: 10px; }
  .lb-next  { right: 10px; }
}

/* ============== ROOM DETAIL POLISH ============== */
/* Make photo tiles slightly bigger and tappable */
.photos-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 6px;
}
.photo-tile {
  cursor: pointer;
  transition: transform .15s;
}
.photo-tile:active { transform: scale(.97); }

/* Make the empty-state Vaastu CTA more prominent */
.vaastu-empty {
  background: linear-gradient(135deg, #faf5e6, #f6f1e7);
  border: 1.5px dashed rgba(196,100,45,.45);
}
.vaastu-empty .btn-primary {
  font-size: 15px;
  padding: 12px 22px;
}

/* Make the action buttons at the bottom of room detail stand out a bit more */
.screen[data-screen="room"] .btn-row {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
