:root {
  /* Surface — warm dark */
  --bg:         #131110;
  --surface:    #1c1917;
  --surface-2:  #252220;
  --surface-3:  #302c29;
  --border:     #302c29;
  --border-dim: #252220;

  /* Text */
  --text:       #ede8e3;
  --text-2:     #8a8076;
  --text-3:     #55504a;

  /* Accent — dusty rose */
  --accent:     #c9a0b4;
  --accent-2:   #a07890;

  /* Semantic */
  --green:      #4caf7d;
  --red:        #e05c6a;
  --amber:      #d4952a;
  --blue:       #5a88d0;
  --purple:     #9b5cd4;

  /* Period */
  --flow-heavy:   #8c2f4a;
  --flow-medium:  #d44d70;
  --flow-light:   #f08aaa;
  --flow-spotting:var(--purple);
  --predicted:    var(--blue);
  --fertile:      var(--green);

  /* Finance section colors */
  --fin-commute: var(--blue);
  --fin-fixed:   var(--accent);
  --fin-food:    var(--amber);
  --fin-nec:     var(--cat-health);
  --fin-opt:     var(--purple);
  --fin-saved:   var(--green);

  /* Calendar event categories — fixed, not user-configurable */
  --cat-work:      #B8C89A;
  --cat-personal:  #D69AA5;
  --cat-health:    #C79A9A;
  --cat-family:    #86AFC5;
  --cat-friends:   #7C9CCB;
  --cat-travel:    #D1B36A;
  --cat-education: #8FAFA2;
  --cat-project:   #C49A73;
  --cat-partner:   #B7A6B5;

  /* Motion */
  --ease:       cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out:   cubic-bezier(0, 0, 0.2, 1);
  --ease-spring:cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:   120ms;
  --dur-base:   220ms;
  --dur-slow:   380ms;

  /* Layout */
  --tab-h:      44px;
  --sidebar-w:  280px;
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;

  /* Space */
  --s1: 4px;   --s2: 8px;   --s3: 12px;
  --s4: 16px;  --s5: 24px;  --s6: 32px;  --s7: 48px;

  /* Standard padding for a view's scrollable content area (top / sides / bottom).
     Used by every module body so calendar/period/finance/gacha line up. Change here only. */
  --view-pad: var(--s4) var(--s5) var(--s6);

  /* Standard height of a view's top header/tab bar. Every view's header uses this
     so switching tabs never nudges content up/down. Change here only. */
  --view-head-h: 48px;

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  --mono: 'SF Mono', 'Fira Code', monospace;
  --brand-serif: 'Fraunces', Georgia, serif;
  --fs-xs: 11px;  --fs-sm: 13px;  --fs-base: 15px;
  --fs-lg: 18px;  --fs-xl: 22px;  --fs-2xl: 28px;

  /* Brand */
  --brand-ink:   var(--text);
  --brand-paper: var(--bg);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  color-scheme: dark;
}

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

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--s2) var(--s3);
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent-2);
}

::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

/* ── Brand pill ── */
.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--brand-ink);
  color: var(--brand-paper);
  border-radius: 999px;
  text-decoration: none;
}
.brand-pill-name {
  font-family: var(--brand-serif);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 144;
  line-height: 1;
  color: var(--text);
}
.brand-pill-name::after {
  content: '.';
  color: var(--accent);
}
.brand-pill-ver {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: 0.1em;
  opacity: 0.6;
  line-height: 1;
}

/* ── Shared panel header nav (year/month < > buttons, label, today, view toggle) ── */
.cal-header {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 0 var(--s5);
  height: var(--view-head-h);
  border-bottom: 1px solid var(--border-dim);
  flex-shrink: 0;
}

.cal-year-btn {
  color: var(--text-3);
  font-size: var(--fs-lg);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.cal-year-btn:hover { color: var(--text); background: var(--surface-2); }
.cal-year-btn:disabled { opacity: 0.3; pointer-events: none; }

.cal-year-label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text);
  min-width: 110px;
  text-align: center;
}

.cal-today-btn {
  font-size: var(--fs-xs);
  color: var(--text-3);
  padding: 5px var(--s3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-dim);
  transition: color var(--dur-fast), border-color var(--dur-fast);
}
.cal-today-btn:hover { color: var(--text-2); border-color: var(--border); }

.cal-view-toggle {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  padding: 2px;
  margin-left: var(--s3);
}

.cal-view-btn {
  font-size: var(--fs-xs);
  padding: 3px var(--s3);
  border-radius: 4px;
  color: var(--text-3);
  transition: color var(--dur-fast), background var(--dur-fast);
}
.cal-view-btn:hover { color: var(--text-2); }
.cal-view-btn.active { background: var(--surface-3); color: var(--text); }

/* ── Light theme ── */
[data-theme="light"] {
  --bg:         #f2ede8;
  --surface:    #ebe4dd;
  --surface-2:  #e0d8d0;
  --surface-3:  #d4cbc2;
  --border:     #c8bfb6;
  --border-dim: #d8d0c8;
  --text:       #1f1a17;
  --text-2:     #6b5f57;
  --text-3:     #a89080;
  --accent:     #b07090;
  --accent-2:   #8a5070;
  --green:      #3a8f5a;
  --red:        #c04050;
  --amber:      #b07820;
  --blue:       #4060b0;
  --purple:     #7040a0;
  --flow-heavy:   #7a1f38;
  --flow-medium:  #c03460;
  --flow-light:   #e07090;
}
