/* ============================================================
 * Hotel Labs — Owner dashboard
 * Visual system per hotel_labs/PRODUCT.md + DESIGN.md (Refined):
 *   deep navy ink on warm off-white, single accent, no shadows,
 *   no gradients, italic for evidence quotes.
 * ============================================================ */

:root {
  /* Color — exact tokens from DESIGN.md §3 */
  --ink: #1F3A5F;
  --surface: #FBFAF7;
  --surface-elev: #FFFFFF;
  --text: #1A1D24;
  --text-2: #6B6F7A;
  --separator: #E5E2DC;
  --ok: #2D7A4E;
  --warn: #8B6F1F;
  --danger: #8B3A2E;

  /* Spacing */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;

  /* Radii */
  --r-sm: 8px;
  --r-lg: 16px;

  /* Type */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
}

* {
  box-sizing: border-box;
}

/* The HTML `hidden` attribute is overridden by any display: rule set lower in
 * cascade. Force it here so `el.hidden = true` actually hides .signin / .app. */
[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font-family: inherit;
}

/* ─── Sign-in overlay ────────────────────────────────────────── */

.signin {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--surface);
  padding: var(--s-5);
  z-index: 100;
}

.signin__card {
  width: 100%;
  max-width: 420px;
  background: var(--surface-elev);
  border: 1px solid var(--separator);
  border-radius: var(--r-lg);
  padding: var(--s-6);
}

.signin__title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: var(--s-5) 0 var(--s-3);
}

.signin__lede {
  color: var(--text-2);
  margin: 0 0 var(--s-5);
}

.signin__form {
  display: grid;
  gap: var(--s-4);
}

.signin__error {
  color: var(--danger);
  font-size: 14px;
  margin: 0;
}

.field {
  display: grid;
  gap: var(--s-2);
}

.field__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.field__input {
  height: 44px;
  padding: 0 var(--s-3);
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: var(--r-sm);
  outline: none;
}

.field__input:focus {
  border-color: var(--ink);
}

/* ─── Buttons ────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 44px;
  padding: 0 var(--s-5);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn--primary {
  background: var(--ink);
  color: var(--surface-elev);
}

.btn--primary:hover { background: #182f4d; }

.btn--ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--separator);
}

.btn--ghost:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.btn--sm {
  height: 32px;
  padding: 0 var(--s-3);
  font-size: 13px;
}

/* ─── Top bar + tabs ─────────────────────────────────────────── */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--separator);
  z-index: 10;
}

.topbar__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s-4) var(--s-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s-2);
  font-weight: 600;
  letter-spacing: -0.005em;
}

.wordmark__name {
  font-size: 17px;
  color: var(--ink);
}

.wordmark__divider {
  color: var(--text-2);
  font-weight: 400;
}

.wordmark__role {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 500;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}

.live__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-2);
}

.live--on .live__dot {
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(45, 122, 78, 0.5);
  animation: pulse 2.2s infinite ease-out;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(45, 122, 78, 0.45); }
  70%  { box-shadow: 0 0 0 8px rgba(45, 122, 78, 0); }
  100% { box-shadow: 0 0 0 0 rgba(45, 122, 78, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .live--on .live__dot { animation: none; }
}

.tabs {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--s-5);
  display: flex;
  gap: var(--s-2);
}

.tab {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  padding: var(--s-3) var(--s-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--ink);
}

.tab--active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ─── Panels ─────────────────────────────────────────────────── */

.panel {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: var(--s-6) var(--s-5) var(--s-7);
  display: grid;
  gap: var(--s-7);
}

.kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-head {
  display: grid;
  gap: var(--s-1);
  margin-bottom: var(--s-4);
}

.section-head--inline {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-4);
}

.section-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.section-sub {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}

/* ─── Rollup (portfolio stats) ───────────────────────────────── */

.rollup__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
  gap: var(--s-3);
}

.rollup__title {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
}

.rollup__asof {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
}

.stats {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: var(--surface-elev);
  border: 1px solid var(--separator);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.stat {
  padding: var(--s-5);
  border-right: 1px solid var(--separator);
}

.stat:last-child { border-right: 0; }

.stat dt {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: var(--s-2);
}

.stat__value {
  margin: 0;
  font-size: 36px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat__value--ok   { color: var(--ok); }
.stat__value--warn { color: var(--warn); }

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--separator); }
}

/* ─── Property cards (Front desk) ────────────────────────────── */

.property-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: var(--s-4);
}

.prop-card {
  background: var(--surface-elev);
  border: 1px solid var(--separator);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  display: grid;
  gap: var(--s-4);
}

.prop-card__head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--s-3);
}

.prop-card__name {
  margin: 0 0 var(--s-1);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.prop-card__meta {
  font-size: 13px;
  color: var(--text-2);
}

.prop-card__count {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.prop-card__count-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: var(--s-1);
}

.prop-card__count-wrap {
  text-align: right;
}

.behaviors {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-2);
  border-top: 1px solid var(--separator);
  border-bottom: 1px solid var(--separator);
  padding: var(--s-3) 0;
}

.behavior {
  display: grid;
  gap: 2px;
  text-align: left;
}

.behavior__count {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.behavior__count--zero {
  color: var(--text-2);
  font-weight: 600;
}

.behavior__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.02em;
}

.quote {
  margin: 0;
  padding: 0;
  font-style: italic;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.quote__attr {
  display: block;
  margin-top: var(--s-2);
  font-style: normal;
  font-size: 12px;
  color: var(--text-2);
}

.quote--empty {
  color: var(--text-2);
  font-style: normal;
}

/* ─── Live indicator on property card ────────────────────────── */

.prop-card__live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-top: 2px;
}

.prop-card__live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-2);
}

.prop-card__live--on .prop-card__live-dot {
  background: var(--ok);
  animation: pulse 2.2s infinite ease-out;
}

.prop-card__live--on {
  color: var(--ok);
}

/* ─── Conversation feed ──────────────────────────────────────── */

.feed__list {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface-elev);
  border: 1px solid var(--separator);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.feed__item {
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--separator);
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: var(--s-4);
  align-items: start;
}

.feed__item:first-child { border-top: 0; }

.feed__when {
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.feed__when strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.feed__transcript {
  font-style: italic;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.feed__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  align-self: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  background: rgba(31, 58, 95, 0.08);
  letter-spacing: 0.01em;
}

.chip--zero {
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--separator);
  font-weight: 500;
}

.feed__empty,
.task-list__empty {
  padding: var(--s-5);
  color: var(--text-2);
  text-align: center;
  font-size: 14px;
}

/* ─── Tasks tab ──────────────────────────────────────────────── */

.task-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-3);
}

.task-tile {
  background: var(--surface-elev);
  border: 1px solid var(--separator);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5);
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: var(--s-3);
  transition: border-color 0.15s ease;
  font: inherit;
  color: var(--text);
}

.task-tile:hover { border-color: var(--ink); }

.task-tile--active {
  border-color: var(--ink);
  background: rgba(31, 58, 95, 0.03);
}

.task-tile__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.task-tile__counts {
  display: flex;
  gap: var(--s-4);
  align-items: baseline;
}

.task-tile__count {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.task-tile__count-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.task-tile__count--warn { color: var(--warn); }
.task-tile__count--ok   { color: var(--ok); }
.task-tile__count--mute { color: var(--text-2); }

.seg {
  display: inline-flex;
  background: var(--surface-elev);
  border: 1px solid var(--separator);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.seg__btn {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.seg__btn--active {
  background: var(--ink);
  color: var(--surface-elev);
}

.task-list {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface-elev);
  border: 1px solid var(--separator);
  border-radius: var(--r-lg);
}

.task-item {
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--separator);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--s-4);
  align-items: center;
}

.task-item:first-child { border-top: 0; }

.task-item__status {
  width: 22px;
  height: 22px;
  border: 2px solid var(--separator);
  border-radius: 50%;
}

.task-item--done .task-item__status {
  background: var(--ok);
  border-color: var(--ok);
  position: relative;
}

.task-item--done .task-item__status::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 6px;
  width: 5px;
  height: 9px;
  border: solid var(--surface-elev);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.task-item--overdue .task-item__status {
  border-color: var(--warn);
}

.task-item__body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.task-item__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-item--done .task-item__title {
  color: var(--text-2);
  text-decoration: line-through;
  text-decoration-color: var(--separator);
}

.task-item__meta {
  font-size: 13px;
  color: var(--text-2);
}

.task-item__meta .pill {
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  height: 18px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 6px;
  background: rgba(31, 58, 95, 0.08);
  color: var(--ink);
  letter-spacing: 0.01em;
}

.task-item__meta .pill--warn {
  background: rgba(139, 111, 31, 0.12);
  color: var(--warn);
}

.task-item__when {
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ─── Footer ─────────────────────────────────────────────────── */

.footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s-5);
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.footer__sep { color: var(--separator); }

/* ─── Responsive ─────────────────────────────────────────────── */

@media (max-width: 720px) {
  .topbar__inner { flex-wrap: wrap; gap: var(--s-3); }
  .panel { padding: var(--s-5) var(--s-4); gap: var(--s-6); }
  .feed__item { grid-template-columns: 1fr; }
  .feed__chips { justify-content: flex-start; }
  .behaviors { grid-template-columns: repeat(2, 1fr); }
  .task-item { grid-template-columns: auto 1fr; }
  .task-item__when { grid-column: 2; font-size: 12px; }
}
