/* MY ASX Options: fluid, device-agnostic layout from 240px phones to 4K and foldables.
   Layout switches on available width (media queries for the shell, container queries for
   components), input type (pointer/hover) and display segments (dual-screen foldables). */

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: dark;
  --bg: #06080c;
  --surface: #0b0e14;
  --surface-2: #121721;
  --surface-3: #1a2230;
  --ink: #f1f5f9;
  --ink-2: #94a3b8;
  --muted: #64748b;
  --line: #1f293d;
  --line-strong: #2e3c59;
  --ring: rgba(0, 229, 153, 0.25);
  --accent: #00e599;
  --accent-hover: #4dffb2;
  --accent-ink: #002112;
  --accent-soft: rgba(0, 229, 153, 0.12);
  --link: #00e599;
  --bar: #00e599;
  --up: #00e599;
  --down: #ff3b56;
  --notice-bg: rgba(255, 184, 0, 0.12);
  --notice-line: #ffb800;
  --error-bg: rgba(255, 59, 86, 0.14);
  --error-line: #ff3b56;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 12px -2px rgba(0, 229, 153, 0.05);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.9), 0 0 20px -4px rgba(0, 229, 153, 0.15);
  --scrim: rgba(6, 8, 12, 0.85);

  --font: "Space Grotesk", "Geist", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: clamp(1.0625rem, 0.98rem + 0.4vw, 1.3rem);
  --fs-xl: clamp(1.3rem, 1.05rem + 1.1vw, 2rem);
  --fs-kpi: clamp(1.45rem, 1.15rem + 1vw, 2.1rem);

  --gutter: clamp(0.75rem, 0.45rem + 1.6vw, 2rem);
  --gap: clamp(0.75rem, 0.6rem + 0.7vw, 1.25rem);
  --radius: 0.25rem;
  --radius-sm: 0.125rem;
  --tap: 2.5rem;
  --rail: 5.75rem;
  --sidebar: clamp(13rem, 15vw, 17rem);
  --bottomnav-h: 3.75rem;
  --appbar-h: 3.75rem;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #06080c;
    --surface: #0b0e14;
    --surface-2: #121721;
    --surface-3: #1a2230;
    --ink: #f1f5f9;
    --ink-2: #94a3b8;
    --muted: #64748b;
    --line: #1f293d;
    --line-strong: #2e3c59;
    --ring: rgba(0, 229, 153, 0.25);
    --accent: #00e599;
    --accent-hover: #4dffb2;
    --accent-ink: #002112;
    --accent-soft: rgba(0, 229, 153, 0.12);
    --link: #00e599;
    --bar: #00e599;
    --up: #00e599;
    --down: #ff3b56;
    --notice-bg: rgba(255, 184, 0, 0.12);
    --notice-line: #ffb800;
    --error-bg: rgba(255, 59, 86, 0.14);
    --error-line: #ff3b56;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 12px -2px rgba(0, 229, 153, 0.05);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.9), 0 0 20px -4px rgba(0, 229, 153, 0.15);
    --scrim: rgba(6, 8, 12, 0.85);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #06080c;
  --surface: #0b0e14;
  --surface-2: #121721;
  --surface-3: #1a2230;
  --ink: #f1f5f9;
  --ink-2: #94a3b8;
  --muted: #64748b;
  --line: #1f293d;
  --line-strong: #2e3c59;
  --ring: rgba(0, 229, 153, 0.25);
  --accent: #00e599;
  --accent-hover: #4dffb2;
  --accent-ink: #002112;
  --accent-soft: rgba(0, 229, 153, 0.12);
  --link: #00e599;
  --bar: #00e599;
  --up: #00e599;
  --down: #ff3b56;
  --notice-bg: rgba(255, 184, 0, 0.12);
  --notice-line: #ffb800;
  --error-bg: rgba(255, 59, 86, 0.14);
  --error-line: #ff3b56;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 12px -2px rgba(0, 229, 153, 0.05);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.9), 0 0 20px -4px rgba(0, 229, 153, 0.15);
  --scrim: rgba(6, 8, 12, 0.85);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f2;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --surface-3: #e7e6e1;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #67655f;
  --line: #e1e0d9;
  --line-strong: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.1);
  --accent: #009e66;
  --accent-hover: #008053;
  --accent-ink: #ffffff;
  --accent-soft: #e5f9f0;
  --link: #007a4f;
  --bar: #009e66;
  --up: #00873a;
  --down: #c62f2f;
  --notice-bg: #fff6e0;
  --notice-line: #f0d48a;
  --error-bg: #fdecec;
  --error-line: #f1b5b5;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.05), 0 6px 20px rgba(11, 11, 11, 0.05);
  --shadow-lg: 0 12px 48px rgba(11, 11, 11, 0.18);
  --scrim: rgba(11, 11, 11, 0.42);
}
/* ------------------------------------------------------------------ base */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  /* 15px on phones -> 16px at 1280 -> 18px at 2560 -> 20px at 4K */
  font-size: clamp(15px, 14px + 0.15625vw, 20px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--appbar-h) + 4.5rem);
}
@media (max-width: 300px) {
  html {
    font-size: 14px;
  }
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
  overflow-wrap: break-word;
}
h1,
h2,
h3,
p,
ol,
ul,
figure {
  margin: 0;
}
h1 {
  font-size: var(--fs-xl);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
h2 {
  font-size: var(--fs-lg);
  line-height: 1.25;
}
h3 {
  font-size: var(--fs-md);
  line-height: 1.3;
}
a {
  color: var(--link);
  text-underline-offset: 0.15em;
}
code {
  font-family: var(--mono);
  font-size: 0.9em;
}
small {
  font-size: var(--fs-xs);
}
.muted {
  color: var(--muted);
  font-weight: 400;
}
img,
svg {
  max-width: 100%;
}
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  vertical-align: -0.2em;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.skip-link:focus {
  top: 0.5rem;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------ controls */
.btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: var(--tap);
  padding: 0.45rem 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  color: var(--ink);
  background: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.icon-btn {
  min-width: var(--tap);
  padding: 0.45rem;
  border-color: var(--line);
  background: var(--surface);
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-ghost {
  border-color: var(--line);
  background: var(--surface);
}
.btn-link {
  min-height: auto;
  padding: 0.25rem 0.35rem;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
}
.source-more {
  padding: 0.15rem 0;
  font-size: var(--fs-xs);
  font-weight: 600;
}
.btn:disabled,
.icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.btn.is-busy .icon {
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (hover: hover) {
  .btn-primary:not(:disabled):hover {
    background: var(--accent-hover);
  }
  .btn-ghost:not(:disabled):hover,
  .icon-btn:not(:disabled):hover {
    background: var(--surface-2);
  }
  .btn-link:hover {
    text-decoration: underline;
  }
}
input,
select,
textarea {
  font: inherit;
  font-size: max(16px, var(--fs-sm)); /* >=16px stops iOS zooming on focus */
  color: var(--ink);
}
input[type="search"],
input[type="text"],
input[type="number"],
input[type="time"],
input:not([type]),
select {
  min-height: var(--tap);
  width: 100%;
  min-width: 0;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
select {
  padding-right: 2rem;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1rem) 55%, calc(100% - 0.7rem) 55%;
  background-size: 0.3rem 0.3rem;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
}
.field {
  display: grid;
  gap: 0.3rem;
  font-size: var(--fs-sm);
  color: var(--ink-2);
  min-width: 0;
}
.field.grow {
  flex: 1 1 10rem;
}
.switch {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-height: var(--tap);
  padding: 0.35rem 0;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.switch input {
  flex: none;
  appearance: none;
  width: 2.4rem;
  height: 1.4rem;
  margin: 0.05rem 0 0;
  border-radius: 1rem;
  background: var(--line-strong);
  position: relative;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.switch input::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}
.switch input:checked {
  background: var(--accent);
}
.switch input:checked::after {
  transform: translateX(1rem);
}
.switch input:disabled {
  opacity: 0.5;
}
.switch-text {
  flex: 1 1 0;
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}
.switch-text label {
  cursor: pointer;
  color: var(--ink);
}
.switch .error-msg {
  flex-basis: 100%;
  padding-left: 3.05rem; /* aligns under the label, past the 2.4rem switch and gap */
}
.switch {
  flex-wrap: wrap;
}
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem;
}
.hint {
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* ------------------------------------------------------------------ app shell (phones first) */
.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: max(0.5rem, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 0.5rem max(var(--gutter), env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
.brand-mark {
  width: 2rem;
  height: 2rem;
  flex: none;
}
.brand-text {
  display: grid;
  min-width: 0;
  line-height: 1.15;
}
.brand-text strong {
  font-size: var(--fs-md);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text small {
  color: var(--muted);
  white-space: nowrap;
}
.appbar-nav {
  display: flex;
  align-items: center;
  margin-inline: 0.75rem auto;
}
.appbar-nav .nav-list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.appbar-nav .nav-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.appbar-nav .nav-list a:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.appbar-nav .nav-list a[aria-current="page"] {
  background: var(--surface-3);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--ring);
}
.appbar-nav .nav-list .icon {
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
}
.appbar-nav .nav-count {
  font-size: var(--fs-xs);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  min-width: 1.25rem;
  text-align: center;
  font-weight: 600;
  line-height: 1.2;
}
.appbar-nav .nav-count:empty {
  display: none;
}
.appbar-nav .nav-list a[aria-current="page"] .nav-count {
  background: var(--accent-soft);
  color: var(--accent);
}
@media (max-width: 860px) {
  .appbar {
    gap: 0.5rem;
  }
  .appbar-nav {
    order: 4;
    flex: 1 1 100%;
    margin-inline: 0;
    overflow-x: auto;
    scrollbar-width: none;
    padding-top: 0.35rem;
    border-top: 1px solid var(--line);
  }
  .appbar-nav::-webkit-scrollbar {
    display: none;
  }
  .appbar-nav .nav-list {
    display: flex;
    gap: 0.25rem;
    width: 100%;
  }
  .appbar-nav .nav-list a {
    flex: 1 0 auto;
    justify-content: center;
    padding: 0.35rem 0.5rem;
    font-size: var(--fs-xs);
  }
  .bottomnav {
    display: none !important;
  }
  .main {
    padding-bottom: max(var(--gutter), env(safe-area-inset-bottom)) !important;
  }
}
.appbar-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.report-picker {
  min-width: 0;
}
.report-picker select {
  max-width: 13rem;
}
.run-progress {
  flex-basis: 100%;
  display: grid;
  gap: 0.25rem;
  padding-bottom: 0.15rem;
}
.run-progress-track {
  height: 0.3rem;
  border-radius: 0.3rem;
  background: var(--surface-3);
  overflow: hidden;
}
.run-progress-fill {
  height: 100%;
  width: var(--pct, 2%);
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.4s ease;
}
.run-progress-label {
  font-size: var(--fs-xs);
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Narrowest phones (240-359px): icon-only actions, no subtitle, report picker on its own row. */
@media (max-width: 359px) {
  .brand-text small,
  .btn-text {
    display: none;
  }
  .brand-mark {
    width: 1.75rem;
    height: 1.75rem;
  }
  .appbar-tools {
    flex: 1 1 100%;
  }
  .report-picker {
    flex: 1;
  }
  .report-picker select {
    max-width: none;
  }
  #run-btn {
    min-width: var(--tap);
    padding-inline: 0.5rem;
  }
}
@media (min-width: 360px) and (max-width: 559px) {
  .btn-text {
    display: none;
  }
  #run-btn {
    min-width: var(--tap);
    padding-inline: 0.55rem;
  }
  .report-picker select {
    max-width: 9.5rem;
  }
}

/* ------------------------------------------------------------------ Google Sign-In & Account Avatar */
.appbar-account {
  position: relative;
  display: flex;
  align-items: center;
  flex: none;
}
.btn-google-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 2.5rem;
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
#signin-btn {
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  border-radius: 50%;
}
.btn-google-signin:hover {
  background: var(--surface-3);
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45), 0 0 12px -2px rgba(66, 133, 244, 0.4);
}
.btn-google-signin:active {
  transform: scale(0.96);
}
.btn-google-signin:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.google-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}

/* Round Google Profile Avatar Button when logged in */
.account-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--accent);
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.account-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45), 0 0 12px -2px var(--accent);
}
.account-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.account-btn .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.account-btn .avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
}
.account-profile-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}
.account-dialog-avatar,
.account-dialog-initial {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  flex: none;
}
.account-dialog-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
}
.account-profile-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.account-profile-meta strong {
  font-size: 0.95rem;
  color: var(--ink);
}
.account-profile-meta span {
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Anchored Account Dropdown Menu */
.account-dropdown {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  width: 17.5rem;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04);
  z-index: 250;
  overflow: hidden;
  animation: accountDropdownIn 0.14s ease-out;
}
.account-dropdown[hidden] {
  display: none !important;
}
@keyframes accountDropdownIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.account-dropdown-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}
.account-dropdown-avatar,
.account-dropdown-initial {
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  flex: none;
}
.account-dropdown-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}
.account-dropdown-meta {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}
.account-dropdown-meta strong {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-dropdown-meta span:not(.account-role-badge) {
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-role-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  margin-top: 0.2rem;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.account-dropdown-items {
  display: flex;
  flex-direction: column;
  padding: 0.35rem;
  gap: 0.15rem;
}
.account-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.account-dropdown-item:hover,
.account-dropdown-item:focus-visible {
  background: var(--surface-3);
  border-color: var(--line-strong);
  color: var(--ink);
  outline: none;
}
.account-dropdown-item .icon {
  width: 1rem;
  height: 1rem;
  color: var(--accent);
  flex: none;
}
.account-dropdown-signout:hover,
.account-dropdown-signout:focus-visible {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fda4af;
}
.account-dropdown-signout .icon {
  color: var(--muted);
}
.account-dropdown-signout:hover .icon {
  color: #fda4af;
}

/* Large variant for Superadmin Gate card */
.btn-google-large {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 9999px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  margin-top: 0.5rem;
}
.btn-google-large:hover {
  background: var(--surface-3);
  border-color: rgba(66, 133, 244, 0.6);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 16px -2px rgba(66, 133, 244, 0.4);
}
.btn-google-large .google-icon {
  width: 1.35rem;
  height: 1.35rem;
}
.sidenav {
  display: none;
}
.main {
  flex: 1;
  min-width: 0;
  padding: var(--gutter) max(var(--gutter), env(safe-area-inset-right)) calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + var(--gutter)) max(var(--gutter), env(safe-area-inset-left));
  outline: none;
}
.bottomnav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.bottomnav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-width: 0;
  padding: 0.35rem 0.1rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-decoration: none;
}
.bottomnav a span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bottomnav .icon {
  width: 1.4rem;
  height: 1.4rem;
}
.bottomnav a[aria-current="page"] {
  color: var(--link);
}
@media (max-width: 299px) {
  .bottomnav a span {
    display: none;
  }
}

/* One view at a time below the desktop breakpoint. */
.view {
  display: none;
  margin-top: var(--gap);
}
.main:is([data-view="overview"], [data-view="confirmed"], [data-view="upcoming"]) > #overview,
.main[data-view="takeaways"] > #takeaways-view,
.main[data-view="settings"] > #admin,
.main[data-view="admin"] > #admin,
.main[data-view="welcome"] > #welcome {
  display: block;
}
.main[data-view="settings"] > .filters,
.main[data-view="takeaways"] > .filters,
.main[data-view="admin"] > .filters {
  display: none;
}

/* Tablets, landscape phones and unfolded foldables */
@media (min-width: 640px) {
  .app {
    display: flex;
    flex-direction: column;
  }
  .appbar {
    width: 100%;
  }
  .sidenav {
    display: none !important;
  }
  .bottomnav {
    display: none !important;
  }
  .main {
    flex: 1;
    width: 100%;
    padding-bottom: max(var(--gutter), env(safe-area-inset-bottom));
  }
  .sidenav {
    grid-area: nav;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: var(--appbar-h);
    height: calc(100dvh - var(--appbar-h));
    padding: 0.75rem 0.4rem max(0.75rem, env(safe-area-inset-bottom)) max(0.4rem, env(safe-area-inset-left));
    overflow-y: auto;
    border-right: 1px solid var(--line);
  }
  .nav-list {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 0.25rem;
  }
  .nav-list a {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.55rem 0.25rem;
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
  }
  .nav-list .icon {
    width: 1.35rem;
    height: 1.35rem;
  }
  .nav-list a[aria-current="page"] {
    background: var(--accent-soft);
    color: var(--link);
  }
  .nav-count {
    position: absolute;
    top: 0.2rem;
    right: 0.35rem;
    min-width: 1.25rem;
    padding: 0 0.3rem;
    border-radius: 0.7rem;
    background: var(--surface-3);
    color: var(--ink-2);
    font-size: 0.66rem;
    line-height: 1.25rem;
  }
  .nav-count:empty {
    display: none;
  }
  .sidenav-note {
    display: none;
  }
  .main {
    grid-area: main;
    padding-bottom: max(var(--gutter), env(safe-area-inset-bottom));
  }
  .bottomnav {
    display: none;
  }
}
@media (hover: hover) and (min-width: 640px) {
  .nav-list a:hover {
    background: var(--surface-2);
  }
}

/* Very short screens (feature phones, split-screen): let the bars scroll away with the page. */
@media (max-height: 420px) {
  .appbar,
  .filters {
    position: static;
  }
  .sidenav {
    top: 0;
    height: 100dvh;
  }
}

/* Short landscape screens: keep the chrome compact so content keeps the height. */
@media (max-height: 480px) and (min-width: 560px) {
  .brand-text small {
    display: none;
  }
  .appbar {
    padding-top: max(0.3rem, env(safe-area-inset-top));
    padding-bottom: 0.3rem;
  }
  .nav-list a {
    padding: 0.35rem 0.25rem;
  }
}

/* Laptops and desktops: labelled sidebar, and the brief's three sections shown together. */
@media (min-width: 1024px) {
  .app {
    display: flex;
    flex-direction: column;
  }
  .sidenav {
    padding: 1rem 0.75rem;
  }
  .nav-list a {
    flex-direction: row;
    gap: 0.7rem;
    padding: 0.6rem 0.75rem;
    font-size: var(--fs-sm);
    text-align: left;
  }
  .nav-count {
    position: static;
    margin-left: auto;
  }
  .sidenav-note {
    display: block;
    margin-top: auto;
    padding: 0.75rem;
    font-size: var(--fs-xs);
    color: var(--muted);
  }
  .main:is([data-view="overview"], [data-view="confirmed"], [data-view="upcoming"]) > #overview {
    display: block;
  }
}

/* Wide monitors: spacious centered layout with fluid geometry */
@media (min-width: 1600px) {
  .main:is([data-view="overview"], [data-view="confirmed"], [data-view="upcoming"]) {
    display: block;
    max-width: 1680px;
    margin-inline: auto;
  }
}

/* Ultrawide and 4K: cap line length and centre the shell. */
@media (min-width: 2400px) {
  .app {
    max-width: 2560px;
    margin-inline: auto;
    border-inline: 1px solid var(--line);
  }
}

/* Dual-screen foldables spanning the fold side by side (Surface Duo, Galaxy Z Fold, Pixel Fold,
   Zenbook Fold): content on the left screen, the brief on the right, nothing under the hinge. */
@media (horizontal-viewport-segments: 2) {
  .app {
    display: grid;
    grid-template-columns: env(viewport-segment-width 0 0) env(viewport-segment-width 1 0);
    column-gap: calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0));
    grid-template-rows: auto 1fr;
    grid-template-areas: "bar bar" "main brief";
  }
  .sidenav {
    display: none;
  }
  .main {
    grid-area: main;
    padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + var(--gutter));
  }
  .main > #overview {
    display: block !important;
    position: fixed;
    top: var(--appbar-h);
    bottom: 0;
    left: env(viewport-segment-left 1 0);
    width: env(viewport-segment-width 1 0);
    margin: 0;
    padding: var(--gutter);
    overflow-y: auto;
    background: var(--bg);
  }
  .main[data-view="overview"] > #confirmed {
    display: block;
  }
  .bottomnav {
    display: grid;
    right: auto;
    width: env(viewport-segment-width 0 0);
  }
  .bottomnav a[data-nav="overview"] {
    display: none;
  }
  .bottomnav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* Foldables held like a laptop (fold across the middle): brief pinned to the upper screen,
   filters and lists start on the lower screen. */
@media (vertical-viewport-segments: 2) {
  .main {
    padding-top: calc(env(viewport-segment-top 0 1) - var(--appbar-h) + var(--gutter));
  }
  .main > #overview {
    display: block !important;
    position: fixed;
    z-index: 15;
    top: var(--appbar-h);
    left: 0;
    right: 0;
    height: calc(env(viewport-segment-bottom 0 0) - var(--appbar-h));
    margin: 0;
    padding: var(--gutter);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg);
  }
  .filters {
    top: env(viewport-segment-top 0 1);
    margin-top: 0;
  }
  .main[data-view="overview"] > #confirmed {
    display: block;
  }
}
@media (vertical-viewport-segments: 2) and (min-width: 640px) {
  .main > #overview {
    left: var(--rail);
  }
}
@media (vertical-viewport-segments: 2) and (min-width: 1024px) {
  .main > #overview {
    left: var(--sidebar);
  }
}

/* ------------------------------------------------------------------ filters */
.filters {
  position: sticky;
  top: var(--appbar-h);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: calc(var(--gutter) * -1) calc(var(--gutter) * -1) 0;
  padding: 0.65rem var(--gutter);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.filters-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 480px;
  min-width: 0;
}
.search {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}
.search .icon {
  position: absolute;
  left: 0.7rem;
  color: var(--muted);
  pointer-events: none;
}
.search input {
  padding-left: 2.2rem;
}
.filters-toggle {
  flex: none;
}
.filters-badge {
  min-width: 1.2rem;
  padding: 0 0.3rem;
  border-radius: 0.6rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.7rem;
  line-height: 1.2rem;
}
.filters-more {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 480px;
}
.filters.is-open .filters-more {
  display: flex;
}
.filters-more .select {
  flex: 1 1 9.5rem;
  min-width: 0;
}
.seg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  padding: 0.2rem;
  gap: 0.2rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow-x: auto;
  scrollbar-width: none;
}
.seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex: 1 0 auto;
  min-height: calc(var(--tap) - 0.4rem);
  padding: 0.3rem 0.7rem;
  border: 0;
  border-radius: calc(var(--radius-sm) - 0.15rem);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.seg-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  background: var(--surface-3);
  color: var(--ink-2);
  transition: all 0.15s ease;
}
.seg-count:empty {
  display: none;
}
.seg-count.has-matches {
  background: rgba(227, 179, 65, 0.22);
  color: #9a6c0b;
}
:root[data-theme="dark"] .seg-count.has-matches {
  background: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
}
.seg button[aria-checked="true"] .seg-count.has-matches {
  background: #e3b341;
  color: #1a1a1a;
}
.seg button[aria-checked="true"],
.seg button[aria-selected="true"],
.seg button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px var(--ring), 0 0 0 1px var(--ring);
}
.admin-tab-bar {
  margin-bottom: var(--gap);
  max-width: 440px;
}
.admin-tab-panel[hidden] {
  display: none !important;
}
/* Centered filters on desktop and wide screens */
@media (min-width: 900px) {
  .filters {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
  }
  .filters-row {
    flex: 0 1 24rem;
    max-width: 26rem;
    width: auto;
  }
  .filters-toggle {
    display: none;
  }
  .filters-more {
    display: flex;
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    justify-content: center;
  }
  .seg {
    flex: 0 0 auto;
    width: auto;
  }
  .filters-more .select {
    flex: 1 1 9rem;
    max-width: 14rem;
  }
}

/* ------------------------------------------------------------------ brief: head, notices, KPIs */
.report-head {
  display: grid;
  gap: 0.35rem;
}
.eyebrow {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.report-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.1rem 0.5rem;
  border-radius: 1rem;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}
.badge-ai {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--link);
}
.notices {
  display: grid;
  gap: 0.5rem;
  margin-top: var(--gap);
}
.notices:empty {
  display: none;
}
.notice {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--fs-sm);
}
.notice .icon {
  margin-top: 0.1rem;
}
.notice-warn {
  background: var(--notice-bg);
  border-color: var(--notice-line);
}
.notice-error {
  background: var(--error-bg);
  border-color: var(--error-line);
}
.notice-info {
  background: var(--accent-soft);
  border-color: transparent;
}
.notice-info .icon {
  color: var(--link);
}
.notice-empty {
  font-size: var(--fs-md);
  font-weight: 600;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
  gap: var(--gap);
  margin-top: var(--gap);
}
.kpi {
  display: grid;
  align-content: start;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.kpi-label {
  font-size: var(--fs-sm);
  color: var(--ink-2);
}
.kpi-value {
  font-size: var(--fs-kpi);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.kpi-sub {
  font-size: var(--fs-xs);
  color: var(--muted);
  overflow-wrap: anywhere;
}
.card {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  min-width: 0;
  margin-top: var(--gap);
  padding: clamp(0.9rem, 0.7rem + 0.8vw, 1.35rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--fs-md);
  font-weight: 650;
  color: var(--ink);
  line-height: 1.3;
}
.card-sub {
  margin-top: 0.25rem;
  font-size: var(--fs-xs, 0.78rem);
  color: var(--muted);
  line-height: 1.45;
}

/* ------------------------------------------------------------------ 4 Postcards Deck & Respective Expandable Panels */
.deck-view {
  width: 100%;
}
.postcard-deck {
  width: 100%;
  margin-top: var(--gap);
}

/* Desktop (>= 900px): 4 postcards side-by-side on Row 1, active panel spans full width on Row 2 */
@media (min-width: 900px) {
  .postcard-deck {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
  }
  .postcard-group {
    display: contents;
  }
  .postcard {
    grid-row: 1;
  }
  .postcard-panel {
    grid-row: 2;
    grid-column: 1 / -1;
    margin-top: 1.15rem;
  }
}

/* Mobile & Tablet (< 900px): Accordion layout where each section expands directly under its respective box */
@media (max-width: 899px) {
  .postcard-deck {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
  .postcard-group {
    display: flex;
    flex-direction: column;
    width: 100%;
  }
  .postcard {
    width: 100%;
    min-height: auto;
  }
  .postcard-panel {
    width: 100%;
    margin-top: 0.5rem;
  }
}

.postcard {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 155px;
  padding: 1.15rem 1.15rem 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.2s ease,
              box-shadow 0.2s ease,
              background-color 0.2s ease;
}
@media (hover: hover) {
  .postcard:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 6px 18px -4px rgba(0, 0, 0, 0.12);
  }
}
.postcard:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.postcard.is-active {
  background: var(--surface-2);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), 0 8px 24px -4px rgba(37, 99, 235, 0.18);
  transform: translateY(-2px);
}
@media (min-width: 900px) {
  .postcard.is-active::after {
    content: "";
    position: absolute;
    bottom: -11px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-top: 10px solid var(--accent);
    z-index: 5;
  }
}
.postcard-stamp {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  padding: 0.2rem 0.45rem;
  font-size: 0.62rem;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1.5px dashed var(--accent);
  border-radius: 3px;
  background: rgba(37, 99, 235, 0.05);
  pointer-events: none;
  line-height: 1;
}
.postcard-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}
.postcard-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--accent);
  flex-shrink: 0;
}
.postcard-icon svg {
  width: 0.95rem;
  height: 0.95rem;
}
.postcard-tag {
  font-size: 0.68rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.postcard-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  margin: 0;
}
.postcard-desc {
  font-size: 0.77rem;
  color: var(--muted);
  line-height: 1.4;
  margin: 0.35rem 0 auto 0;
}
.postcard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--line);
}
.postcard-stat {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.postcard-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 9999px;
  background: var(--surface-3);
  color: var(--muted);
  transition: transform 0.25s ease, background-color 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}
.postcard-indicator svg {
  width: 0.75rem;
  height: 0.75rem;
}
.postcard.is-active .postcard-indicator {
  transform: rotate(180deg);
  background: var(--accent);
  color: #fff;
}

/* ------------------------------------------------------------------ Expanded Panels */
.postcard-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(0.9rem, 0.75rem + 1vw, 1.5rem);
  animation: panelFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes panelFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.postcard-panel[hidden] {
  display: none !important;
}

.panel-top-bar,
.panel-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-top-bar {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.panel-bottom-bar {
  justify-content: flex-end;
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
}
.panel-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.panel-title .icon {
  width: 1rem;
  height: 1rem;
  flex: none;
}
.panel-collapse-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 9999px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.panel-collapse-btn:hover {
  background: var(--surface-3);
  border-color: var(--accent);
  color: var(--accent);
}
.panel-collapse-btn .icon {
  width: 0.75rem;
  height: 0.75rem;
}

/* ------------------------------------------------------------------ Collapsible components */
.collapsible-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.collapse-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}
.collapsible-head:hover .collapse-toggle-btn,
.collapsible-head:focus-visible .collapse-toggle-btn {
  border-color: var(--accent);
  color: var(--ink);
}
.collapsible-head[aria-expanded="true"] .collapse-toggle-btn {
  transform: rotate(180deg);
  border-color: var(--accent);
  color: var(--accent);
}
.collapsible-body.is-collapsed {
  display: none !important;
}

.toggle-all-btn {
  display: none;
}
.row-toggle-btn {
  display: none;
}

.daily-brief-card {
  margin-bottom: var(--gap);
}
.daily-brief-card .report-head {
  margin-bottom: 0;
}
.brief-narrative {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0.75rem 0 1.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem;
}
.brief-narrative-p {
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.65;
  margin: 0;
}
.brief-narrative-p strong {
  color: var(--accent);
  font-weight: 600;
}
.brief-narrative .ticker-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0 0.2rem;
  padding: 0.15rem 0.45rem;
  font-size: var(--fs-xs);
  font-family: var(--mono);
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  vertical-align: baseline;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.brief-narrative .ticker-btn:hover {
  background: var(--surface-3);
  border-color: var(--accent);
  color: var(--accent);
}
.brief-narrative .ticker-btn .up {
  color: var(--up);
}
.brief-narrative .ticker-btn .down {
  color: var(--down);
}
.brief-narrative .ticker-btn .opt-badge {
  font-size: 0.62rem;
  padding: 0.05rem 0.3rem;
  border-radius: 2px;
  background: rgba(0, 229, 153, 0.15);
  color: var(--accent);
}

@media (max-width: 768px), (pointer: coarse) and (max-width: 1023px) {
  .collapsible-card .collapsible-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    padding: 0.25rem 0;
  }
  .section-head.collapsible-head {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .collapse-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-sm, 3px);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--muted);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
  }
  .collapsible-head:hover .collapse-toggle-btn,
  .collapsible-head:focus-visible .collapse-toggle-btn {
    border-color: var(--accent);
    color: var(--fg);
  }
  .collapsible-head[aria-expanded="true"] .collapse-toggle-btn {
    transform: rotate(180deg);
    border-color: var(--accent);
    color: var(--accent);
  }
  .collapsible-body.is-collapsed {
    display: none !important;
  }
  .toggle-all-btn {
    display: inline-flex;
    align-items: center;
    font-size: var(--fs-xs, 0.75rem);
    padding: 0.25rem 0.6rem;
  }

  /* Contract row cards on mobile */
  .date-cell-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
  }
  .row-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
    transition: transform 0.2s ease, color 0.2s ease;
  }
  .data-table tr.row {
    position: relative;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s ease, background 0.15s ease;
  }
  .data-table tr.row:hover {
    border-color: var(--border-hover, #2a384c);
  }
  .data-table tr.row.is-collapsed .row-toggle-btn {
    transform: rotate(0deg);
  }
  .data-table tr.row:not(.is-collapsed) .row-toggle-btn {
    transform: rotate(180deg);
    color: var(--accent, #00E599);
  }
  .data-table tr.row.is-collapsed td:nth-child(4), /* Agency */
  .data-table tr.row.is-collapsed td:nth-child(6) { /* Source */
    display: none !important;
  }
  .data-table tr.row.is-collapsed td:nth-child(5) .cell-sub { /* Detailed scope text */
    display: none !important;
  }
}
.takeaways-metrics {
  margin-bottom: 1.25rem;
}
.takeaways {
  display: grid;
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.takeaways li.takeaway-card-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent, #00E599);
  border-radius: var(--radius-sm, 3px);
  transition: border-color var(--transition-fast, 0.15s ease), background var(--transition-fast, 0.15s ease);
}
.takeaways li.takeaway-card-item:hover {
  border-color: var(--border-hover, #2a384c);
  border-left-color: var(--accent, #00E599);
}
.takeaway-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.takeaway-tag {
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-xs, 0.75rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent, #00E599);
  font-family: var(--font-mono, monospace);
}
.takeaway-num {
  font-family: var(--font-mono, monospace);
  font-size: var(--fs-xs, 0.75rem);
  color: var(--muted);
  font-weight: 600;
}
.takeaway-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.takeaway-body {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: var(--fs-base, 0.9375rem);
  line-height: 1.6;
  color: var(--ink);
}
.takeaway-stocks {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  max-width: 42%;
  padding-left: 1rem;
  border-left: 1px dashed var(--line);
}
.takeaway-stocks .ticker {
  display: inline-flex;
  margin: 0;
}
@media (max-width: 639px) {
  .takeaway-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }
  .takeaway-stocks {
    max-width: 100%;
    padding-left: 0;
    padding-top: 0.5rem;
    border-left: none;
    border-top: 1px dashed var(--line);
    justify-content: flex-end;
  }
}
.takeaways li:not(.takeaway-card-item) {
  padding-left: 0.25rem;
  line-height: 1.55;
}
.takeaways li:not(.takeaway-card-item)::marker {
  color: var(--muted);
  font-weight: 700;
}

/* Sector bars: one series, one hue; thin bars from a shared baseline, value at the tip. */
.bars {
  display: grid;
  gap: 0.15rem;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(4.5rem, 7.5rem) minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  outline-offset: 0;
}
.bar-label {
  font-size: var(--fs-sm);
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  position: relative;
  height: 0.75rem;
  border-left: 1px solid var(--line-strong);
}
.bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w, 0%);
  min-width: 2px;
  border-radius: 0 4px 4px 0;
  background: var(--bar);
}
.bar-value {
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.bar-value small {
  color: var(--muted);
}
.bar-row:hover,
.bar-row:focus-visible {
  background: var(--surface-2);
}
.bar-row:hover .bar,
.bar-row:focus-visible .bar {
  filter: brightness(1.12);
}
@container (max-width: 20rem) {
  .bar-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "label value" "track track";
    row-gap: 0.25rem;
    padding-block: 0.35rem;
  }
  .bar-label {
    grid-area: label;
  }
  .bar-value {
    grid-area: value;
  }
  .bar-track {
    grid-area: track;
  }
}
.card {
  container-type: inline-size;
}
.empty-chart {
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* ------------------------------------------------------------------ sections and tables */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}
.section-head > div:first-child {
  min-width: min(100%, 18rem);
  flex: 1 1 22rem;
}
.section-sub {
  margin-top: 0.2rem;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
@media (max-width: 419px) {
  .section-actions .btn span {
    display: none;
  }
}
#confirmed,
#upcoming {
  scroll-margin-top: calc(var(--appbar-h) + 5rem);
}
@media (min-width: 1024px) {
  .main:is([data-view="overview"], [data-view="confirmed"], [data-view="upcoming"]) > #confirmed,
  .main:is([data-view="overview"], [data-view="confirmed"], [data-view="upcoming"]) > #upcoming {
    margin-top: calc(var(--gap) * 2);
  }
}
.table-wrap {
  container-type: inline-size;
  container-name: tbl;
  margin-top: 0.85rem;
  min-width: 0;
}

/* Narrow containers: each row is a card. */
.data-table {
  display: block;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
}
.data-table thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.data-table tbody {
  display: grid;
  gap: 0.6rem;
}
.data-table tr.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "a b" "c c" "d d" "e e" "f f";
  gap: 0.3rem 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.data-table td {
  display: block;
  min-width: 0;
  padding: 0;
}
.data-table td:nth-child(1) {
  grid-area: a;
}
.data-table td:nth-child(2) {
  grid-area: c;
}
.data-table td:nth-child(3) {
  grid-area: b;
  justify-self: end;
  text-align: right;
}
.data-table td:nth-child(4) {
  grid-area: d;
}
.data-table td:nth-child(5) {
  grid-area: e;
}
.data-table td:nth-child(6) {
  grid-area: f;
  padding-top: 0.4rem;
  border-top: 1px solid var(--line);
}
.data-table td[data-label]::before {
  content: attr(data-label);
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
}
.data-table td.c-lead::before,
.data-table td.c-ticker::before,
.data-table td.c-source::before {
  content: none;
}
.data-table tr.row.is-watch {
  box-shadow: inset 3px 0 0 var(--accent), var(--shadow);
}
.data-table .empty-row td {
  padding: 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}
/* Very narrow cards: the ticker drops under the company name. */
@container tbl (max-width: 21rem) {
  .data-table tr.row {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "a" "c" "b" "d" "e" "f";
  }
  .data-table td:nth-child(3) {
    justify-self: start;
    text-align: left;
  }
}
/* Medium containers (tablet portrait, half-width windows): two columns of cards. */
@container tbl (min-width: 40rem) and (max-width: 51.99rem) {
  .data-table tbody {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .data-table .empty-row {
    grid-column: 1 / -1;
  }
}
/* Wide containers: a real table. */
@container tbl (min-width: 52rem) {
  .data-table {
    display: table;
    table-layout: fixed;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
  }
  .data-table thead {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    display: table-header-group;
  }
  .data-table tbody {
    display: table-row-group;
  }
  .data-table tr {
    display: table-row;
  }
  .data-table tr.row {
    display: table-row;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .data-table tr.row.is-watch td:first-child {
    box-shadow: inset 3px 0 0 var(--accent);
  }
  .data-table th,
  .data-table td,
  .data-table td:nth-child(n) {
    display: table-cell;
    padding: 0.75rem 0.8rem;
    border-top: 0;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    text-align: left;
    justify-self: auto;
  }
  .data-table tbody tr:last-child td {
    border-bottom: 0;
  }
  .data-table th {
    position: sticky;
    top: 0;
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .data-table td[data-label]::before {
    content: none;
  }
  .data-table .col-date {
    width: 7rem;
  }
  .data-table .col-company {
    width: 17%;
  }
  .data-table .col-ticker {
    width: 9.5rem;
  }
  .data-table .col-agency {
    width: 17%;
  }
  .data-table .col-source {
    width: 18%;
  }
  .data-table .empty-row td {
    border: 0;
  }
}
@media (hover: hover) {
  .data-table tr.row:hover {
    background: var(--surface-2);
  }
}
.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.sort-btn[aria-pressed="true"]::after {
  content: "↓";
}
.cell-main {
  font-weight: 600;
  color: var(--ink);
}
.cell-sub {
  display: block;
  margin-top: 0.15rem;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.date-cell time {
  font-weight: 600;
  white-space: nowrap;
}
.stage {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: var(--fs-xs);
  color: var(--muted);
}
@container tbl (min-width: 52rem) {
  .stage {
    display: block;
    margin: 0.15rem 0 0;
  }
}
.company-btn {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.2em;
}
.company-btn:hover {
  text-decoration-color: currentColor;
}
.watch-star {
  width: 0.95em;
  height: 0.95em;
  margin-right: 0.25rem;
  color: var(--accent);
  vertical-align: -0.1em;
}
.value-cell strong {
  display: block;
  font-variant-numeric: tabular-nums;
}
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.source-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  max-width: 100%;
  color: var(--link);
  text-decoration: none;
}
.source-link .src-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.source-link .icon {
  width: 0.9em;
  height: 0.9em;
  align-self: center;
}
.source-link:hover .src-title {
  text-decoration: underline;
}
.source-more {
  display: inline-block;
  margin-top: 0.15rem;
}
.context-text {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--ink-2);
}

/* Ticker chips: listing, latest move (sign + arrow, never colour alone) and options badge. */
.tickers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: inherit;
}
.data-table td:nth-child(3) .tickers {
  justify-content: flex-end;
}
@container tbl (max-width: 21rem) {
  .data-table td:nth-child(3) .tickers {
    justify-content: flex-start;
  }
}
@container tbl (min-width: 52rem) {
  .data-table td:nth-child(3) .tickers {
    justify-content: flex-start;
  }
}
.ticker {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.35rem;
  padding: 0.15rem 0.45rem;
  border-radius: 0.4rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: var(--fs-xs);
  white-space: nowrap;
}
.ticker-code {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--ink);
}
.ticker[data-listing="Private"],
.ticker[data-listing="Government-owned"],
.ticker[data-listing="Unverified"] {
  background: transparent;
  color: var(--muted);
}
.ticker[data-listing="Private"] .ticker-code,
.ticker[data-listing="Government-owned"] .ticker-code,
.ticker[data-listing="Unverified"] .ticker-code {
  font-family: var(--font);
  font-weight: 600;
  color: var(--muted);
}
.chg {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.chg .icon {
  width: 0.6rem;
  height: 0.6rem;
  vertical-align: 0;
}
.chg.up {
  color: var(--up);
}
.chg.down {
  color: var(--down);
}
.chg.flat {
  color: var(--muted);
}
/* ASX codes stand out from unlisted names and open the price history. */
button.ticker-btn {
  min-height: 1.75rem;
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-xs);
  cursor: pointer;
}
button.ticker-btn .ticker-code {
  color: var(--link);
}
button.ticker-btn:hover {
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 1px var(--accent-hover);
}
.opt-badge {
  padding: 0 0.3rem;
  border-radius: 0.25rem;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ settings */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: var(--gap);
  margin-top: 0.4rem;
  align-items: start;
}
.settings-grid .card {
  margin-top: 0;
}
.card-wide {
  grid-column: 1 / -1;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
}
.chips:empty::before {
  content: "No tickers yet.";
  font-size: var(--fs-sm);
  color: var(--muted);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.25rem 0.15rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 1rem;
  font-family: var(--mono);
  font-size: var(--fs-sm);
  font-weight: 700;
  transition: all 0.15s ease;
}
.chip.is-confirming {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}
.chip button {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip button:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.chip-confirm {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.2rem;
}
.chip-confirm[hidden] {
  display: none;
}
.chip-btn-confirm {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: auto !important;
  height: auto !important;
  padding: 0.15rem 0.5rem !important;
  font-size: 0.72rem !important;
  font-family: var(--font) !important;
  font-weight: 700 !important;
  border-radius: 0.8rem !important;
  border: 1px solid #ef4444 !important;
  background: #ef4444 !important;
  color: #fff !important;
  cursor: pointer;
  line-height: 1.2 !important;
  transition: all 0.15s ease;
}
.chip-btn-confirm:hover {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #fff !important;
}
.chip-btn-cancel {
  display: grid !important;
  place-items: center;
  width: 1.35rem !important;
  height: 1.35rem !important;
  padding: 0 !important;
  border: 1px solid var(--line) !important;
  border-radius: 50% !important;
  background: var(--surface-2) !important;
  color: var(--muted) !important;
  cursor: pointer;
}
.chip-btn-cancel:hover {
  color: var(--ink) !important;
  background: var(--surface-3) !important;
}
.chip-btn-cancel .icon {
  width: 0.75rem;
  height: 0.75rem;
}
.thresholds {
  display: grid;
  gap: 0.6rem;
  margin: 0.4rem 0 0;
  padding: 0.75rem 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.thresholds legend {
  padding: 0;
  font-size: var(--fs-sm);
  font-weight: 650;
}
.data-table.compact {
  font-size: var(--fs-xs);
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-pill .dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--muted);
}
.status-pill[data-status="ok"] .dot {
  background: #0ca30c;
}
.status-pill[data-status="partial"] .dot,
.status-pill[data-status="stale"] .dot {
  background: #fab219;
}
.status-pill[data-status="error"] .dot {
  background: #d03b3b;
}
.md-raw {
  max-height: 32rem;
  margin: 0;
  padding: 1rem;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ footer */
.app-foot {
  margin-top: calc(var(--gap) * 2);
  padding-top: var(--gap);
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--muted);
  max-width: 70rem;
}

/* ------------------------------------------------------------------ detail dialog */
.dialog {
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--ink);
}
.dialog::backdrop {
  background: var(--scrim);
}
.dialog-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.dialog-head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: max(1rem, env(safe-area-inset-top)) max(1.1rem, env(safe-area-inset-right)) 0.9rem max(1.1rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}
.dialog-heading {
  flex: 1;
  min-width: 0;
}
.dialog-heading h2 {
  font-size: var(--fs-lg);
}
.dialog-head-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  align-self: center;
}
.company-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-watch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-watch:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-watch .icon-star,
.btn-watch .icon {
  width: 0.85rem;
  height: 0.85rem;
}
.btn-watch.is-watched {
  background: rgba(227, 179, 65, 0.15);
  border-color: #e3b341;
  color: #9a6c0b;
}
.btn-watch.is-watched .icon-star,
.btn-watch.is-watched .icon {
  fill: #e3b341;
  color: #e3b341;
}
.ticker-item-group {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.btn-star-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border-radius: var(--radius-sm, 0.35rem);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  vertical-align: middle;
}
.btn-star-toggle:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}
.btn-star-toggle .icon-star {
  width: 0.9rem;
  height: 0.9rem;
}
.btn-star-toggle.is-watched {
  color: #e3b341;
}
.btn-star-toggle.is-watched .icon-star {
  fill: #e3b341;
}
.btn-star-toggle.is-watched:hover {
  background: rgba(227, 179, 65, 0.15);
  border-color: rgba(227, 179, 65, 0.3);
}
button.watch-star-btn {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  vertical-align: -0.1em;
  transition: opacity 0.15s ease;
}
button.watch-star-btn:hover {
  opacity: 0.75;
}
.dialog-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  align-content: start;
  gap: 1.1rem;
  padding: 1rem max(1.1rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom)) max(1.1rem, env(safe-area-inset-left));
}
/* Popups fit the screen: lists are paged in script, so no scrollbar is ever drawn. The body can
   still scroll as a last resort (e.g. very large text), just without a visible bar. */
.dialog-body {
  scrollbar-width: none;
}
.dialog-body::-webkit-scrollbar {
  display: none;
}
.dialog-heading h2 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp-4 {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.detail-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line);
}
.detail-tabs button {
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--tap);
  padding: 0.4rem 0.5rem;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.detail-tabs button[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--ink);
}
.detail-panel:not(.is-active) {
  display: none;
}
.detail-stack {
  display: grid;
  gap: 1.1rem;
}
.company-list {
  display: grid;
  gap: 0.6rem;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.pager-status {
  font-variant-numeric: tabular-nums;
}
.pager-btn {
  min-width: var(--tap);
  min-height: 2rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.pager-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
/* Short screens (small phones, landscape): tighter spacing and shorter text so popups still fit. */
@media (max-height: 640px) {
  .dialog-head {
    padding-top: max(0.6rem, env(safe-area-inset-top));
    padding-bottom: 0.5rem;
  }
  .dialog-heading h2 {
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  .dialog-body {
    gap: 0.6rem;
    padding-top: 0.6rem;
  }
  .detail-section h3 {
    margin-bottom: 0.3rem;
  }
  .facts {
    gap: 0.35rem 0.75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .clamp-4 {
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  .detail-tabs button {
    min-height: 2.25rem;
  }
}
/* Phones in landscape: one-line titles, and the price chart sits beside its numbers. */
@media (max-height: 480px) {
  .dialog-heading h2 {
    -webkit-line-clamp: 1;
    line-clamp: 1;
  }
  .dialog-body {
    gap: 0.5rem;
  }
}
@media (max-height: 480px) and (min-width: 560px) {
  dialog.dialog {
    max-height: calc(100dvh - 1rem);
  }
  .facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .facts .fact-wide {
    grid-column: span 2;
  }
  .paged {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.75rem;
  }
  .pager {
    margin-top: 0;
  }
  #price-dialog.dialog {
    width: min(46rem, calc(100% - 2rem));
  }
  #price-body {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    column-gap: 1.25rem;
  }
  #price-body > * {
    grid-column: 1;
  }
  #price-body > .price-chart {
    grid-column: 2;
    grid-row: 1 / span 4;
    margin: 0;
  }
  .price-last {
    margin-bottom: 0;
  }
  .price-last strong {
    font-size: var(--fs-xl);
  }
  #price-body .price-periods {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 0;
  }
  #price-body .facts.price-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* With room, the details popup shows every tab side by side. */
@media (min-width: 1100px) and (min-height: 560px) {
  #detail.dialog {
    width: min(76rem, calc(100% - 2rem));
  }
  .detail-tabs {
    display: none;
  }
  .detail-panels {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    align-items: start;
    gap: 1.5rem;
  }
  .detail-panel:not(.is-active) {
    display: block;
  }
  .detail-panel + .detail-panel {
    padding-left: 1.5rem;
    border-left: 1px solid var(--line);
  }
}
.detail-section h3 {
  margin-bottom: 0.5rem;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: 0.6rem 1rem;
  margin: 0;
}
.facts div {
  min-width: 0;
}
.facts dt {
  font-size: var(--fs-xs);
  color: var(--muted);
}
.facts dd {
  margin: 0;
  font-weight: 600;
}
.company-card {
  display: grid;
  gap: 0.5rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.company-card + .company-card {
  margin-top: 0.5rem;
}
.company-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  font-size: var(--fs-sm);
}
.source-list {
  display: grid;
  gap: 0.5rem;
  padding: 0;
  list-style: none;
}
.source-list li {
  display: grid;
  gap: 0.1rem;
  font-size: var(--fs-sm);
}
.source-list .cell-sub {
  margin: 0;
}
@media (min-width: 640px) {
  .dialog {
    width: min(46rem, calc(100% - 2rem));
    height: auto;
    max-height: min(52rem, calc(100dvh - 3rem));
    margin: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
  }
  .dialog-inner {
    max-height: inherit;
  }
}
@media (horizontal-viewport-segments: 2) {
  .dialog {
    width: env(viewport-segment-width 0 0);
    height: 100%;
    max-height: 100%;
    margin: 0;
    border-radius: 0;
  }
}

/* ------------------------------------------------------------------ tooltip and toast */
.tooltip {
  position: fixed;
  z-index: 60;
  max-width: min(18rem, calc(100vw - 1rem));
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--bg);
  font-size: var(--fs-xs);
  line-height: 1.35;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.tooltip strong {
  display: block;
  font-size: var(--fs-sm);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + 0.75rem);
  z-index: 70;
  max-width: calc(100vw - 2rem);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--bg);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, 1rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (min-width: 640px) {
  .toast {
    bottom: 1.5rem;
  }
}

/* ------------------------------------------------------------------ input modes and preferences */
/* Touch and pen: bigger targets, no hover-only affordances. */
@media (pointer: coarse) {
  :root {
    --tap: 2.875rem;
  }
  .company-btn {
    padding-block: 0.2rem;
  }
  .source-link {
    padding-block: 0.25rem;
  }
  .bar-row {
    min-height: 2.75rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
@media (forced-colors: active) {
  .bar {
    background: CanvasText;
  }
  .switch input {
    border: 1px solid CanvasText;
  }
  .switch input:checked {
    background: Highlight;
  }
  .nav-list a[aria-current="page"],
  .bottomnav a[aria-current="page"] {
    outline: 2px solid Highlight;
  }
}
@media print {
  .appbar,
  .sidenav,
  .bottomnav,
  .filters,
  .section-actions,
  #settings,
  #other,
  .toast,
  .tooltip {
    display: none !important;
  }
  .app {
    display: block;
  }
  .main {
    padding: 0;
  }
  .view#overview,
  .view#confirmed,
  .view#upcoming,
  .view#takeaways-view {
    display: block !important;
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .card,
  .kpi,
  .data-table tr.row {
    box-shadow: none;
    break-inside: avoid;
  }
}

/* ------------------------------------------------------------------ tokens and superadmin */
.token {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.token[data-tip] {
  cursor: help;
  border-radius: 0.3rem;
}
.token-icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}
.wallet-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: var(--tap);
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
@media (hover: hover) {
  .wallet-btn:hover {
    background: var(--surface-2);
  }
}
.unlock-btn {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  min-height: calc(var(--tap) - 0.25rem);
  padding: 0.3rem 0.7rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.unlock-btn .icon {
  color: var(--muted);
}
@media (hover: hover) {
  .unlock-btn:hover {
    border-style: solid;
    border-color: var(--accent);
  }
}
.locked-note {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: var(--fs-xs);
}
.locked-panel {
  display: grid;
  gap: 0.6rem;
  justify-items: start;
  padding: 0.9rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
}
.dialog-small .dialog-inner {
  max-width: 100%;
}

/* Price history popup */
.price-last {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.6rem;
  margin: 0 0 0.75rem;
}
.price-last strong {
  font-size: var(--fs-kpi);
  font-variant-numeric: tabular-nums;
}
/* Period picker: four across, two by two on very narrow phones. */
.price-periods {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}
@media (max-width: 359px) {
  .price-periods {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.price-periods button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 0;
  min-height: 2.25rem;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  white-space: nowrap;
}
.price-periods button:hover {
  border-color: var(--accent);
}
.price-periods button[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.price-periods .period-label {
  font-weight: 700;
}
.price-periods .chg {
  font-size: var(--fs-xs);
}
.price-readout {
  margin: 0 0 0.35rem;
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.price-plot {
  position: relative;
  height: 9rem;
  padding-left: 0;
  border-radius: var(--radius-sm);
  touch-action: pan-y;
}
.price-line {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.price-path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.price-grid {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.price-axis {
  position: absolute;
  right: 0;
  padding: 0 0.25rem;
  border-radius: 0.25rem;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}
.price-axis-max {
  top: 0;
  transform: translateY(-50%);
}
.price-axis-min {
  bottom: 0;
  transform: translateY(50%);
}
.price-cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line-strong);
  pointer-events: none;
}
.price-dot {
  position: absolute;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.price-chart {
  margin-bottom: 1rem;
}
.facts.price-facts {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 479px) {
  .facts.price-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 640px) {
  .dialog.dialog-small {
    width: min(30rem, calc(100% - 2rem));
  }
}
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.buy-total {
  font-weight: 700;
  min-height: 1.5em;
}
textarea {
  width: 100%;
  min-width: 0;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  resize: vertical;
}
input[type="password"] {
  min-height: var(--tap);
  width: 100%;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.admin-login {
  max-width: 26rem;
  margin-top: 0.4rem;
}
.item-form {
  display: grid;
  gap: 0.7rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}
.item-form h4 {
  margin: 0;
  font-size: var(--fs-sm);
}
.item-form .inline-form .field {
  flex: 1 1 8rem;
}
.admin-table .inline-form {
  flex-wrap: nowrap;
}
.admin-table .inline-form input {
  max-width: 8rem;
}
.ledger summary {
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.ledger ul {
  margin-top: 0.6rem;
}

/* ------------------------------------------------------------------ schema-generated forms */
.field-hint {
  display: block;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.error-msg {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--down);
}
.error-msg:empty {
  display: none;
}
[aria-invalid="true"] {
  border-color: var(--down) !important;
  outline-color: var(--down);
}
.schema-fields,
form.card {
  display: grid;
  gap: 0.6rem;
  align-content: start;
}
.schema-fields.inline-form {
  display: flex;
}
.schema-group {
  display: grid;
  gap: 0.6rem;
  min-width: 0;
  margin: 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.schema-group legend {
  padding: 0 0.3rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
}
textarea {
  width: 100%;
  min-width: 0;
  min-height: 5rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: max(16px, var(--fs-sm));
  color: var(--ink);
  resize: vertical;
}
.item-form > .field,
.item-form > .switch {
  max-width: 40rem;
}
.item-form > button {
  justify-self: start;
}
form.card > button[type="submit"] {
  justify-self: start;
}
.inline-form > .field {
  flex: 1 1 10rem;
  max-width: 20rem;
}
.inline-form > .form-error {
  flex-basis: 100%;
}
.admin-table .inline-form > .field {
  flex: 0 1 8rem;
}
.admin-table .inline-form > .field label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ Geolocation, Weather & Time Widget */
.geo-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0 0.85rem;
  background: var(--surface-2);
  border: 0;
  border-top: 1px solid var(--line-strong);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  z-index: 95;
  transition: background-color 0.15s ease, color 0.15s ease, border-top-color 0.15s ease;
}
.geo-bar:hover,
.geo-bar:focus-visible {
  background: var(--surface-3);
  color: var(--ink);
  border-top-color: var(--accent);
  outline: none;
}
.geo-bar-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}
.geo-bar .geo-icon {
  width: 0.85rem;
  height: 0.85rem;
  color: var(--accent);
  flex-shrink: 0;
}
.geo-bar-sep {
  opacity: 0.45;
  user-select: none;
}

@media (max-width: 639px) {
  .geo-bar {
    bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
    height: 25px;
    min-height: 25px;
    font-size: 0.65rem;
    gap: 0.45rem;
    padding: 0 0.5rem;
  }
  .geo-bar .geo-icon {
    width: 0.75rem;
    height: 0.75rem;
  }
  .main {
    padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + var(--gutter) + 26px);
  }
}
@media (min-width: 640px) {
  .main {
    padding-bottom: calc(max(var(--gutter), env(safe-area-inset-bottom)) + 30px);
  }
}

/* Centered Geo & Time Settings Popup */
.geo-dialog {
  width: min(440px, calc(100vw - 1.5rem)) !important;
  max-width: 440px !important;
  height: auto !important;
  max-height: min(92vh, 530px) !important;
  margin: auto !important;
  border-radius: var(--radius) !important;
  border: 1px solid var(--line-strong) !important;
  background: var(--surface) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
  overflow: hidden !important;
}
.geo-dialog::backdrop {
  background: var(--scrim);
  backdrop-filter: blur(4px);
}
.geo-dialog .dialog-inner {
  height: auto;
  max-height: min(92vh, 530px);
  overflow: hidden;
}
.geo-dialog-body {
  padding: 0.95rem 1.15rem 1.15rem 1.15rem !important;
  gap: 0.85rem !important;
  overflow: hidden !important;
  scrollbar-width: none !important;
}
.geo-dialog-body::-webkit-scrollbar {
  display: none !important;
}

.geo-fieldset {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  background: var(--surface-2);
}
.geo-legend {
  padding: 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.geo-form-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}
.geo-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.geo-form-group.flex-1 {
  flex: 1;
  min-width: 0;
}
.geo-state-group {
  min-width: 5.5rem;
}
.geo-form-group label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.geo-form-group input,
.geo-form-group select {
  height: 2.15rem;
  padding: 0.25rem 0.55rem;
  font-family: var(--font);
  font-size: 0.82rem;
  border-radius: calc(var(--radius-sm, 4px));
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}
.geo-form-group input:focus,
.geo-form-group select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.geo-locate-btn {
  margin-top: 0.5rem;
  width: 100%;
  justify-content: center;
  font-size: 0.75rem;
  padding: 0.35rem 0.6rem;
}
.geo-locate-btn .icon {
  width: 0.85rem;
  height: 0.85rem;
  color: var(--accent);
}

/* Weather Card inside popup */
.geo-weather-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  border-radius: calc(var(--radius) - 2px);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.geo-weather-main {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.geo-weather-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--accent);
}
.geo-weather-icon .icon {
  width: 1.15rem;
  height: 1.15rem;
}
.geo-weather-temp {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}
.geo-weather-cond {
  font-size: 0.72rem;
  color: var(--muted);
}
.geo-weather-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-2);
  text-align: right;
}

/* Radio button pills */
.geo-radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.geo-radio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.geo-radio-label input[type="radio"] {
  accent-color: var(--accent);
  width: 0.9rem;
  height: 0.9rem;
  margin: 0;
  cursor: pointer;
}

.geo-timezone-group {
  margin-top: 0.5rem;
}

.geo-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}
.geo-dialog-actions .btn {
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
}

/* Special Country Token Pricing (PPP) */
.country-pricing-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.country-pricing-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}
.country-pricing-controls .field-grow {
  flex: 2 1 14rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.country-pricing-controls .field-tokens {
  flex: 1 1 7rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.country-controls-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-bottom: 2px;
}
.admin-country-search-input,
.admin-country-select,
.admin-country-tokens-input {
  height: 2.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.85rem;
}
.admin-country-search-input {
  margin-bottom: 0.25rem;
}
.country-rates-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.4rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--line);
}
.country-rates-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.country-rates-ul {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.country-rate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm, 4px);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  flex-wrap: wrap;
}
.country-rate-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.country-rate-name {
  font-weight: 600;
  color: var(--ink);
}
.country-rate-meta {
  color: var(--muted);
  font-size: 0.8rem;
}
.country-rate-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.country-rate-input {
  width: 4.5rem;
  height: 1.9rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--accent);
  font-family: var(--font-mono, monospace);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
}
.unit-label {
  font-size: 0.78rem;
  color: var(--muted);
}
.text-subtle {
  color: var(--ink-subtle, #64748b) !important;
}
.text-subtle:hover {
  color: var(--accent) !important;
}
.text-danger {
  color: #f43f5e !important;
}
.text-danger:hover {
  color: #e11d48 !important;
}
.btn-sm {
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm, 4px);
}
.confirm-delete-group,
.confirm-item-del-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.btn-danger {
  background: #f43f5e;
  color: #fff;
  border: 1px solid #e11d48;
}
.btn-danger:hover {
  background: #e11d48;
}



