/* ============================================================
   Ivory Days Wedding Planner — design system
   ============================================================ */
:root {
  /* ============ semantic tokens (re-written per user by the theme engine) ============ */
  --color-primary: #843747;
  --color-primary-2: #A5525F;
  --color-primary-strong: #6C2A39;
  --color-primary-soft: #F5EAEC;
  --color-primary-tint: #FAF2F4;
  --color-on-primary: #FFFFFF;
  --color-secondary: #A5525F;
  --color-accent: #D28C91;
  --color-accent-strong: #B26A70;
  --color-accent-soft: #F6E6E5;
  --color-background: #FBF7F2;
  --color-surface: #FFFFFF;
  --color-surface-secondary: #F5ECE5;
  --color-surface-sunken: #F8F2EC;
  --color-text-primary: #39272A;
  --color-text-strong: #4A2530;
  --color-text-secondary: #7C6A6D;
  --color-text-on-strong: #FFFFFF;
  --color-border: #E7D8CD;
  --color-border-strong: #DCC9BA;
  --color-success: #2F7D5A;
  --color-success-bg: #EBF4EE;
  --color-success-text: #276647;
  --color-warning: #A9741F;
  --color-warning-bg: #FBF2DF;
  --color-warning-text: #7F5614;
  --color-error: #A4384A;
  --color-error-bg: #FAEBED;
  --color-error-text: #8A2C3E;
  --color-info: #3F6488;
  --color-info-bg: #ECF2F8;
  --color-info-text: #33546F;
  --color-link: #7A3140;
  --color-focus: rgba(122, 49, 64, .35);
  --color-shadow-rgb: 87, 33, 45;
  --color-scrim: rgba(57, 39, 42, .42);
  --grad-primary: linear-gradient(120deg, var(--color-primary-cta, var(--color-primary)), var(--color-primary-cta-2, var(--color-primary-2)));
  --grad-brand: linear-gradient(140deg, var(--color-primary-cta-2, var(--color-primary-2)), var(--color-primary-cta, var(--color-primary)));
  --grad-hero: linear-gradient(118deg, #F3DCD7 0%, #F7E6DF 46%, #F2E4D9 100%);
  --grad-app-bg:
    radial-gradient(1000px 520px at 12% -8%, rgba(210, 140, 145, .34), transparent 62%),
    radial-gradient(820px 460px at 96% 4%, rgba(165, 82, 95, .16), transparent 60%),
    radial-gradient(900px 620px at 60% 108%, rgba(210, 140, 145, .22), transparent 65%),
    var(--color-background);

  /* ============ legacy aliases (kept so every component follows the theme) ============ */
  --ivory: var(--color-background);
  --cream: var(--color-surface-secondary);
  --blush: var(--color-accent-soft);
  --rose: var(--color-accent);
  --burgundy: var(--color-primary);
  --wine: var(--color-text-strong);
  --beige: var(--color-border-strong);
  --ink: var(--color-text-primary);
  --ink-2: var(--color-text-secondary);
  --white: var(--color-surface);
  --line: var(--color-border);
  --ok: var(--color-success);
  --ok-bg: var(--color-success-bg);
  --warn: var(--color-warning);
  --warn-bg: var(--color-warning-bg);
  --danger: var(--color-error);
  --danger-bg: var(--color-error-bg);
  --info: var(--color-info);
  --info-bg: var(--color-info-bg);

  /* ============ shape / typography tokens (per UI style preset) ============ */
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
  --card-border-w: 1px;
  --font-heading: var(--serif);
  --sidebar-bg: rgba(255, 255, 255, .72);
  --topbar-bg: rgba(251, 247, 242, .82);
  --hero-decor: block;
  --hero-bg: var(--grad-hero);
  --side-active-bg: linear-gradient(120deg, var(--color-primary-cta, var(--color-primary)), var(--color-primary-cta-2, var(--color-primary-2)));
  --side-active-fg: var(--color-on-primary);
  --btn-primary-bg: linear-gradient(120deg, var(--color-primary-cta, var(--color-primary)), var(--color-primary-cta-2, var(--color-primary-2)));
  --shadow-sm: 0 2px 6px rgba(var(--color-shadow-rgb), .06);
  --shadow: 0 18px 40px -28px rgba(var(--color-shadow-rgb), .42);
  --shadow-lg: 0 30px 60px -34px rgba(var(--color-shadow-rgb), .40);
  --serif: "Playfair Display", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --side-w: 264px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--ivory);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.app-body {
  background: var(--grad-app-bg);
  background-attachment: fixed;
}

a { color: var(--color-link); text-decoration: none; }
a:hover { color: var(--color-text-strong); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 .35em; font-weight: 600; line-height: 1.25; }
p { margin: 0 0 .75em; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; letter-spacing: .04em; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.serif { font-family: var(--serif); }
.inline { display: inline; }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------ app shell */
.shell {
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns .26s cubic-bezier(.4, 0, .2, 1);
}
.shell.nav-collapsed { grid-template-columns: 0 minmax(0, 1fr); }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  transition: transform .26s cubic-bezier(.4, 0, .2, 1), opacity .2s ease, visibility .26s ease;
  background: var(--sidebar-bg);
  backdrop-filter: blur(18px) saturate(160%);
  border-right: 1px solid var(--color-border);
  z-index: 40;
}
.side-brand { padding: 22px 18px 14px; }
.brand-link { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand-link:hover { color: var(--ink); }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  display: grid; place-items: center;
  background: var(--grad-brand);
  color: var(--color-on-primary); font-family: var(--serif); font-size: 17px; letter-spacing: .04em;
  box-shadow: 0 10px 20px -12px rgba(var(--color-shadow-rgb), .55);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-serif { font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: .01em; }
.brand-sub { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-2); }
.side-nav { flex: 1; overflow-y: auto; padding: 4px 12px 20px; scrollbar-width: thin; }
.side-section { margin-bottom: 14px; }
.side-label {
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--color-text-secondary); opacity: .85; margin: 0 0 6px; padding-left: 12px; font-weight: 600;
}
.side-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--r-sm); color: var(--color-text-primary); font-size: 14px; font-weight: 500;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.side-link .ico { width: 17px; height: 17px; opacity: .8; }
.side-link:hover { background: var(--color-primary-tint); color: var(--color-text-strong); }
.side-link.active {
  background: var(--side-active-bg);
  color: var(--side-active-fg); box-shadow: 0 12px 22px -16px rgba(var(--color-shadow-rgb), .7);
}
.side-link.active .ico { opacity: 1; }
.side-foot { padding: 14px 18px 20px; border-top: 1px solid var(--color-border); }
/* desktop collapse: the grid column becomes 0 so the content really widens */
.shell.nav-collapsed .sidebar {
  transform: translateX(-100%); opacity: 0; visibility: hidden;
  pointer-events: none; border-right-color: transparent; overflow: hidden;
}
.shell.nav-collapsed .topbar { padding-left: 16px; }
.side-couple { font-family: var(--font-heading); font-size: 15px; margin: 0; }
.side-date { font-size: 11.5px; color: var(--ink-2); margin: 2px 0 0; }
.scrim { position: fixed; inset: 0; background: var(--color-scrim); z-index: 35; border: 0; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px;
  background: var(--topbar-bg);
  backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--color-border);
}
.nav-toggle { display: inline-grid; }   /* always available: collapses the sidebar on desktop, opens the drawer on mobile */
.search {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--r-pill); padding: 0 16px; height: 42px; max-width: 520px;
  color: var(--ink-2); box-shadow: var(--shadow-sm);
}
.search .ico { width: 16px; height: 16px; }
.search input {
  border: 0; background: transparent; font: inherit; color: var(--ink);
  width: 100%; outline: none; height: 100%;
}
.search input::placeholder { color: var(--color-text-secondary); opacity: .8; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--color-surface); border: 1px solid var(--color-border);
  color: var(--color-text-secondary); cursor: pointer; position: relative; transition: all .18s ease;
}
.icon-btn:hover { background: var(--color-primary-tint); color: var(--color-text-strong); border-color: var(--color-border-strong); }
.dot {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px;
  border-radius: var(--r-pill); background: var(--color-primary); color: var(--color-on-primary);
  font-size: 10.5px; font-weight: 600; display: grid; place-items: center; padding: 0 4px;
  border: 2px solid var(--color-surface);
}
.notif, .profile-menu { position: relative; }
.notif summary, .profile-menu summary { list-style: none; cursor: pointer; }
.notif summary::-webkit-details-marker, .profile-menu summary::-webkit-details-marker { display: none; }
.profile {
  display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px;
  border-radius: var(--r-pill); background: var(--color-surface); border: 1px solid var(--color-border);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none;
  border: 2px solid var(--color-surface); box-shadow: 0 2px 6px rgba(var(--color-shadow-rgb), .16);
}
.avatar-text {
  display: grid; place-items: center; background: var(--grad-brand);
  color: var(--color-on-primary); font-family: var(--font-heading); font-size: 15px;
}
.profile-txt { display: flex; flex-direction: column; line-height: 1.2; }
.profile-txt strong { font-size: 13px; font-weight: 600; }
.profile-txt small { font-size: 10.5px; color: var(--ink-2); }
.popover {
  position: absolute; right: 0; top: calc(100% + 10px); width: 320px;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 14px; z-index: 60;
}
.pop-title { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 8px; }
.pop-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 320px; overflow: auto; }
.pop-list a { display: block; font-size: 13px; color: var(--color-text-primary); padding: 8px 10px; border-radius: var(--r-sm); background: var(--color-surface-sunken); }
.pop-list a:hover { background: var(--color-primary-tint); }
.pop-list .lvl-danger a { border-left: 3px solid var(--danger); }
.pop-list .lvl-warn a { border-left: 3px solid var(--warn); }
.pop-list .lvl-info a { border-left: 3px solid var(--info); }
.pop-list .lvl-ok a { border-left: 3px solid var(--ok); }
.pop-link {
  display: block; width: 100%; text-align: left; font: inherit; font-size: 13.5px;
  padding: 9px 10px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--color-text-primary); cursor: pointer;
}
.pop-link:hover { background: var(--color-surface-secondary); }
.pop-link.danger { color: var(--danger); }
.pop-logout { margin: 4px 0 0; border-top: 1px solid var(--color-border); padding-top: 4px; }
.profile-menu .popover { width: 232px; }

.content { padding: 26px 28px 40px; width: 100%; max-width: 1440px; margin: 0 auto; flex: 1; }
.shell.nav-collapsed .content { max-width: 1560px; }
.app-foot {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  padding: 18px; font-size: 12px; color: var(--ink-2);
  border-top: 1px solid rgba(220, 201, 186, .45);
}

/* ------------------------------------------------------------ headings */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; }
/* keep the title block from overflowing underneath the action buttons */
.page-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.page-head .sub { max-width: 68ch; }
.head-actions { flex: 0 0 auto; }
.page-head h1, .page-title {
  font-family: var(--font-heading); font-size: 30px; font-weight: 600; margin: 0;
  letter-spacing: -.01em; color: var(--color-text-strong);
}
.page-head .sub { color: var(--ink-2); font-size: 13.5px; margin: 4px 0 0; }
.crumbs { font-size: 12px; color: var(--ink-2); margin: 0 0 6px; }
.crumbs a { color: var(--ink-2); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: var(--r-pill); border: 1px solid transparent;
  font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: transform .15s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
  white-space: nowrap; text-decoration: none;
}
.btn .ico { width: 16px; height: 16px; }
.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--color-on-primary); box-shadow: 0 12px 24px -16px rgba(var(--color-shadow-rgb), .75);
}
.btn-primary:hover { color: var(--color-on-primary); transform: translateY(-1px); box-shadow: 0 16px 28px -16px rgba(var(--color-shadow-rgb), .7); filter: brightness(1.06); }
.btn-soft { background: var(--color-primary-soft); color: var(--color-primary-strong); border-color: var(--color-border-strong); }
.btn-soft:hover { background: var(--color-accent-soft); color: var(--color-primary-strong); }
.btn-ghost { background: var(--color-surface); border-color: var(--color-border-strong); color: var(--color-text-primary); }
.btn-ghost:hover { background: var(--color-surface); color: var(--color-primary-strong); border-color: var(--color-primary); }
.btn-dark { background: var(--color-text-strong); color: var(--color-text-on-strong); }
.btn-dark:hover { color: var(--color-text-on-strong); }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn-danger-ghost { background: transparent; border-color: var(--color-error); color: var(--color-error-text); }
.btn-danger-ghost:hover { background: var(--color-error-bg); color: var(--color-error-text); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ------------------------------------------------------------ cards */
.card {
  background: var(--color-surface);
  border: var(--card-border-w) solid var(--color-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px 12px; flex-wrap: wrap;
}
.card-head h2, .card-head h3 { font-family: var(--font-heading); font-size: 18px; margin: 0; color: var(--color-text-strong); font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--ink-2); margin: 2px 0 0; }
.card-body { padding: 4px 20px 20px; }
.card-body.flush { padding: 0; }
.card + .card, .card + .grid, .grid + .card, .grid + .grid { margin-top: 20px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) minmax(290px, 340px); align-items: start; }
.stack { display: grid; gap: 20px; }
.section-gap { margin-top: 32px; }

/* ------------------------------------------------------------ dashboard hero */
.hero {
  position: relative; overflow: hidden;
  border-radius: 26px;
  padding: 30px 34px;
  background:
    radial-gradient(420px 220px at 88% 6%, rgba(255, 255, 255, .55), transparent 70%),
    var(--hero-bg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 26px; align-items: center;
}
.hero:after {
  content: ""; position: absolute; right: -40px; bottom: -70px; width: 320px; height: 320px;
  background: radial-gradient(circle at 30% 30%, var(--color-accent-soft), transparent 62%);
  border-radius: 50%; pointer-events: none;
}
.hero-leaf { position: absolute; right: 18px; top: -12px; opacity: .5; pointer-events: none; }
.hero-eyebrow {
  font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--color-primary-strong); opacity: .8; margin: 0 0 8px; font-weight: 600;
}
.hero h1 { font-family: var(--font-heading); font-size: 33px; line-height: 1.16; color: var(--color-text-strong); margin: 0 0 8px; font-weight: 600; }
.hero p.lead { color: var(--color-text-primary); opacity: .88; font-size: 14px; max-width: 46ch; margin: 0 0 18px; }
.hero-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.hero-meta div { font-size: 12.5px; color: var(--color-text-secondary); display: flex; align-items: center; gap: 7px; }
.hero-meta strong { color: var(--color-text-strong); font-weight: 600; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.countdown-card {
  position: relative; z-index: 2;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--r-lg); padding: 20px 24px; text-align: center; min-width: 186px;
  backdrop-filter: blur(10px); box-shadow: var(--shadow-sm);
}
.countdown-num { font-family: var(--font-heading); font-size: 44px; line-height: 1; color: var(--color-primary-strong); }
.countdown-lbl { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--color-text-secondary); margin-top: 6px; }
.countdown-sub { font-size: 11.5px; color: var(--ink-2); margin-top: 8px; }

/* ------------------------------------------------------------ stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin-top: 20px; }
.stat { background: var(--color-surface); border: var(--card-border-w) solid var(--color-border); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.stat-lbl { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; }
.stat-ic { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--color-primary-soft); color: var(--color-primary-strong); flex: none; }
.stat-val { font-family: var(--font-heading); font-size: 25px; color: var(--color-text-strong); line-height: 1.1; letter-spacing: -.01em; overflow-wrap: anywhere; }
.stat-meta { font-size: 12px; color: var(--ink-2); margin-top: 7px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.stat-meta strong { color: var(--ink); font-weight: 600; }
.bar { height: 7px; background: var(--color-surface-secondary); border-radius: var(--r-pill); overflow: hidden; margin-top: 12px; }
.bar > span { display: block; height: 100%; border-radius: var(--r-pill); background: var(--color-primary); }
.bar.ok > span { background: var(--color-success); }
.bar.warn > span { background: var(--color-warning); }
.bar.soft > span { background: var(--color-accent-strong); }

/* ------------------------------------------------------------ charts */
.donut-wrap { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.donut-holder { position: relative; width: var(--donut-size, 176px); height: var(--donut-size, 176px); flex: none; }
.donut-svg { display: block; width: 100%; height: 100%; }
.donut-seg {
  transition: opacity .15s ease, filter .15s ease;
  cursor: default; outline: none;
}
.donut-seg:hover, .donut-seg:focus-visible { filter: brightness(1.12) saturate(1.1); opacity: .92; }
.donut-seg:focus-visible { stroke-linecap: round; }
.donut-center {
  position: absolute; inset: 27%; display: grid; place-content: center; text-align: center;
  pointer-events: none;
}
.donut-center span { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--color-text-secondary); }
.donut-center strong { font-family: var(--font-heading); font-size: 18px; color: var(--color-text-strong); display: block; line-height: 1.2; }

.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; flex: 1; min-width: 210px; }
.legend li { display: grid; grid-template-columns: 12px 1fr auto auto; align-items: center; gap: 9px; font-size: 12.5px; }
.legend .swatch { width: 12px; height: 12px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.legend .lg-name { color: var(--color-text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .lg-pct { color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
.legend .lg-val { color: var(--color-text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.legend-chart { gap: 6px; }
.legend-chart li { padding: 3px 0; border-bottom: 1px dashed var(--color-border); }
.legend-chart li:last-child { border-bottom: 0; }

.sbar { display: flex; gap: 3px; height: 16px; border-radius: var(--r-pill); overflow: hidden; background: var(--color-surface-secondary); }
.sbar-seg { display: block; height: 100%; border-radius: 2px; transition: filter .15s ease; }
.sbar-seg:hover, .sbar-seg:focus-visible { filter: brightness(1.1); outline: none; }

.pair-bar { height: 8px; background: var(--color-surface-secondary); border-radius: var(--r-pill); overflow: hidden; box-shadow: inset 0 0 0 1px var(--color-border); }
.pair-paid { display: block; height: 100%; background: var(--color-success); border-radius: var(--r-pill); }

.chart-card-legend { display: grid; gap: 4px; margin-top: 14px; }

.swatch-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch-strip span { width: 26px; height: 26px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }

/* floating tooltip driven by [data-tip] (charts) */
.tip-pop {
  position: fixed; z-index: 300; pointer-events: none; opacity: 0;
  transform: translate(-50%, -130%); transition: opacity .12s ease, transform .12s ease;
  background: var(--color-text-strong); color: var(--color-text-on-strong);
  padding: 6px 10px; border-radius: 9px; font-size: 12px; line-height: 1.35;
  max-width: 280px; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .55); white-space: nowrap;
}
.tip-pop.show { opacity: 1; transform: translate(-50%, -145%); }

/* ------------------------------------------------------------ progress rows */
.prog-list { display: grid; gap: 15px; }
.prog-row .prog-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 6px; }
.prog-row .prog-top span:last-child { font-weight: 600; color: var(--wine); font-variant-numeric: tabular-nums; }
.prog-row .hint { font-size: 11.5px; color: var(--ink-2); margin: 5px 0 0; }
.overall { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; background: var(--ivory); border: 1px dashed var(--beige); margin-bottom: 16px; }
.overall-num { font-family: var(--font-heading); font-size: 30px; color: var(--color-primary-strong); line-height: 1; }
.overall p { margin: 0; font-size: 12px; color: var(--ink-2); }

/* ------------------------------------------------------------ lists */
.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid var(--color-border);
}
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item .li-main { flex: 1; min-width: 0; }
.li-title { font-size: 13.5px; font-weight: 500; color: var(--color-text-primary); margin: 0; display: block; overflow-wrap: anywhere; }
.li-sub { font-size: 12px; color: var(--ink-2); margin: 2px 0 0; }
.li-amount { font-size: 13px; font-weight: 600; color: var(--color-text-strong); white-space: nowrap; font-variant-numeric: tabular-nums; }
.li-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rose); margin-top: 7px; flex: none; }
.li-dot.danger { background: var(--danger); }
.li-dot.warn { background: var(--warn); }
.li-dot.ok { background: var(--ok); }
.li-dot.info { background: var(--info); }

/* ------------------------------------------------------------ badges & chips */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill); font-size: 11px; font-weight: 600;
  letter-spacing: .02em; background: var(--color-surface-secondary); color: var(--color-text-secondary); white-space: nowrap;
}
.badge-ok { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-warn { background: var(--color-warning-bg); color: var(--color-warning-text); }
.badge-danger { background: var(--color-error-bg); color: var(--color-error-text); }
.badge-info { background: var(--color-info-bg); color: var(--color-info-text); }
.badge-muted { background: var(--color-surface-secondary); color: var(--color-text-secondary); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--color-surface); border: 1px solid var(--color-border); font-size: 12.5px; color: var(--color-text-primary);
}
.chip.active, .chip:hover { background: var(--color-primary-soft); border-color: var(--color-border-strong); color: var(--color-primary-strong); }
.chip.active { font-weight: 600; }
.chip-x { color: var(--ink-2); }

/* ------------------------------------------------------------ tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
/* Column intent: text columns get room, numbers/status/actions never wrap.
   When the viewport is too narrow the wrapper scrolls horizontally instead of
   squeezing every column to a few pixels (which used to stack one letter per line). */
.table th, .table td { min-width: 0; }
.table .col-title, .table td.t-title { min-width: 200px; }
.table .col-cat { min-width: 108px; }
.table .col-vendor { min-width: 132px; }
.table .col-money { min-width: 116px; }
.table .col-date { min-width: 116px; white-space: nowrap; }
.table .col-status { min-width: 96px; white-space: nowrap; }
.table .col-actions { width: 1%; white-space: nowrap; }
.table td.col-money, .table th.col-money { text-align: right; }
.table--wide { min-width: 900px; }
.table--medium { min-width: 720px; }
.table--narrow { min-width: 520px; }
.table .t-sub {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; max-width: 46ch;
}
.table .badge { white-space: nowrap; }
.table th {
  text-align: left; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--color-text-secondary); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--color-border);
  white-space: nowrap; background: var(--color-surface-sunken);
}
.table td { padding: 12px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--color-primary-tint); }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.table .t-title { font-weight: 500; color: var(--color-text-primary); }
.table .t-sub { font-size: 11.5px; color: var(--ink-2); }

/* ------------------------------------------------------------ forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.col-2 { grid-column: 1 / -1; }
.field > label { font-size: 12px; font-weight: 600; color: var(--color-text-secondary); letter-spacing: .01em; }
.req { color: var(--rose); }
.input {
  width: 100%; font: inherit; font-size: 13.5px; color: var(--color-text-primary);
  background: var(--color-surface); border: 1px solid var(--color-border-strong); border-radius: var(--r-sm);
  padding: 10px 12px; transition: border .16s ease, box-shadow .16s ease;
  min-height: 42px;
}
textarea.input { min-height: 84px; resize: vertical; line-height: 1.55; }
.input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-focus); }
.input::placeholder { color: var(--color-text-secondary); opacity: .75; }
.hint { font-size: 11.5px; color: var(--ink-2); margin: 0; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; padding-top: 22px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--color-primary); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.form-card { padding: 22px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1; min-width: 150px; }

/* ------------------------------------------------------------ dialog */
.dlg {
  border: 0; padding: 0; border-radius: 22px; width: min(760px, calc(100vw - 28px));
  max-height: min(88vh, 900px); background: var(--color-surface); box-shadow: 0 40px 90px -40px var(--color-scrim);
  color: var(--color-text-primary);
}
.dlg::backdrop { background: var(--color-scrim); backdrop-filter: blur(3px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 12px; border-bottom: 1px solid var(--color-border); position: sticky; top: 0; background: var(--color-surface); border-radius: 22px 22px 0 0; z-index: 2; }
.dlg-head h3 { font-family: var(--font-heading); font-size: 19px; margin: 0; color: var(--color-text-strong); }
.dlg-body { padding: 20px 22px 22px; overflow-y: auto; }
.dlg-body .form-actions { position: sticky; bottom: 0; background: var(--color-surface); padding-top: 10px; }

/* ------------------------------------------------------------ flash */
.flashes { display: grid; gap: 10px; margin-bottom: 18px; }
.flash { padding: 12px 16px; border-radius: 13px; font-size: 13.5px; border: 1px solid transparent; }
.flash-success { background: var(--color-success-bg); color: var(--color-success-text); border-color: var(--color-success); }
.flash-error { background: var(--color-error-bg); color: var(--color-error-text); border-color: var(--color-error); }
.flash-info { background: var(--color-info-bg); color: var(--color-info-text); border-color: var(--color-info); }

/* ------------------------------------------------------------ empty states */
.empty {
  text-align: center; padding: 34px 20px; border: 1px dashed var(--color-border-strong);
  border-radius: var(--r); background: var(--color-surface-sunken);
}
.empty-ic { width: 46px; height: 46px; border-radius: var(--r); background: var(--color-primary-soft); color: var(--color-primary-strong); display: grid; place-items: center; margin: 0 auto 12px; }
.empty h3 { font-family: var(--font-heading); font-size: 17px; color: var(--color-text-strong); margin-bottom: 4px; }
.empty p { font-size: 13px; color: var(--ink-2); max-width: 46ch; margin: 0 auto 14px; }

/* ------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); margin-bottom: 20px; overflow-x: auto; }
.tab {
  padding: 10px 16px; font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--color-text-strong); }
.tab.active { color: var(--color-primary-strong); border-bottom-color: var(--color-primary); font-weight: 600; }

/* ------------------------------------------------------------ quick actions */
.qa-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.qa {
  display: flex; align-items: center; gap: 9px; padding: 11px 12px; border-radius: 12px;
  background: var(--color-surface-sunken); border: 1px solid var(--color-border); font-size: 12.5px;
  color: var(--color-text-primary); font-weight: 500; text-align: left; cursor: pointer; font-family: var(--sans);
  transition: all .16s ease;
}
.qa:hover { background: var(--color-primary-tint); border-color: var(--color-border-strong); color: var(--color-primary-strong); }
.qa .ico { width: 15px; height: 15px; color: var(--color-primary); }

/* ------------------------------------------------------------ attention */
.attn { display: grid; gap: 8px; }
.attn-item {
  display: flex; gap: 10px; padding: 11px 13px; border-radius: 12px;
  background: var(--color-surface-sunken); border-left: 3px solid var(--color-border-strong); font-size: 12.5px; color: var(--color-text-primary);
}
.attn-item.lvl-danger { border-left-color: var(--color-error); background: var(--color-error-bg); }
.attn-item.lvl-warn { border-left-color: var(--color-warning); background: var(--color-warning-bg); }
.attn-item.lvl-info { border-left-color: var(--color-info); background: var(--color-info-bg); }
.attn-item.lvl-ok { border-left-color: var(--color-success); background: var(--color-success-bg); }

/* ------------------------------------------------------------ moodboard */
.mood-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 20px; }
.mood-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.mood-thumb { aspect-ratio: 4 / 3; background: var(--color-surface-secondary); position: relative; overflow: hidden; }
.mood-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mood-thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--color-text-secondary); opacity: .6; }
.mood-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.mood-body h3 { font-family: var(--font-heading); font-size: 15px; margin: 0; color: var(--color-text-strong); }
.mood-foot { margin-top: auto; display: flex; gap: 6px; align-items: center; justify-content: space-between; }
.fav { border: 0; background: transparent; cursor: pointer; font-size: 15px; line-height: 1; color: var(--color-text-secondary); padding: 4px; }
.fav.on { color: var(--color-primary); }
.swatch-line { display: flex; gap: 4px; }
.swatch-line i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, .06); }

/* ------------------------------------------------------------ calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-dow { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); text-align: center; padding-bottom: 4px; }
.cal-cell { min-height: 92px; border: 1px solid var(--color-border); border-radius: var(--r-sm); padding: 7px 8px; background: var(--color-surface); font-size: 11.5px; }
.cal-cell.out { background: var(--color-surface-sunken); color: var(--color-text-secondary); opacity: .7; }
.cal-cell.today { border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-focus); }
.cal-cell.wedding { background: linear-gradient(150deg, var(--color-primary-soft), var(--color-surface)); border-color: var(--color-primary); }
.cal-day { font-weight: 600; font-size: 12px; color: var(--color-text-primary); }
.cal-items { display: grid; gap: 3px; margin-top: 5px; }
.cal-pill { display: block; padding: 2px 6px; border-radius: 6px; font-size: 10.5px; background: var(--color-surface-secondary); color: var(--color-text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-pill.pay { background: var(--color-warning-bg); color: var(--color-warning-text); }
.cal-pill.task { background: var(--color-primary-soft); color: var(--color-primary-strong); }
.cal-pill.event { background: var(--color-info-bg); color: var(--color-info-text); }

/* ------------------------------------------------------------ misc */
.kv { display: grid; grid-template-columns: 132px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--ink-2); font-size: 12.5px; }
.kv dd { margin: 0; }
.stat-row { display: flex; gap: 18px; flex-wrap: wrap; }
.mini-stat { background: var(--color-surface-sunken); border: 1px solid var(--color-border); border-radius: var(--r-sm); padding: 11px 15px; min-width: 120px; }
.mini-stat span { display: block; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.mini-stat strong { font-family: var(--font-heading); font-size: 19px; color: var(--color-text-strong); }
.split-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.toolbar .field { min-width: 150px; }
.divider { height: 1px; background: var(--color-border); margin: 18px 0; border: 0; }
.note-card { background: var(--color-surface-secondary); border: 1px solid var(--color-border); border-radius: var(--r); padding: 14px 16px; }
.note-card h4 { font-family: var(--font-heading); font-size: 15px; color: var(--color-text-strong); margin: 0 0 6px; }
.note-card p { font-size: 13px; white-space: pre-wrap; margin: 0; color: var(--color-text-primary); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 74px 1fr; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--color-border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .tm-time { font-size: 12.5px; font-weight: 600; color: var(--color-primary-strong); font-variant-numeric: tabular-nums; }
.timeline .tm-title { font-size: 13.5px; font-weight: 500; margin: 0; }
.timeline .tm-sub { font-size: 12px; color: var(--ink-2); margin: 2px 0 0; }
.sec-title { font-family: var(--font-heading); font-size: 20px; color: var(--color-text-strong); margin: 30px 0 14px; }
.warn-box { background: var(--color-warning-bg); border: 1px solid var(--color-warning); color: var(--color-warning-text); border-radius: var(--r-sm); padding: 11px 14px; font-size: 12.5px; }
.danger-text { color: var(--danger); }
.ok-text { color: var(--ok); }
.rail-sticky { position: sticky; top: 84px; }
.pi { font-family: var(--font-heading); font-size: 15px; color: var(--color-text-strong); }

/* ------------------------------------------------------------ public pages */
.public-body { background: var(--ivory); }
.pub-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--topbar-bg); backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--color-border);
}
.pub-inner { max-width: 1180px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 26px; height: 74px; }
.pub-brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.pub-brand:hover { color: var(--ink); }
.pub-nav { display: flex; gap: 24px; margin-left: 14px; flex: 1; }
.pub-nav a { font-size: 13.5px; color: var(--color-text-secondary); font-weight: 500; }
.pub-nav a:hover, .pub-nav a.active { color: var(--color-primary); }
.pub-actions { display: flex; gap: 8px; align-items: center; }
.pub-burger { display: none; }
.pub-footer { background: var(--color-surface); border-top: 1px solid var(--color-border); margin-top: 60px; }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; padding-top: 42px; padding-bottom: 34px; align-items: start; }
.foot-grid a { display: block; font-size: 13px; color: var(--color-text-secondary); margin-bottom: 8px; }
.foot-grid a:hover { color: var(--color-primary); }
.foot-title { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; margin-bottom: 10px; }
.foot-bottom { border-top: 1px solid var(--color-border); padding: 18px 24px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--color-text-secondary); max-width: 1180px; }
section.pub-section { max-width: 1180px; margin: 0 auto; padding: 60px 24px; }
.pub-eyebrow { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--color-accent-strong); font-weight: 600; margin-bottom: 10px; }
.pub-h1 { font-family: var(--font-heading); font-size: 56px; line-height: 1.06; color: var(--color-text-strong); letter-spacing: -.015em; margin: 0 0 18px; font-weight: 600; }
.pub-h2 { font-family: var(--font-heading); font-size: 34px; color: var(--color-text-strong); line-height: 1.2; margin: 0 0 12px; }
.pub-h3 { font-family: var(--font-heading); font-size: 20px; color: var(--color-text-strong); margin: 0 0 8px; }
.pub-lead { font-size: 16px; color: var(--color-text-secondary); max-width: 52ch; }
.pub-hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: center; padding: 64px 24px 40px; max-width: 1180px; margin: 0 auto; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.pub-badges { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 30px; }
.pub-badge { font-size: 12px; color: var(--color-text-secondary); display: flex; align-items: center; gap: 7px; }
.pub-badge .ico { color: var(--color-primary); }
.preview {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.preview-bar { display: flex; gap: 5px; padding: 11px 14px; border-bottom: 1px solid var(--color-border); background: var(--color-surface-sunken); }
.preview-bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--beige); }
.preview-body { padding: 16px; display: grid; grid-template-columns: 118px 1fr; gap: 14px; background: linear-gradient(160deg, var(--color-surface), var(--color-surface-secondary)); }
.preview-side { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--r-sm); padding: 10px; display: grid; gap: 6px; align-content: start; }
.preview-side i { height: 8px; border-radius: 4px; background: var(--cream); display: block; }
.preview-side i.on { background: var(--blush); }
.preview-main { display: grid; gap: 10px; }
.preview-hero { border-radius: var(--r-sm); padding: 14px; background: var(--grad-hero); }
.preview-hero b { display: block; width: 62%; height: 11px; border-radius: 4px; background: rgba(132, 55, 71, .35); margin-bottom: 7px; }
.preview-hero s { display: block; width: 40%; height: 7px; border-radius: 4px; background: rgba(132, 55, 71, .2); }
.preview-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.preview-cards div { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--r-sm); padding: 9px; }
.preview-cards em { display: block; height: 6px; border-radius: 3px; background: var(--cream); margin-bottom: 5px; }
.preview-cards u { display: block; height: 10px; width: 70%; border-radius: 3px; background: var(--blush); }
.preview-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preview-two div { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--r-sm); height: 74px; padding: 10px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.feature {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease;
}
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature .f-ic { width: 42px; height: 42px; border-radius: var(--r-sm); background: var(--color-primary-soft); color: var(--color-primary-strong); display: grid; place-items: center; margin-bottom: 14px; }
.feature h3 { font-family: var(--font-heading); font-size: 18px; color: var(--color-text-strong); margin-bottom: 6px; }
.feature p { font-size: 13.5px; color: var(--color-text-secondary); margin: 0; }
.benefit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.benefit { display: flex; gap: 13px; padding: 18px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--r); }
.benefit .ico { color: var(--color-primary); margin-top: 2px; }
.benefit h4 { font-size: 14.5px; margin: 0 0 4px; color: var(--color-text-strong); font-family: var(--font-heading); }
.benefit p { margin: 0; font-size: 13px; color: var(--color-text-secondary); }
.step-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: step; }
.step { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--r-lg); padding: 22px; position: relative; }
.step:before {
  counter-increment: step; content: counter(step);
  font-family: var(--font-heading); font-size: 15px; color: var(--color-on-primary);
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--grad-brand); margin-bottom: 12px;
}
.price-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.price-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--r-lg); padding: 26px; display: flex; flex-direction: column; }
.price-card.featured { border-color: var(--color-primary); box-shadow: 0 24px 50px -30px rgba(var(--color-shadow-rgb), .45); position: relative; }
.price-card .p-name { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--color-accent-strong); font-weight: 600; }
.price-card .p-amt { font-family: var(--font-heading); font-size: 32px; color: var(--color-text-strong); margin: 8px 0 4px; }
.price-card ul { list-style: none; padding: 0; margin: 16px 0 22px; display: grid; gap: 9px; font-size: 13px; color: var(--color-text-secondary); }
.price-card ul li { display: flex; gap: 8px; align-items: flex-start; }
.price-card ul .ico { color: var(--color-success); width: 15px; height: 15px; margin-top: 3px; }
.tag-featured { position: absolute; top: 18px; right: 18px; background: var(--color-primary-soft); color: var(--color-primary-strong); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; padding: 4px 9px; border-radius: var(--r-pill); font-weight: 600; }
.prose { max-width: 68ch; }
.prose h2 { font-family: var(--font-heading); font-size: 26px; color: var(--color-text-strong); margin: 34px 0 10px; }
.prose h3 { font-family: var(--font-heading); font-size: 19px; color: var(--color-text-strong); margin: 24px 0 8px; }
.prose p { font-size: 14.5px; color: var(--color-text-primary); opacity: .92; }
.prose ul { font-size: 14.5px; color: var(--color-text-primary); opacity: .92; padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.cta-band {
  background: var(--grad-hero);
  border: 1px solid var(--color-border); border-radius: var(--r-lg);
  padding: 44px; text-align: center; max-width: 1132px; margin: 0 auto;
}
.cta-band h2 { font-family: var(--font-heading); font-size: 32px; color: var(--color-text-strong); margin-bottom: 10px; }
.auth-wrap { max-width: 468px; margin: 56px auto 80px; padding: 0 22px; }
.auth-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 32px; }
.auth-card h1 { font-family: var(--font-heading); font-size: 27px; color: var(--color-text-strong); margin-bottom: 6px; }
.auth-card .form-grid { grid-template-columns: 1fr; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 13px; color: var(--ink-2); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .rail-sticky { position: static; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature-grid, .price-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step-grid { grid-template-columns: 1fr; }
  .pub-h1 { font-size: 44px; }
  .pub-hero { grid-template-columns: 1fr; gap: 34px; padding-top: 44px; }
  .pub-nav { display: none; }
  .pub-nav.open {
    display: flex; position: absolute; top: 74px; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--color-surface); border-bottom: 1px solid var(--color-border);
    padding: 10px 20px 16px; box-shadow: var(--shadow);
  }
  .pub-nav.open a { padding: 10px 0; border-bottom: 1px solid var(--color-border); }
  .pub-burger { display: inline-grid; }
}

@media (max-width: 1024px) {
  .shell, .shell.nav-collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; left: 0; width: 282px; height: 100vh;
    transform: translateX(-102%); transition: transform .24s ease; box-shadow: var(--shadow-lg);
    background: var(--color-surface);
  }
  .sidebar.open { transform: translateX(0); }
  /* the desktop collapse must never hide the mobile drawer state */
  .shell.nav-collapsed .sidebar { transform: translateX(-102%); opacity: 1; visibility: visible; border-right-color: var(--color-border); }
  .shell.nav-collapsed .sidebar.open { transform: translateX(0); }
  .shell.nav-collapsed .sidebar:not(.open) { pointer-events: none; }
  .shell.nav-collapsed .sidebar.open { pointer-events: auto; }
  .shell.nav-collapsed .content { max-width: none; }
  .content { padding: 20px 18px 40px; }
  .topbar { padding: 12px 16px; }
  .profile-txt { display: none; }
  .grid-2, .grid-3, .split-2 { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); padding: 24px; }
  .countdown-card { min-width: 0; display: flex; align-items: center; gap: 14px; text-align: left; }
  .countdown-num { font-size: 34px; }
  .countdown-lbl, .countdown-sub { margin: 0; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .cta-band { padding: 30px 22px; }
}

@media (max-width: 720px) {
  .page-head h1, .page-title { font-size: 24px; }
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .check { padding-top: 0; }
  .feature-grid, .price-grid, .benefit-grid { grid-template-columns: minmax(0, 1fr); }
  .pub-h1 { font-size: 34px; }
  .pub-h2 { font-size: 26px; }
  .cal-cell { min-height: 62px; padding: 5px; }
  .cal-pill { display: none; }
  .cal-cell .cal-count { display: block; font-size: 10px; color: var(--rose); }
  .kv { grid-template-columns: 1fr; gap: 3px 0; }
  .kv dd { margin-bottom: 10px; }
  .qa-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar .search { max-width: none; }
  .hero h1 { font-size: 26px; }
  .timeline li { grid-template-columns: 58px 1fr; }
  .auth-card { padding: 24px; }
  .foot-grid { grid-template-columns: 1fr; gap: 22px; }
}

@media (min-width: 721px) { .cal-cell .cal-count { display: none; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ------------------------------------------------------------ spacing fixes */
/* Avoid doubling the sibling gap inside grids/stacks (gap already applies). */
.stack > .card, .stack > .grid, .stack > .stack,
.grid > .card, .grid > .grid, .grid > .stack { margin-top: 0; }

/* dialogs need a flex column so the body scrolls instead of overflowing */
.dlg[open] { display: flex; flex-direction: column; }
.dlg-body { flex: 1 1 auto; min-height: 0; }

/* table row actions never wrap awkwardly */
.table .actions { flex-wrap: nowrap; }

/* keep long unbroken strings (URLs, emails) inside cards without shrinking columns */
.card, .kv dd, .li-sub, .note-card p { overflow-wrap: break-word; }
.table .t-sub, .table .t-title { overflow-wrap: break-word; word-break: normal; }

/* ============================================================
   UI style presets — chosen independently from the colour theme
   ============================================================ */

/* A. Minimal Clean — near-white surfaces, thin borders, almost no shadow */
body[data-style="minimal"] {
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-pill: 10px;
  --font-heading: var(--sans);
  --sidebar-bg: var(--color-surface);
  --topbar-bg: var(--color-surface);
  --hero-bg: var(--color-surface);
  --side-active-bg: var(--color-primary-soft);
  --side-active-fg: var(--color-primary-strong);
  --btn-primary-bg: var(--color-primary-cta, var(--color-primary));
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: 0 30px 60px -40px rgba(var(--color-shadow-rgb), .3);
  background: var(--color-background);
}
body[data-style="minimal"] .hero,
body[data-style="minimal"] .cta-band { background: var(--color-surface); }
body[data-style="minimal"] .hero-leaf,
body[data-style="minimal"] .hero:after { display: none; }
body[data-style="minimal"] .card,
body[data-style="minimal"] .stat,
body[data-style="minimal"] .feature { box-shadow: none; }
body[data-style="minimal"] .side-link.active { box-shadow: none; }
body[data-style="minimal"] .btn-primary { box-shadow: none; }
body[data-style="minimal"] .content { padding-top: 32px; }
body[data-style="minimal"] .side-label { letter-spacing: .1em; opacity: .7; }

/* B. iOS-inspired — rounded cards, layered soft surfaces, system typography */
body[data-style="ios"] {
  --r-sm: 12px; --r: 18px; --r-lg: 24px; --r-pill: 999px;
  --font-heading: var(--sans);
  --sidebar-bg: rgba(255, 255, 255, .8);
  --topbar-bg: rgba(255, 255, 255, .78);
  --hero-bg: var(--color-surface);
  --shadow-sm: 0 1px 2px rgba(var(--color-shadow-rgb), .06);
  --shadow: 0 10px 30px -26px rgba(var(--color-shadow-rgb), .5);
  --shadow-lg: 0 24px 60px -34px rgba(var(--color-shadow-rgb), .45);
  background: var(--color-background);
}
body[data-style="ios"] .sidebar {
  background: var(--color-surface);
  background: color-mix(in srgb, var(--color-surface) 82%, transparent);
}
body[data-style="ios"] .topbar {
  background: var(--color-surface);
  background: color-mix(in srgb, var(--color-surface) 78%, transparent);
}
body[data-style="ios"] .hero { background: var(--color-surface); }
body[data-style="ios"] .hero-leaf,
body[data-style="ios"] .hero:after { display: none; }
body[data-style="ios"] .card,
body[data-style="ios"] .stat { backdrop-filter: blur(18px) saturate(180%); }
body[data-style="ios"] .btn { font-weight: 600; letter-spacing: -.01em; }
body[data-style="ios"] .table th { text-transform: none; letter-spacing: .01em; font-size: 12px; }
body[data-style="ios"] .page-title { letter-spacing: -.025em; }
body[data-style="ios"] .badge { font-weight: 600; }

/* C. Soft Editorial — the original ivory days look (serif, decorative) */
body[data-style="editorial"] .hero-leaf { display: block; }

/* D. Bold Colorful — strong borders, solid buttons, minimal ornament */
body[data-style="bold"] {
  --r-sm: 6px; --r: 10px; --r-lg: 14px; --r-pill: 8px;
  --font-heading: var(--sans);
  --card-border-w: 2px;
  --sidebar-bg: var(--color-surface);
  --topbar-bg: var(--color-surface);
  --side-active-bg: var(--color-primary-cta, var(--color-primary));
  --side-active-fg: var(--color-on-primary);
  --btn-primary-bg: var(--color-primary-cta, var(--color-primary));
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: 0 24px 50px -30px rgba(var(--color-shadow-rgb), .55);
  background: var(--color-background);
}
body[data-style="bold"] .hero {
  background: var(--color-primary-soft);
  border-width: 2px;
  border-color: var(--color-primary);
}
/* the tinted hero needs stronger body text to stay above 4.5:1 */
body[data-style="bold"] .hero p.lead,
body[data-style="bold"] .hero-meta div { color: var(--color-text-primary); }
body[data-style="bold"] .hero p.lead { opacity: .92; }
body[data-style="bold"] .hero-leaf,
body[data-style="bold"] .hero:after { display: none; }
body[data-style="bold"] .card,
body[data-style="bold"] .stat { border-color: var(--color-border-strong); box-shadow: none; }
body[data-style="bold"] .badge { border: 1px solid currentColor; }
body[data-style="bold"] .stat-lbl,
body[data-style="bold"] .side-label { font-weight: 700; letter-spacing: .12em; }
body[data-style="bold"] h1,
body[data-style="bold"] .page-title,
body[data-style="bold"] .card-head h2,
body[data-style="bold"] .card-head h3,
body[data-style="bold"] .stat-val { font-weight: 700; }
body[data-style="bold"] .btn { font-weight: 600; }
body[data-style="bold"] .table th { background: var(--color-primary-soft); color: var(--color-primary-strong); }
body[data-style="bold"] .btn-primary { border-color: var(--color-primary-strong); }
body[data-style="bold"] .cta-band { background: var(--color-primary-soft); }

/* E. Modern Professional — structured, neutral, clear separation */
body[data-style="professional"] {
  --r-sm: 8px; --r: 10px; --r-lg: 14px; --r-pill: 8px;
  --font-heading: var(--sans);
  --sidebar-bg: var(--color-surface);
  --topbar-bg: var(--color-surface);
  --hero-bg: var(--color-surface);
  --shadow-sm: 0 1px 2px rgba(var(--color-shadow-rgb), .05);
  --shadow: 0 1px 3px rgba(var(--color-shadow-rgb), .09);
  --shadow-lg: 0 24px 50px -34px rgba(var(--color-shadow-rgb), .4);
  background: var(--color-background);
}
body[data-style="professional"] .hero {
  background: var(--color-surface);
  border-left: 4px solid var(--color-primary);
}
body[data-style="professional"] .hero-leaf,
body[data-style="professional"] .hero:after { display: none; }
body[data-style="professional"] .card-head { border-bottom: 1px solid var(--color-border); }
body[data-style="professional"] .stat { border-top: 3px solid var(--color-primary); }
body[data-style="professional"] .card-head h2 { font-size: 16px; }
body[data-style="professional"] .table td { padding: 10px 12px; }
body[data-style="professional"] .content { max-width: 1360px; }
body[data-style="professional"] .cta-band { background: var(--color-surface); }

/* ============================================================
   Theme Studio
   ============================================================ */
.studio-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.active-theme {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--r);
  background: var(--color-primary-tint); border: 1px dashed var(--color-border-strong);
  margin-bottom: 20px;
}
.active-theme .at-swatches { display: flex; gap: 6px; }
.active-theme .at-swatches span { width: 22px; height: 22px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.active-theme .at-text { flex: 1; min-width: 180px; }
.active-theme .at-text strong { display: block; font-family: var(--font-heading); font-size: 16px; color: var(--color-text-strong); }
.active-theme .at-text span { font-size: 12.5px; color: var(--color-text-secondary); }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 20px; }
.theme-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--r-lg); padding: 14px;
  transition: transform .16s ease, box-shadow .18s ease, border-color .18s ease;
}
.theme-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.theme-card.is-active { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-focus); }
.theme-card .tc-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.theme-card .tc-name { font-family: var(--font-heading); font-size: 15px; font-weight: 600; color: var(--color-text-strong); line-height: 1.25; }
.theme-card .tc-tag { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-secondary); }
.theme-card .tc-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 4px; }
.theme-card .tc-actions .btn { flex: 1; }

.theme-preview {
  height: 108px; border-radius: var(--r-sm); padding: 8px;
  display: grid; grid-template-columns: 32px 1fr; gap: 7px;
  background: var(--tp-bg); border: 1px solid var(--tp-line); overflow: hidden;
}
.tp-side { background: var(--tp-surface); border: 1px solid var(--tp-line); border-radius: 6px; padding: 5px 4px; display: grid; gap: 4px; align-content: start; }
.tp-side i { display: block; height: 5px; border-radius: 3px; background: var(--tp-line); }
.tp-side i.on { background: var(--tp-primary); }
.tp-main { display: grid; gap: 5px; align-content: start; min-width: 0; }
.tp-hero { height: 26px; border-radius: 6px; background: var(--tp-hero); display: flex; align-items: center; padding: 0 7px; }
.tp-hero b { display: block; width: 58%; height: 6px; border-radius: 3px; background: var(--tp-primary); opacity: .6; }
.tp-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.tp-stats span { height: 20px; border-radius: 4px; background: var(--tp-surface); border: 1px solid var(--tp-line); border-top: 3px solid var(--tp-primary); }
.tp-chart { height: 26px; border-radius: 6px; background: var(--tp-surface); border: 1px solid var(--tp-line); display: flex; align-items: center; gap: 3px; padding: 0 7px; }
.tp-chart i { width: 9px; height: 9px; border-radius: 50%; display: block; }
.tp-swatches { display: flex; gap: 5px; flex-wrap: wrap; }
.tp-swatches span { width: 17px; height: 17px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.tc-desc { font-size: 11.5px; color: var(--color-text-secondary); line-height: 1.45; }

.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); gap: 20px; }
.style-card {
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--r-lg);
  transition: transform .16s ease, box-shadow .18s ease, border-color .18s ease;
}
.style-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.style-card.is-active { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-focus); }
.style-preview { background: var(--color-background); border: 1px solid var(--color-border); border-radius: var(--r-sm); padding: 10px; }
.sp-card {
  background: var(--color-surface); border-radius: var(--sp-r, 12px); border: var(--sp-bw, 1px) solid var(--color-border);
  box-shadow: var(--sp-shadow, none); padding: 8px 10px;
}
.sp-title { font-family: var(--sp-font, var(--font-heading)); font-size: 12px; font-weight: 700; color: var(--color-text-strong); margin-bottom: 4px; }
.sp-line { height: 4px; border-radius: 2px; background: var(--color-surface-secondary); margin-bottom: 4px; }
.sp-line.short { width: 62%; }
.sp-btn { display: inline-block; margin-top: 6px; font-size: 10px; font-weight: 600; padding: 4px 10px; border-radius: var(--sp-pill, 999px); background: var(--color-primary-cta, var(--color-primary)); color: var(--color-on-primary); }

.token-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.token-field { display: flex; flex-direction: column; gap: 6px; }
.token-field > label { font-size: 12px; font-weight: 600; color: var(--color-text-secondary); }
.token-row { display: flex; align-items: center; gap: 8px; }
.token-row input[type="color"] {
  width: 44px; height: 40px; padding: 2px; cursor: pointer;
  border: 1px solid var(--color-border-strong); border-radius: var(--r-sm); background: var(--color-surface);
}
.token-row .input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-transform: uppercase; }
.contrast-table { display: grid; gap: 8px; }
.contrast-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12.5px; padding: 8px 11px; border-radius: var(--r-sm);
  background: var(--color-surface-sunken); border: 1px solid var(--color-border);
}
.contrast-row .cr-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.cr-pass { color: var(--color-success-text); }
.cr-warn { color: var(--color-warning-text); }
.cr-fail { color: var(--color-error-text); }

.studio-bar {
  /* fixed so the "belum disimpan" action bar is reachable from any scroll position */
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  width: min(1080px, calc(100% - 32px)); z-index: 120;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--r);
  background: var(--color-text-strong); color: var(--color-text-on-strong);
  box-shadow: var(--shadow-lg);
}
.studio-bar[hidden] { display: none; }
.studio-bar .sb-title { font-size: 13px; }
.studio-bar .sb-title strong { font-weight: 700; }
.studio-bar .btn-ghost { background: transparent; border-color: currentColor; color: inherit; }
.studio-bar .btn-primary { background: var(--color-on-primary); color: var(--color-text-strong); }
.studio-note { font-size: 12px; color: var(--color-text-secondary); }

/* ------------------------------------------------------------ readability pass */
.stat-val { font-variant-numeric: tabular-nums; }
.stat-meta { line-height: 1.45; }
.card-head h2, .card-head h3, .li-title, .t-title { overflow-wrap: break-word; }
.card-head .sub, .stat-meta, .li-sub { overflow-wrap: break-word; }
.legend .lg-name { max-width: 100%; }
.badge { border: 1px solid transparent; }
.table .num { font-variant-numeric: tabular-nums; }
.prog-top span:first-child { color: var(--color-text-primary); }
.donut-center span { white-space: nowrap; }

@media (max-width: 720px) {
  .theme-grid, .style-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .theme-preview { height: 92px; grid-template-columns: 24px 1fr; }
  .token-grid { grid-template-columns: minmax(0, 1fr); }
  .studio-bar { bottom: 8px; width: calc(100% - 20px); padding: 10px 12px; }
  .studio-bar .sb-title { font-size: 12px; }
}

/* ------------------------------------------------------------ stat card edit actions */
.stat-actions {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--color-border);
}
.stat-act {
  display: inline-flex; align-items: center; gap: 5px;
  font: inherit; font-size: 11.5px; font-weight: 600; line-height: 1;
  padding: 6px 9px; border-radius: var(--r-pill);
  background: var(--color-surface-sunken); color: var(--color-primary-strong);
  border: 1px solid var(--color-border); cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  text-decoration: none; white-space: nowrap;
}
.stat-act .ico { width: 13px; height: 13px; }
.stat-act:hover { background: var(--color-primary-tint); border-color: var(--color-border-strong); color: var(--color-primary-strong); }
.stat-act:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 1px; }
.stat-flag {
  font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  font-weight: 700; color: var(--color-warning-text); background: var(--color-warning-bg);
  border-radius: var(--r-pill); padding: 4px 8px;
}
@media (max-width: 720px) {
  .stat-act { font-size: 12px; padding: 7px 10px; }
}

/* ============================================================
   Moodboard gallery (multi-photo)
   ============================================================ */
.btn-count {
  margin-left: 6px; font-size: 10.5px; font-weight: 700;
  background: rgba(255, 255, 255, .25); border-radius: var(--r-pill); padding: 2px 7px;
}
.chip-count {
  margin-left: 6px; font-size: 10.5px; font-weight: 700; line-height: 1;
  background: var(--color-surface-sunken); border-radius: var(--r-pill); padding: 2px 6px;
  color: var(--color-text-secondary);
}
.chip-group { display: inline-flex; gap: 6px; align-items: center; }

.mood-gallery { margin-top: 20px; }
.mood-gallery.is-masonry { columns: 4 258px; column-gap: 18px; }
.mood-gallery.is-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 18px; }

.mood-tile {
  margin: 0 0 18px; break-inside: avoid; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-sm); position: relative;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.mood-gallery.is-grid .mood-tile { margin: 0; display: flex; flex-direction: column; }
.mood-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--color-border-strong); }
.mood-open {
  display: block; width: 100%; padding: 0; border: 0; background: var(--color-surface-secondary);
  cursor: zoom-in; position: relative; overflow: hidden; line-height: 0;
  /* reserve the photo's own aspect ratio so nothing jumps while it loads */
  aspect-ratio: var(--ph-ratio, 4 / 3);
  min-height: 90px;
}
/* unknown/absent aspect ratio: let the image keep its natural proportions */
.mood-open[style*="--ph-ratio:auto"] { aspect-ratio: auto; }
.mood-open[style*="--ph-ratio:auto"] img { height: auto; }
.mood-open img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.mood-gallery.is-grid .mood-open { aspect-ratio: 4 / 3; }
.mood-tile:hover .mood-open img { transform: scale(1.03); }
.mood-noimg { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; color: var(--color-text-secondary); }
.mood-tile-bar {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--color-border);
}
.mood-tile-text { min-width: 0; flex: 1; line-height: 1.35; }
.mood-tile-text strong {
  display: block; font-size: 13px; font-weight: 600; color: var(--color-text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mood-tile-text span {
  display: block; font-size: 11.5px; color: var(--color-text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mood-tile-acts { display: flex; align-items: center; gap: 2px; flex: none; }
.mood-tile-acts .fav { font-size: 14px; padding: 3px; }
.icon-mini {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px;
  color: var(--color-text-secondary); background: transparent; border: 1px solid transparent;
}
.icon-mini .ico { width: 14px; height: 14px; }
.icon-mini:hover { background: var(--color-primary-tint); color: var(--color-primary-strong); border-color: var(--color-border); }
.mood-tile-acts form .btn { padding: 4px 7px; font-size: 11px; }
.thumb-mini {
  display: grid; place-items: center; width: 54px; height: 54px; border-radius: 10px;
  overflow: hidden; background: var(--color-surface-secondary); cursor: zoom-in;
  border: 1px solid var(--color-border); color: var(--color-text-secondary);
}
.thumb-mini img { width: 100%; height: 100%; object-fit: cover; }

/* empty state illustration */
.mood-empty-art { position: relative; width: 132px; height: 78px; margin: 0 auto 14px; }
.mood-empty-art span {
  position: absolute; width: 58px; height: 58px; border-radius: 12px;
  background: var(--color-primary-soft); border: 2px solid var(--color-surface);
  box-shadow: var(--shadow-sm);
}
.mood-empty-art span:nth-child(1) { left: 0; top: 12px; transform: rotate(-8deg); background: var(--color-accent-soft); }
.mood-empty-art span:nth-child(2) { left: 37px; top: 0; transform: rotate(3deg); background: var(--color-primary-soft); }
.mood-empty-art span:nth-child(3) { left: 74px; top: 15px; transform: rotate(10deg); background: var(--color-surface-secondary); }

/* upload dropzone */
.dropzone {
  display: grid; justify-items: center; gap: 6px; text-align: center; cursor: pointer;
  padding: 24px 18px; border-radius: var(--r); border: 2px dashed var(--color-border-strong);
  background: var(--color-surface-sunken); transition: border-color .16s ease, background .16s ease;
  position: relative;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--color-primary); background: var(--color-primary-tint); }
.dz-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--color-primary-soft); color: var(--color-primary-strong); }
.dz-main { font-size: 13.5px; color: var(--color-text-primary); }
.dz-sub { font-size: 11.5px; color: var(--color-text-secondary); }
.dz-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 14px; }
.dz-item { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--color-border); background: var(--color-surface-secondary); }
.dz-item img { width: 100%; height: 74px; object-fit: cover; display: block; }
.dz-item .dz-name { font-size: 9.5px; padding: 3px 5px; color: var(--color-text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-item .dz-state { position: absolute; inset: 0; display: none; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .45); }
.dz-item.is-done .dz-state { display: grid; background: rgba(15, 138, 100, .82); }
.dz-item.is-fail .dz-state { display: grid; background: rgba(196, 42, 69, .85); }
.dz-item.is-busy .dz-state { display: grid; }
.upload-progress { margin-top: 14px; }
.up-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--color-text-secondary); margin-bottom: 6px; }
.upload-errors { margin-top: 12px; display: grid; gap: 6px; }
.upload-errors p {
  margin: 0; font-size: 12px; padding: 8px 10px; border-radius: 10px;
  background: var(--color-error-bg); color: var(--color-error-text); border: 1px solid var(--color-error);
}
.dlg-photo-preview { width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--r); margin-bottom: 16px; border: 1px solid var(--color-border); }

/* lightbox */
.dlg.lb { width: min(1080px, calc(100vw - 24px)); max-height: 92vh; padding: 0; overflow: hidden; }
.lb-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--color-border); }
.lb-title h3 { font-family: var(--font-heading); font-size: 17px; margin: 0; color: var(--color-text-strong); }
.lb-title .sub { margin: 2px 0 0; font-size: 12px; color: var(--color-text-secondary); }
.lb-tools { display: flex; gap: 6px; flex: none; }
.lb-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 0; max-height: calc(92vh - 64px); }
.lb-stage { background: #101114; display: grid; place-items: center; overflow: hidden; min-height: 260px; }
.lb-stage img { max-width: 100%; max-height: calc(92vh - 64px); object-fit: contain; }
.lb-meta { padding: 16px 18px; overflow-y: auto; border-left: 1px solid var(--color-border); background: var(--color-surface); }
.lb-meta .kv { grid-template-columns: minmax(0, 96px) minmax(0, 1fr); font-size: 12.5px; }
.lb-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.lb-links a {
  font-size: 11.5px; font-weight: 600; padding: 5px 9px; border-radius: var(--r-pill);
  background: var(--color-primary-tint); color: var(--color-primary-strong); border: 1px solid var(--color-border);
}
@media (max-width: 860px) {
  .lb-body { grid-template-columns: minmax(0, 1fr); }
  .lb-meta { border-left: 0; border-top: 1px solid var(--color-border); max-height: 42vh; }
  .lb-stage img { max-height: 46vh; }
  .mood-gallery.is-masonry { columns: 2 150px; column-gap: 12px; }
  .mood-tile { margin-bottom: 12px; }
  .mood-search { flex: 1 1 100%; margin-left: 0; }
  .dz-preview { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
}
@media (max-width: 480px) {
  .mood-gallery.is-masonry { columns: 2 130px; column-gap: 10px; }
  .mood-tile-text strong { font-size: 12px; }
}

.upload-notice {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px; margin-bottom: 16px; border-radius: var(--r);
  background: var(--color-success-bg); border: 1px solid var(--color-success);
}
.upload-notice .muted { color: var(--color-success-text); }

/* apply the restored sidebar state before app.js runs (avoids a one-frame flash) */
html.nav-collapsed .shell { grid-template-columns: 0 minmax(0, 1fr); }
html.nav-collapsed .sidebar { transform: translateX(-100%); opacity: 0; visibility: hidden; pointer-events: none; }
@media (max-width: 1024px) {
  html.nav-collapsed .shell { grid-template-columns: minmax(0, 1fr); }
  html.nav-collapsed .sidebar { transform: translateX(-102%); opacity: 1; visibility: visible; }
  html.nav-collapsed .sidebar.open { transform: translateX(0); }
}

/* drawer close affordance: only needed while the mobile drawer is open */
.side-close { display: none; position: absolute; top: 14px; right: 12px; z-index: 3; }
@media (max-width: 1024px) {
  .sidebar { position: fixed; }
  .side-close { display: inline-grid; }
  .side-brand { position: relative; padding-right: 56px; }
}

/* pages whose wide tables need the full width drop their side rail earlier */
@media (max-width: 1500px) {
  .grid-main.stack-early { grid-template-columns: minmax(0, 1fr); }
  .grid-main.stack-early .rail-sticky { position: static; }
}
.grid-main.stack-early { gap: 20px; }

.lb-noimg {
  display: none; place-items: center; gap: 8px; text-align: center;
  color: #C9C4C0; font-size: 12px; padding: 30px; max-width: 320px;
}
.lb-noimg .ico { width: 34px; height: 34px; }
.lb-noimg em { font-style: normal; line-height: 1.5; }

.lb-stage { min-height: 320px; padding: 8px; }
.lb-stage img { width: 100%; height: auto; max-height: calc(92vh - 96px); object-fit: contain; }
@media (max-width: 860px) { .lb-stage { min-height: 220px; } }

/* very wide screens: let the freed space actually be used */
@media (min-width: 1700px) {
  .content { max-width: 1560px; }
  .shell.nav-collapsed .content { max-width: 1760px; }
}

/* ============================================================
   Moodboard filter bar (replaces the confusing chip soup)
   ============================================================ */
.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;
}
.filter-card .card-body { padding: 16px 18px; display: grid; gap: 14px; }
.filter-row { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.filter-group {
  display: flex; align-items: center; gap: 10px;
  flex: 1 1 420px; min-width: 0;
}
.filter-label {
  flex: none; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 700; color: var(--color-text-secondary); min-width: 74px;
}
.filter-actions { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }

.chip-scroll {
  display: flex; align-items: center; gap: 6px;
  overflow-x: auto; overflow-y: hidden; padding: 2px 2px 4px;
  min-width: 0; flex: 1;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: var(--color-border-strong) transparent;
}
.chip-scroll::-webkit-scrollbar { height: 6px; }
.chip-scroll::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 999px; }
.chip-scroll .chip { flex: none; white-space: nowrap; }

.filter-card .chip {
  display: inline-flex; align-items: center; gap: 4px; height: 32px;
  padding: 0 11px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 500;
  background: var(--color-surface); border: 1px solid var(--color-border);
  color: var(--color-text-primary); text-decoration: none; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.filter-card .chip:hover { background: var(--color-primary-tint); border-color: var(--color-border-strong); color: var(--color-primary-strong); }
.filter-card .chip:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 1px; }
.filter-card .chip.is-on {
  background: var(--color-primary-cta, var(--color-primary)); border-color: transparent;
  color: var(--color-on-primary); font-weight: 600;
}
.filter-card .chip.is-on .chip-count {
  background: rgba(255, 255, 255, .24); color: inherit;
}
.chip-add { border-style: dashed !important; color: var(--color-text-secondary) !important; }
.chip-add .ico { width: 13px; height: 13px; }
.chip-fav.is-on { background: var(--color-primary-cta, var(--color-primary)); }

.segmented {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--color-surface-sunken); border: 1px solid var(--color-border);
  border-radius: var(--r-pill);
}
.seg {
  display: inline-flex; align-items: center; height: 26px; padding: 0 12px;
  border-radius: var(--r-pill); font-size: 12px; font-weight: 600;
  color: var(--color-text-secondary); text-decoration: none; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.seg:hover { color: var(--color-primary-strong); }
.seg.is-on { background: var(--color-surface); color: var(--color-primary-strong); box-shadow: var(--shadow-sm); }
.seg:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 1px; }

.filter-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding-top: 12px;
  border-top: 1px solid var(--color-border);
}
.filter-search {
  display: flex; align-items: center; gap: 8px; flex: 1 1 340px; min-width: 0; max-width: 560px;
  background: var(--color-surface); border: 1px solid var(--color-border-strong);
  border-radius: var(--r-pill); padding: 4px 4px 4px 14px;
}
.filter-search .ico { width: 15px; height: 15px; color: var(--color-text-secondary); flex: none; }
.filter-search input[type="search"] {
  border: 0; background: transparent; font: inherit; font-size: 13px;
  color: var(--color-text-primary); flex: 1; min-width: 0; outline: none; height: 30px;
}
.filter-search input[type="search"]::placeholder { color: var(--color-text-secondary); opacity: .85; }
.filter-search:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-focus); }
.filter-status { margin: 0; font-size: 12px; color: var(--color-text-secondary); }
.filter-status strong { color: var(--color-text-primary); }
.filter-status a { font-weight: 600; }

/* placeholder tile for entries that have no image file yet */
.mood-noimg {
  display: grid; place-items: center; align-content: center; gap: 6px;
  width: 100%; aspect-ratio: 4 / 3; padding: 14px; text-align: center;
  background:
    repeating-linear-gradient(135deg,
      var(--color-surface-sunken) 0 10px,
      var(--color-surface-secondary) 10px 20px);
  color: var(--color-text-secondary);
}
.mood-noimg .ph-swatch {
  width: 34px; height: 34px; border-radius: 10px; display: block;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12), 0 2px 6px rgba(var(--color-shadow-rgb), .18);
}
.mood-noimg em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--color-text-primary); }
.mood-noimg small { font-size: 10.5px; opacity: .85; }

@media (max-width: 900px) {
  .filter-group { flex: 1 1 100%; }
  .filter-label { min-width: 0; }
  .filter-group { flex-wrap: wrap; gap: 6px; }
  .filter-label { flex: 1 1 100%; }
  .filter-actions { margin-left: 0; width: 100%; justify-content: space-between; }
}
@media (max-width: 560px) {
  .filter-search { flex: 1 1 100%; max-width: none; }
  .filter-foot { flex-direction: column; align-items: stretch; }
  .filter-status { text-align: left; }
}

/* the filter card is a CSS grid: grid/flex children default to min-width:auto, which
   let the chip scroller grow past the viewport instead of scrolling inside itself */
.filter-card .card-body { min-width: 0; }
.filter-card .filter-row,
.filter-card .filter-group,
.filter-card .chip-scroll,
.filter-card .filter-foot,
.filter-card .filter-search { min-width: 0; }
.filter-card .chip-scroll { max-width: 100%; }
.filter-card .filter-actions { flex: 0 0 auto; }

/* Chips wrap instead of hiding behind a horizontal scroller: nothing becomes
   "invisible/unclickable", which was the confusing part of the old filter area. */
.filter-card .chip-scroll {
  flex-wrap: wrap; overflow: visible; padding-bottom: 0;
  row-gap: 6px;
}

/* compact filters on small screens: one "Filter" button instead of a very tall card */
.filter-mobile-head { display: none; align-items: center; justify-content: space-between; gap: 10px; }
.filter-mobile-summary { font-size: 12px; color: var(--color-text-secondary); font-weight: 600; }
.filter-toggle { gap: 6px; }
.filter-toggle .ico { width: 14px; height: 14px; }
@media (max-width: 900px) {
  .filter-card .card-body { gap: 10px; padding: 12px 14px; }
  .filter-mobile-head { display: flex; }
  .filter-rows { display: none; }
  .filter-card.is-open .filter-rows { display: grid; gap: 12px; }
  .filter-foot { padding-top: 0; border-top: 0; }
  .filter-card.is-open .filter-foot { padding-top: 12px; border-top: 1px solid var(--color-border); }
}

/* action buttons in the page header must never push the page wider on phones */
@media (max-width: 720px) {
  .page-head { align-items: stretch; }
  .page-head > div:first-child { flex: 1 1 100%; }
  .head-actions { flex: 1 1 100%; flex-wrap: wrap; max-width: 100%; }
  .head-actions > .btn, .head-actions > form, .head-actions > button { flex: 1 1 auto; min-width: 0; }
  .head-actions .btn { justify-content: center; }
}
