/* ─── Design tokens (Sunset light theme) ─── */
:root {
  /* Sunset palette */
  --primary: #FF6B35;
  --primary-deep: #E8531F;
  --primary-soft: #FFE3D5;
  --gold: #FFB627;
  --gold-soft: #FFF0CC;
  --blush: #FF4D8D;
  --mint: #2DD4A4;
  --sky: #4D9DE0;
  --pine: #1A535C;

  /* Surfaces (light cream) */
  --bg: #FFF8F0;
  --bg-soft: #FFFBF5;
  --surface: #FFFFFF;
  --surface-0: #FFFBF5;
  --surface-1: #FFFFFF;
  --surface-2: #FFF3E5;

  /* Text */
  --ink: #1F1B16;
  --ink-2: #4F4738;
  --muted: #8F8674;
  --hairline: rgba(31, 27, 22, 0.08);
  --hairline-strong: rgba(31, 27, 22, 0.16);

  /* Aliases (backwards compat with existing components.css) */
  --accent: var(--primary);
  --accent-hover: var(--primary-deep);
  --text: var(--ink);
  --text-muted: var(--muted);
  --border: var(--hairline);

  /* Radii */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(31, 27, 22, .06);
  --shadow-md: 0 6px 18px -8px rgba(31, 27, 22, .14), 0 2px 4px rgba(31, 27, 22, .04);
  --shadow-lg: 0 24px 60px -28px rgba(255, 107, 53, .35), 0 8px 18px -8px rgba(31, 27, 22, .12);

  /* Fonts */
  --font-display: 'Sora', 'Noto Sans TC', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Noto Sans TC', system-ui, sans-serif;
  --font-money: 'Sora', 'Noto Sans TC', system-ui, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --pad: 24px;
}

/* ─── Reset & base ─── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html, body { min-height: 100%; }

body {
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  font-size: 13px;
  line-height: 1.5;
  font-feature-settings: "ss01", "cv11";
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
button:hover { filter: brightness(1.1); }
input, select, textarea { font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 4px; }

/* CJK 防斷字 */
button, .page-title { white-space: nowrap; }
.page-title-block, .page-title-block p { word-break: keep-all; overflow-wrap: normal; }
.page-title-block p { white-space: normal !important; }

/* ─── Layout: shell + grids ─── */
.shell {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
}
.grid-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-2     { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-half  { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

@media (max-width: 960px) {
  :root { --pad: 18px; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2     { grid-template-columns: 1fr; }
  .grid-half  { grid-template-columns: 1fr; }
  .shell      { padding: 18px; gap: 18px; }
  .hide-tablet { display: none !important; }
}

@media (max-width: 640px) {
  :root { --pad: 14px; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .shell      { padding: 14px; gap: 14px; }
  .grid-stats > .hero-card { grid-column: 1 / -1; }
  .hide-mobile { display: none !important; }
  h1.page-title { font-size: 20px !important; }
}

/* ─── Utilities ─── */
.text-muted     { color: #9ca3af; }
.text-secondary { color: #6b7280; }
.text-disabled  { color: #4b5563; }
.text-white     { color: #fff; }
.text-success   { color: #10b981; }
.text-warning   { color: #f59e0b; }
.text-error     { color: #ef4444; }
.text-info      { color: #3b82f6; }

.tabular-nums   { font-variant-numeric: tabular-nums; }
.nowrap         { white-space: nowrap; }
.mono           { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.uppercase      { text-transform: uppercase; letter-spacing: 0.05em; }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* Title block (page header) */
.title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title-block .eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
h1.page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.01em;
}
.page-title-block p.sub {
  margin: 6px 0 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .title-row { flex-direction: column; align-items: stretch; }
  .title-row > div:last-child { display: flex; gap: 8px; }
  .title-row button, .title-row a.btn { width: 100%; }
}

/* Code chip (legacy) */
.code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
}

/* SVG defaults */
svg { max-width: 100%; }
