:root {
  --bg: #0e1120;
  --bg2: #151a2c;
  --surface: #1b2136;
  --input: #0a0d19;
  --line: #262d48;
  --line-strong: #3a4368;
  --fg: #eef0f8;
  --fg-soft: #ccd2e6;
  --dim: #8e97b8;
  --accent: #c6f06a;
  --accent-ink: #172006;
  --accent-soft: rgba(198, 240, 106, .14);
  --ai: #ffb86b;
  --warn: #ff9a70;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 18px 50px rgba(3, 5, 14, .5);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-display: ui-rounded, "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --grid: linear-gradient(rgba(142, 151, 184, .045) 1px, transparent 1px) 0 0 / 28px 28px,
          linear-gradient(90deg, rgba(142, 151, 184, .045) 1px, transparent 1px) 0 0 / 28px 28px;
  color-scheme: dark;
  scrollbar-color: var(--line-strong) transparent;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font); }
button, input, textarea, select { font: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code { font-family: var(--font-mono); font-size: .9em; }

/* An (i) that shows its data-tip text on hover, keyboard focus or tap: <button type="button" class="info-tip"
   data-tip="…" aria-label="…">i</button>. The text opens to the right of the icon, so keep the icon near the left. */
.info-tip {
  position: relative; flex: none; display: inline-grid; place-items: center;
  width: 16px; height: 16px; padding: 0; vertical-align: middle;
  border: 1px solid var(--line-strong); border-radius: 50%; background: transparent;
  color: var(--dim); font: italic 700 10px/1 Georgia, "Times New Roman", serif; cursor: help;
}
.info-tip:hover, .info-tip:focus-visible { color: var(--fg); border-color: var(--dim); }
.info-tip::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 6px); left: -8px; z-index: 10; box-sizing: border-box;
  width: max-content; max-width: 240px; padding: 8px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface);
  box-shadow: var(--shadow); color: var(--fg-soft); font: 400 12px/1.45 var(--font); text-align: left;
  text-transform: none; letter-spacing: normal; white-space: normal;
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .12s ease, visibility .12s;
}
.info-tip:hover::after, .info-tip:focus::after { opacity: 1; visibility: visible; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  height: 52px; padding: 0 16px;
  background: rgba(21, 26, 44, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.brand {
  display: flex; align-items: center; gap: 9px; white-space: nowrap;
  font: 700 15px/1 var(--font-display); letter-spacing: .2px; color: var(--fg); text-decoration: none;
}
.brand small { color: var(--dim); font: 400 12px/1 var(--font); }
.logo {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink);
  font: 800 16px/1 var(--font-display); transform: rotate(-6deg);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn, .actions button, .modal-actions button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--accent); border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: transform .12s ease, background-color .12s ease, border-color .12s ease, color .12s ease;
}
:is(.btn, .actions button, .modal-actions button):hover:not(:disabled) { transform: translateY(-1px); background: #d6f78a; }
:is(.btn, .actions button, .modal-actions button):active:not(:disabled) { transform: none; }
:is(.btn, .actions button, .modal-actions button):disabled { opacity: .5; cursor: not-allowed; }
:is(.btn, .actions button, .modal-actions button).ghost { background: transparent; border-color: var(--line-strong); color: var(--fg-soft); font-weight: 500; }
:is(.btn, .actions button, .modal-actions button).ghost:hover:not(:disabled) { background: var(--surface); border-color: var(--dim); color: var(--fg); }

.input, .field input, .field textarea, .field select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--input); color: var(--fg); transition: border-color .12s ease, box-shadow .12s ease;
}
:is(.input, .field input, .field textarea, .field select)::placeholder { color: #5f6788; }
:is(.input, .field input, .field textarea, .field select):focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

kbd {
  display: inline-block; min-width: 18px; padding: 1px 5px; border: 1px solid var(--line-strong);
  border-bottom-width: 2px; border-radius: 5px; background: var(--surface); color: var(--fg-soft);
  font: 600 11px/1.4 var(--font-mono); text-align: center;
}

:is(.btn, .actions button, .modal-actions button).danger { background: var(--warn); border-color: var(--warn); color: #2a0e04; }
:is(.btn, .actions button, .modal-actions button).danger:hover:not(:disabled) { background: #ffb394; }

.account { position: relative; display: flex; flex: none; align-items: center; }
.account:empty { display: none; }
.account-toggle { max-width: 280px; }
.account-email { min-width: 0; overflow: hidden; color: var(--fg-soft); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.account-short { display: none; }
.account-caret { color: var(--dim); font-size: 11px; }
.account-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; display: grid; min-width: 220px; padding: 6px;
  background: var(--bg2); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow);
}
.account-menu-email { overflow: hidden; margin: 4px 10px 6px; color: var(--dim); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-item {
  display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--fg); font-size: 14px; text-align: left; text-decoration: none; cursor: pointer;
}
.account-menu-item:hover, .account-menu-item:focus-visible { background: var(--surface); }
.account-menu-item:disabled { color: var(--dim); cursor: wait; }
.account-menu-footer { display: grid; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.account-menu-minor { padding: 6px 10px; color: var(--dim); font-size: 12.5px; }
@media (max-width: 700px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .topbar .btn { padding: 6px 11px; }
  .topbar .brand small, .account-email, .wide-only { display: none; }
  .account-short { display: inline; }
}

dialog {
  width: min(560px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 32px));
  color: var(--fg); background: var(--bg2); border: 1px solid var(--line-strong); border-radius: 18px;
  padding: 0; box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
dialog[open] { animation: pop .2s cubic-bezier(.2, .8, .2, 1); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
dialog::backdrop { background: rgba(5, 7, 16, .72); backdrop-filter: blur(3px); }
.modal-body { padding: 26px; overflow-y: auto; }
.modal-body h2 { margin: 0 0 8px; font: 700 22px/1.2 var(--font-display); }
.modal-body p { color: var(--dim); margin: 6px 0; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.modal-body .form-error, .form-error { color: var(--warn); }
.form-error:empty { display: none; }

.notice {
  position: fixed; left: 50%; bottom: 18px; z-index: 30; display: flex; align-items: flex-start; gap: 12px;
  width: min(560px, calc(100vw - 32px)); padding: 12px 14px; transform: translateX(-50%);
  background: var(--bg2); border: 1px solid var(--warn); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--fg);
}
.notice span { flex: 1; }
.notice-close { padding: 0 4px; border: 0; background: none; color: var(--dim); font-size: 20px; line-height: 1; cursor: pointer; }
.notice-close:hover { color: var(--fg); }

.eyebrow { margin: 0; color: var(--accent); font: 700 11px/1.2 var(--font); text-transform: uppercase; letter-spacing: .12em; }
