/*
 * naru's one stylesheet. The tokens, sizes and spacing follow Galpi's (styles.css, shell.css,
 * area.css), so the two read as one product; naru's own colour is a calmer orange. See
 * docs/ui.md for the components that use these.
 */

@font-face {
  font-family: 'Pretendard Variable';
  font-style: normal;
  font-weight: 45 920;
  font-display: swap;
  src: url(fonts/PretendardVariable.woff2) format('woff2');
}

/* ── tokens ─────────────────────────────────────────────────────────── */

:root {
  color-scheme: light;

  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --bg-raised: #ffffff;
  --bg-sunken: #f4f4f5;
  --bg-frame: #f4f4f5;
  --bg-input: #ffffff;
  --fg: #09090b;
  --fg-muted: #52525b;
  --fg-faint: #71717a;
  --border: rgb(9 9 11 / 0.1);
  --border-strong: rgb(9 9 11 / 0.2);
  --border-soft: rgb(9 9 11 / 0.05);
  --accent: #18181b;
  --accent-fg: #ffffff;
  --accent-soft: rgb(9 9 11 / 0.05);
  --brand: #c2571a;
  --brand-soft: #fcefe6;
  --ok: #15803d;
  --ok-soft: rgb(34 197 94 / 0.15);
  --warn: #b45309;
  --warn-soft: rgb(251 191 36 / 0.2);
  --danger: #b91c1c;
  --danger-soft: rgb(239 68 68 / 0.12);
  --info: #1d4ed8;
  --info-soft: rgb(59 130 246 / 0.12);
  --scrim: rgb(9 9 11 / 0.25);
  --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --panel: rgb(255 255 255 / 0.9);
  --panel-ring: 0 0 0 1px rgb(9 9 11 / 0.1);
  --bg-hover: rgb(9 9 11 / 0.05);
  --bg-press: rgb(9 9 11 / 0.09);
  --scrollbar: rgb(9 9 11 / 0.16);
  --scrollbar-hover: rgb(9 9 11 / 0.32);
  --ring: #a1a1aa;

  --text-2xs: 12px;
  --text-xs: 13px;
  --mono-xs: 12px;
  --text-sm: 14px;
  --text-base: 15px;
  --text-lg: 17px;
  --text-xl: 1.375rem;

  --radius: 12px;
  --radius-sm: 8px;
  --control-h: 32px;
  --control-h-sm: 28px;
  --sidebar-w: 272px;
  --gutter: 16px;

  --font: 'Pretendard Variable', Pretendard, Inter, -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, 'JetBrains Mono', Menlo, Consolas, monospace;

  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --bg: #18181b;
  --bg-subtle: #1f1f22;
  --bg-raised: #1f1f22;
  --bg-sunken: #09090b;
  --bg-frame: #09090b;
  --bg-input: rgb(255 255 255 / 0.05);
  --fg: #ffffff;
  --fg-muted: #a1a1aa;
  --fg-faint: #8b8b94;
  --border: rgb(255 255 255 / 0.1);
  --border-strong: rgb(255 255 255 / 0.2);
  --border-soft: rgb(255 255 255 / 0.05);
  --accent: #ffffff;
  --accent-fg: #09090b;
  --accent-soft: rgb(255 255 255 / 0.08);
  --brand: #f0894a;
  --brand-soft: #2c1c12;
  --ok: #4ade80;
  --ok-soft: rgb(34 197 94 / 0.1);
  --warn: #fbbf24;
  --warn-soft: rgb(251 191 36 / 0.1);
  --danger: #f87171;
  --danger-soft: rgb(239 68 68 / 0.1);
  --info: #60a5fa;
  --info-soft: rgb(59 130 246 / 0.1);
  --scrim: rgb(0 0 0 / 0.5);
  --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.4);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.4);
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --panel: rgb(39 39 42 / 0.92);
  --panel-ring: inset 0 0 0 1px rgb(255 255 255 / 0.1);
  --bg-hover: rgb(255 255 255 / 0.05);
  --bg-press: rgb(255 255 255 / 0.09);
  --scrollbar: rgb(255 255 255 / 0.16);
  --scrollbar-hover: rgb(255 255 255 / 0.3);
  --ring: #71717a;
}

@media (max-width: 899px) {
  :root {
    --control-h: 36px;
    --control-h-sm: 32px;
  }
}

/* ── base ───────────────────────────────────────────────────────────── */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  background: var(--bg-frame);
  color: var(--fg);
  font-size: var(--text-sm);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  /* Korean breaks between words, not inside one; an address too long for its line still breaks. */
  word-break: keep-all;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
p,
dl,
dd,
ul,
ol,
fieldset {
  margin: 0;
  padding: 0;
}

ul,
ol {
  list-style: none;
}

fieldset {
  min-width: 0;
  border: 0;
}

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

button {
  cursor: pointer;
}

button:disabled,
[aria-disabled='true'] {
  cursor: default;
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  text-underline-offset: 3px;
}

@media (hover: hover) {
  a:hover {
    text-decoration-color: currentColor;
  }
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

code,
.mono {
  font-family: var(--mono);
  font-size: var(--mono-xs);
}

code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--bg-sunken);
  overflow-wrap: anywhere;
  word-break: break-all;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-fg);
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background-color: var(--scrollbar);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-hover);
}
@supports not selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar) transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ── the frame: a list at the left, the page on a card beside it ────── */

.shell {
  display: flex;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-frame);
}

.sidebar {
  display: flex;
  flex: none;
  flex-direction: column;
  width: var(--sidebar-w);
  min-height: 0;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 46px;
  padding: 7px 8px 6px 12px;
  border-bottom: 1px solid var(--border-soft);
}

.brand {
  display: inline-flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: var(--text-base);
  font-weight: 650;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.mark {
  display: block;
  flex: none;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
}

.nav-group + .nav-group {
  margin-top: 20px;
}

.nav-label {
  padding: 0 8px 4px;
  color: var(--fg-faint);
  font-size: var(--text-2xs);
  font-weight: 500;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 34px;
  margin-top: 1px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
}

@media (hover: hover) {
  .nav-link:hover {
    background: var(--bg-hover);
  }
}

.nav-link:active {
  background: var(--bg-press);
}

.nav-link[aria-current='page'] {
  background: var(--bg-hover);
}

.nav-icon {
  flex: none;
  color: var(--fg-faint);
}

.nav-link[aria-current='page'] .nav-icon {
  color: var(--fg);
}

@media (hover: hover) {
  .nav-link:hover .nav-icon {
    color: var(--fg);
  }
}

/* The open one, as Galpi's open chat: the tint, and a 2px bar at the sidebar's edge. */
.nav-link[aria-current='page']::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -8px;
  width: 2px;
  border-radius: 999px;
  background: var(--fg);
}

.sidebar-foot {
  padding: 6px 8px;
  border-top: 1px solid var(--border-soft);
}

.account-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
}

@media (hover: hover) {
  .account-button:hover {
    background: var(--bg-hover);
  }
}

.account-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.account-name {
  overflow: hidden;
  font-size: var(--text-sm);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-sub {
  overflow: hidden;
  color: var(--fg-faint);
  font-size: var(--text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Galpi's account avatar: the initial on the sunk grey, a hairline ring. */
.avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--bg-sunken);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--fg-muted);
  font-size: var(--text-sm);
  font-weight: 500;
}

.account-chevron {
  flex: none;
  color: var(--fg-faint);
}

.menu[data-open] > .account-button,
.account-button[aria-expanded='true'] {
  background: var(--bg-hover);
}

.stage-wrap {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 8px 8px 8px 0;
}

.stage {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 10px;
  background: var(--bg);
  box-shadow:
    0 1px 2px 0 rgb(0 0 0 / 0.05),
    0 0 0 1px rgb(9 9 11 / 0.05);
}

:root[data-theme='dark'] .stage {
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.1);
}

.topbar {
  display: none;
}

.stage:focus {
  outline: none;
}

.scrim {
  display: none;
}

.sidebar-head .nav-close {
  display: none;
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 32px 80px;
}

.page-narrow {
  max-width: 672px;
}

@media (max-width: 768px) {
  .shell {
    flex-direction: column;
  }

  .stage-wrap {
    padding: 0;
  }

  .stage {
    border-radius: 0;
    box-shadow: none;
  }

  .topbar {
    display: flex;
    flex: none;
    align-items: center;
    gap: 6px;
    height: 52px;
    padding: 0 8px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
  }

  .topbar-brand {
    display: inline-flex;
    flex: none;
  }

  .topbar-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: var(--text-sm);
    font-weight: 650;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page {
    padding: 20px var(--gutter) 64px;
  }

  /* The list lies over the page as Galpi's: a card inset from the edges. */
  html.js .sidebar {
    position: fixed;
    inset: 8px auto 8px 8px;
    z-index: 40;
    width: min(88vw - 16px, 304px);
    border-radius: 10px;
    background: var(--bg);
    box-shadow:
      0 20px 40px -12px rgb(0 0 0 / 0.35),
      0 0 0 1px rgb(9 9 11 / 0.06);
    padding-bottom: env(safe-area-inset-bottom);
    overflow: hidden;
    transform: translateX(calc(-100% - 16px));
    visibility: hidden;
    transition:
      transform 0.25s ease,
      visibility 0s linear 0.25s;
  }

  html.js[data-theme='dark'] .sidebar {
    box-shadow:
      0 20px 40px -12px rgb(0 0 0 / 0.6),
      0 0 0 1px rgb(255 255 255 / 0.1);
  }

  html.js .shell.nav-open .sidebar {
    transform: none;
    visibility: visible;
    transition:
      transform 0.25s ease,
      visibility 0s;
  }

  html.js .sidebar-head .nav-close {
    display: inline-flex;
  }

  html.js .shell.nav-open .scrim {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: block;
    background: var(--scrim);
  }

  /* With no script the list simply sits over the page. */
  html:not(.js) .shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  html:not(.js) .sidebar {
    width: 100%;
  }

  html:not(.js) .topbar {
    display: none;
  }
}

/* The sign-in pages, as Galpi's: one card in the middle of the frame, the mark and the name at its top. */
.auth {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 24px var(--gutter);
  background: var(--bg-frame);
}

.auth-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 420px;
  padding: 36px 32px 32px;
  border-radius: 16px;
  background: var(--bg);
  box-shadow:
    0 1px 3px 0 rgb(0 0 0 / 0.06),
    0 0 0 1px rgb(9 9 11 / 0.05);
}

:root[data-theme='dark'] .auth-card {
  background: #18181b;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.1);
}

.auth-card-wide {
  max-width: 520px;
}

.auth-brand {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 8px;
  font-size: var(--text-lg);
  font-weight: 700;
  text-decoration: none;
}

.auth-card h1 {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.auth-card .sub {
  margin-top: 16px;
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

.auth-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

.auth-user {
  overflow: hidden;
  color: var(--fg-muted);
  font-size: var(--text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Galpi's link button: words underlined at 40%, the line full under a pointer. */
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 3px;
  cursor: pointer;
}

@media (hover: hover) {
  .link-btn:hover:not(:disabled) {
    text-decoration-color: currentColor;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 28px 22px 24px;
  }
}

/* ── page structure ─────────────────────────────────────────────────── */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-soft);
}

.page-header-text {
  flex: 1 1 240px;
  min-width: 0;
}

.page-header h1 {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--fg-faint);
  font-size: var(--text-2xs);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  color: var(--fg-muted);
  font-size: var(--text-xs);
  text-decoration: none;
}

@media (hover: hover) {
  .back-link:hover {
    color: var(--fg);
  }
}

.page-sub {
  margin-top: 4px;
  color: var(--fg-muted);
}

.page-actions,
.section-actions {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 28px;
}

.section + .section {
  margin-top: 28px;
  border-top: 1px solid var(--border-soft);
}

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

.section-head h2 {
  font-size: var(--text-base);
  font-weight: 600;
}

.section-desc {
  margin-top: 2px;
  color: var(--fg-muted);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.muted {
  color: var(--fg-muted);
}

.tabs {
  display: flex;
  gap: 2px;
  margin: 16px 0 0;
  padding: 3px;
  overflow-x: auto;
  border-radius: 9px;
  background: var(--bg-hover);
}

.tab {
  flex: 1 0 auto;
  min-height: 28px;
  padding: 3px 12px;
  border-radius: 7px;
  color: var(--fg-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 22px;
  text-align: center;
  text-decoration: none;
}

.tab[aria-current='page'] {
  background: var(--bg);
  box-shadow:
    var(--shadow-xs),
    0 0 0 1px var(--border);
  color: var(--fg);
  font-weight: 600;
}

/* ── lists ──────────────────────────────────────────────────────────── */

.list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
}

.row + .row {
  border-top: 1px solid var(--border);
}

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

.row-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.row-title a {
  text-decoration: none;
}

@media (hover: hover) {
  .row-title a:hover {
    text-decoration: underline;
  }
}

.row-sub {
  min-width: 0;
  margin-top: 2px;
  color: var(--fg-muted);
  font-size: var(--text-xs);
}

.row-side {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-height: 28px;
}

.row-keep .row-side {
  min-height: 0;
}

.row-title .mono {
  font-weight: 500;
}

/* A row that is one link: the tint and the focus ring cover all of it. */
.row-link {
  padding: 0;
}

.row-anchor {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: inherit;
  color: inherit;
  text-decoration: none;
}

.row-anchor .row-main,
.row-anchor .row-sub {
  display: block;
}

@media (hover: hover) {
  .row-anchor:hover {
    background: var(--bg-hover);
  }
}

.row-anchor:active {
  background: var(--bg-press);
}

.row-anchor:focus-visible {
  outline-offset: -2px;
}

.row-chevron {
  flex: none;
  color: var(--fg-faint);
}

.row-meta {
  margin-top: 2px;
  color: var(--fg-faint);
  font-size: var(--text-2xs);
}

.row-danger {
  background: var(--danger-soft);
}

.row:first-child {
  border-top-left-radius: 11px;
  border-top-right-radius: 11px;
}

.row:last-child {
  border-bottom-right-radius: 11px;
  border-bottom-left-radius: 11px;
}

.dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--fg-faint);
}

.dot-ok {
  background: var(--ok);
}

.dot-warn {
  background: var(--warn);
}

.dot-danger {
  background: var(--danger);
}

.feedback {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--fg-muted);
  font-size: var(--text-xs);
}

.feedback[data-tone='ok'] {
  color: var(--ok);
}

.feedback[data-tone='danger'] {
  color: var(--danger);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.stat {
  display: block;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  text-decoration: none;
}

@media (hover: hover) {
  a.stat:hover {
    border-color: var(--border-strong);
  }
}

.stat-value {
  display: block;
  font-size: var(--text-lg);
  font-weight: 650;
  line-height: 1.5;
}

.stat-label {
  display: block;
  color: var(--fg-muted);
  font-size: var(--text-xs);
}

.empty {
  padding: 4px 0;
  color: var(--fg-muted);
}

.empty-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--fg-muted);
}

.definition {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 6px 12px;
}

.definition dt {
  color: var(--fg-muted);
}

.definition dd {
  min-width: 0;
}

@media (max-width: 639px) {
  .row:not(.row-keep) {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .row:not(.row-keep) .row-side {
    justify-content: flex-start;
    min-height: 0;
  }

  .section-head {
    flex-wrap: wrap;
  }

  .definition {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .definition dd {
    margin-bottom: 8px;
  }
}

/* ── controls ───────────────────────────────────────────────────────── */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--control-h);
  padding: 0 calc(0.8rem - 1px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  box-shadow: var(--shadow-xs);
  color: var(--fg);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.5rem;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease;
}

.btn .icon {
  color: var(--fg-faint);
}

@media (hover: hover) {
  .btn:hover:not(:disabled):not([aria-busy='true']) {
    border-color: var(--border-strong);
    background-image: linear-gradient(var(--bg-hover), var(--bg-hover));
  }
}

.btn:disabled {
  opacity: 0.5;
}

:root[data-theme='dark'] .btn {
  border-color: rgb(255 255 255 / 0.15);
  background: transparent;
  box-shadow: none;
}

.btn-primary,
:root[data-theme='dark'] .btn-primary {
  border-color: color-mix(in srgb, var(--accent) 90%, black);
  background: var(--accent);
  color: var(--accent-fg);
}

.btn-primary {
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.15),
    var(--shadow-sm);
}

.btn-primary .icon {
  color: inherit;
}

@media (hover: hover) {
  .btn-primary:hover:not(:disabled):not([aria-busy='true']),
  :root[data-theme='dark'] .btn-primary:hover:not(:disabled):not([aria-busy='true']) {
    border-color: color-mix(in srgb, var(--accent) 90%, black);
    background: color-mix(in srgb, var(--accent) 88%, var(--accent-fg));
  }
}

.btn-ghost,
:root[data-theme='dark'] .btn-ghost {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

@media (hover: hover) {
  .btn-ghost:hover:not(:disabled),
  :root[data-theme='dark'] .btn-ghost:hover:not(:disabled) {
    border-color: transparent;
    background: var(--bg-hover);
  }
}

.btn-danger,
:root[data-theme='dark'] .btn-danger {
  border-color: rgb(185 28 28 / 0.9);
  background: #dc2626;
  color: #ffffff;
}

.btn-danger .icon {
  color: inherit;
}

@media (hover: hover) {
  .btn-danger:hover:not(:disabled):not([aria-busy='true']),
  :root[data-theme='dark'] .btn-danger:hover:not(:disabled):not([aria-busy='true']) {
    border-color: rgb(185 28 28 / 0.9);
    background: #c81e1e;
  }
}

.btn-danger-outline,
:root[data-theme='dark'] .btn-danger-outline {
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  background: transparent;
  box-shadow: none;
  color: var(--danger);
}

@media (hover: hover) {
  .btn-danger-outline:hover:not(:disabled),
  :root[data-theme='dark'] .btn-danger-outline:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--danger) 55%, transparent);
    background: var(--danger-soft);
  }
}

.btn-small {
  gap: 4px;
  min-height: var(--control-h-sm);
  padding: 0 calc(0.6rem - 1px);
  font-size: var(--text-xs);
  line-height: 1.25rem;
}

.btn-block {
  width: 100%;
}

.btn[aria-busy='true'] {
  cursor: progress;
  opacity: 0.75;
}

.btn[aria-busy='true']::before {
  content: '';
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner {
  display: inline-block;
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.icon-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--control-h);
  height: var(--control-h);
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg-faint);
  text-decoration: none;
}

@media (hover: hover) {
  .icon-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--fg);
  }
}

.icon-btn:disabled {
  opacity: 0.4;
}

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

/* A form of sections takes its spacing from them. */
.form:has(> .section) {
  gap: 0;
}

.form-compact {
  max-width: 560px;
}

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

.form-grid > :only-child {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  color: var(--fg);
  font-size: var(--text-sm);
  font-weight: 500;
}

.field-optional {
  color: var(--fg-faint);
  font-weight: 400;
}

.field-hint {
  color: var(--fg-muted);
  font-size: var(--text-xs);
  line-height: 1.5;
}

.field-error {
  color: var(--danger);
  font-size: var(--text-xs);
  line-height: 1.5;
}

.input,
.textarea,
.select-button {
  display: block;
  width: 100%;
  min-height: var(--control-h);
  padding: 0 calc(0.7rem - 1px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--fg);
  font-size: var(--text-sm);
  line-height: 1.5rem;
  appearance: none;
}

.textarea {
  min-height: 92px;
  padding-block: 6px;
  resize: vertical;
}

.textarea.mono,
.input.mono {
  font-family: var(--mono);
  font-size: var(--mono-xs);
}

@media (hover: hover) {
  :is(.input, .textarea, .select-button):hover:not(:disabled):not(:focus) {
    border-color: color-mix(in srgb, var(--fg) 30%, transparent);
  }
}

:is(.input, .textarea, .select-button):focus,
.select-button[aria-expanded='true'] {
  border-color: var(--ring);
  outline: 2px solid var(--ring);
  outline-offset: -1px;
}

:is(.input, .textarea):disabled,
.select-button:disabled {
  background: var(--bg-sunken);
  color: var(--fg-muted);
  opacity: 0.7;
}

:is(.input, .textarea)[aria-invalid='true'],
.select-native[aria-invalid='true'] + .select-button {
  border-color: var(--danger);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--fg-faint);
}

/* A phone zooms a field under 16px on focus. */
@media (max-width: 899px) {
  .input,
  .textarea,
  .select-button {
    font-size: 16px;
  }

  .textarea.mono,
  .input.mono {
    font-size: 14px;
  }
}

.select {
  position: relative;
  display: block;
  min-width: 0;
}

/* The field the form reads. With no script it is the control; with one, the button below it is. */
.select-native {
  display: block;
  width: 100%;
  min-height: var(--control-h);
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}

html.js .select-native {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  pointer-events: none;
}

.select-button {
  display: none;
  text-align: left;
}

html.js .select-button {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-button .icon {
  flex: none;
  color: var(--fg-faint);
}

.menu-panel {
  z-index: 60;
  min-width: 200px;
  max-width: min(360px, calc(100vw - 24px));
  max-height: min(320px, 60dvh);
  overflow-y: auto;
  padding: 4px;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow:
    var(--shadow),
    var(--panel-ring);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}

.listbox {
  position: fixed;
  max-width: calc(100vw - 16px);
  margin: 0;
}

.option,
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 5px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg);
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.5rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.option-text {
  flex: 1;
  min-width: 0;
}

.option-check {
  flex: none;
  visibility: hidden;
  color: var(--fg-muted);
}

.option[aria-selected='true'] .option-check,
.menu-item[aria-checked='true'] .option-check {
  visibility: visible;
}

.option[aria-selected='true'] {
  font-weight: 600;
}

.option[data-active],
.menu-item:focus {
  outline: none;
  background: var(--bg-press);
}

@media (hover: hover) {
  .option:hover:not([aria-disabled='true']),
  .menu-item:hover {
    background: var(--bg-hover);
  }
}

.option[aria-disabled='true'] {
  color: var(--fg-faint);
  cursor: not-allowed;
}

.menu {
  position: relative;
  display: inline-flex;
}

.menu-block {
  display: block;
}

.menu > .menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
}

.menu.menu-up > .menu-panel {
  top: auto;
  right: auto;
  bottom: calc(100% + 6px);
  left: 0;
  width: 100%;
}

.menu-head {
  padding: 6px 10px;
  color: var(--fg-muted);
  font-size: var(--text-xs);
  overflow-wrap: anywhere;
}

.menu-sep {
  height: 1px;
  margin: 4px 12px;
  background: var(--border-soft);
}

:root[data-theme='dark'] .menu-sep {
  background: var(--border);
}

.menu-icon {
  flex: none;
  color: var(--fg-faint);
}

.menu-item:focus .menu-icon {
  color: var(--fg);
}

@media (hover: hover) {
  .menu-item:hover .menu-icon {
    color: var(--fg);
  }
}

.menu-danger {
  color: var(--danger);
}

.theme-icon {
  display: none;
}

html[data-theme-pref='light'] .theme-icon-light,
html[data-theme-pref='dark'] .theme-icon-dark,
html[data-theme-pref='system'] .theme-icon-system,
html:not([data-theme-pref]) .theme-icon-system {
  display: block;
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  background: var(--bg-hover);
}

.segmented label {
  position: relative;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}

.segmented span {
  display: block;
  min-height: 26px;
  padding: 2px 10px;
  border-radius: 7px;
  color: var(--fg-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 22px;
  text-align: center;
  white-space: nowrap;
}

.segmented input:checked + span {
  background: var(--bg);
  box-shadow:
    var(--shadow-xs),
    0 0 0 1px var(--border);
  color: var(--fg);
  font-weight: 600;
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}

.segmented input:disabled + span {
  opacity: 0.5;
}

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.toggle-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.toggle-label {
  font-weight: 500;
}

.switch {
  position: relative;
  display: inline-flex;
  flex: none;
}

.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-track {
  position: relative;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: #e4e4e7;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.05);
  transition: background 0.2s ease;
}

:root[data-theme='dark'] .switch-track {
  background: rgb(255 255 255 / 0.05);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.15);
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow:
    0 1px 2px rgb(0 0 0 / 0.15),
    0 0 0 1px rgb(0 0 0 / 0.05);
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

:root[data-theme='dark'] .switch input:checked + .switch-track::after {
  background: var(--accent-fg);
}

.switch input:checked + .switch-track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.switch input:disabled + .switch-track {
  opacity: 0.5;
}

/* Galpi's (Catalyst's) checkbox: drawn, not the browser's. */
.check-input {
  appearance: none;
  position: relative;
  flex: none;
  width: 16px;
  height: 16px;
  margin: 3px 0 0;
  border: 1px solid rgb(9 9 11 / 0.15);
  border-radius: 5px;
  background: var(--bg-raised) center / 100% no-repeat;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
}

.check-input[type='radio'] {
  border-radius: 999px;
}

:root[data-theme='dark'] .check-input {
  border-color: rgb(255 255 255 / 0.2);
  background-color: rgb(255 255 255 / 0.05);
  box-shadow: none;
}

.check-input:checked,
:root[data-theme='dark'] .check-input:checked {
  border-color: color-mix(in srgb, var(--accent) 90%, black);
  background-color: var(--accent);
}

.check-input[type='checkbox']:checked {
  background-image: url(check.svg);
}

:root[data-theme='dark'] .check-input[type='checkbox']:checked {
  background-image: url(check-dark.svg);
}

.check-input[type='radio']:checked {
  background-image: radial-gradient(circle, var(--accent-fg) 0 3px, transparent 3.5px);
}

.check-input:disabled {
  opacity: 0.5;
  cursor: default;
}

.check-input:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

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

.check-group .toggle-row {
  gap: 8px;
  align-items: center;
}

.check-group .check-input {
  margin: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgb(82 82 91 / 0.1);
  color: #3f3f46;
  font-size: var(--text-2xs);
  font-weight: 500;
  line-height: 1.25rem;
  white-space: nowrap;
}

:root[data-theme='dark'] .badge {
  background: rgb(255 255 255 / 0.05);
  color: #a1a1aa;
}

.badge-brand,
:root[data-theme='dark'] .badge-brand {
  background: var(--brand-soft);
  color: var(--brand);
}

.badge-ok,
:root[data-theme='dark'] .badge-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge-warn,
:root[data-theme='dark'] .badge-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge-danger,
:root[data-theme='dark'] .badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.alert {
  display: flex;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  font-size: var(--text-sm);
}

.alert .icon {
  flex: none;
  margin-top: 2px;
}

.alert-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.alert-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.alert-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

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

.alert-body .detail {
  margin-top: 2px;
  font-size: var(--text-xs);
}

.flash {
  margin-bottom: 16px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--fg-faint);
  font-size: var(--text-xs);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.copy {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 2px 2px 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}

.copy [data-copied='ok'] {
  color: var(--ok);
}

.copy [data-copied='failed'] {
  color: var(--danger);
}

.copy-value {
  flex: 1;
  min-width: 0;
  padding: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: var(--mono-xs);
  overflow-wrap: anywhere;
  word-break: break-all;
}

details.advanced {
  border-radius: var(--radius-sm);
}

details.advanced > summary {
  padding: 2px 0;
  color: var(--fg-muted);
}

.advanced-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 12px;
}

/* Shown only while the choice it hangs on says so: naru.js marks it. */
html.js [data-show-when]:not(.is-shown) {
  display: none;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  counter-reset: step;
}

.step {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  counter-increment: step;
}

.step-head {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--fg-muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

/* The first step has nowhere to go up to: whatever order the steps are put in. */
.step:first-child [data-repeat-up] {
  visibility: hidden;
}

.step-head::before {
  content: counter(step) '단계';
  flex: 1;
}

.filters {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

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

/* ── disclosures and the browser's own field parts ──────────────────
   A disclosure's marker is one chevron that turns as it opens, drawn with
   borders (no image, so the CSP needs no exception), not the browser's
   triangle. Numbers lose the browser's spin arrows (the keyboard's arrows
   still step them); dates keep the browser's picker, as Catalyst's do, with
   the inner padding taken out and the calendar icon quiet until pointed at. */

summary {
  cursor: pointer;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: '';
  display: inline-block;
  width: 0.4em;
  height: 0.4em;
  margin: 0 0.6em 0.14em 0.12em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: 0.65;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

details[open] > summary::before {
  transform: rotate(45deg);
}

@media (hover: hover) {
  summary:hover {
    color: var(--fg);
  }
}

input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input:is([type='date'], [type='time'], [type='datetime-local'], [type='month'])::-webkit-datetime-edit,
input:is([type='date'], [type='time'], [type='datetime-local'], [type='month'])::-webkit-datetime-edit-fields-wrapper {
  padding: 0;
}

input:is([type='date'], [type='time'], [type='datetime-local'], [type='month'])::-webkit-calendar-picker-indicator {
  margin-left: 6px;
  border-radius: 4px;
  opacity: 0.5;
  cursor: pointer;
}

input:is([type='date'], [type='time'], [type='datetime-local'], [type='month'])::-webkit-calendar-picker-indicator:hover {
  opacity: 0.85;
}

@media (prefers-reduced-motion: reduce) {
  summary::before {
    transition: none;
  }
}

/* ── dialogs ────────────────────────────────────────────────────────── */

.dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  overflow-y: auto;
  border: 0;
  border-radius: 16px;
  background: var(--bg);
  box-shadow:
    var(--shadow),
    var(--panel-ring);
  color: var(--fg);
}

.dialog::backdrop {
  background: var(--scrim);
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
}

.dialog-title {
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.dialog-text {
  color: var(--fg-muted);
  white-space: pre-line;
}

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

@media (max-width: 639px) {
  .dialog {
    width: 100%;
    max-width: none;
    margin: auto 0 0;
    border-radius: 16px 16px 0 0;
  }

  .dialog-actions .btn {
    flex: 1;
  }
}
/* ── date picker (date-picker.tsx): the family's date field ─────────────
   A field drawn as the text fields are, and a month in Galpi's menu panel.
   Galpi, Mothership and naru carry the same rules. */

.datepicker {
  position: relative;
  display: block;
  min-width: 0;
}
.datepicker-field {
  display: flex;
  width: 100%;
  min-height: var(--control-h);
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 10px 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  box-shadow: var(--shadow-xs);
  color: var(--fg);
  font: inherit;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease;
}
:root[data-theme='dark'] .datepicker-field {
  background: rgb(255 255 255 / 0.05);
  box-shadow: none;
}
@media (hover: hover) {
  .datepicker-field:hover:not(:disabled) {
    border-color: var(--border-strong);
  }
}
.datepicker-field[aria-expanded='true'] {
  border-color: var(--border-strong);
}
.datepicker-field:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}
.datepicker-field:disabled {
  opacity: 0.5;
  cursor: default;
}
.datepicker-field[aria-invalid='true'] {
  border-color: var(--danger);
}
.datepicker-value {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.datepicker-field.is-empty .datepicker-value {
  color: var(--fg-faint);
}
.datepicker-icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--fg-faint);
}

.datepicker-panel {
  position: fixed;
  z-index: 70;
  width: 292px;
  padding: 10px;
  border-radius: 12px;
  background: rgb(255 255 255 / 0.85);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow:
    0 10px 15px -3px rgb(0 0 0 / 0.1),
    0 4px 6px -4px rgb(0 0 0 / 0.1),
    0 0 0 1px rgb(9 9 11 / 0.1);
  color: var(--fg);
  font-size: var(--text-sm);
}
:root[data-theme='dark'] .datepicker-panel {
  background: rgb(39 39 42 / 0.85);
  box-shadow:
    0 10px 15px -3px rgb(0 0 0 / 0.5),
    inset 0 0 0 1px rgb(255 255 255 / 0.1);
}
@media (prefers-reduced-motion: no-preference) {
  .datepicker-panel {
    animation: pop-in 0.14s ease-out;
  }
  .datepicker-panel.is-up {
    animation-name: pop-up;
  }
}
.datepicker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 6px;
}
.datepicker-month {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.datepicker-nav {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--fg-faint);
  cursor: pointer;
}
@media (hover: hover) {
  .datepicker-nav:hover {
    background: var(--bg-hover);
    color: var(--fg);
  }
}
.datepicker-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.datepicker-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.datepicker-weekday {
  padding: 4px 0;
  color: var(--fg-faint);
  font-size: var(--text-2xs);
  font-weight: 500;
  text-align: center;
}
.datepicker-weekday.is-sunday {
  color: var(--danger);
  opacity: 0.8;
}
.datepicker-day {
  display: grid;
  width: 100%;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
@media (hover: hover) {
  .datepicker-day:hover:not(:disabled, .is-selected) {
    background: var(--bg-hover);
  }
}
.datepicker-day:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: -2px;
}
.datepicker-day.is-outside {
  color: var(--fg-faint);
  opacity: 0.6;
}
.datepicker-day.is-today {
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.datepicker-day.is-selected,
.datepicker-day.is-selected:hover {
  background: var(--accent);
  box-shadow: none;
  color: var(--accent-fg);
  font-weight: 600;
  opacity: 1;
}
.datepicker-day:disabled {
  color: var(--fg-faint);
  opacity: 0.35;
  cursor: not-allowed;
}
.datepicker-time {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
  color: var(--fg-muted);
  font-size: var(--text-xs);
}
.datepicker-time-input {
  width: 5.5em;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--fg);
  font: inherit;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: var(--text-sm);
}
.datepicker-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  padding: 8px 2px 0;
  border-top: 1px solid var(--border-soft);
}
.datepicker-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 3px;
  cursor: pointer;
}
.datepicker-link:disabled {
  opacity: 0.4;
  cursor: default;
}
.datepicker-done {
  margin-left: auto;
  min-height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-fg);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}
@media (max-width: 899px) {
  .datepicker-field {
    font-size: 16px;
  }
  .datepicker-day {
    height: 38px;
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

@keyframes pop-up {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
}
