/* Lumen — a quiet light that taps you on the shoulder.
   Warm near-black, bone text, candle-amber accent, sage for "on". */

:root {
  --bg: #12100e;
  --surface: #1b1714;
  --surface-2: #242019;
  --line: #2c261f;
  --ink: #e9e1d2;
  --muted: #8d8270;
  --faint: #5d5546;
  --amber: #d2a04c;
  --amber-dim: #8a6a34;
  --sage: #87a07a;
  --clay: #c4694b;
  --radius: 14px;
  --nav-h: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Karla', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  background:
    radial-gradient(ellipse 120% 60% at 50% -10%, rgba(210, 160, 76, 0.07), transparent 60%),
    var(--bg);
}

.hidden { display: none !important; }

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* ---------- Auth ---------- */

.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.auth-inner { width: 100%; max-width: 340px; text-align: center; }

.auth-mark {
  width: 56px; height: 56px;
  margin: 0 auto 28px;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(circle at 50% 42%, rgba(210, 160, 76, 0.85), rgba(210, 160, 76, 0.12) 62%, transparent 72%);
  box-shadow: 0 0 34px rgba(210, 160, 76, 0.35);
}
.auth-mark::after {
  content: '';
  position: absolute;
  inset: 17px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #f3d79a, var(--amber) 70%);
}

.auth-label {
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 14px;
}

.auth-title {
  font-family: 'Marcellus', serif;
  font-weight: 400;
  font-size: 1.9rem;
  line-height: 1.25;
  margin-bottom: 36px;
}

.auth-form { display: flex; flex-direction: column; gap: 12px; }

.auth-form input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
}
.auth-form input:focus { outline: none; border-color: var(--amber-dim); }

.auth-form button {
  margin-top: 8px;
  background: var(--amber);
  color: #1a140a;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 1rem;
}
.auth-form button:disabled { opacity: 0.6; }

.auth-error { color: var(--clay); font-size: 0.88rem; }

/* ---------- Shell ---------- */

.app { min-height: 100dvh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 20px 12px;
  background: linear-gradient(rgba(18, 16, 14, 0.96), rgba(18, 16, 14, 0.82));
  backdrop-filter: blur(8px);
}

.topbar__title {
  font-family: 'Marcellus', serif;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
}

.topbar__actions { display: flex; align-items: center; gap: 12px; }

.topbar__logout {
  font-size: 0.78rem;
  color: var(--faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sync-badge {
  font-size: 0.72rem;
  color: var(--amber);
  border: 1px solid var(--amber-dim);
  border-radius: 99px;
  padding: 2px 10px;
}

.view-container {
  padding: 8px 20px calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
  max-width: 520px;
  margin: 0 auto;
}

.loading { text-align: center; color: var(--faint); padding: 48px 0; font-size: 1.4rem; }
.empty { text-align: center; color: var(--muted); padding: 40px 8px; line-height: 1.6; }
.offline-note { color: var(--amber); font-size: 0.82rem; margin-top: 6px; }

/* ---------- Bottom nav ---------- */

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(20, 17, 14, 0.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--faint);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  transition: color 0.2s;
}
.bottom-nav__item svg { width: 21px; height: 21px; }
.bottom-nav__item.active { color: var(--amber); }

/* ---------- View heads ---------- */

.view-head { padding: 14px 0 4px; }
.view-head__title {
  font-family: 'Marcellus', serif;
  font-size: 1.55rem;
  line-height: 1.2;
}
.view-head__sub { color: var(--muted); font-size: 0.88rem; margin-top: 2px; }

.zone { margin-top: 22px; animation: rise 0.45s ease both; }

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

.zone__title {
  font-size: 0.72rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--amber);
  font-weight: 600;
  margin-bottom: 12px;
}

/* ---------- Reminders list ---------- */

.add-btn {
  width: 100%;
  background: var(--surface);
  border: 1px dashed var(--amber-dim);
  color: var(--amber);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  margin-bottom: 16px;
  transition: transform 0.15s, background 0.15s;
}
.add-btn:active { transform: scale(0.98); }

.reminder {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 8px;
  transition: opacity 0.25s;
}
.reminder--off { opacity: 0.5; }

.reminder__body { flex: 1; min-width: 0; }
.reminder__text {
  font-size: 0.98rem;
  color: var(--ink);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.reminder__title { font-weight: 600; color: var(--amber); display: block; margin-bottom: 2px; font-size: 0.86rem; letter-spacing: 0.02em; }
.reminder__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 99px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.tag--pin { color: var(--amber); border-color: rgba(210, 160, 76, 0.4); }
.tag--off { color: var(--faint); }

.reminder__edit {
  flex-shrink: 0;
  color: var(--faint);
  padding: 2px 4px;
}
.reminder__edit svg { width: 18px; height: 18px; display: block; }

/* ---------- Settings ---------- */

.setting {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}
.setting__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.setting__label { font-size: 0.98rem; }
.setting__label small { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 3px; line-height: 1.4; }

.setting__sub {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 8px;
}

/* Toggle switch */
.switch { position: relative; width: 48px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__track {
  position: absolute; inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  transition: background 0.2s, border-color 0.2s;
}
.switch__track::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s, background 0.2s;
}
.switch input:checked + .switch__track { background: rgba(135, 160, 122, 0.25); border-color: var(--sage); }
.switch input:checked + .switch__track::before { transform: translateX(20px); background: var(--sage); }

/* Segmented control */
.seg { display: flex; gap: 5px; }
.seg__opt {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 4px;
  font-size: 0.82rem;
  color: var(--muted);
  transition: all 0.15s;
}
.seg__opt--on { background: var(--amber); border-color: var(--amber); color: #1a140a; font-weight: 600; }

/* Number + time fields */
.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.field-row:last-child { border-bottom: none; }
.field-row__label { font-size: 0.92rem; color: var(--ink); }
.field-row__label small { display: block; color: var(--faint); font-size: 0.76rem; }

.num-input, .time-input {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  text-align: center;
}
.num-input { width: 72px; }
.time-input { width: 110px; }
.num-input:focus, .time-input:focus { outline: none; border-color: var(--amber-dim); }

.ghost-btn {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 13px;
  font-size: 0.92rem;
  margin-top: 10px;
  transition: transform 0.15s, border-color 0.15s;
}
.ghost-btn:active { transform: scale(0.98); }
.ghost-btn--amber { border-color: var(--amber-dim); color: var(--amber); }
.ghost-btn:disabled { opacity: 0.45; }

.push-status {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 10px;
  text-align: center;
}
.push-status--on { color: var(--sage); }
.push-status--off { color: var(--clay); }

/* ---------- Bottom sheet ---------- */

.sheet-backdrop {
  position: fixed; inset: 0;
  z-index: 40;
  background: rgba(10, 8, 6, 0.6);
  opacity: 0;
  transition: opacity 0.22s;
}
.sheet-backdrop.open { opacity: 1; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 90dvh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.22s ease;
  max-width: 520px;
  margin: 0 auto;
}
.sheet.open { transform: none; }

.sheet__handle {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 4px auto 14px;
}

.sheet__title {
  font-family: 'Marcellus', serif;
  font-weight: 400;
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.sheet__sub {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 0 6px;
}

.sheet__input, .sheet__textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.98rem;
  line-height: 1.5;
}
.sheet__textarea { min-height: 96px; resize: vertical; }
.sheet__input:focus, .sheet__textarea:focus { outline: none; border-color: var(--amber-dim); }

.sheet__inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
}

.sheet__save {
  width: 100%;
  margin-top: 18px;
  background: var(--amber);
  color: #1a140a;
  font-weight: 600;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 1rem;
  letter-spacing: 0.03em;
}
.sheet__save:disabled { opacity: 0.35; }

.sheet__row { display: flex; gap: 10px; margin-top: 10px; }
.sheet__minor {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 0.9rem;
}
.sheet__minor--danger { color: var(--clay); border-color: rgba(196, 105, 75, 0.35); }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  left: 50%;
  transform: translate(-50%, 12px);
  z-index: 60;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.88rem;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.toast__action {
  color: var(--amber);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
