:root {
  --ink: #132238;
  --text: #132238;
  --muted: #5d6c82;
  --paper: rgba(255, 252, 247, 0.92);
  --paper-strong: #fffaf2;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-muted: rgba(255, 255, 255, 0.56);
  --line: rgba(19, 34, 56, 0.12);
  --accent: #dd6b20;
  --accent-cool: #0f766e;
  --danger: #b42318;
  --shadow: 0 24px 60px rgba(13, 24, 43, 0.14);
  --radius: 24px;
  --glow: 0 24px 80px rgba(221, 107, 32, 0.14);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf4ff;
  --text: #edf4ff;
  --muted: #93a3bc;
  --paper: rgba(11, 19, 34, 0.9);
  --paper-strong: #122038;
  --surface: rgba(16, 28, 49, 0.78);
  --surface-muted: rgba(17, 29, 49, 0.58);
  --line: rgba(158, 174, 201, 0.18);
  --accent: #f08a43;
  --accent-cool: #2cc3b3;
  --danger: #ff8b83;
  --shadow: 0 28px 64px rgba(0, 0, 0, 0.4);
  --glow: 0 24px 90px rgba(240, 138, 67, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Gill Sans", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(253, 186, 116, 0.45), transparent 32%),
    radial-gradient(circle at bottom right, rgba(45, 212, 191, 0.22), transparent 30%),
    linear-gradient(135deg, #f2eee5 0%, #f7f2e8 42%, #eff5f2 100%);
  overflow-x: hidden;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at top left, rgba(240, 138, 67, 0.2), transparent 34%),
    radial-gradient(circle at bottom right, rgba(44, 195, 179, 0.15), transparent 28%),
    linear-gradient(140deg, #09111d 0%, #10192b 46%, #0a1221 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 82%);
}

html[data-theme="dark"] body::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
}

body::after {
  content: "";
  position: fixed;
  inset: auto auto -180px 50%;
  width: min(54vw, 700px);
  height: min(54vw, 700px);
  transform: translateX(-50%);
  border-radius: 999px;
  pointer-events: none;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0.08) 28%, transparent 72%),
    radial-gradient(circle at 35% 35%, rgba(221, 107, 32, 0.12), transparent 58%);
  filter: blur(14px);
  opacity: 0.9;
}

html[data-theme="dark"] body::after {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 26%, transparent 72%),
    radial-gradient(circle at 35% 35%, rgba(240, 138, 67, 0.12), transparent 58%);
}

h1,
h2,
legend {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", serif;
  letter-spacing: 0.01em;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

/* Global: the HTML `hidden` attribute must always win. Without this, any
   later `display: grid | flex | ...` rule would silently override it. */
[hidden] {
  display: none !important;
}

.page-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  position: sticky;
  top: 12px;
  z-index: 30;
}

.nav-brand {
  color: var(--ink);
  text-decoration: none;
  font-family: "Palatino Linotype", "Book Antiqua", serif;
  font-size: 1.4rem;
  font-weight: 700;
}

.nav-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(19, 34, 56, 0.12);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.nav-link.is-active {
  background: linear-gradient(135deg, rgba(221, 107, 32, 0.16), rgba(15, 118, 110, 0.12));
}

.nav-icon-button,
.nav-avatar-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(19, 34, 56, 0.12);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
}

.nav-icon-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.nav-icon-button.is-active,
.nav-avatar-button.is-active,
.nav-login-link.is-active {
  background: linear-gradient(135deg, rgba(221, 107, 32, 0.18), rgba(15, 118, 110, 0.14));
  border-color: rgba(221, 107, 32, 0.28);
}

.nav-icon-badge {
  position: absolute;
  top: 3px;
  right: 1px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #dc2626, #ea580c);
  color: white;
  font-size: 0.68rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(180, 35, 24, 0.25);
}

.nav-avatar-button span,
.account-avatar-preview span {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.nav-avatar-button img,
.account-avatar-preview img {
  /* Abs-position so the grid's `place-items: center` doesn't size the track
     to the image's intrinsic (upload) dimensions — without this, width:100%
     resolved to the full 512px and object-fit never had a reason to scale. */
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: inherit;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(19, 34, 56, 0.12);
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  font-weight: 700;
}

.theme-toggle-copy {
  font-size: 0.9rem;
}

.theme-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-toggle-track {
  width: 52px;
  height: 30px;
  padding: 3px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(19, 34, 56, 0.16), rgba(19, 34, 56, 0.28));
  display: inline-flex;
  align-items: center;
  transition: background 180ms ease;
}

.theme-toggle-thumb {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: white;
  box-shadow: 0 8px 18px rgba(13, 24, 43, 0.2);
  transition: transform 180ms ease, background 180ms ease;
}

.theme-toggle-input:checked + .theme-toggle-track {
  background: linear-gradient(135deg, rgba(240, 138, 67, 0.86), rgba(44, 195, 179, 0.72));
}

.theme-toggle-input:checked + .theme-toggle-track .theme-toggle-thumb {
  transform: translateX(22px);
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-gallery {
  margin-bottom: 20px;
}

.hero-copy,
.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow), var(--glow);
  backdrop-filter: blur(18px);
}

.hero-copy {
  padding: 36px;
}

.hero-copy::after,
.card::after {
  content: "";
  position: absolute;
  inset: auto -40px -58px auto;
  width: 180px;
  height: 180px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(221, 107, 32, 0.14) 0%, transparent 68%);
  pointer-events: none;
}

.hero-calendar .hero-copy::before,
.hero-calendar .hero-meta::before {
  content: "";
  position: absolute;
  inset: auto auto -90px -60px;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.14) 0%, transparent 70%);
  pointer-events: none;
}

.hero-text,
.muted,
.meta-label {
  color: var(--muted);
}

.hero h1 {
  font-size: clamp(2.75rem, 5vw, 4.5rem);
  line-height: 0.95;
  margin-bottom: 14px;
}

.hero-text {
  width: min(54ch, 100%);
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.6;
}

.eyebrow,
.meta-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  font-weight: 700;
}

.hero-actions,
.month-actions,
.modal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-actions {
  margin-top: 24px;
}

.button,
.icon-button,
.member-chip {
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.button:hover,
.icon-button:hover,
.member-chip:hover {
  filter: brightness(1.04);
}

.button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
}

.button-primary {
  color: white;
  background: linear-gradient(135deg, #dd6b20, #ea580c);
  box-shadow: 0 14px 28px rgba(221, 107, 32, 0.24);
}

.button-secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(19, 34, 56, 0.12);
}

.button-danger {
  color: white;
  background: linear-gradient(135deg, #dc2626, #b42318);
  margin-right: auto;
}

a.button {
  text-decoration: none;
}

.hero-meta {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-signal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.hero-signal-grid span {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.12), rgba(221, 107, 32, 0.38));
}

.hero-signal-grid span:nth-child(2) {
  opacity: 0.72;
}

.hero-signal-grid span:nth-child(3) {
  opacity: 0.45;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.summary-card {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(19, 34, 56, 0.08);
}

.summary-card strong {
  display: block;
  font-size: 1.7rem;
  line-height: 1;
  margin-bottom: 8px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(330px, 0.85fr);
  gap: 24px;
}

.schedule-layout {
  align-items: start;
}

.calendar-stage {
  display: grid;
  gap: 24px;
  min-width: 0;
}

.rhythm-rail {
  display: grid;
  gap: 24px;
  align-content: start;
}

.gallery-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.62fr) minmax(0, 1.38fr);
  gap: 24px;
}

.assistant-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.85fr);
  gap: 24px;
}

.account-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.access-layout {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 180px);
}

.access-card {
  width: min(560px, 100%);
}

.account-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.board-brief {
  display: grid;
  gap: 16px;
}

.board-brief h1 {
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  line-height: 1;
}

.avatar-picker-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: start;
}

.avatar-preview-shell,
.avatar-browser {
  display: grid;
  gap: 14px;
}

.avatar-browser-head {
  display: grid;
  gap: 12px;
}

.account-avatar-preview {
  position: relative;
  width: 124px;
  height: 124px;
  border-radius: 999px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(221, 107, 32, 0.18), rgba(15, 118, 110, 0.14));
  border: 1px solid rgba(19, 34, 56, 0.1);
  box-shadow: 0 18px 40px rgba(13, 24, 43, 0.12);
}

.avatar-picker-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.avatar-folder-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.avatar-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
}

.avatar-image-option {
  display: grid;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  text-align: left;
}

.avatar-image-option[data-active="true"] {
  border-color: rgba(221, 107, 32, 0.45);
  box-shadow: 0 0 0 1px rgba(221, 107, 32, 0.18);
}

.avatar-image-option img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  object-fit: cover;
}

.avatar-image-option span {
  font-size: 0.82rem;
  line-height: 1.35;
  word-break: break-word;
}

.notifications-list {
  display: grid;
  gap: 14px;
}

.notification-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.notification-card[data-dismissed="true"] {
  opacity: 0.68;
}

.notification-card-topline,
.notification-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.notification-card-topline h3 {
  margin: 0;
}

.notification-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
  font-weight: 700;
}

.notification-pill-muted {
  align-self: flex-start;
  margin-top: 4px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(71, 85, 105, 0.12);
  color: #475569;
}

.notification-body {
  margin: 0;
  line-height: 1.6;
}

.standalone-event-form {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.account-section-title {
  margin: 0 0 12px;
  font-size: 1rem;
}

.account-tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.account-tab.is-active {
  background: var(--accent);
  color: white;
  border-color: transparent;
}

.admin-tab-panel {
  display: grid;
  gap: 14px;
}

.visibility-grid {
  display: grid;
  gap: 12px;
}

.admin-source-settings-grid {
  display: grid;
  gap: 12px;
}

.admin-source-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.admin-source-copy {
  display: grid;
  gap: 6px;
}

.admin-source-copy strong {
  font-size: 0.98rem;
}

.admin-source-toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(221, 107, 32, 0.26);
  background: rgba(255, 247, 237, 0.78);
  white-space: nowrap;
}

.admin-source-toggle-control input {
  accent-color: var(--accent);
}

.device-list {
  display: grid;
  gap: 12px;
}

.device-group {
  display: grid;
  gap: 12px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-muted);
}

.device-group summary {
  list-style: none;
  cursor: pointer;
}

.device-group summary::-webkit-details-marker {
  display: none;
}

.device-group-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  border-radius: 18px;
}

.device-group-header h3 {
  margin: 0 0 6px;
}

.device-group-header.has-anonymous {
  border-color: rgba(220, 38, 38, 0.28);
  background: rgba(220, 38, 38, 0.06);
}

.device-group-list,
.user-list {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
}

.device-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  display: grid;
  gap: 8px;
}

.device-card.has-anonymous,
.user-card.is-pending {
  border-color: rgba(220, 38, 38, 0.28);
  background: rgba(220, 38, 38, 0.05);
}

.device-card-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.device-card-topline h3 {
  margin: 0;
  font-size: 1rem;
}

.device-card-ip,
.device-card-meta,
.device-card-agent {
  color: var(--muted);
  margin: 0;
}

.device-card-agent {
  font-size: 0.92rem;
  word-break: break-word;
}

.device-group-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
  font-weight: 700;
  white-space: nowrap;
}

.device-group-badge.is-warn {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}

.user-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  display: grid;
  gap: 12px;
}

.user-card-topline {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.user-card-topline h3 {
  margin: 0 0 6px;
}

.user-card-controls {
  display: grid;
  gap: 12px;
}

.user-access-select {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.user-card-checkbox {
  margin: 0;
}

.visibility-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(120px, 0.85fr) minmax(120px, 0.85fr);
  gap: 12px;
  align-items: end;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.visibility-title {
  font-weight: 700;
  color: var(--text);
}

.visibility-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.visibility-field select,
.viewer-move-select {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.calendar-panel,
.sidebar {
  min-width: 0;
}

.calendar-panel {
  padding: 24px;
  overflow: visible;
}

.sidebar {
  display: grid;
  gap: 24px;
}

.card {
  padding: 22px;
}

.calendar-ribbon {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(19, 34, 56, 0.08);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 248, 239, 0.9)),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.1), transparent 46%);
}

.calendar-ribbon-copy,
.event-studio-copy {
  margin: 0;
  line-height: 1.6;
}

.pulse-panel {
  padding: 24px;
}

.pulse-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.pulse-stack {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(19, 34, 56, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.58)),
    radial-gradient(circle at top left, rgba(221, 107, 32, 0.08), transparent 48%);
}

.pulse-intro {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 700;
}

.event-studio-card {
  position: sticky;
  top: 94px;
  background:
    linear-gradient(180deg, rgba(255, 251, 246, 0.94), rgba(255, 255, 255, 0.78)),
    radial-gradient(circle at top right, rgba(221, 107, 32, 0.12), transparent 34%);
}

.event-studio-form {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.event-studio-grid {
  display: grid;
  gap: 16px;
}

.studio-state-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.studio-state-pill[data-mode="edit"] {
  background: rgba(221, 107, 32, 0.14);
  color: #c05f1d;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.panel-heading-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.panel-icon {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.2);
  flex-shrink: 0;
}

.panel-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.panel-header.tight {
  margin-bottom: 14px;
}

.hero-assistant {
  margin-bottom: 20px;
}

.assistant-busy {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(221, 107, 32, 0.12);
  color: var(--accent);
  font-weight: 700;
}

.assistant-main,
.assistant-sidebar {
  min-width: 0;
}

.assistant-sidebar {
  display: grid;
  gap: 24px;
}

.assistant-chat {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 420px;
  max-height: 62vh;
  overflow-y: auto;
  padding-right: 4px;
}

.assistant-message {
  width: min(85%, 720px);
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 28px rgba(13, 24, 43, 0.08);
}

.assistant-message[data-role="user"] {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(221, 107, 32, 0.18), rgba(15, 118, 110, 0.12));
}

.assistant-message[data-role="assistant"] {
  align-self: flex-start;
}

.assistant-message-header {
  margin-bottom: 8px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.assistant-message-body {
  white-space: pre-wrap;
  line-height: 1.6;
}

.assistant-message-sources {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.assistant-message-sources-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.assistant-message-source {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(19, 34, 56, 0.05);
}

.assistant-message-source a {
  color: var(--accent-cool);
  text-decoration: none;
  font-weight: 700;
  word-break: break-word;
}

.assistant-message-source span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.assistant-form {
  margin-top: 18px;
  display: grid;
  gap: 16px;
}

.assistant-web-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: flex-start;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid rgba(19, 34, 56, 0.12);
  background: rgba(255, 255, 255, 0.72);
  font-weight: 700;
}

.assistant-web-toggle input {
  width: auto;
  margin: 0;
}

.assistant-prompt-label {
  display: grid;
  gap: 10px;
}

.assistant-form textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(19, 34, 56, 0.12);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.assistant-form input {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(19, 34, 56, 0.12);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.assistant-form-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.assistant-footnote {
  margin: 0;
  max-width: 52ch;
}

.assistant-status-shell {
  display: grid;
  gap: 14px;
}

.assistant-status-pill {
  justify-self: flex-start;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.assistant-status-pill[data-state="ready"] {
  background: rgba(15, 118, 110, 0.14);
  border-color: rgba(15, 118, 110, 0.2);
  color: #0d766d;
}

.assistant-status-pill[data-state="waiting"] {
  background: rgba(221, 107, 32, 0.12);
  border-color: rgba(221, 107, 32, 0.2);
  color: #b55e1d;
}

.assistant-status-pill[data-state="offline"] {
  background: rgba(180, 35, 24, 0.1);
  border-color: rgba(180, 35, 24, 0.16);
  color: var(--danger);
}

.assistant-status-list {
  display: grid;
  gap: 10px;
}

.assistant-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.assistant-status-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
}

.assistant-status-row span {
  color: var(--muted);
}

.assistant-help-card p,
.assistant-status-card p {
  margin: 0;
}

.assistant-code-block {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(19, 34, 56, 0.06);
  overflow-x: auto;
}

.assistant-code-block code {
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 0.95rem;
}

.assistant-empty-state {
  display: grid;
  gap: 16px;
}

.assistant-suggestions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.assistant-suggestion {
  white-space: nowrap;
}

.section-top {
  margin-top: 18px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(19, 34, 56, 0.12);
  background: rgba(255, 255, 255, 0.8);
  font-size: 1.2rem;
  color: var(--ink);
}

.member-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.member-chip {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(13, 24, 43, 0.05);
}

.member-chip[data-active="false"] {
  opacity: 0.45;
  background: rgba(255, 255, 255, 0.45);
}

.gallery-sidebar,
.gallery-main {
  min-width: 0;
}

.gallery-search-label {
  display: block;
}

.gallery-search-label input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(19, 34, 56, 0.16);
  background: rgba(255, 255, 255, 0.88);
}

.gallery-search-status {
  min-height: 20px;
  margin-top: 8px;
}

.gallery-private-albums {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(19, 34, 56, 0.05);
  border: 1px solid rgba(31, 41, 55, 0.08);
}

.gallery-private-albums[hidden] {
  display: none;
}

.empty-state-copy {
  margin: 0;
  color: var(--muted);
}

.library-tab,
.folder-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(19, 34, 56, 0.08);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  text-align: left;
  font-weight: 700;
}

.library-tab[data-active="true"],
.folder-link:hover {
  border-color: rgba(221, 107, 32, 0.3);
  background: rgba(255, 248, 238, 0.9);
}

.gallery-main-header {
  align-items: flex-start;
}

.breadcrumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.breadcrumb-button {
  border: none;
  background: rgba(19, 34, 56, 0.08);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 700;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.gallery-pagination {
  margin-top: 20px;
}

.gallery-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(19, 34, 56, 0.08);
  background: rgba(255, 255, 255, 0.68);
}

.gallery-pagination-status {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.gallery-pagination-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.pagination-button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.pagination-step {
  padding: 8px 14px;
}

.pagination-number {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(19, 34, 56, 0.14);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink, #132238);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.pagination-number:hover:not([disabled]) {
  border-color: rgba(15, 118, 110, 0.5);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.pagination-number:focus-visible {
  outline: none;
  border-color: rgba(15, 118, 110, 0.7);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.25);
}

.pagination-number[data-current="true"] {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.95), rgba(6, 78, 73, 0.95));
  border-color: rgba(15, 118, 110, 0.95);
  color: #ffffff;
  cursor: default;
  opacity: 1;
}

.pagination-gap {
  min-width: 20px;
  color: var(--muted);
  font-weight: 700;
  user-select: none;
  padding: 0 2px;
}

html[data-theme="dark"] .pagination-number {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
}

html[data-theme="dark"] .pagination-number:hover:not([disabled]) {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.18);
}

html[data-theme="dark"] .pagination-number[data-current="true"] {
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.9), rgba(20, 184, 166, 0.9));
  border-color: rgba(94, 234, 212, 0.9);
  color: #0f172a;
}

@media (max-width: 600px) {
  .gallery-pagination-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .gallery-pagination-controls {
    width: 100%;
    justify-content: center;
  }

  .pagination-number {
    min-width: 34px;
    height: 34px;
    font-size: 0.9rem;
  }
}

.media-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 20px;
  border: 1px solid rgba(19, 34, 56, 0.1);
  background: rgba(255, 255, 255, 0.82);
}

.media-card-thumb {
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(19, 34, 56, 0.08), rgba(15, 118, 110, 0.08));
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
}

.media-card-thumb img,
.media-card-thumb video,
.media-card-thumb iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
}

.media-placeholder {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

.media-placeholder-video {
  width: 100%;
  height: 100%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(19, 34, 56, 0.88), rgba(15, 118, 110, 0.78)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.22), transparent 50%);
  color: rgba(255, 250, 245, 0.95);
}

.media-placeholder-video strong {
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.media-placeholder-video span {
  font-size: 0.82rem;
}

.media-video-thumb {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(19, 34, 56, 0.88), rgba(15, 118, 110, 0.78)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.22), transparent 50%);
}

.media-video-thumb[data-ready="false"] {
  background:
    linear-gradient(135deg, rgba(19, 34, 56, 0.88), rgba(15, 118, 110, 0.78)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.22), transparent 50%);
}

.media-video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-video-badge,
.media-video-hint {
  position: absolute;
  left: 12px;
  color: rgba(255, 250, 245, 0.96);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.media-video-badge {
  top: 12px;
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(19, 34, 56, 0.72);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.media-video-hint {
  bottom: 12px;
  font-size: 0.82rem;
  font-weight: 700;
}

.media-card-title {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
}

.media-card-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.viewer-modal .modal-form {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.viewer-body {
  margin-top: 16px;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(19, 34, 56, 0.06);
  display: grid;
  justify-items: center;
}

.viewer-body img,
.viewer-body video,
.viewer-body iframe {
  display: block;
  max-width: 100%;
  width: auto;
  max-height: 72vh;
  border: 0;
  background: white;
  object-fit: contain;
}

.viewer-download {
  display: inline-flex;
  margin-top: 14px;
}

.viewer-actions {
  width: 100%;
  display: grid;
  gap: 10px;
  justify-items: start;
  margin-top: 14px;
  padding: 14px 0 2px;
}

.viewer-move-row {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.viewer-move-select {
  min-width: 220px;
}

.viewer-quarantine {
  margin-right: 0;
}

.viewer-action-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.video-quality-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(19, 34, 56, 0.08);
  margin-bottom: 14px;
}

.video-quality-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--ink);
}

.video-quality-select {
  min-width: 120px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(19, 34, 56, 0.14);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

.video-quality-hint {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}

#viewer-meta {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.weekday-row {
  margin-bottom: 10px;
  padding-inline: 2px;
}

.weekday-row div {
  text-align: center;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 700;
}

.calendar-day {
  position: relative;
  min-height: 146px;
  border: 1px solid rgba(19, 34, 56, 0.1);
  border-radius: 22px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.62)),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.08), transparent 42%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  box-shadow: 0 18px 36px rgba(13, 24, 43, 0.06);
}

.calendar-day:hover {
  box-shadow:
    inset 0 0 0 1px rgba(221, 107, 32, 0.3),
    0 24px 42px rgba(13, 24, 43, 0.1);
}

.calendar-day.other-month {
  opacity: 0.58;
}

.calendar-day.selected {
  border-color: rgba(221, 107, 32, 0.55);
  box-shadow:
    inset 0 0 0 1px rgba(221, 107, 32, 0.28),
    0 26px 48px rgba(221, 107, 32, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 245, 235, 0.94), rgba(255, 255, 255, 0.88)),
    radial-gradient(circle at top right, rgba(221, 107, 32, 0.16), transparent 42%);
}

.calendar-day.today .day-number {
  background: var(--accent);
  color: white;
}

.calendar-day::after {
  content: "";
  position: absolute;
  inset: auto 12px 10px auto;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.08), transparent 72%);
  pointer-events: none;
}

.day-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.day-number {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-weight: 700;
}

.event-pill,
.event-card,
.member-card,
.bulletin-card {
  border-radius: 18px;
  border: 1px solid rgba(19, 34, 56, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.68)),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.06), transparent 46%);
}

.event-pill {
  padding: 8px 11px;
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.35;
  border-left: 4px solid var(--accent);
  box-shadow: 0 10px 20px rgba(13, 24, 43, 0.05);
}

.event-card,
.member-card,
.bulletin-card {
  padding: 14px 16px;
}

.event-card-highlight {
  border-color: rgba(221, 107, 32, 0.45);
  box-shadow: 0 0 0 1px rgba(221, 107, 32, 0.2), 0 22px 40px rgba(221, 107, 32, 0.12);
}

.event-card h3,
.member-card h3,
.bulletin-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-family: inherit;
}

.event-card-meta,
.member-card p,
.bulletin-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.bulletin-card {
  border-left: 4px solid var(--accent-cool);
}

.bulletin-card[data-tone="Alert"] {
  border-left-color: #dc2626;
}

.bulletin-card[data-tone="Reminder"] {
  border-left-color: #ca8a04;
}

.bulletin-card[data-tone="Heads-up"] {
  border-left-color: #2563eb;
}

.bulletin-card[data-pinned="true"] {
  background: linear-gradient(180deg, rgba(255, 248, 238, 0.94), rgba(255, 255, 255, 0.82));
}

.bulletin-topline,
.bulletin-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.bulletin-topline {
  margin-bottom: 6px;
}

.bulletin-meta {
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.bulletin-tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bulletin-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(19, 34, 56, 0.08);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
}

.bulletin-tag.pinned {
  background: rgba(221, 107, 32, 0.14);
}

.bulletin-message {
  white-space: pre-wrap;
}

.stack {
  display: grid;
  gap: 12px;
}

.event-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.link-button {
  border: none;
  padding: 0;
  background: none;
  color: var(--accent-cool);
  font-weight: 700;
}

.member-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-right: 8px;
}

.modal {
  border: none;
  border-radius: 28px;
  padding: 0;
  width: min(620px, calc(100vw - 20px));
  max-width: calc(100vw - 20px);
  background: transparent;
}

.viewer-modal {
  width: min(960px, calc(100vw - 20px));
  max-width: calc(100vw - 20px);
}

.modal::backdrop {
  background: rgba(5, 16, 31, 0.45);
  backdrop-filter: blur(4px);
}

.modal-form {
  padding: 24px;
  border-radius: 28px;
  background: var(--paper-strong);
  border: 1px solid rgba(19, 34, 56, 0.08);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-form label,
.modal-form fieldset {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--ink);
  font-weight: 700;
}

.modal-form input,
.modal-form select,
.modal-form textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(19, 34, 56, 0.16);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.modal-form textarea {
  resize: vertical;
}

.split-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.checkbox-field {
  display: flex;
  grid-auto-flow: column;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
}

.checkbox-field input {
  width: auto;
}

fieldset {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(19, 34, 56, 0.12);
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-weight: 600;
}

.checkbox-grid input {
  width: auto;
}

.notification-fieldset {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(19, 34, 56, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.6)),
    radial-gradient(circle at top right, rgba(221, 107, 32, 0.08), transparent 42%);
}

.notification-fieldset .meta-label {
  margin: 0 0 8px;
}

#event-annoy-interval-wrap {
  display: grid;
  gap: 8px;
}

#event-ai-use-web-wrap {
  display: grid;
  gap: 8px;
}

html[data-mobile-app="true"] .page-shell {
  width: min(100% - 12px, 100%);
  padding-top: 12px;
  padding-bottom: 24px;
}

html[data-mobile-app="true"] .site-nav {
  position: sticky;
  top: 10px;
  z-index: 20;
  margin-bottom: 14px;
  align-items: stretch;
  flex-direction: column;
}

html[data-mobile-app="true"] .hero {
  gap: 14px;
  margin-bottom: 14px;
}

html[data-mobile-app="true"] .hero-copy,
html[data-mobile-app="true"] .hero-meta,
html[data-mobile-app="true"] .calendar-panel,
html[data-mobile-app="true"] .card {
  border-radius: 22px;
}

html[data-mobile-app="true"] .hero-copy {
  padding: 24px;
}

html[data-mobile-app="true"] .hero h1 {
  font-size: clamp(2.1rem, 8vw, 3.25rem);
}

html[data-mobile-app="true"] .hero-text {
  width: 100%;
  font-size: 0.98rem;
}

html[data-mobile-app="true"] .layout,
html[data-mobile-app="true"] .gallery-layout,
html[data-mobile-app="true"] .assistant-layout,
html[data-mobile-app="true"] .account-layout {
  grid-template-columns: 1fr;
  gap: 14px;
}

html[data-mobile-app="true"] .nav-brand {
  align-self: flex-start;
}

html[data-mobile-app="true"] .nav-tools {
  width: 100%;
  display: grid;
  gap: 12px;
}

html[data-mobile-app="true"] .nav-actions {
  width: 100%;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

html[data-mobile-app="true"] .nav-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

html[data-mobile-app="true"] .nav-link {
  min-width: 0;
  width: 100%;
  white-space: nowrap;
}

html[data-mobile-app="true"] .theme-toggle {
  width: 100%;
  justify-content: space-between;
  grid-column: 1 / -1;
}

.form-error,
.empty-state p {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
}

.form-success {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(15, 118, 110, 0.1);
  color: #0f766e;
}

.empty-state p {
  background: rgba(19, 34, 56, 0.05);
  color: var(--muted);
}

html[data-theme="dark"] .nav-link,
html[data-theme="dark"] .button-secondary,
html[data-theme="dark"] .nav-icon-button,
html[data-theme="dark"] .nav-avatar-button,
html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .library-tab,
html[data-theme="dark"] .folder-link,
html[data-theme="dark"] .member-chip,
html[data-theme="dark"] .gallery-search-label input,
html[data-theme="dark"] .media-card,
html[data-theme="dark"] .gallery-pagination-bar,
html[data-theme="dark"] .event-card,
html[data-theme="dark"] .member-card,
html[data-theme="dark"] .bulletin-card,
html[data-theme="dark"] .assistant-message,
html[data-theme="dark"] .assistant-status-row,
html[data-theme="dark"] .assistant-form input,
html[data-theme="dark"] .assistant-form textarea,
html[data-theme="dark"] .assistant-code-block,
html[data-theme="dark"] .assistant-web-toggle,
html[data-theme="dark"] .assistant-message-source,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .avatar-image-option,
html[data-theme="dark"] .notification-card,
html[data-theme="dark"] .modal-form input,
html[data-theme="dark"] .modal-form select,
html[data-theme="dark"] .modal-form textarea,
html[data-theme="dark"] .video-quality-bar,
html[data-theme="dark"] .video-quality-select,
html[data-theme="dark"] fieldset,
html[data-theme="dark"] .bulletin-tag,
html[data-theme="dark"] .breadcrumb-button {
  background: rgba(18, 31, 53, 0.9);
  border-color: rgba(158, 174, 201, 0.16);
  color: var(--ink);
}

html[data-theme="dark"] .button-secondary,
html[data-theme="dark"] .nav-link,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .gallery-search-label input,
html[data-theme="dark"] .assistant-form input,
html[data-theme="dark"] .modal-form input,
html[data-theme="dark"] .modal-form select,
html[data-theme="dark"] .modal-form textarea,
html[data-theme="dark"] .assistant-form textarea,
html[data-theme="dark"] .video-quality-select {
  box-shadow: none;
}

html[data-theme="dark"] .nav-link.is-active,
html[data-theme="dark"] .nav-icon-button.is-active,
html[data-theme="dark"] .nav-avatar-button.is-active,
html[data-theme="dark"] .nav-login-link.is-active,
html[data-theme="dark"] .library-tab[data-active="true"],
html[data-theme="dark"] .folder-link:hover {
  background: linear-gradient(135deg, rgba(240, 138, 67, 0.18), rgba(44, 195, 179, 0.14));
  border-color: rgba(240, 138, 67, 0.3);
}

html[data-theme="dark"] .button-primary {
  box-shadow: 0 14px 30px rgba(240, 138, 67, 0.2);
}

html[data-theme="dark"] .calendar-day,
html[data-theme="dark"] .gallery-pagination-bar,
html[data-theme="dark"] .empty-state p {
  border-color: rgba(158, 174, 201, 0.14);
}

html[data-theme="dark"] .calendar-day,
html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .event-card,
html[data-theme="dark"] .member-card,
html[data-theme="dark"] .bulletin-card {
  background: rgba(15, 27, 47, 0.86);
}

html[data-theme="dark"] .calendar-ribbon,
html[data-theme="dark"] .pulse-stack,
html[data-theme="dark"] .event-studio-card,
html[data-theme="dark"] .notification-fieldset {
  background:
    linear-gradient(180deg, rgba(18, 32, 56, 0.92), rgba(13, 23, 41, 0.8)),
    radial-gradient(circle at top right, rgba(44, 195, 179, 0.1), transparent 44%);
}

html[data-theme="dark"] .calendar-day.today,
html[data-theme="dark"] .bulletin-card[data-pinned="true"] {
  background: linear-gradient(180deg, rgba(34, 55, 88, 0.95), rgba(15, 27, 47, 0.88));
}

html[data-theme="dark"] .event-pill {
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .modal::backdrop {
  background: rgba(1, 8, 18, 0.68);
}

html[data-theme="dark"] .modal-form,
html[data-theme="dark"] .hero-copy,
html[data-theme="dark"] .card {
  background: var(--paper);
}

html[data-theme="dark"] .hero-copy::after,
html[data-theme="dark"] .card::after {
  background: radial-gradient(circle, rgba(240, 138, 67, 0.14) 0%, transparent 70%);
}

html[data-theme="dark"] .media-card-thumb,
html[data-theme="dark"] .viewer-body {
  background: linear-gradient(135deg, rgba(17, 28, 46, 0.92), rgba(24, 44, 67, 0.92));
}

html[data-theme="dark"] .assistant-message[data-role="user"] {
  background: linear-gradient(135deg, rgba(240, 138, 67, 0.18), rgba(44, 195, 179, 0.14));
}

html[data-theme="dark"] .assistant-busy,
html[data-theme="dark"] .assistant-status-pill[data-state="waiting"] {
  background: rgba(240, 138, 67, 0.14);
  color: #ffbe8d;
}

html[data-theme="dark"] .assistant-status-pill[data-state="ready"] {
  background: rgba(44, 195, 179, 0.14);
  color: #85ece0;
}

html[data-theme="dark"] .assistant-status-pill[data-state="offline"] {
  background: rgba(255, 118, 108, 0.12);
}

html[data-theme="dark"] .notification-pill {
  background: rgba(44, 195, 179, 0.12);
  color: #7fe0d4;
}

html[data-theme="dark"] .studio-state-pill {
  color: #74e4d6;
  background: rgba(44, 195, 179, 0.12);
}

html[data-theme="dark"] .studio-state-pill[data-mode="edit"] {
  color: #ffb67e;
  background: rgba(240, 138, 67, 0.18);
}

html[data-theme="dark"] .viewer-body img,
html[data-theme="dark"] .viewer-body video,
html[data-theme="dark"] .viewer-body iframe {
  background: rgba(7, 14, 25, 0.96);
}

html[data-theme="dark"] .form-error {
  background: rgba(255, 118, 108, 0.12);
}

html[data-theme="dark"] .empty-state p {
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .gallery-private-albums {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(158, 174, 201, 0.14);
}

html[data-theme="dark"] .link-button {
  color: #7fe0d4;
}

@media (max-width: 1080px) {
  .hero,
  .layout,
  .gallery-layout,
  .assistant-layout,
  .account-layout {
    grid-template-columns: 1fr;
  }

  .avatar-picker-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 18px, 100%);
    padding-top: 16px;
  }

  .hero-copy,
  .calendar-panel,
  .card,
  .modal-form {
    padding: 18px;
  }

  .summary-cards,
  .split-fields {
    grid-template-columns: 1fr;
  }

  .visibility-row {
    grid-template-columns: 1fr;
  }

  .admin-source-toggle {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-source-toggle-control {
    width: 100%;
    justify-content: space-between;
  }

  .site-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .nav-brand {
    align-self: flex-start;
  }

  .nav-tools {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .nav-links {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .nav-link {
    min-width: 0;
    width: 100%;
    padding: 10px 6px;
    text-align: center;
    font-size: 0.92rem;
    white-space: nowrap;
  }

  .nav-actions {
    width: 100%;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 10px;
    align-items: center;
  }

  .nav-actions .theme-toggle {
    width: 100%;
    justify-content: space-between;
    grid-column: 1 / -1;
  }

  .calendar-grid {
    gap: 8px;
  }

  .pulse-grid {
    grid-template-columns: 1fr;
  }

  .calendar-day {
    min-height: 110px;
    padding: 10px;
  }

  .event-studio-card {
    position: static;
  }

  .video-quality-bar,
  .video-quality-label {
    flex-direction: column;
    align-items: flex-start;
  }

  .assistant-form-actions,
  .assistant-status-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .assistant-message {
    width: 100%;
  }

  .video-quality-hint {
    text-align: left;
  }

  html[data-mobile-app="true"] .site-nav {
    justify-content: flex-start;
  }

  html[data-mobile-app="true"] .nav-tools {
    width: 100%;
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

/* ==========================================================================
   Hearthboard - Immersive Ambient Layer (appended)
   --------------------------------------------------------------------------
   Extends the existing theme with a cozy-hearth + aurora look: animated
   backgrounds, ember particles (JS canvas via effects.js), gradient glass
   cards, shimmer accents, parallax tilt, reveal-on-scroll, and polished
   micro-interactions across navigation and forms. All original layout
   rules above this section continue to apply.
   ========================================================================== */

:root {
  --ember: #ff8f3d;
  --ember-soft: rgba(255, 143, 61, 0.24);
  --ember-glow: rgba(255, 168, 92, 0.42);
  --aurora-cool: #5ee3d2;
  --aurora-violet: #b487ff;
  --cozy-paper: rgba(255, 247, 235, 0.86);
  --cozy-ink: #2a1807;
  --card-glow-x: 50%;
  --card-glow-y: 50%;
  --card-tilt-x: 0deg;
  --card-tilt-y: 0deg;
}

html[data-theme="dark"] {
  --cozy-paper: rgba(18, 24, 44, 0.82);
  --cozy-ink: #f9efe1;
  --ember-glow: rgba(255, 180, 120, 0.36);
}

/* ---------- animated fireplace body background ---------- */

body {
  position: relative;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(255, 186, 120, 0.38), transparent 55%),
    radial-gradient(900px 700px at 90% 0%, rgba(94, 227, 210, 0.22), transparent 60%),
    radial-gradient(1100px 900px at 50% 120%, rgba(180, 135, 255, 0.18), transparent 65%),
    linear-gradient(165deg, #f7ecd9 0%, #f6efe2 35%, #eff5f1 75%, #f9efe1 100%);
  animation: hearthBodyShift 28s ease-in-out infinite alternate;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(255, 138, 67, 0.35), transparent 55%),
    radial-gradient(900px 700px at 90% 0%, rgba(44, 195, 179, 0.22), transparent 60%),
    radial-gradient(1100px 900px at 50% 120%, rgba(139, 92, 246, 0.22), transparent 65%),
    linear-gradient(180deg, #050914 0%, #0b1322 40%, #0a1428 75%, #05070f 100%);
  animation: hearthBodyShift 34s ease-in-out infinite alternate;
}

@keyframes hearthBodyShift {
  0%   { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
  50%  { background-position: 6% -4%, -8% 4%, 2% -6%, 0% 0%; }
  100% { background-position: -4% 4%, 6% -2%, -4% 6%, 0% 0%; }
}

/* ---------- ambient canvas container positioning ---------- */

.hearthboard-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  isolation: isolate;
}

body.has-hearthboard-ambient {
  overflow-x: hidden;
}

body.has-hearthboard-ambient > *:not(.hearthboard-ambient) {
  position: relative;
  z-index: 1;
}

.hearthboard-ambient-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: screen;
  opacity: 0.9;
}

html[data-theme="dark"] .hearthboard-ambient-canvas {
  opacity: 1;
  mix-blend-mode: lighter;
}

.hearthboard-ambient-aurora {
  position: absolute;
  inset: -15%;
  filter: blur(40px) saturate(1.16);
  opacity: 0.64;
  will-change: transform, opacity;
  transform: translateZ(0);
}

.hearthboard-aurora-ribbon {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 220px at 30% 20%, var(--ember-glow), transparent 60%),
    radial-gradient(620px 260px at 70% 10%, rgba(94, 227, 210, 0.28), transparent 65%),
    radial-gradient(480px 220px at 50% 30%, rgba(180, 135, 255, 0.22), transparent 60%);
  animation: hearthAurora 24s ease-in-out infinite alternate;
  opacity: 0.85;
}

.hearthboard-aurora-ribbon-2 {
  animation-duration: 31s;
  transform: scale(1.05) translateY(8%);
  opacity: 0.55;
}

.hearthboard-aurora-ribbon-3 {
  animation-duration: 38s;
  transform: scale(1.12) translateY(-6%);
  opacity: 0.45;
}

html[data-theme="dark"] .hearthboard-ambient-aurora {
  opacity: 0.95;
}

@keyframes hearthAurora {
  0%   { transform: translate3d(-4%, -2%, 0) scale(1.03); }
  50%  { transform: translate3d(5%, 3%, 0) scale(1.08); }
  100% { transform: translate3d(-2%, 4%, 0) scale(1.05); }
}

.hearthboard-ambient-hearth {
  position: absolute;
  left: 50%;
  bottom: -280px;
  width: min(80vw, 960px);
  height: min(80vw, 960px);
  transform: translateX(-50%);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 198, 120, 0.55), transparent 55%),
    radial-gradient(circle at 50% 48%, rgba(255, 112, 36, 0.38), transparent 60%);
  filter: blur(36px);
  animation: hearthBreathe 6.5s ease-in-out infinite;
  will-change: transform, opacity;
}

html[data-theme="dark"] .hearthboard-ambient-hearth {
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 186, 118, 0.32), transparent 60%),
    radial-gradient(circle at 50% 50%, rgba(255, 120, 40, 0.28), transparent 62%);
}

@keyframes hearthBreathe {
  0%, 100% { transform: translateX(-50%) scale(1);    opacity: 0.9; }
  50%      { transform: translateX(-50%) scale(1.06); opacity: 1; }
}

/* ---------- kill the old grid + glow, we are replacing them ---------- */

body::before,
body::after {
  display: none;
}

/* ---------- glass cards with glow + tilt ---------- */

.card {
  position: relative;
  transition: box-shadow 0.4s ease, border-color 0.4s ease;
  overflow: hidden;
  backdrop-filter: blur(16px) saturate(1.03);
  -webkit-backdrop-filter: blur(16px) saturate(1.03);
  background:
    linear-gradient(160deg, rgba(255, 252, 245, 0.86) 0%, rgba(255, 248, 233, 0.72) 100%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 24px 60px rgba(36, 19, 8, 0.14),
    0 0 0 1px rgba(255, 168, 92, 0.05);
  opacity: 1;
}

html[data-theme="dark"] .card {
  background: linear-gradient(160deg, rgba(22, 30, 52, 0.82) 0%, rgba(14, 22, 44, 0.72) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 30px 70px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 168, 92, 0.04);
}

.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  background: radial-gradient(
    320px 320px at var(--card-glow-x) var(--card-glow-y),
    var(--ember-soft),
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  z-index: 0;
}

.card:hover::before,
.card:focus-within::before {
  opacity: 1;
}

.card > * {
  position: relative;
  z-index: 1;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 30%);
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: 0;
  opacity: 0.6;
}

html[data-theme="dark"] .card::after {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 40%);
}

/* reveal-on-scroll: keep cards visible by default but allow JS to add a richer rise */
.card.is-revealed {
  animation: cardRise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes cardRise {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------- headings: gradient ink + ember shimmer ---------- */

h1, .hero h1, .hero-copy h1 {
  background: linear-gradient(120deg, #4a1d00 0%, #b9541a 35%, #dd6b20 60%, #3b2a06 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  letter-spacing: 0.008em;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] .hero h1,
html[data-theme="dark"] .hero-copy h1 {
  background: linear-gradient(120deg, #ffe6c8 0%, #ffb87a 35%, #ff8f3d 65%, #ffe6c8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 2px 12px rgba(255, 143, 61, 0.35));
}

/* ---------- navigation: pill glow + active ember underline ---------- */

.site-nav {
  backdrop-filter: blur(18px) saturate(1.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    0 10px 40px rgba(22, 14, 6, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

html[data-theme="dark"] .site-nav {
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.nav-brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.nav-brand::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff7df, #ff8f3d 45%, #4a1d00 95%);
  box-shadow:
    0 0 14px rgba(255, 143, 61, 0.75),
    0 0 30px rgba(255, 143, 61, 0.45);
  animation: brandFlicker 3.2s ease-in-out infinite;
}

@keyframes brandFlicker {
  0%, 100% {
    box-shadow: 0 0 14px rgba(255, 143, 61, 0.75), 0 0 30px rgba(255, 143, 61, 0.45);
    transform: scale(1);
  }
  45% {
    box-shadow: 0 0 18px rgba(255, 180, 100, 0.95), 0 0 40px rgba(255, 143, 61, 0.7);
    transform: scale(1.08);
  }
  70% {
    box-shadow: 0 0 10px rgba(255, 110, 40, 0.7), 0 0 20px rgba(255, 110, 40, 0.4);
    transform: scale(0.97);
  }
}

.nav-link {
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, color 0.25s ease, background 0.25s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--ember), transparent);
  opacity: 0;
  transform: scaleX(0.4);
  transform-origin: center;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.nav-link:hover {
  box-shadow: 0 8px 24px rgba(221, 107, 32, 0.22);
  background: rgba(255, 255, 255, 0.35);
}

html[data-theme="dark"] .nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-link:hover::after,
.nav-link.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.nav-link.is-active {
  box-shadow: 0 8px 24px rgba(221, 107, 32, 0.28);
}

.nav-icon-button,
.nav-avatar-button {
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.nav-icon-button:hover,
.nav-avatar-button:hover {
  box-shadow:
    0 0 0 2px rgba(221, 107, 32, 0.35),
    0 12px 28px rgba(221, 107, 32, 0.25);
  filter: brightness(1.05);
}

/* ---------- buttons: glowing primary + soft ripple ---------- */

.button {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.25s ease, filter 0.25s ease;
}

.button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(140px 80px at 50% 50%, rgba(255, 255, 255, 0.35), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.button:hover::before {
  opacity: 1;
}

.button:hover {
  filter: brightness(1.04);
}

.button:active {
  filter: brightness(0.96);
}

.button-primary {
  background: linear-gradient(135deg, #ff8f3d 0%, #dd6b20 45%, #b9541a 100%);
  color: #fff;
  box-shadow:
    0 10px 28px rgba(221, 107, 32, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.button-primary:hover {
  filter: brightness(1.05) saturate(1.1);
  box-shadow:
    0 14px 34px rgba(221, 107, 32, 0.55),
    0 0 0 1px rgba(255, 143, 61, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

html[data-theme="dark"] .button-primary {
  box-shadow:
    0 14px 32px rgba(255, 143, 61, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(221, 107, 32, 0.25);
}

html[data-theme="dark"] .button-secondary {
  background: rgba(22, 30, 52, 0.7);
  border: 1px solid rgba(255, 143, 61, 0.28);
  color: var(--ink);
}

/* ---------- hero: aurora wash + parallax-ready ---------- */

.hero,
.hero-account {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(320px 220px at 85% -10%, rgba(255, 168, 92, 0.42), transparent 70%),
    radial-gradient(460px 320px at -10% 120%, rgba(94, 227, 210, 0.28), transparent 70%),
    linear-gradient(160deg, rgba(255, 250, 240, 0.78), rgba(255, 240, 220, 0.6));
  backdrop-filter: blur(26px) saturate(1.08);
  -webkit-backdrop-filter: blur(26px) saturate(1.08);
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 30px 70px rgba(22, 14, 6, 0.14);
  isolation: isolate;
}

.hero::after,
.hero-account::after {
  content: "";
  position: absolute;
  inset: auto -10% -50% -10%;
  height: 180px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 143, 61, 0.24), transparent 70%),
    radial-gradient(circle at 80% 10%, rgba(94, 227, 210, 0.16), transparent 70%);
  filter: blur(28px);
  z-index: -1;
  opacity: 0.75;
  animation: heroShimmer 11s ease-in-out infinite alternate;
  will-change: transform, opacity;
}

@keyframes heroShimmer {
  0% { transform: translateY(0); opacity: 0.6; }
  100% { transform: translateY(-40px); opacity: 0.9; }
}

html[data-theme="dark"] .hero,
html[data-theme="dark"] .hero-account {
  background:
    radial-gradient(320px 220px at 85% -10%, rgba(255, 168, 92, 0.26), transparent 70%),
    radial-gradient(460px 320px at -10% 120%, rgba(44, 195, 179, 0.22), transparent 70%),
    linear-gradient(160deg, rgba(20, 28, 50, 0.82), rgba(12, 20, 40, 0.75));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 40px 80px rgba(0, 0, 0, 0.5);
}

/* ---------- calendar cells ---------- */

.calendar-cell {
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.calendar-cell:hover {
  box-shadow:
    inset 0 0 0 1px rgba(221, 107, 32, 0.35),
    0 16px 30px rgba(221, 107, 32, 0.18);
}

.calendar-cell.is-today {
  animation: pulseToday 3s ease-in-out infinite;
  box-shadow:
    0 0 0 1px rgba(221, 107, 32, 0.45),
    0 20px 40px rgba(221, 107, 32, 0.25);
}

@keyframes pulseToday {
  0%, 100% { box-shadow: 0 0 0 1px rgba(221, 107, 32, 0.45), 0 20px 40px rgba(221, 107, 32, 0.25); }
  50%      { box-shadow: 0 0 0 2px rgba(255, 143, 61, 0.65), 0 24px 50px rgba(255, 143, 61, 0.35); }
}

/* ---------- summary cards ---------- */

.summary-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.summary-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent 40%);
  pointer-events: none;
  mix-blend-mode: overlay;
}

.summary-card:hover {
  box-shadow:
    inset 0 0 0 1px rgba(221, 107, 32, 0.4),
    0 14px 30px rgba(221, 107, 32, 0.22);
}

.summary-card strong {
  background: linear-gradient(135deg, #ff8f3d, #dd6b20);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ---------- forms: focus glow + label ember ---------- */

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

input:not([type="checkbox"]):not([type="radio"]):focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: rgba(221, 107, 32, 0.75);
  box-shadow:
    0 0 0 4px rgba(221, 107, 32, 0.18),
    0 10px 24px rgba(221, 107, 32, 0.12);
  background: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):focus-visible,
html[data-theme="dark"] select:focus-visible,
html[data-theme="dark"] textarea:focus-visible {
  background: rgba(22, 30, 52, 0.92);
  box-shadow:
    0 0 0 4px rgba(255, 143, 61, 0.22),
    0 10px 24px rgba(0, 0, 0, 0.45);
}

label:focus-within {
  color: var(--ember);
}

/* ---------- annoyance level meter (paired with the bug fix) ---------- */

.annoy-level-field {
  display: grid;
  gap: 12px;
  padding: 14px 16px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(221, 107, 32, 0.06), rgba(15, 118, 110, 0.04));
  border: 1px solid rgba(221, 107, 32, 0.15);
  --annoy-level: 5;
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
}

html[data-theme="dark"] .annoy-level-field {
  background: linear-gradient(180deg, rgba(255, 143, 61, 0.09), rgba(44, 195, 179, 0.06));
  border-color: rgba(255, 143, 61, 0.25);
}

.annoy-level-field[data-hidden="true"] {
  display: none !important;
}

.annoy-level-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.annoy-level-title {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.annoy-level-value {
  font-family: "Palatino Linotype", "Book Antiqua", serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ember, #dd6b20);
  text-shadow: 0 0 12px rgba(255, 143, 61, 0.35);
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.annoy-level-value-unit {
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: 2px;
  font-weight: 500;
  text-shadow: none;
}

.annoy-level-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

.annoy-level-picker {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
}

.annoy-level-pill {
  position: relative;
  appearance: none;
  border: 1px solid rgba(221, 107, 32, 0.25);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  font-weight: 700;
  font-family: inherit;
  padding: 10px 0;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.25s ease, color 0.25s ease,
    border-color 0.25s ease, box-shadow 0.25s ease;
  touch-action: manipulation;
}

html[data-theme="dark"] .annoy-level-pill {
  background: rgba(22, 30, 52, 0.65);
  border-color: rgba(255, 143, 61, 0.3);
  color: var(--ink);
}

.annoy-level-pill:hover:not(:disabled) {
  border-color: rgba(221, 107, 32, 0.65);
  box-shadow:
    inset 0 0 0 1px rgba(221, 107, 32, 0.35),
    0 6px 18px rgba(221, 107, 32, 0.2);
  filter: brightness(1.05);
}

.annoy-level-pill:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(221, 107, 32, 0.35), 0 6px 18px rgba(221, 107, 32, 0.2);
}

.annoy-level-pill[data-scale="on"] {
  background: linear-gradient(180deg, rgba(255, 198, 120, 0.9), rgba(221, 107, 32, 0.8));
  border-color: rgba(221, 107, 32, 0.6);
  color: #fff;
  box-shadow: 0 6px 16px rgba(221, 107, 32, 0.35);
}

html[data-theme="dark"] .annoy-level-pill[data-scale="on"] {
  background: linear-gradient(180deg, rgba(255, 186, 118, 0.92), rgba(255, 112, 36, 0.85));
  color: #1a0e05;
}

.annoy-level-pill[data-active="true"] {
  box-shadow:
    0 0 0 3px rgba(255, 143, 61, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.45),
    0 10px 24px rgba(221, 107, 32, 0.45);
  z-index: 2;
  filter: brightness(1.08);
}

.annoy-level-pill:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Pills on the right ramp up the heat */
.annoy-level-pill[data-level="8"][data-scale="on"],
.annoy-level-pill[data-level="9"][data-scale="on"],
.annoy-level-pill[data-level="10"][data-scale="on"] {
  background: linear-gradient(180deg, #fb923c, #ef4444);
  border-color: rgba(239, 68, 68, 0.7);
  box-shadow: 0 8px 22px rgba(239, 68, 68, 0.45);
}

.annoy-level-meter {
  position: relative;
  display: block;
  height: 10px;
  border-radius: 999px;
  background: rgba(221, 107, 32, 0.12);
  overflow: hidden;
}

.annoy-level-meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--annoy-level, 5) * 10%);
  background: linear-gradient(
    90deg,
    #4ade80 0%,
    #facc15 35%,
    #fb923c 65%,
    #ef4444 100%
  );
  transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1.1);
  box-shadow: 0 0 14px rgba(255, 143, 61, 0.5);
}

.annoy-level-meter-ticks {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  pointer-events: none;
}

.annoy-level-meter-ticks i {
  border-right: 1px solid rgba(255, 255, 255, 0.35);
}

.annoy-level-meter-ticks i:last-child {
  border-right: none;
}

.annoy-level-field[data-annoy-on="0"] .annoy-level-meter-fill {
  filter: grayscale(0.3) brightness(0.9);
}

.annoy-level-field[data-level="10"] .annoy-level-meter-fill {
  animation: annoyGlow 1.6s ease-in-out infinite alternate;
}

.annoy-level-field[data-level="10"] .annoy-level-value {
  animation: annoyValueGlow 1.6s ease-in-out infinite alternate;
  color: #ef4444;
}

@keyframes annoyGlow {
  from { box-shadow: 0 0 10px rgba(239, 68, 68, 0.35); filter: saturate(1); }
  to   { box-shadow: 0 0 22px rgba(239, 68, 68, 0.7);  filter: saturate(1.15); }
}

@keyframes annoyValueGlow {
  from { text-shadow: 0 0 10px rgba(239, 68, 68, 0.4); }
  to   { text-shadow: 0 0 22px rgba(239, 68, 68, 0.8), 0 0 40px rgba(239, 68, 68, 0.35); }
}

/* ---------- theme toggle polish ---------- */

.theme-toggle-track {
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.theme-toggle-input:checked + .theme-toggle-track {
  background: linear-gradient(135deg, #1a2948, #0d1527);
  box-shadow:
    inset 0 0 12px rgba(255, 143, 61, 0.25),
    0 0 12px rgba(68, 132, 255, 0.35);
}

/* ---------- gallery tiles (defensive selectors that no-op when absent) ---------- */

.media-grid img,
.gallery-grid img,
.gallery-tile img,
[class*="media-tile"] img {
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1.1), filter 0.4s ease;
}

.media-grid a:hover img,
.gallery-grid a:hover img,
.gallery-tile:hover img,
[class*="media-tile"]:hover img {
  transform: scale(1.04);
  filter: brightness(1.06) saturate(1.08);
}

/* ---------- modals: entrance animation ---------- */

.modal[open] {
  animation: modalIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1.1) both;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 30px 80px rgba(22, 14, 6, 0.25);
  backdrop-filter: blur(26px) saturate(1.15);
  -webkit-backdrop-filter: blur(26px) saturate(1.15);
  background: var(--cozy-paper);
}

html[data-theme="dark"] .modal[open] {
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 40px 100px rgba(0, 0, 0, 0.6);
}

.modal::backdrop {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: radial-gradient(circle at center, rgba(36, 19, 8, 0.35), rgba(8, 4, 2, 0.75));
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ---------- scrollbar + link polish ---------- */

::selection {
  background: rgba(221, 107, 32, 0.35);
  color: inherit;
}

a {
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

a:hover {
  text-shadow: 0 0 12px rgba(221, 107, 32, 0.45);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(221, 107, 32, 0.65), rgba(94, 227, 210, 0.45));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255, 143, 61, 0.55), rgba(44, 195, 179, 0.35));
  background-clip: padding-box;
}

/* Reduce heavy backdrop-filter on small screens for snappier rendering */
@media (max-width: 480px) {
  .card,
  .site-nav,
  .hero,
  .hero-account,
  .modal[open] {
    backdrop-filter: blur(14px) saturate(1);
    -webkit-backdrop-filter: blur(14px) saturate(1);
  }
}

/* =================================================================== */
/*  Account page v2 — roomier layout, upload-only portrait, more glow  */
/* =================================================================== */

.account-layout.account-layout-v2 {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  grid-template-areas:
    "portrait profile"
    "portrait password"
    "admin    admin";
  gap: 22px;
  align-items: start;
}

.account-layout.account-layout-v2 .account-panel-portrait  { grid-area: portrait; }
.account-layout.account-layout-v2 .account-panel-profile   { grid-area: profile; }
.account-layout.account-layout-v2 .account-panel-password  { grid-area: password; }
.account-layout.account-layout-v2 .account-panel-admin     { grid-area: admin; }

@media (max-width: 820px) {
  .account-layout.account-layout-v2 {
    grid-template-columns: 1fr;
    grid-template-areas:
      "portrait"
      "profile"
      "password"
      "admin";
  }
}

.account-panel-portrait {
  position: sticky;
  top: 92px;
  align-self: start;
  overflow: hidden;
}

.account-panel-portrait::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(480px 320px at 20% 10%, rgba(255, 143, 61, 0.2), transparent 60%),
    radial-gradient(420px 320px at 80% 90%, rgba(94, 227, 210, 0.18), transparent 60%);
  filter: blur(30px);
  z-index: 0;
  pointer-events: none;
  animation: portraitSheen 14s ease-in-out infinite alternate;
}

@keyframes portraitSheen {
  0%   { transform: translate3d(-2%, -2%, 0) scale(1.02); opacity: 0.85; }
  100% { transform: translate3d(3%, 3%, 0) scale(1.08);  opacity: 1;    }
}

.account-panel-portrait > * {
  position: relative;
  z-index: 1;
}

.portrait-uploader {
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
}

.portrait-preview {
  width: 176px;
  height: 176px;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 198, 120, 0.55), rgba(221, 107, 32, 0.14) 60%),
    linear-gradient(135deg, rgba(221, 107, 32, 0.18), rgba(15, 118, 110, 0.14));
  border: 2px solid rgba(221, 107, 32, 0.35);
  box-shadow:
    0 20px 52px rgba(221, 107, 32, 0.28),
    inset 0 0 30px rgba(255, 255, 255, 0.18);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
}

html[data-theme="dark"] .portrait-preview {
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 186, 118, 0.35), rgba(255, 112, 36, 0.08) 60%),
    linear-gradient(135deg, rgba(255, 143, 61, 0.22), rgba(44, 195, 179, 0.14));
  border-color: rgba(255, 143, 61, 0.45);
  box-shadow:
    0 22px 56px rgba(0, 0, 0, 0.5),
    inset 0 0 30px rgba(255, 255, 255, 0.08);
}

.portrait-preview:hover {
  border-color: rgba(221, 107, 32, 0.7);
  box-shadow:
    0 0 0 4px rgba(221, 107, 32, 0.2),
    0 26px 60px rgba(221, 107, 32, 0.42),
    inset 0 0 30px rgba(255, 255, 255, 0.22);
}

.portrait-preview #avatar-preview-fallback {
  font-family: "Palatino Linotype", "Book Antiqua", serif;
  font-size: 4rem;
  font-weight: 800;
  color: var(--ember, #dd6b20);
  text-shadow: 0 4px 20px rgba(221, 107, 32, 0.4);
}

.portrait-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portrait-preview-ring {
  position: absolute;
  inset: -6px;
  border-radius: 999px;
  pointer-events: none;
  background: conic-gradient(
    from 0deg,
    rgba(221, 107, 32, 0.55),
    rgba(255, 198, 120, 0.2),
    rgba(94, 227, 210, 0.45),
    rgba(221, 107, 32, 0.55)
  );
  filter: blur(14px);
  opacity: 0.6;
  animation: portraitRingSpin 18s linear infinite;
}

@keyframes portraitRingSpin {
  to { transform: rotate(360deg); }
}

.portrait-preview.is-drop-target {
  border-color: rgba(94, 227, 210, 0.85);
  box-shadow:
    0 0 0 6px rgba(94, 227, 210, 0.35),
    0 24px 56px rgba(94, 227, 210, 0.35),
    inset 0 0 40px rgba(94, 227, 210, 0.25);
}

.portrait-preview.is-uploading::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.32) 70%);
  animation: portraitPulse 1.1s ease-in-out infinite;
}

@keyframes portraitPulse {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 0.45; }
}

.portrait-caption {
  margin: 0;
  max-width: 34ch;
  line-height: 1.45;
}

.portrait-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.portrait-status {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

/* Account hero spacing tightening + eyebrow polish */
.hero-account .summary-cards {
  gap: 10px;
}

.hero-account .summary-card {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(221, 107, 32, 0.18);
  backdrop-filter: blur(10px) saturate(1.05);
  -webkit-backdrop-filter: blur(10px) saturate(1.05);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

html[data-theme="dark"] .hero-account .summary-card {
  background: rgba(22, 30, 52, 0.6);
  border-color: rgba(255, 143, 61, 0.22);
}

.hero-account .summary-card:hover {
  border-color: rgba(221, 107, 32, 0.55);
  box-shadow:
    inset 0 0 0 1px rgba(221, 107, 32, 0.25),
    0 10px 24px rgba(221, 107, 32, 0.18);
}

.hero-account .eyebrow {
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--ember, #dd6b20);
  text-shadow: 0 0 10px rgba(221, 107, 32, 0.3);
}

/* ================ */
/*  Extra immersion  */
/* ================ */

/* Cards glow more on hover — no positional motion so hit targets stay put */
.card {
  transition: box-shadow 0.35s ease, border-color 0.3s ease;
}

.card:hover {
  border-color: rgba(221, 107, 32, 0.3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 18px 40px rgba(22, 14, 6, 0.14),
    0 0 0 1px rgba(221, 107, 32, 0.12);
}

html[data-theme="dark"] .card:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 22px 50px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 143, 61, 0.22);
}

/* Buttons get a shimmer on hover */
.button.button-primary {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.button.button-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
  pointer-events: none;
}

.button.button-primary:hover::after {
  transform: translateX(120%);
}

/* Navigation link "flame" underline intensifies on active */
.nav-link.is-active::after,
.site-nav [data-active-page="account"] .nav-link[href="/account"]::after {
  height: 3px;
}

/* Gallery/Calendar cell: steady position, glowing border on hover */
.calendar-cell {
  transition: box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.calendar-cell:hover {
  box-shadow:
    inset 0 0 0 1px rgba(221, 107, 32, 0.35),
    0 10px 24px rgba(221, 107, 32, 0.2);
  border-color: rgba(221, 107, 32, 0.4);
}

/* Modal slides up with a little more flourish */
.modal[open] .modal-card {
  animation: modalRise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1.05) both;
}

@keyframes modalRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

/* Text inputs get a sweeping underline when focused */
.assistant-prompt-label {
  position: relative;
}

.assistant-prompt-label input:focus ~ .meta-label,
.assistant-prompt-label:focus-within .meta-label {
  color: var(--ember, #dd6b20);
  letter-spacing: 0.22em;
}

/* Annoy-level wrap gets a quiet pulse while notifications are on + level=10 */
.annoy-level-field[data-level="10"][data-annoy-on="1"] {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.35), 0 10px 26px rgba(239, 68, 68, 0.25);
}

/* Focus ring for the pill picker follows current level color */
.annoy-level-picker:focus-within {
  filter: saturate(1.1);
}

/* =================================================================== */
/*  Image / media viewer: fit the viewport, lock background scrollbar  */
/* =================================================================== */

/* When any <dialog.modal> is open, freeze the page scroll so the
   desktop doesn't show a thin orange scrollbar next to the dialog. */
html:has(dialog[open]) {
  overflow: hidden;
}

/* JS fallback for browsers without :has() support (effects.js sets
   body.has-modal-open whenever any dialog is open). */
body.has-modal-open {
  overflow: hidden;
}

/* Click-to-dismiss affordance: the image in the viewer should feel
   tappable, and the dialog backdrop should look inviting to click away. */
#viewer-body img {
  cursor: zoom-out;
}
.viewer-modal {
  cursor: pointer; /* backdrop feel */
}
.viewer-modal .modal-form {
  cursor: auto;
}

.viewer-modal {
  width: min(1100px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  flex-direction: column;
}

.viewer-modal[open] {
  display: flex;
}

.viewer-modal:not([open]) {
  display: none;
}

.viewer-modal .modal-form {
  width: 100%;
  max-width: 100%;
  max-height: calc(100vh - 24px);
  overflow-x: hidden;
  overflow-y: auto;
  /* Snug inner scrollbar styling so if overflow does happen it doesn't
     look like a raw browser bar glued onto the side. */
  scrollbar-width: thin;
  scrollbar-color: rgba(221, 107, 32, 0.55) transparent;
}

.viewer-body {
  margin-top: 12px;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(19, 34, 56, 0.06);
  display: grid;
  justify-items: center;
  align-items: center;
  /* Give the image / video as much of the dialog as possible on big
     screens, gracefully collapse on short laptops. Header + meta + chrome
     usually take ~180 px, so the media gets the remaining viewport. */
  min-height: 0;
}

.viewer-body img,
.viewer-body video,
.viewer-body iframe {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: min(78vh, calc(100vh - 220px));
  border: 0;
  background: white;
  object-fit: contain;
}

@media (max-height: 720px) {
  .viewer-body img,
  .viewer-body video,
  .viewer-body iframe {
    max-height: calc(100vh - 200px);
  }
}

@media (max-height: 560px) {
  .viewer-body img,
  .viewer-body video,
  .viewer-body iframe {
    max-height: calc(100vh - 160px);
  }
}

/* =================================================================== */
/*  Performance lite mode — low-end laptops / reduced motion           */
/* =================================================================== */

/* Turn off heavy body gradient animation + drop most blurs so the page
   repaints cheaply on integrated-GPU laptops. */
body.is-ambient-lite {
  animation: none !important;
}

body.is-ambient-lite .hearthboard-ambient,
body.is-ambient-lite .hearthboard-ambient-aurora,
body.is-ambient-lite .hearthboard-ambient-hearth,
body.is-ambient-lite .hearthboard-ambient-canvas,
body.is-ambient-lite .account-panel-portrait::before,
body.is-ambient-lite .hero::after,
body.is-ambient-lite .hero-account::after {
  display: none !important;
}

body.is-ambient-lite .card,
body.is-ambient-lite .site-nav,
body.is-ambient-lite .hero,
body.is-ambient-lite .hero-account,
body.is-ambient-lite .modal[open] {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Give lite-mode cards/nav a solid-ish paper fill instead of relying on
   backdrop blur for contrast against the body gradient. */
body.is-ambient-lite .card,
body.is-ambient-lite .site-nav {
  background: var(--paper-strong, rgba(255, 248, 233, 0.97));
}
html[data-theme="dark"] body.is-ambient-lite .card,
html[data-theme="dark"] body.is-ambient-lite .site-nav {
  background: rgba(18, 24, 44, 0.97);
}

body.is-ambient-lite .portrait-preview-ring,
body.is-ambient-lite .nav-brand::before {
  animation: none !important;
}

body.is-ambient-lite .annoy-level-field[data-level="10"] .annoy-level-meter-fill,
body.is-ambient-lite .annoy-level-field[data-level="10"] .annoy-level-value {
  animation: none !important;
}

/* Honor the OS-level reduced-motion preference everywhere, belt + suspenders. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* While the user is actively scrolling, freeze the heaviest decorative
   animations (blur-saturated ambient glows). The canvas ember layer is
   already paused by effects.js; this extends that to the CSS-driven
   layers so the GPU isn't repainting huge blurred regions every frame
   while the page is moving. Resumes ~220ms after the last scroll tick. */
body.is-scrolling .hearthboard-ambient-aurora,
body.is-scrolling .hearthboard-aurora-ribbon,
body.is-scrolling .hearthboard-ambient-hearth,
body.is-scrolling .hero::after,
body.is-scrolling .hero-account::after {
  animation-play-state: paused;
}

/* When Hearthboard stays visible on a second monitor while you're using a
   different app or Chrome window, freeze the decorative CSS animations and
   let the canvas drop into its low-FPS mode. The scene still looks rich,
   but it stops behaving like a full-time animated wallpaper. */
body.is-ambient-idle .hearthboard-ambient-aurora,
body.is-ambient-idle .hearthboard-aurora-ribbon,
body.is-ambient-idle .hearthboard-ambient-hearth,
body.is-ambient-idle,
body.is-ambient-idle .hero::after,
body.is-ambient-idle .hero-account::after,
body.is-ambient-idle .nav-brand::before {
  animation-play-state: paused;
}

/* =================================================================== */
/*  Scroll performance — let the browser skip offscreen work           */
/* =================================================================== */

/* content-visibility: auto lets the browser skip layout + paint for
   anything scrolled far off-screen, which is the single biggest win
   for pages with lots of cards / tiles. contain-intrinsic-size gives
   it a reasonable placeholder height so scrollbar geometry stays
   stable. These are additive to all the visual effects. */
.card {
  content-visibility: auto;
  contain-intrinsic-size: 1px 420px;
  contain: layout paint style;
}

/* Calendar cells and gallery tiles benefit even more since there can be
   many dozens on one page. Give them a tighter intrinsic size hint. */
.calendar-cell,
.gallery-tile,
.media-grid > *,
.gallery-grid > *,
[class*="media-tile"] {
  content-visibility: auto;
  contain-intrinsic-size: 1px 200px;
  contain: layout paint style;
}

/* Notifications list and assistant chat can grow hundreds of rows tall.
   Give each row a content-visibility hint too. */
.notifications-list > *,
.assistant-chat > *,
.bulletins-list > *,
#integrations-list > * {
  content-visibility: auto;
  contain-intrinsic-size: 1px 120px;
}

/* The hero and nav should always render (they're always visible and
   above-the-fold), so undo the auto behavior for them in case .card
   applies. */
.site-nav,
.hero,
.hero-account,
.modal[open] .card,
.account-panel-portrait {
  content-visibility: visible;
  contain: none;
}

/* Calendar integrations panel (Google + Outlook) -------------------------- */
.account-panel-integrations .integration-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 0.75rem;
}
.integrations-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.integration-item {
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  border-radius: 10px;
  padding: 0.85rem 1rem;
  background: var(--surface-alt, rgba(0, 0, 0, 0.02));
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.integration-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
}
.integration-head .integration-actions {
  margin: 0;
  justify-self: end;
}
.integration-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.integration-meta strong { line-height: 1.1; }
.integration-meta .muted { font-size: 0.85rem; }
.integration-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.integration-badge-google { background: #4285f4; }
.integration-badge-microsoft { background: #0078d4; }
.integration-calendars {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.integration-calendar {
  font-size: 0.78rem;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}
@media (max-width: 640px) {
  .integration-head {
    grid-template-columns: auto 1fr;
  }
  .integration-head .integration-actions {
    grid-column: 1 / -1;
    justify-self: stretch;
  }
}

/* Imported-event pill source badge on the calendar ----------------------- */
.event-source-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  margin-right: 4px;
  vertical-align: middle;
  flex-shrink: 0;
}
.event-source-badge.source-google { background: #4285f4; }
.event-source-badge.source-microsoft { background: #0078d4; }

/* Event studio "imported from" note -------------------------------------- */
.event-studio-import-note {
  font-size: 0.85rem;
  background: rgba(66, 133, 244, 0.08);
  border: 1px solid rgba(66, 133, 244, 0.25);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}
.event-studio-import-note.source-microsoft {
  background: rgba(0, 120, 212, 0.08);
  border-color: rgba(0, 120, 212, 0.25);
}

/* =================================================================== */
/*  Messages page                                                     */
/* =================================================================== */

.messages-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 0;
  min-height: 72vh;
  padding: 0;
  overflow: hidden;
}

.messages-sidebar {
  border-right: 1px solid rgba(19, 34, 56, 0.08);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.messages-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem 0.75rem;
  border-bottom: 1px solid rgba(19, 34, 56, 0.06);
}

.messages-threads {
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  gap: 0.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.thread-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  gap: 0.15rem 0.5rem;
  align-items: start;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
  position: relative;
}

.thread-item:hover {
  background: rgba(221, 107, 32, 0.07);
}

.thread-item.is-active {
  background: linear-gradient(135deg, rgba(221, 107, 32, 0.12), rgba(15, 118, 110, 0.08));
  border-color: rgba(221, 107, 32, 0.25);
}

.thread-item.has-unread .thread-item-title {
  font-weight: 700;
}

.thread-item-kicker {
  grid-column: 1 / 2;
  grid-row: 1;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(19, 34, 56, 0.55);
}

.thread-item-title {
  grid-column: 1 / 2;
  grid-row: 2;
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.2;
}

.thread-item-preview {
  grid-column: 1 / 3;
  grid-row: 3;
  font-size: 0.85rem;
  color: rgba(19, 34, 56, 0.65);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.thread-item-when {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  align-self: start;
  justify-self: end;
  font-size: 0.72rem;
  color: rgba(19, 34, 56, 0.5);
}

.thread-item-unread {
  position: absolute;
  top: 0.6rem;
  right: 0.5rem;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #dc2626, #ea580c);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(180, 35, 24, 0.3);
}

.messages-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.messages-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid rgba(19, 34, 56, 0.08);
}

.messages-pane-header h2 {
  margin: 0.15rem 0 0;
  font-size: 1.2rem;
}

.messages-pane-tools {
  font-size: 0.85rem;
}

.messages-stream {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 0;
}

.messages-day-sep {
  align-self: center;
  margin: 0.5rem 0 0.25rem;
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(19, 34, 56, 0.55);
  background: rgba(19, 34, 56, 0.05);
}

.message-row {
  display: flex;
  margin: 0;
}

.message-row.is-mine {
  justify-content: flex-end;
}

.message-bubble {
  position: relative;
  max-width: min(560px, 72%);
  padding: 0.55rem 0.85rem 0.65rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(19, 34, 56, 0.09);
  box-shadow: 0 8px 18px rgba(36, 19, 8, 0.06);
  line-height: 1.4;
}

.message-row.is-mine .message-bubble {
  background: linear-gradient(135deg, rgba(221, 107, 32, 0.95), rgba(234, 88, 12, 0.92));
  color: #fff8ec;
  border-color: rgba(221, 107, 32, 0.5);
}

.message-bubble-header {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  font-size: 0.72rem;
  margin-bottom: 0.2rem;
}

.message-bubble-author {
  font-weight: 700;
  color: rgba(19, 34, 56, 0.8);
}

.message-row.is-mine .message-bubble-author {
  color: rgba(255, 248, 236, 0.9);
}

.message-bubble-time {
  color: rgba(19, 34, 56, 0.5);
}

.message-row.is-mine .message-bubble-time {
  color: rgba(255, 248, 236, 0.72);
}

.message-bubble-body {
  font-size: 0.96rem;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-bubble-delete {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  border: none;
  background: rgba(19, 34, 56, 0.85);
  color: white;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.message-bubble:hover .message-bubble-delete,
.message-bubble-delete:focus {
  opacity: 1;
}

.messages-composer {
  border-top: 1px solid rgba(19, 34, 56, 0.08);
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: rgba(255, 255, 255, 0.6);
}

.messages-composer textarea {
  resize: vertical;
  min-height: 60px;
  max-height: 220px;
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  font: inherit;
}

.messages-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.new-dm-contacts {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 52vh;
  overflow-y: auto;
  margin: 0.5rem 0;
}

.new-dm-contact {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(19, 34, 56, 0.1);
  background: rgba(255, 255, 255, 0.8);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.new-dm-contact:hover {
  background: rgba(221, 107, 32, 0.1);
  border-color: rgba(221, 107, 32, 0.35);
}

.new-dm-contact-name {
  font-weight: 600;
}

/* Dark mode tweaks */
html[data-theme="dark"] .messages-sidebar {
  border-right-color: rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .messages-sidebar-header,
html[data-theme="dark"] .messages-pane-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .thread-item-kicker,
html[data-theme="dark"] .thread-item-preview,
html[data-theme="dark"] .thread-item-when,
html[data-theme="dark"] .messages-day-sep {
  color: rgba(255, 255, 255, 0.55);
}
html[data-theme="dark"] .thread-item:hover {
  background: rgba(255, 168, 92, 0.08);
}
html[data-theme="dark"] .thread-item.is-active {
  background: linear-gradient(135deg, rgba(255, 168, 92, 0.18), rgba(94, 227, 210, 0.10));
  border-color: rgba(255, 168, 92, 0.35);
}
html[data-theme="dark"] .message-bubble {
  background: rgba(22, 30, 52, 0.85);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.92);
}
html[data-theme="dark"] .message-bubble-author {
  color: rgba(255, 255, 255, 0.9);
}
html[data-theme="dark"] .message-bubble-time {
  color: rgba(255, 255, 255, 0.55);
}
html[data-theme="dark"] .messages-composer {
  background: rgba(18, 24, 46, 0.4);
  border-top-color: rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .new-dm-contact {
  background: rgba(22, 30, 52, 0.8);
  border-color: rgba(255, 255, 255, 0.1);
}
html[data-theme="dark"] .new-dm-contact:hover {
  background: rgba(255, 168, 92, 0.12);
}

/* Responsive: stack sidebar above pane on narrow screens */
@media (max-width: 820px) {
  .messages-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .messages-sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(19, 34, 56, 0.08);
    max-height: 40vh;
  }
  html[data-theme="dark"] .messages-sidebar {
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Icon-only nav links + tooltip system
   ========================================================================== */

.nav-link-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(19, 34, 56, 0.12);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  text-decoration: none;
  overflow: visible;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, filter 0.25s ease;
}

.nav-link-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.nav-link-icon:hover {
  box-shadow:
    0 0 0 2px rgba(221, 107, 32, 0.35),
    0 12px 28px rgba(221, 107, 32, 0.25);
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.nav-link-icon.is-active {
  background: linear-gradient(135deg, rgba(221, 107, 32, 0.18), rgba(15, 118, 110, 0.14));
  border-color: rgba(221, 107, 32, 0.32);
  box-shadow: 0 8px 24px rgba(221, 107, 32, 0.28);
  color: var(--ember, #dd6b20);
}

html[data-theme="dark"] .nav-link-icon {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f5e6d3;
}

html[data-theme="dark"] .nav-link-icon.is-active {
  background: linear-gradient(135deg, rgba(221, 107, 32, 0.32), rgba(15, 118, 110, 0.22));
  border-color: rgba(221, 107, 32, 0.55);
  color: #ffd9b8;
}

/* Tooltip system — attach data-tooltip to any nav icon */
.site-nav [data-tooltip] {
  position: relative;
}

.site-nav [data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translate(-50%, -4px);
  padding: 6px 11px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(19, 34, 56, 0.96), rgba(10, 40, 48, 0.96));
  color: #fef5ed;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  box-shadow: 0 8px 20px rgba(19, 34, 56, 0.28);
  z-index: 60;
}

.site-nav [data-tooltip]::after {
  content: "";
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: rgba(19, 34, 56, 0.96);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 61;
}

.site-nav [data-tooltip]:hover::before,
.site-nav [data-tooltip]:focus-visible::before {
  opacity: 1;
  transform: translate(-50%, 0);
}

.site-nav [data-tooltip]:hover::after,
.site-nav [data-tooltip]:focus-visible::after {
  opacity: 1;
}

/* Allow tooltip to escape the icon button for bell + messages */
.site-nav .nav-icon-button[data-tooltip] {
  overflow: visible;
}

/* The nav bar is a .card, which sets overflow:hidden. That clips the
   tooltip pseudo-elements below the bar. Override so tooltips can float
   beneath the nav without being chopped in half. */
.site-nav.card {
  overflow: visible;
}

/* The decorative glow on .card::after is positioned partly outside the
   card — hidden by the card's overflow:hidden. Once we lift that above,
   the glow would peek out below the nav. Suppress it for the nav only. */
.site-nav.card::after {
  display: none;
}

html[data-theme="dark"] .site-nav [data-tooltip]::before {
  background: linear-gradient(135deg, rgba(245, 230, 211, 0.96), rgba(221, 107, 32, 0.9));
  color: #1a1410;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .site-nav [data-tooltip]::after {
  border-bottom-color: rgba(245, 230, 211, 0.96);
}

/* Mobile: icon nav lays out in a row of circles; hide tooltips on touch */
@media (max-width: 720px) {
  .nav-links {
    width: 100%;
    display: flex;
    grid-template-columns: none;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  .nav-link-icon {
    width: 48px;
    height: 48px;
  }
  .site-nav [data-tooltip]::before,
  .site-nav [data-tooltip]::after {
    display: none;
  }
}

/* ==========================================================================
   Stats page — speed test chart + controls
   ========================================================================== */

.stats-hero-meter {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.stats-hero-meter .pulse-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.stats-hero-meter .pulse-number {
  font-size: 2.3rem;
  font-weight: 800;
  background: linear-gradient(135deg, #dd6b20, #0f766e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}

.stats-hero-meter .pulse-unit {
  font-size: 0.85rem;
  color: rgba(19, 34, 56, 0.6);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

html[data-theme="dark"] .stats-hero-meter .pulse-unit {
  color: rgba(245, 230, 211, 0.55);
}

.stats-layout {
  display: grid;
  gap: 18px;
}

.stats-primary-card {
  display: grid;
  gap: 18px;
}

.stats-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: space-between;
}

.stats-window-chips {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(19, 34, 56, 0.06);
  border: 1px solid rgba(19, 34, 56, 0.08);
}

html[data-theme="dark"] .stats-window-chips {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.09);
}

.stats-window-chip {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
  color: rgba(19, 34, 56, 0.65);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  letter-spacing: 0.04em;
}

html[data-theme="dark"] .stats-window-chip {
  color: rgba(245, 230, 211, 0.65);
}

.stats-window-chip:hover {
  color: var(--ember, #dd6b20);
  transform: translateY(-1px);
}

.stats-window-chip.is-active {
  background: linear-gradient(135deg, #dd6b20, #f59e0b);
  color: #fff;
  box-shadow: 0 6px 16px rgba(221, 107, 32, 0.35);
}

.stats-target-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.4));
  border: 1px solid rgba(19, 34, 56, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

html[data-theme="dark"] .stats-target-row {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.stats-target-chips {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(19, 34, 56, 0.06);
  border: 1px solid rgba(19, 34, 56, 0.08);
}

html[data-theme="dark"] .stats-target-chips {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.09);
}

.stats-target-chip {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
  color: rgba(19, 34, 56, 0.65);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  letter-spacing: 0.04em;
}

html[data-theme="dark"] .stats-target-chip {
  color: rgba(245, 230, 211, 0.65);
}

.stats-target-chip:hover {
  color: var(--ember, #dd6b20);
  transform: translateY(-1px);
}

.stats-target-chip.is-active {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.stats-target-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 220px;
  text-align: right;
}

.stats-target-info .meta-label {
  margin: 0;
}

#stats-server-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: rgba(19, 34, 56, 0.88);
  letter-spacing: 0.01em;
}

html[data-theme="dark"] #stats-server-label {
  color: rgba(245, 230, 211, 0.92);
}

#stats-target-note {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

.stats-custom-range {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.4));
  border: 1px dashed rgba(221, 107, 32, 0.35);
}

html[data-theme="dark"] .stats-custom-range {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border-color: rgba(245, 158, 11, 0.45);
}

.stats-custom-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 180px;
  min-width: 0;
}

.stats-custom-field input[type="datetime-local"] {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(19, 34, 56, 0.14);
  border-radius: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.85);
  color: rgba(19, 34, 56, 0.92);
  font-weight: 600;
  font-size: 0.88rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.stats-custom-field input[type="datetime-local"]:focus {
  outline: none;
  border-color: var(--ember, #dd6b20);
  box-shadow: 0 0 0 3px rgba(221, 107, 32, 0.18);
}

html[data-theme="dark"] .stats-custom-field input[type="datetime-local"] {
  background: rgba(19, 34, 56, 0.55);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(245, 230, 211, 0.95);
  color-scheme: dark;
}

.stats-custom-range #stats-custom-apply {
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  .stats-target-row {
    flex-direction: column;
    align-items: stretch;
  }
  .stats-target-info {
    text-align: left;
  }
}

.stats-run-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.stats-run-button.is-running {
  pointer-events: none;
  opacity: 0.85;
}

.stats-run-button .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: statsSpin 0.9s linear infinite;
}

@keyframes statsSpin {
  to { transform: rotate(360deg); }
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.stats-summary-tile {
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.65));
  border: 1px solid rgba(19, 34, 56, 0.08);
  box-shadow: 0 8px 24px rgba(19, 34, 56, 0.05);
  display: grid;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.stats-summary-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(221, 107, 32, 0.1), transparent 55%);
  pointer-events: none;
}

.stats-summary-tile[data-kind="upload"]::before {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 55%);
}

.stats-summary-tile[data-kind="latency"]::before {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), transparent 55%);
}

html[data-theme="dark"] .stats-summary-tile {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.stats-summary-tile .label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(19, 34, 56, 0.55);
}

html[data-theme="dark"] .stats-summary-tile .label {
  color: rgba(245, 230, 211, 0.55);
}

.stats-summary-tile .value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.stats-summary-tile .sub {
  font-size: 0.78rem;
  color: rgba(19, 34, 56, 0.55);
}

html[data-theme="dark"] .stats-summary-tile .sub {
  color: rgba(245, 230, 211, 0.5);
}

.stats-summary-tile[data-kind="download"] .value {
  background: linear-gradient(135deg, #dd6b20, #f59e0b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stats-summary-tile[data-kind="upload"] .value {
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stats-summary-tile[data-kind="latency"] .value {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Chart */
.stats-chart-wrap {
  position: relative;
  border-radius: 22px;
  padding: 18px;
  background:
    radial-gradient(1200px 400px at 15% 0%, rgba(221, 107, 32, 0.12), transparent 55%),
    radial-gradient(1200px 400px at 85% 100%, rgba(15, 118, 110, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4));
  border: 1px solid rgba(19, 34, 56, 0.08);
  overflow: hidden;
  min-height: 320px;
}

html[data-theme="dark"] .stats-chart-wrap {
  background:
    radial-gradient(1200px 400px at 15% 0%, rgba(221, 107, 32, 0.18), transparent 55%),
    radial-gradient(1200px 400px at 85% 100%, rgba(15, 118, 110, 0.18), transparent 55%),
    linear-gradient(180deg, rgba(8, 16, 28, 0.72), rgba(8, 16, 28, 0.4));
  border-color: rgba(255, 255, 255, 0.08);
}

.stats-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 10px;
}

.stats-chart-legend {
  display: inline-flex;
  gap: 14px;
  font-size: 0.78rem;
  font-weight: 700;
  flex-wrap: wrap;
}

.stats-chart-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.stats-chart-legend .dot.download { background: linear-gradient(135deg, #dd6b20, #f59e0b); }
.stats-chart-legend .dot.upload { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.stats-chart-legend .dot.latency { background: linear-gradient(135deg, #8b5cf6, #6366f1); }

.stats-chart-svg {
  width: 100%;
  height: 360px;
  display: block;
  user-select: none;
}

.stats-chart-svg .axis-label {
  font-size: 11px;
  fill: rgba(19, 34, 56, 0.55);
  font-weight: 700;
}

html[data-theme="dark"] .stats-chart-svg .axis-label {
  fill: rgba(245, 230, 211, 0.55);
}

.stats-chart-svg .grid-line {
  stroke: rgba(19, 34, 56, 0.08);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

html[data-theme="dark"] .stats-chart-svg .grid-line {
  stroke: rgba(255, 255, 255, 0.08);
}

.stats-chart-svg .series-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.12));
}

.stats-chart-svg .series-point {
  cursor: crosshair;
  transition: r 0.15s ease;
}

.stats-chart-svg .hover-guide {
  stroke: rgba(19, 34, 56, 0.35);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

html[data-theme="dark"] .stats-chart-svg .hover-guide {
  stroke: rgba(245, 230, 211, 0.4);
}

.stats-chart-tooltip {
  position: absolute;
  pointer-events: none;
  padding: 10px 13px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(19, 34, 56, 0.96), rgba(10, 40, 48, 0.96));
  color: #fef5ed;
  font-size: 0.82rem;
  min-width: 170px;
  box-shadow: 0 14px 30px rgba(19, 34, 56, 0.35);
  opacity: 0;
  transform: translate(-50%, -12px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stats-chart-tooltip.is-visible {
  opacity: 1;
  transform: translate(-50%, -18px);
}

.stats-chart-tooltip .t-time {
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: rgba(254, 245, 237, 0.75);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.stats-chart-tooltip .t-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 2px;
}

.stats-chart-tooltip .t-row .k {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: rgba(254, 245, 237, 0.8);
}

.stats-chart-tooltip .t-row .k .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.stats-chart-tooltip .t-row .v {
  font-weight: 800;
  letter-spacing: 0.02em;
}

.stats-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: rgba(19, 34, 56, 0.55);
}

html[data-theme="dark"] .stats-empty-state {
  color: rgba(245, 230, 211, 0.5);
}

.stats-empty-state svg {
  width: 56px;
  height: 56px;
  opacity: 0.5;
  margin-bottom: 12px;
}

.stats-running-status {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(221, 107, 32, 0.1), rgba(15, 118, 110, 0.08));
  border: 1px solid rgba(221, 107, 32, 0.2);
  font-size: 0.86rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

html[data-theme="dark"] .stats-running-status {
  background: linear-gradient(135deg, rgba(221, 107, 32, 0.18), rgba(15, 118, 110, 0.14));
  border-color: rgba(221, 107, 32, 0.35);
}

.stats-running-bar {
  flex: 1;
  height: 6px;
  background: rgba(19, 34, 56, 0.08);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

html[data-theme="dark"] .stats-running-bar {
  background: rgba(255, 255, 255, 0.08);
}

.stats-running-bar .fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, #dd6b20, transparent);
  width: 40%;
  transform: translateX(-100%);
  animation: statsRunBar 1.4s ease-in-out infinite;
}

@keyframes statsRunBar {
  to { transform: translateX(250%); }
}

@media (max-width: 720px) {
  .stats-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .stats-window-chips {
    overflow-x: auto;
    justify-content: flex-start;
    flex-wrap: nowrap;
  }
  .stats-chart-svg {
    height: 280px;
  }
}
