/* =====================================================================
   Qsmart — professional IoT dashboard
   Style: Modern Dark (cinematic glassmorphism) + light theme
   ===================================================================== */

/* ===== Fonts (brand assets) ===== */
@font-face {
  font-family: 'GM';
  src: url('../assets/fonts/GilroyMedium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'GB';
  src: url('../assets/fonts/GilroyBold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'SM';
  src: url('../assets/fonts/ShabnamMedium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'SB';
  src: url('../assets/fonts/ShabnamBold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

/* ===== Design tokens ===== */
:root {
  /* brand */
  --accent: #5B79FF;
  --accent-strong: #3B5EDF;
  --accent-glow: rgba(91, 121, 255, 0.35);
  --green: #22C58B;
  --green-glow: rgba(34, 197, 139, 0.35);
  --red: #F0554D;
  --amber: #FFC325;
  --purple: #A78BFA;

  /* dark surfaces */
  --bg-top: #0D0D17;
  --bg-bottom: #060609;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #EDEDF2;
  --text-muted: #8A8F9E;
  --scrim: rgba(0, 0, 0, 0.55);
  --nav-glass: rgba(13, 13, 23, 0.72);
  --field-bg: rgba(255, 255, 255, 0.06);

  /* system */
  --radius: 16px;
  --radius-lg: 22px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 220ms;
  --appbar-h: 64px;
  --nav-h: 72px;
  --font-body: 'SM', 'GM', system-ui, sans-serif;
  --font-bold: 'SB', 'GB', system-ui, sans-serif;
  color-scheme: dark;
}

body[data-theme="light"] {
  --bg-top: #F2F4FB;
  --bg-bottom: #E7EAF5;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-hover: rgba(255, 255, 255, 0.95);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #101426;
  --text-muted: #5D6473;
  --scrim: rgba(15, 23, 42, 0.35);
  --nav-glass: rgba(255, 255, 255, 0.7);
  --field-bg: rgba(15, 23, 42, 0.05);
  --accent: #3B5EDF;
  --accent-glow: rgba(59, 94, 223, 0.28);
  color-scheme: light;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text);
  overflow: hidden;
  transition: background var(--dur), color var(--dur);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ===== Scrollbars ===== */
.page, .timer-body {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.page::-webkit-scrollbar, .timer-body::-webkit-scrollbar { width: 5px; }
.page::-webkit-scrollbar-thumb, .timer-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 100px;
}
.page::-webkit-scrollbar-track, .timer-body::-webkit-scrollbar-track { background: transparent; }

/* ===== Ambient light blobs ===== */
.ambient { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.blob {
  position: absolute;
  width: 420px; height: 420px;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.14;
  will-change: transform;
}
.blob-1 { background: #4F6BFF; top: -12%; inset-inline-start: -10%; animation: drift1 26s ease-in-out infinite alternate; }
.blob-2 { background: #8B5CF6; bottom: -18%; inset-inline-end: -12%; animation: drift2 32s ease-in-out infinite alternate; }
.blob-3 { background: #1DB68B; top: 42%; inset-inline-start: 55%; width: 300px; height: 300px; opacity: 0.08; animation: drift1 38s ease-in-out infinite alternate-reverse; }
body[data-theme="light"] .blob { opacity: 0.18; }
@keyframes drift1 { to { transform: translate(70px, 50px) scale(1.12); } }
@keyframes drift2 { to { transform: translate(-60px, -70px) scale(0.94); } }

/* ===== Icons ===== */
.icon {
  width: 22px; height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.icon.sm { width: 18px; height: 18px; }

/* icon tiles (tinted rounded squares) */
.icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--accent-glow);
  color: var(--accent);
  flex-shrink: 0;
}
.icon-tile.lg { width: 56px; height: 56px; border-radius: 18px; }
.icon-tile.lg .icon { width: 26px; height: 26px; }
.icon-tile.xl { width: 72px; height: 72px; border-radius: 22px; }
.icon-tile.xl .icon { width: 34px; height: 34px; }
.icon-tile.green  { background: var(--green-glow); color: var(--green); }
.icon-tile.purple { background: rgba(167, 139, 250, 0.22); color: var(--purple); }
.icon-tile.amber  { background: rgba(255, 195, 37, 0.2); color: var(--amber); }
.icon-tile.muted  { background: var(--surface); color: var(--text-muted); }

/* ===== Glass surfaces ===== */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.card {
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 12px 32px rgba(0, 0, 0, 0.18);
}
body[data-theme="light"] .card {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 10px 28px rgba(15, 23, 42, 0.08);
}

/* ===== Press feedback ===== */
.pressable {
  transition: transform 140ms var(--ease), background var(--dur) var(--ease),
              border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              color var(--dur) var(--ease), opacity var(--dur) var(--ease);
  cursor: pointer;
}
.pressable:active { transform: scale(0.97); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-bold);
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
}
.btn.full { width: 100%; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 8px 24px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 10px 30px var(--accent-glow); filter: brightness(1.06); }
.btn-green {
  background: linear-gradient(135deg, #2BD89B, #17A87A);
  color: #04281D;
  box-shadow: 0 8px 24px var(--green-glow);
}
.btn-green:hover { filter: brightness(1.05); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-hover); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-hover); }
.glass-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.glass-btn.danger { color: var(--red); }
.glass-btn.danger:hover { background: rgba(240, 85, 77, 0.14); border-color: rgba(240, 85, 77, 0.3); }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  background: var(--surface);
  color: var(--accent);
  font-family: var(--font-bold);
  font-size: 13px;
  cursor: pointer;
}
.ghost-btn:hover { background: var(--surface-hover); }

/* ===== App Bar ===== */
.appbar {
  position: fixed;
  top: 0; inset-inline: 0;
  height: var(--appbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 30;
  border-block-start: none;
  border-inline: none;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 6px 18px var(--accent-glow);
}
.brand-dot .icon { width: 20px; height: 20px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: 'GB', var(--font-bold); font-size: 17px; }
.brand-sub { font-size: 11px; color: var(--text-muted); }

.appbar-actions { display: flex; align-items: center; gap: 10px; }
.date-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.date-label { font-size: 10px; color: var(--text-muted); }
.date-value { font-family: var(--font-bold); font-size: 13px; color: var(--accent); }

/* ===== Pages ===== */
.pages {
  position: fixed;
  top: var(--appbar-h);
  bottom: var(--nav-h);
  inset-inline: 0;
  z-index: 1;
}
.page {
  position: absolute;
  inset: 0;
  display: none;
  overflow-y: auto;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
}
.page.active { display: block; }

.center-fill {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-title { font-family: var(--font-bold); font-size: 22px; }
.page-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.section-title { font-family: var(--font-bold); font-size: 16px; margin: 28px 4px 14px; }

.card-title { font-family: var(--font-bold); font-size: 17px; }
.card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.7; margin-top: 4px; }

/* ===== entrance animation ===== */
.anim-in { animation: rise 480ms var(--ease) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Page 0 : آفلاین ===== */
.offline-card {
  width: 420px;
  max-width: 100%;
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}
.offline-card .card-desc { max-width: 300px; }
.hint-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--field-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}

/* ===== Page 1 : ورود ===== */
.login-card {
  width: 440px;
  max-width: 100%;
  padding: 32px;
}
.login-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.login-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 12px 0;
}
.result-label { font-family: var(--font-bold); font-size: 16px; }
.result-hint { font-size: 12px; color: var(--text-muted); }
.ip-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 14px;
  background: var(--field-bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-family: 'GB', monospace;
  font-size: 17px;
  cursor: pointer;
}
.ip-chip:hover { background: var(--surface-hover); border-color: var(--accent); }
.login-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 30px 0;
}
.loading-text { font-size: 13px; color: var(--text-muted); }

.loader {
  width: 42px; height: 42px;
  border: 3px solid var(--field-bg);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Fields (floating label) ===== */
.field {
  position: relative;
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.field:focus-within { border-color: var(--accent); background: var(--surface-hover); }
.field input {
  width: 100%;
  min-height: 56px;
  padding: 20px 14px 6px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
}
.field label {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
  transition: all 160ms var(--ease);
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label {
  top: 14px;
  font-size: 11px;
  color: var(--accent);
}
.field.ltr input { direction: ltr; text-align: left; }
.field input[type=number]::-webkit-outer-spin-button,
.field input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
.field input[type=number] { -moz-appearance: textfield; appearance: textfield; }

.eye-btn {
  position: absolute;
  inset-inline-end: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.eye-btn:hover { color: var(--text); background: var(--surface-hover); }

/* ===== Page 2 : پنل ===== */
.toolbar { display: flex; gap: 10px; }

.devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr));
  gap: 16px;
}

.device-card {
  position: relative;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  animation: rise 480ms var(--ease) both;
}
.device-card:hover { background: var(--surface-hover); }
.device-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 10px 30px var(--accent-glow);
}
.device-card.selected::after {
  content: '';
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.device-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}
.device-card.is-on .icon-tile {
  background: rgba(255, 195, 37, 0.2);
  color: var(--amber);
  box-shadow: 0 0 22px rgba(255, 195, 37, 0.25);
}
.timer-btn { width: 40px; height: 40px; color: var(--text-muted); }
.timer-btn:hover { color: var(--text); }

.device-name { font-family: var(--font-bold); font-size: 15px; }
.device-ip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--field-bg);
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  direction: ltr;
  cursor: pointer;
}
.device-ip:hover { color: var(--text); background: var(--surface-hover); }
.device-ip .icon { width: 13px; height: 13px; }

.device-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}

/* active timer on the device card */
.timer-btn.active {
  color: var(--green);
  background: var(--green-glow);
}
.card-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--field-bg);
  border: 1px solid var(--border);
  color: var(--green);
}
.timer-track {
  flex: 1;
  height: 6px;
  border-radius: 100px;
  background: var(--field-bg);
  box-shadow: inset 0 0 0 1px var(--border);
  overflow: hidden;
}
.timer-fill {
  height: 100%;
  width: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, #2BD89B, #17A87A);
  box-shadow: 0 0 10px var(--green-glow);
  transition: width 1s linear;
}
.timer-remaining {
  font-family: var(--font-bold);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-width: 42px;
  text-align: center;
  direction: ltr;
}
.device-state { font-size: 12px; color: var(--text-muted); }
.device-card.is-on .device-state { color: var(--amber); }

/* toggle switch */
.switch {
  position: relative;
  width: 52px; height: 30px;
  border: none;
  border-radius: 100px;
  background: var(--field-bg);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  cursor: pointer;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  flex-shrink: 0;
}
.switch .knob {
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 260ms var(--ease);
}
.switch.on {
  background: linear-gradient(135deg, #FFD43A, #F6B512);
  box-shadow: inset 0 0 0 1px transparent, 0 0 18px rgba(255, 195, 37, 0.4);
}
.switch.on .knob { transform: translateX(-22px); }
html[dir="ltr"] .switch.on .knob { transform: translateX(22px); }

/* empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
}

/* ===== Page 3 : خانه ===== */
.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 28px;
  overflow: hidden;
}
.hero-welcome { font-family: 'GM', var(--font-body); font-size: 14px; color: var(--text-muted); }
.hero-brand { font-family: 'GB', var(--font-bold); font-size: 24px; margin-top: 2px; }
.hero-stats { display: flex; gap: 10px; margin-top: 18px; }
.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
  padding: 8px 14px;
  border-radius: 14px;
  background: var(--field-bg);
  border: 1px solid var(--border);
}
.stat-value { font-family: 'GB', var(--font-bold); font-size: 18px; color: var(--accent); }
.stat-label { font-size: 11px; color: var(--text-muted); }
.hero-illustration {
  width: 170px;
  max-width: 40%;
  height: auto;
  filter: drop-shadow(0 12px 24px rgba(79, 107, 255, 0.25));
}

/* active timers card on home */
.home-timers {
  margin-top: 16px;
  padding: 22px 24px;
}
.home-timers-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.home-timer-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.ht-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ht-name { font-family: var(--font-bold); font-size: 14px; }
.ht-info .timer-track { flex: 0 0 auto; width: 100%; }
.ht-time {
  font-family: var(--font-bold);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  color: var(--green);
  direction: ltr;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
  gap: 14px;
}
.link-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  text-decoration: none;
  color: var(--text);
}
.link-card:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.link-card .icon-tile { margin-bottom: 10px; }
.link-title { font-family: var(--font-bold); font-size: 15px; }
.link-sub { font-size: 12px; color: var(--text-muted); }
.home-grid .link-card:nth-child(2) { animation-delay: 50ms; }
.home-grid .link-card:nth-child(3) { animation-delay: 100ms; }
.home-grid .link-card:nth-child(4) { animation-delay: 150ms; }

/* ===== Bottom Navigation ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; inset-inline: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  z-index: 30;
  background: var(--nav-glass);
  border-inline: none;
  border-block-end: none;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
}
.nav-item::before {
  content: '';
  position: absolute;
  top: 8px;
  width: 44px; height: 34px;
  border-radius: 12px;
  background: var(--accent-glow);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.nav-item.active { color: var(--accent); }
.nav-item.active::before { opacity: 1; transform: scale(1); }
.nav-item .icon { position: relative; }
.nav-label { font-family: var(--font-bold); font-size: 11px; position: relative; }

/* ===== Timer Page ===== */
.timer-page {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  display: flex;
  flex-direction: column;
  animation: rise 320ms var(--ease) both;
}
.timer-page .appbar {
  position: relative;
  justify-content: flex-start;
  gap: 8px;
  flex-shrink: 0;
}
.timer-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.timer-card {
  width: 420px;
  max-width: 100%;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.ring-wrap { position: relative; width: 210px; height: 210px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track {
  fill: none;
  stroke: var(--field-bg);
  stroke-width: 10;
}
.ring-progress {
  fill: none;
  stroke: url(#ringGradient);
  stroke: var(--green);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 553;
  stroke-dashoffset: 553;
  transition: stroke-dashoffset 1s linear;
  filter: drop-shadow(0 0 8px var(--green-glow));
}
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.ring-time {
  font-family: 'GB', var(--font-bold);
  font-size: 40px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}
.ring-label { font-size: 12px; color: var(--text-muted); }
.timer-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}
.timer-fields .field { margin-bottom: 0; }

/* ===== Dialog ===== */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--scrim);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade 200ms var(--ease) both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.dialog-card {
  width: 400px;
  max-width: 100%;
  padding: 24px;
  animation: pop 320ms var(--ease) both;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.dialog-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 22px;
}
.dialog-head-text { flex: 1; }
.dialog-close { width: 36px; height: 36px; color: var(--text-muted); }
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  inset-inline: 16px;
  bottom: calc(var(--nav-h) + 14px);
  z-index: 60;
  margin-inline: auto;
  max-width: 480px;
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--nav-glass);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  animation: toast-in 260ms var(--ease) both;
}
@keyframes toast-in {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.toast-icon { display: inline-flex; color: var(--accent); }
.toast-icon .icon { width: 20px; height: 20px; }
.toast-icon.success { color: var(--green); }
.toast-icon.error { color: var(--red); }
.toast-content { flex: 1; font-size: 13.5px; line-height: 1.5; }
.toast-content.clickable { cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.toast-action {
  border: none;
  background: transparent;
  color: var(--accent);
  font-family: var(--font-bold);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.toast-action:hover { background: var(--surface-hover); }

/* ===== Responsive ===== */
@media (max-width: 560px) {
  .hero-card { flex-direction: column-reverse; text-align: center; }
  .hero-stats { justify-content: center; }
  .hero-illustration { max-width: 55%; }
  .date-chip { display: none; }
  .page-title { font-size: 19px; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; }
  .anim-in, .device-card, .dialog-card, .toast, .timer-page { animation: none; }
  .pressable, .switch, .switch .knob, .nav-item::before { transition: none; }
}
