/* Smart Home Demo. Standalone, fake data, in-memory only (ADR 0006).
   The palette is the owner's app look: dark glass cards on a deep navy background. */

:root {
  --bg: #020617;
  --bg-glow: #0f172a;
  --card: rgba(15, 23, 42, 0.72);
  --card-strong: rgba(15, 23, 42, 0.92);
  --text: #f8fafc;
  --muted: #94a3b8;
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.14);
  --blue: #38bdf8;
  --blue-2: #0ea5e9;
  --blue-3: #0284c7;
  --green: #22c55e;
  --green-2: #16a34a;
  --red: #ef4444;
  --red-2: #991b1b;
  --purple: #7c3aed;
  --purple-2: #5b21b6;
  --amber: #fbbf24;
  --violet: #a855f7;
  --teal: #14b8a6;
  --pink: #f472b6;
  --radius-lg: 28px;
  --radius-md: 22px;
  --shadow: 0 24px 48px rgba(2, 6, 23, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-block-size: 100%;
}

body {
  background: radial-gradient(circle at 50% 0, var(--bg-glow), transparent 62%), var(--bg);
  color: var(--text);
  font-family: system-ui, 'Segoe UI', Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-block-end: 72px;
  transition: background 0.3s ease;
}

body.is-alarm {
  background: radial-gradient(circle at 50% 0, rgba(153, 27, 27, 0.55), transparent 62%), var(--bg);
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

h2,
h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app {
  display: grid;
  gap: 14px;
  padding: 14px;
  max-inline-size: 520px;
  margin-inline: auto;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card-strong);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand__icon {
  display: grid;
  place-items: center;
  inline-size: 42px;
  block-size: 42px;
  border-radius: 14px;
  background: rgba(56, 189, 248, 0.16);
  font-size: 22px;
}

.brand__text {
  display: flex;
  flex-direction: column;
}

.brand__name {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand__sub {
  color: var(--muted);
  font-size: 0.8rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line-strong);
}

.pill::before {
  content: '';
  inline-size: 7px;
  block-size: 7px;
  border-radius: 50%;
  background: currentcolor;
}

.pill--green {
  color: var(--green);
  background: rgba(34, 197, 94, 0.14);
}

.pill--red {
  color: var(--red);
  background: rgba(239, 68, 68, 0.16);
}

/* ---------- Banners ---------- */

.banner {
  margin: 0;
  padding: 12px 16px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: var(--radius-md);
  background: rgba(251, 191, 36, 0.14);
  color: var(--amber);
  font-weight: 700;
}

/* ---------- Cards ---------- */

.card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.card__title {
  font-size: 0.82rem;
  color: var(--muted);
}

.card--down {
  border-color: rgba(239, 68, 68, 0.4);
}

.card[hidden] {
  display: none;
}

.room {
  border-top: 3px solid var(--line-strong);
}

.room[data-accent='blue'] {
  border-top-color: var(--blue);
}

.room[data-accent='amber'] {
  border-top-color: var(--amber);
}

.room[data-accent='violet'] {
  border-top-color: var(--violet);
}

.room[data-accent='teal'] {
  border-top-color: var(--teal);
}

.room[data-accent='pink'] {
  border-top-color: var(--pink);
}

.row {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
}

.row--wrap {
  flex-wrap: wrap;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-block-size: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78rem;
  transition:
    transform 0.15s ease,
    background 0.2s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn--green {
  border-color: transparent;
  background: linear-gradient(180deg, var(--green), var(--green-2));
  color: #04140a;
}

.btn--red {
  border-color: transparent;
  background: linear-gradient(180deg, var(--red), var(--red-2));
  color: #fff;
}

.btn--blue {
  border-color: transparent;
  background: linear-gradient(180deg, var(--blue-2), var(--blue-3));
  color: #041a24;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

/* ---------- Active lights ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid rgba(34, 197, 94, 0.5);
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.16);
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 600;
}

.chip::after {
  content: '✕';
  font-size: 0.7rem;
}

/* ---------- Room tabs ---------- */

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-block: 2px;
}

.tab {
  flex: none;
  min-block-size: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.tab--active {
  border-color: transparent;
  background: linear-gradient(180deg, var(--blue-2), var(--blue-3));
  color: #041a24;
}

/* ---------- Light grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.light {
  position: relative;
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 14px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-align: center;
}

.light--on {
  border-color: transparent;
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.9), rgba(22, 163, 74, 0.9));
  color: #04140a;
}

.light__icon {
  font-size: 20px;
}

.light__timer {
  position: absolute;
  inset-block-start: 6px;
  inset-inline-end: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.8);
  color: var(--text);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- Floating buttons ---------- */

.fabs {
  position: fixed;
  inset-block-end: 14px;
  inset-inline-end: 14px;
  z-index: 30;
  display: flex;
  gap: 10px;
}

.fab {
  min-block-size: 48px;
  padding: 12px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: var(--shadow);
}

.fab--scenes {
  border-color: transparent;
  background: linear-gradient(180deg, var(--purple), var(--purple-2));
}

.fab--settings {
  background: rgba(2, 6, 23, 0.9);
}

/* ---------- Sheets ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  background: rgba(2, 6, 23, 0.62);
}

.sheet[hidden] {
  display: none;
}

.sheet__panel {
  display: grid;
  gap: 14px;
  inline-size: 100%;
  max-inline-size: 520px;
  max-block-size: 88dvh;
  overflow-y: auto;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-md) var(--radius-md);
  background: var(--card-strong);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sheet__head h2 {
  font-size: 0.95rem;
}

.sheet__close {
  inline-size: 36px;
  block-size: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.sheet__body {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.field input,
.field select {
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.6);
  color: var(--text);
  font: inherit;
}

.field--small {
  flex: 1;
}

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
}

.switch input {
  inline-size: 22px;
  block-size: 22px;
  accent-color: var(--green);
}

/* ---------- Scenes ---------- */

.scene {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
}

.scene h3 {
  font-size: 0.9rem;
}

/* ---------- Scene editor ---------- */

.editor {
  display: grid;
  gap: 14px;
}

.editor__room {
  display: grid;
  gap: 8px;
}

.editor__room h3 {
  font-size: 0.78rem;
  color: var(--muted);
}

.editor__row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.editor__label {
  flex: 1 1 40%;
  min-inline-size: 96px;
  font-size: 0.82rem;
}

.mini {
  min-block-size: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.mini--active {
  border-color: transparent;
  background: linear-gradient(180deg, var(--blue-2), var(--blue-3));
  color: #041a24;
}

.editor__row input[type='number'] {
  inline-size: 68px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.6);
  color: var(--text);
  font: inherit;
}

/* ---------- Timer ---------- */

.timer-count {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--blue);
}

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  inset-block-end: 76px;
  inset-inline: 0;
  z-index: 50;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding-inline: 16px;
  pointer-events: none;
}

.toast {
  margin: 0;
  padding: 10px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.92);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow);
}
