:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #171a21;
  --panel-border: #262b36;
  --text: #e8eaed;
  --muted: #8b93a1;
  --accent: #6c8dff;
  --accent-hover: #85a1ff;
  --on-accent: #0f1115;
  --danger: #ff6c6c;
  --on-danger: #1a0000;
  --success: #4ade80;
  --code-bg: rgba(255, 255, 255, 0.08);
  --overlay: rgba(0, 0, 0, 0.6);
  --menu-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  --radius: 10px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #dff0fb;
  --panel: #f5fbff;
  --panel-border: #b4d3ea;
  --text: #10304a;
  --muted: #456480;
  --accent: #1b68c7;
  --accent-hover: #1557a8;
  --on-accent: #ffffff;
  --danger: #c0262d;
  --on-danger: #ffffff;
  --success: #12773b;
  --code-bg: rgba(16, 48, 74, 0.08);
  --overlay: rgba(16, 48, 74, 0.45);
  --menu-shadow: 0 10px 28px rgba(16, 48, 74, 0.2);
}

* { box-sizing: border-box; }

.hidden { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--panel-border);
}

.topbar h1 { font-size: 18px; margin: 0; }

.points-badge {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 600;
  color: var(--accent);
}

.home-link {
  color: inherit;
  text-decoration: none;
}

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

.google-email {
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.google-action,
.theme-toggle {
  background: transparent;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: 5px 12px;
  text-decoration: none;
}

.google-action:hover,
.theme-toggle:hover,
.demo-reset:hover,
.demo-prompts button:hover {
  background: transparent;
  border-color: var(--accent);
}

.demo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 14px;
}

.demo-reset,
.demo-prompts button {
  background: transparent;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: 5px 12px;
}

.demo-reset { flex-shrink: 0; }

.demo-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

/* App layout and side menu */
.app-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-body {
  display: flex;
  flex: 1;
}

.app-body main {
  flex: 1;
  min-width: 0;
}

.topbar-start {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.nav-icon {
  fill: none;
  flex: none;
  height: 20px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 20px;
}

.sidebar-toggle {
  align-items: center;
  background: transparent;
  border-radius: var(--radius);
  color: var(--text);
  display: flex;
  flex: none;
  height: 38px;
  justify-content: center;
  padding: 0;
  width: 38px;
}

.sidebar-toggle:hover { background: var(--code-bg); }

.sidebar {
  border-right: 1px solid var(--panel-border);
  flex: 0 0 224px;
  transition: flex-basis 0.2s ease;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  position: sticky;
  top: 0;
}

.tab-btn {
  align-items: center;
  background: none;
  color: var(--muted);
  display: flex;
  font-weight: 500;
  gap: 12px;
  overflow: hidden;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
  width: 100%;
}

.tab-btn:hover {
  background: var(--code-bg);
  color: var(--text);
}

.tab-btn.active {
  background: var(--code-bg);
  color: var(--text);
}

.tab-btn.active .nav-icon { color: var(--accent); }

.sidebar-scrim {
  background: var(--overlay);
  display: none;
  inset: 0;
  position: fixed;
  z-index: 20;
}

@media (min-width: 761px) {
  .sidebar-collapsed .sidebar { flex-basis: 68px; }
  .sidebar-collapsed .tab-label { display: none; }
}

/* On phones the menu slides over the page instead of taking up width. */
@media (max-width: 760px) {
  .sidebar {
    background: var(--panel);
    border-right: 1px solid var(--panel-border);
    bottom: 0;
    left: 0;
    position: fixed;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease, visibility 0.2s;
    visibility: hidden;
    width: 240px;
    z-index: 21;
  }

  /* Visible immediately on opening, so focus can move into the menu. */
  .sidebar-open .sidebar {
    transform: none;
    transition: transform 0.2s ease, visibility 0s;
    visibility: visible;
  }

  .sidebar-open .sidebar-scrim { display: block; }

  .app-body main { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

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

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

button {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

button:hover { background: var(--accent-hover); }

button.secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--panel-border);
}

button.danger { background: var(--danger); color: var(--on-danger); }

select, input[type="text"], input[type="number"], textarea {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}

.visually-hidden {
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* Custom form fields (see form-fields.js) */
.date-field { min-width: 0; }

.date-placeholder { color: var(--muted); font-weight: 400; }

.date-field .dropdown-trigger[aria-expanded="true"] .dropdown-chevron { transform: none; }

.date-popup {
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--menu-shadow);
  padding: 12px;
  position: fixed;
  width: min(304px, calc(100vw - 16px));
  z-index: 30;
}

.date-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.date-month { font-size: 14px; font-weight: 600; }

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

.date-weekday {
  color: var(--muted);
  font-size: 12px;
  padding: 4px 0;
  text-align: center;
}

.date-popup button,
.date-popup button:hover { background: transparent; }

.date-popup .date-nav,
.date-popup .date-day {
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 500;
  padding: 0;
}

.date-popup .date-nav { height: 32px; width: 32px; }

.date-popup .date-day {
  aspect-ratio: 1;
  font-size: 13px;
}

.date-popup .date-nav:hover,
.date-popup .date-day:hover { background: var(--code-bg); }

.date-popup .date-day.is-today { border-color: var(--accent); }

.date-popup .date-day[aria-pressed="true"],
.date-popup .date-day[aria-pressed="true"]:hover {
  background: var(--accent);
  color: var(--on-accent);
}

.date-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}

.date-popup .date-link {
  color: var(--accent);
  font-size: 13px;
  padding: 4px 6px;
}

.date-popup .date-link:hover { text-decoration: underline; }

.scale-options {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.scale-option {
  cursor: pointer;
  position: relative;
}

.scale-option span {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  display: block;
  font-size: 15px;
  font-weight: 600;
  padding: 9px 0;
  text-align: center;
}

.scale-option:hover span { border-color: var(--accent); }

.scale-option input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.scale-option input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.scale-hints {
  color: var(--muted);
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  margin-top: 4px;
}

.milestones-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.milestone-add-row {
  display: flex;
  gap: 8px;
}

.milestone-add-row input { flex: 1; min-width: 0; width: 0; }

.milestone-add-row .milestone-percent-input,
.add-milestone-form .milestone-percent-input {
  flex: 0 0 76px;
  width: 76px;
}

.milestone-draft-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.milestone-draft-list:empty { display: none; }

.milestone-draft {
  align-items: center;
  background: var(--bg);
  border-radius: var(--radius);
  display: flex;
  gap: 8px;
  padding: 5px 8px;
}

.milestone-draft .milestone-title { overflow-wrap: anywhere; }

.milestone-summary {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.modal-error {
  color: var(--danger);
  font-size: 13px;
  margin: 0;
}

/* Dropdowns (see select.js) */
.native-select { display: none; }

.dropdown {
  max-width: 100%;
  min-width: 0;
}

.dropdown-trigger {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text);
  display: flex;
  font-family: inherit;
  font-weight: 500;
  gap: 10px;
  justify-content: space-between;
  max-width: 100%;
  padding: 9px 12px;
  text-align: left;
  width: 100%;
}

.dropdown-trigger:hover {
  background: var(--panel);
  border-color: var(--accent);
}

.dropdown-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.dropdown-value {
  display: grid;
  min-width: 0;
}

.dropdown-value > span { grid-area: 1 / 1; }

.dropdown-sizer {
  height: 0;
  visibility: hidden;
}

.dropdown-chevron {
  color: var(--accent);
  fill: none;
  flex: none;
  height: 16px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
  transition: transform 0.15s ease;
  width: 16px;
}

.dropdown-trigger[aria-expanded="true"] .dropdown-chevron { transform: rotate(180deg); }

.dropdown-menu {
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--menu-shadow);
  max-height: min(280px, 70vh);
  max-width: min(440px, calc(100vw - 16px));
  overflow-y: auto;
  padding: 4px;
  position: fixed;
  z-index: 30;
}

.dropdown-option {
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  padding: 8px 10px 8px 28px;
  position: relative;
}

.dropdown-option.is-active { background: var(--code-bg); }

.dropdown-option[aria-selected="true"] {
  color: var(--accent);
  font-weight: 600;
}

.dropdown-option[aria-selected="true"]::before {
  content: "\2713";
  left: 10px;
  position: absolute;
}

/* Chat */
.chat-log {
  height: 60vh;
  overflow-y: auto;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius);
  line-height: 1.4;
  white-space: pre-wrap;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--on-accent);
}

.chat-msg.agent {
  align-self: flex-start;
  background: var(--panel);
  border: 1px solid var(--panel-border);
}

.chat-msg code {
  background: var(--code-bg);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.9em;
}

.chat-msg.typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 16px;
}

.chat-msg.typing .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing-bounce 1.2s infinite ease-in-out;
}

.chat-msg.typing .dot:nth-child(2) { animation-delay: 0.2s; }
.chat-msg.typing .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Typewriter, shared by the chat and the home page */
.type-rest { visibility: hidden; }

.type-caret { position: relative; }

.type-caret.is-active::after {
  animation: caret-blink 0.9s steps(1) infinite;
  background: var(--accent);
  bottom: -0.12em;
  content: "";
  height: 1em;
  left: 1px;
  position: absolute;
  width: 2px;
}

@keyframes caret-blink {
  50% { opacity: 0; }
}

.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; }

/* Cards */
.card-list { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--accent); }

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.card-title { font-weight: 600; }
.card-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-meta { color: var(--muted); font-size: 12px; margin-top: 6px; }

.card-actions { display: flex; gap: 6px; margin-top: 10px; }

.badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  white-space: nowrap;
}

.empty-state { color: var(--muted); padding: 24px 0; text-align: center; }

/* Rewards */
.add-award-row { margin-top: 22px; }

.award-actions {
  align-items: center;
  flex-wrap: wrap;
}

.award-error { margin-top: 8px; }

.qty-stepper {
  align-items: stretch;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  display: inline-flex;
  overflow: hidden;
}

.qty-stepper:focus-within { border-color: var(--accent); }

.qty-stepper button {
  background: transparent;
  border-radius: 0;
  color: var(--text);
  font-size: 16px;
  padding: 0;
  width: 32px;
}

.qty-stepper button:hover:not(:disabled) { background: var(--code-bg); }

.qty-stepper button:disabled:hover { background: transparent; }

.qty-stepper input[type="text"] {
  background: transparent;
  border: none;
  border-radius: 0;
  font-weight: 600;
  outline: none;
  padding: 7px 0;
  text-align: center;
  width: 36px;
}

.money-input {
  flex: 1 1 130px;
  min-width: 0;
  position: relative;
}

.money-input span {
  color: var(--muted);
  font-size: 14px;
  left: 11px;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.dollar-spend-form .money-input input {
  padding-left: 22px;
  width: 100%;
}

/* Redemption pop-up */
.redeem-card { text-align: center; }

.redeem-card .modal-actions { justify-content: center; }

.redeem-check {
  fill: none;
  height: 60px;
  margin-bottom: 8px;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  width: 60px;
}

.is-entering { animation: overlay-in 0.2s ease; }

.is-entering .redeem-card { animation: redeem-pop 0.42s cubic-bezier(0.2, 1.35, 0.4, 1); }

.is-entering .redeem-check circle,
.is-entering .redeem-check path {
  stroke-dasharray: 1;
  animation: redeem-draw 0.4s ease 0.1s backwards;
}

.is-entering .redeem-check path { animation-delay: 0.42s; animation-duration: 0.26s; }

.is-entering .redeem-card h2,
.is-entering .redeem-card p,
.is-entering .redeem-card .modal-actions { animation: redeem-rise 0.32s ease 0.28s backwards; }

.is-leaving { animation: overlay-in 0.18s ease reverse forwards; }

.is-leaving .redeem-card { animation: redeem-out 0.18s ease forwards; }

@keyframes overlay-in {
  from { opacity: 0; }
}

@keyframes redeem-pop {
  from { opacity: 0; transform: scale(0.8) translateY(14px); }
}

@keyframes redeem-draw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes redeem-rise {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes redeem-out {
  to { opacity: 0; transform: scale(0.92); }
}

@media (prefers-reduced-motion: reduce) {
  .is-entering,
  .is-entering *,
  .is-leaving,
  .is-leaving * { animation: none !important; }
}

/* Reward banks */
.bank-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.bank-card { display: flex; flex-direction: column; gap: 8px; }

.bank-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.bank-value { font-size: 20px; font-weight: 700; }

.bank-timer {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 28px;
  color: var(--accent);
}

.dollar-spend-form { display: flex; gap: 8px; flex-wrap: wrap; }
.dollar-spend-form input { flex: 1 1 150px; width: 0; }

button:disabled { opacity: 0.4; cursor: not-allowed; }

.transaction-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
  margin-top: 4px;
}

.transaction-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
  border-top: 1px solid var(--panel-border);
}

.transaction-reason { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transaction-amount { font-weight: 600; white-space: nowrap; }
.transaction-amount.positive { color: var(--success); }
.transaction-amount.negative { color: var(--danger); }

@media (max-width: 520px) {
  .bank-row { grid-template-columns: minmax(0, 1fr); }
}

/* Settings form */
.settings-form, #setup-form, #generic-modal-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* Milestones */
.milestone-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.milestone-row {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  display: flex;
  gap: 10px;
  padding: 10px 10px 10px 14px;
}

.milestone-title { flex: 1; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }

/* The strikethrough is a background line, so its width can animate. */
.milestone-text {
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 58%;
  background-repeat: no-repeat;
  background-size: 0 1.5px;
  transition: background-size 0.35s ease, color 0.25s ease;
}

.is-done .milestone-text {
  background-size: 100% 1.5px;
  color: var(--muted);
}

.milestone-done-btn {
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  flex: none;
  font-size: 13px;
  min-width: 66px;
  padding: 5px 12px;
}

.milestone-done-btn:hover:not(:disabled) {
  background: var(--accent);
  color: var(--on-accent);
}

.milestone-done-btn:disabled:hover { background: transparent; }

.milestone-lock-hint { margin: 0 0 8px; }

.settings-rule-effect { color: var(--accent); margin: 0; }

.milestone-done-btn.is-undo {
  border-color: var(--panel-border);
  color: var(--muted);
}

.milestone-done-btn.is-undo:hover {
  background: transparent;
  border-color: var(--accent);
  color: var(--text);
}

.milestone-points.is-earned {
  animation: points-earned 0.45s ease;
  color: var(--accent);
  font-weight: 600;
}

@keyframes points-earned {
  40% { transform: scale(1.25); }
}

.detail-card { margin-bottom: 8px; padding: 20px; }

.detail-progress-track {
  background: var(--code-bg);
  border-radius: 999px;
  height: 8px;
  margin: 14px 0;
  overflow: hidden;
}

.detail-progress-fill {
  background: var(--accent);
  border-radius: 999px;
  height: 100%;
  transition: width 0.4s ease;
  width: 0;
}

.detail-stats {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.detail-status.is-in_progress {
  border-color: var(--accent);
  color: var(--accent);
}

.detail-status.is-done {
  border-color: var(--success);
  color: var(--success);
}

.detail-stat {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  gap: 8px;
}

.detail-pips {
  display: flex;
  gap: 3px;
}

.detail-pips span {
  background: var(--panel-border);
  border-radius: 2px;
  height: 10px;
  width: 14px;
}

.detail-pips .is-filled { background: var(--accent); }

.detail-section-head {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
}

.detail-section-head .card-meta { margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
  .milestone-text,
  .detail-progress-fill { transition: none; }
  .milestone-points.is-earned { animation: none; }
}

.milestone-points { font-size: 12px; color: var(--muted); white-space: nowrap; }

.milestone-delete {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
}

.milestone-delete:hover { background: none; color: var(--danger); }

.add-milestone-form { display: flex; gap: 8px; }
.add-milestone-form input { flex: 1; width: 0; }

/* Assignment detail view */
#assignment-detail-view h2 { margin: 0; font-size: 20px; }
#assignment-detail-view h3 { font-size: 14px; margin: 20px 0 8px; color: var(--muted); }

#assignment-detail-back { margin-bottom: 16px; }

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.danger-zone {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--panel-border);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 24px;
  width: min(480px, 90vw);
  max-height: 85vh;
  overflow-y: auto;
}

.modal h2 { margin-top: 0; font-size: 16px; }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
