@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Sans";
  src: url("/assets/fonts/geist-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Sans";
  src: url("/assets/fonts/geist-sans-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Sans";
  src: url("/assets/fonts/geist-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Sans";
  src: url("/assets/fonts/geist-sans-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   Calopic design tokens + UI primitives — v2 "Liquid Glass" (BRAND.md)
   Neutral graphite / warm paper + one warm orange accent.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* surfaces */
  --bg: #0b0b0c;
  --bg-soft: #121214;
  --surface: rgba(255, 255, 255, 0.055);
  --surface-2: rgba(255, 255, 255, 0.09);
  --surface-3: rgba(255, 255, 255, 0.12);

  /* glass + strokes */
  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --stroke: rgba(255, 255, 255, 0.12);
  --stroke-top: rgba(255, 255, 255, 0.22);
  --border: var(--stroke);
  --border-strong: rgba(255, 255, 255, 0.2);
  --well: rgba(0, 0, 0, 0.18);
  --scrim: rgba(0, 0, 0, 0.45);

  /* type */
  --text: #f2f2f4;
  --text-dim: #a6a6ac;
  --text-faint: #6e6e75;

  /* brand — one accent only */
  --accent: #e8702a;
  --accent-hover: #f08140;
  --accent-soft: rgba(232, 112, 42, 0.14);
  --accent-2: #c9a18a;
  --ink: #14120f;

  /* status (used sparingly) */
  --success: #79b58e;
  --success-soft: rgba(121, 181, 142, 0.14);
  --warning: #d9a441;
  --warning-soft: rgba(217, 164, 65, 0.14);
  --danger: #d96b5e;
  --danger-soft: rgba(217, 107, 94, 0.14);
  --info: #a6a6ac;
  --info-soft: rgba(166, 166, 172, 0.14);

  /* geometry */
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 24px;
  --radius-xl: 28px;
  --radius-pill: 999px;
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 18px 48px rgba(0, 0, 0, 0.38);
  --glass-shadow-strong: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 24px 64px rgba(0, 0, 0, 0.46);
  --shadow-1: 0 10px 30px rgba(0, 0, 0, 0.28);
  --shadow-2: 0 18px 48px rgba(0, 0, 0, 0.38);
  --shadow-glow: 0 18px 48px rgba(0, 0, 0, 0.38);

  /* typography */
  --font-sans: "Geist Sans", "Instrument Sans", -apple-system, "Segoe UI Variable", "Segoe UI", Inter, system-ui,
    "Noto Sans SC", "Noto Sans KR", "Noto Sans JP", "Noto Sans Arabic", sans-serif;
  --font-mono: "Cascadia Code", "SF Mono", "JetBrains Mono", Consolas, monospace;

  /* layout */
  --sidebar-w: 260px;
  --titlebar-h: 44px;
  --header-h: 68px;
  --container: 1180px;
  --container-narrow: 860px;

  /* motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 160ms;
  --mid: 180ms;
  --slow: 220ms;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f3f1ee;
  --bg-soft: #fbfaf8;
  --surface: rgba(255, 255, 255, 0.62);
  --surface-2: rgba(255, 255, 255, 0.82);
  --surface-3: rgba(20, 18, 15, 0.06);

  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --stroke: rgba(20, 18, 15, 0.08);
  --stroke-top: rgba(255, 255, 255, 0.9);
  --border: var(--stroke);
  --border-strong: rgba(20, 18, 15, 0.14);
  --well: rgba(0, 0, 0, 0.03);
  --scrim: rgba(20, 18, 15, 0.35);

  --text: #171512;
  --text-dim: #5c5952;
  --text-faint: #8c8880;

  --accent-soft: rgba(232, 112, 42, 0.12);

  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 18px 48px rgba(20, 18, 15, 0.1);
  --glass-shadow-strong: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 24px 64px rgba(20, 18, 15, 0.14);
  --shadow-1: 0 8px 24px rgba(20, 18, 15, 0.08);
  --shadow-2: 0 18px 48px rgba(20, 18, 15, 0.1);
  --shadow-glow: 0 18px 48px rgba(20, 18, 15, 0.1);
}

/* --------------------------------------------------------------------------
   Reset + base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(760px 420px at 50% -140px, rgba(232, 112, 42, 0.06), transparent 70%) no-repeat,
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
h1,
h2,
h3,
h4,
h5,
h6,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

hr {
  border: 0;
  border-top: 1px solid var(--stroke);
  margin: 0;
}

code,
pre,
kbd,
samp {
  font-family: var(--font-mono);
}

::selection {
  background: rgba(232, 112, 42, 0.32);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid rgba(232, 112, 42, 0.65);
  outline-offset: 2px;
  border-radius: 6px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
  border: 3px solid transparent;
  background-clip: padding-box;
}

/* --------------------------------------------------------------------------
   Layout helpers
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}

.container-narrow {
  max-width: var(--container-narrow);
}

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

.hidden,
[hidden] {
  display: none !important;
}

.skip-link {
  position: absolute;
  inset-inline-start: 16px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  transition: top var(--fast) var(--ease);
}
.skip-link:focus-visible {
  top: 12px;
}

/* --------------------------------------------------------------------------
   Glass primitives
   -------------------------------------------------------------------------- */
.glass,
.card,
.card-glass {
  background: var(--glass);
  backdrop-filter: blur(26px) saturate(140%);
  -webkit-backdrop-filter: blur(26px) saturate(140%);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
}

.glass-strong {
  background: var(--glass-strong);
  backdrop-filter: blur(26px) saturate(140%);
  -webkit-backdrop-filter: blur(26px) saturate(140%);
  border: 1px solid var(--stroke);
  box-shadow: var(--glass-shadow-strong);
}

.glass-pill {
  border-radius: var(--radius-pill);
  padding: 6px 14px;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass,
  .card,
  .card-glass,
  .glass-strong {
    background: var(--bg-soft);
  }
}

/* --------------------------------------------------------------------------
   Typography helpers
   -------------------------------------------------------------------------- */
.text-accent {
  color: var(--accent);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.section-title {
  font-size: clamp(28px, 3.6vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.section-subtitle {
  margin-top: 14px;
  max-width: 620px;
  color: var(--text-dim);
  font-size: 16px;
}

.text-dim {
  color: var(--text-dim);
}
.text-faint {
  color: var(--text-faint);
}
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  --btn-h: 44px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: var(--btn-h);
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: transform var(--fast) var(--ease), box-shadow var(--mid) var(--ease),
    background-color var(--mid) var(--ease), border-color var(--mid) var(--ease),
    color var(--mid) var(--ease), opacity var(--mid) var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn .icon,
.btn > svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 8px 24px rgba(232, 112, 42, 0.16);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--glass);
  border-color: var(--stroke);
  color: var(--text);
  box-shadow: inset 0 1px 0 var(--stroke-top);
  backdrop-filter: blur(26px) saturate(140%);
  -webkit-backdrop-filter: blur(26px) saturate(140%);
}
.btn-secondary:hover {
  background: var(--glass-strong);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn-ghost {
  color: var(--text-dim);
}
.btn-ghost:hover {
  color: var(--text);
  background: var(--surface);
}

.btn-outline {
  border-color: var(--stroke);
  color: var(--text);
  background: transparent;
}
.btn-outline:hover {
  border-color: rgba(232, 112, 42, 0.5);
  color: var(--accent);
  background: var(--accent-soft);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #e07c70;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: #0d1a12;
}
.btn-success:hover {
  background: #8cc39f;
}

.btn-sm {
  --btn-h: 34px;
  padding: 0 13px;
  font-size: 13px;
  gap: 6px;
}

.btn-lg {
  --btn-h: 52px;
  padding: 0 28px;
  font-size: 15.5px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: var(--btn-h);
  padding: 0;
}

/* spinner */
.spinner {
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --------------------------------------------------------------------------
   Badges / pills
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--stroke);
  background: var(--glass);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-accent {
  background: var(--accent-soft);
  border-color: rgba(232, 112, 42, 0.32);
  color: var(--accent);
}

.badge-success {
  background: var(--success-soft);
  border-color: rgba(121, 181, 142, 0.32);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-soft);
  border-color: rgba(217, 164, 65, 0.32);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-soft);
  border-color: rgba(217, 107, 94, 0.32);
  color: var(--danger);
}

.badge-info {
  background: var(--info-soft);
  border-color: rgba(166, 166, 172, 0.32);
  color: var(--info);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.01em;
}

.label .optional {
  font-weight: 500;
  color: var(--text-faint);
  font-size: 12px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  background: var(--well);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--mid) var(--ease), box-shadow var(--mid) var(--ease),
    background-color var(--mid) var(--ease);
}

.textarea {
  height: auto;
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.55;
}

.select {
  appearance: none;
  padding-inline-end: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
[dir="rtl"] .select {
  background-position: 13px 50%, 18px 50%;
}

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

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--border-strong);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: rgba(232, 112, 42, 0.55);
  box-shadow: 0 0 0 2px rgba(232, 112, 42, 0.35);
}

.input[aria-invalid="true"],
.select[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(217, 107, 94, 0.28);
}

.input[disabled],
.select[disabled],
.textarea[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.field-hint {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.5;
}

.field-error {
  font-size: 12px;
  color: var(--danger);
  line-height: 1.5;
  display: none;
}
.field-error:not(:empty) {
  display: block;
}

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

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  line-height: 1.5;
}

.check input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}

/* switch */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}

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

.switch-track {
  position: relative;
  width: 42px;
  height: 24px;
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--well);
  border: 1px solid var(--stroke);
  transition: background-color var(--mid) var(--ease), border-color var(--mid) var(--ease);
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform var(--mid) var(--ease), background-color var(--mid) var(--ease);
}

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

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
  background: #fff;
}

[dir="rtl"] .switch input:checked + .switch-track::after {
  transform: translateX(-18px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid rgba(232, 112, 42, 0.65);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--glass);
  backdrop-filter: blur(26px) saturate(140%);
  -webkit-backdrop-filter: blur(26px) saturate(140%);
  box-shadow: var(--glass-shadow);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 680px;
}

.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 14px;
  text-align: start;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--bg-soft);
  border-bottom: 1px solid var(--stroke);
  white-space: nowrap;
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--stroke);
  color: var(--text-dim);
  vertical-align: middle;
}

.table tbody tr {
  transition: background-color var(--fast) var(--ease);
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

:root[data-theme="light"] .table tbody tr:hover {
  background: rgba(20, 18, 15, 0.025);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table .cell-strong {
  color: var(--text);
  font-weight: 600;
}

.table .cell-mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

/* --------------------------------------------------------------------------
   Toast, modal, states
   -------------------------------------------------------------------------- */
.toast-host {
  position: fixed;
  inset-block-end: 20px;
  inset-inline-end: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: var(--glass-strong);
  backdrop-filter: blur(26px) saturate(140%);
  -webkit-backdrop-filter: blur(26px) saturate(140%);
  color: var(--text);
  box-shadow: var(--glass-shadow-strong);
  font-size: 13.5px;
  line-height: 1.5;
  pointer-events: auto;
  animation: toast-in var(--slow) var(--ease);
}

.toast::before {
  content: "";
  width: 3px;
  align-self: stretch;
  border-radius: 999px;
  background: var(--accent);
  flex: none;
}

.toast[data-kind="success"]::before {
  background: var(--success);
}
.toast[data-kind="error"]::before {
  background: var(--danger);
}
.toast[data-kind="warning"]::before {
  background: var(--warning);
}

.toast.leaving {
  animation: toast-out var(--mid) var(--ease) forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.99);
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: var(--scrim);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in var(--mid) var(--ease);
}

.modal {
  width: 100%;
  max-width: 440px;
  background: var(--glass-strong);
  backdrop-filter: blur(26px) saturate(140%);
  -webkit-backdrop-filter: blur(26px) saturate(140%);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow-strong);
  padding: 24px;
  animation: modal-in var(--slow) var(--ease);
}

.modal h3 {
  font-size: 18px;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  font-weight: 600;
}

.modal p {
  color: var(--text-dim);
  font-size: 14px;
}

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

@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
}

.empty-state,
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-dim);
}

.empty-state svg,
.error-state svg {
  width: 38px;
  height: 38px;
  color: var(--text-faint);
  margin-bottom: 4px;
}

.empty-state h3,
.error-state h3 {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.empty-state p,
.error-state p {
  max-width: 380px;
  font-size: 13.5px;
}

.error-state .btn {
  margin-top: 6px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  animation: shimmer 1.4s infinite;
}

:root[data-theme="light"] .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(20, 18, 15, 0.05), transparent);
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

.spinner-lg {
  width: 28px;
  height: 28px;
  border-width: 3px;
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Utility layout
   -------------------------------------------------------------------------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.wrap {
  flex-wrap: wrap;
}
.grow {
  flex: 1;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   Shared chrome controls
   -------------------------------------------------------------------------- */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease),
    border-color var(--fast) var(--ease);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--stroke);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.theme-icon {
  display: none;
}
:root[data-theme="dark"] .theme-icon-sun,
:root:not([data-theme]) .theme-icon-sun {
  display: block;
}
:root[data-theme="light"] .theme-icon-moon {
  display: block;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 38px;
  padding-inline: 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--text-dim);
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease);
  cursor: pointer;
}

.lang-switch:hover,
.lang-switch:focus-within {
  background: var(--surface);
  border-color: var(--stroke);
}

.lang-switch svg {
  width: 16px;
  height: 16px;
  flex: none;
  pointer-events: none;
}

.lang-select {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  max-width: 92px;
}

.lang-select option {
  background: var(--bg-soft);
  color: var(--text);
}

.password-field {
  position: relative;
}

.password-field .input {
  padding-inline-end: 44px;
}

.password-toggle {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-faint);
}

.password-toggle:hover {
  color: var(--text);
  background: var(--surface);
}

.password-toggle svg {
  width: 16px;
  height: 16px;
}

/* --------------------------------------------------------------------------
   Motion preferences
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 900px) {
  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* Display typography: closer to a studio site than a template. */
h1, .hero h1, .page-hero h1, .section-title, .display {
  letter-spacing: -0.035em;
  font-weight: 600;
  line-height: 1.02;
  text-wrap: balance;
}
.hero-sub, .page-hero p, .section-sub {
  letter-spacing: -0.005em;
  line-height: 1.62;
}
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }


/* Calopic typography: Latin grotesk + a real CJK family, not one font pretending to cover both. */
:root {
  --font-display: "Instrument Sans", "Geist Sans", -apple-system, "Segoe UI Variable", "Segoe UI", sans-serif;
  --font-cjk: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
}
h1, h2, .hero h1, .page-hero h1, .section-title, .display {
  font-family: var(--font-display);
}
html[lang="zh"] body,
html[lang="ja"] body,
html[lang="ko"] body,
html[lang="zh"] .btn,
html[lang="zh"] .nav-link,
html[lang="ja"] .btn,
html[lang="ko"] .btn {
  font-family: var(--font-cjk);
}
html[lang="zh"] h1,
html[lang="ja"] h1,
html[lang="ko"] h1,
html[lang="zh"] h2,
html[lang="ja"] h2,
html[lang="ko"] h2,
html[lang="zh"] .hero h1,
html[lang="ja"] .hero h1,
html[lang="ko"] .hero h1 {
  font-family: var(--font-cjk);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.2;
}
html[lang="zh"] .hero-sub,
html[lang="ja"] .hero-sub,
html[lang="ko"] .hero-sub {
  letter-spacing: 0;
  line-height: 1.78;
}
