/* Renewda — comic-editorial design system. Playful personality, premium trust, light + dark. */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

@font-face {
  font-family: "Technul Soft";
  src: url("/assets/fonts/technul-soft.ttf") format("truetype");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #faf6ee;
  --paper: #fffdf8;
  --surface: #ffffff;
  --surface-alt: #f3ede0;
  --ink: #17140f;
  --border: rgba(23, 20, 15, 0.14);
  --border-strong: rgba(23, 20, 15, 0.28);
  --text: #17140f;
  --text-muted: #6b6255;
  --text-faint: #9a9182;
  --accent: #17140f;
  --accent-contrast: #fffdf8;
  --brand: #ff5a36;
  --brand-ink: #17140f;
  --brand-bg: rgba(255, 90, 54, 0.14);
  --shadow-comic: 3px 3px 0 var(--ink);
  --shadow-comic-sm: 2px 2px 0 var(--ink);
  --shadow-soft: 0 1px 2px rgba(23, 20, 15, 0.04), 0 10px 26px -14px rgba(23, 20, 15, 0.22);
  --shadow: 0 1px 2px rgba(23, 20, 15, 0.05), 0 18px 40px -16px rgba(23, 20, 15, 0.28);
  --emerald: #0d8a5f; --emerald-bg: rgba(13, 138, 95, 0.14);
  --blue: #2a5fd6; --blue-bg: rgba(42, 95, 214, 0.13);
  --amber: #b5750a; --amber-bg: rgba(181, 117, 10, 0.15);
  --red: #d43d2f; --red-bg: rgba(212, 61, 47, 0.13);
  --indigo: #5b3fd6; --indigo-bg: rgba(91, 63, 214, 0.13);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --font-display: "Technul Soft", "Space Grotesk", "Inter", -apple-system, sans-serif;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-heading: "Geist Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* User preference (Settings → Preferences → Heading font): use the
   logo's display font for headings instead of Geist. The logo itself
   (.brand/.brand-mark) always stays on --font-display regardless. */
:root[data-heading-font="display"] {
  --font-heading: var(--font-display);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14120e;
  --paper: #1a1712;
  --surface: #1e1b15;
  --surface-alt: #26221a;
  --ink: #fdf9f0;
  --border: rgba(253, 249, 240, 0.12);
  --border-strong: rgba(253, 249, 240, 0.22);
  --text: #fdf9f0;
  --text-muted: #b3aa98;
  --text-faint: #7d7666;
  --accent: #fdf9f0;
  --accent-contrast: #14120e;
  --brand: #ff7452;
  --brand-ink: #14120e;
  --brand-bg: rgba(255, 116, 82, 0.16);
  --shadow-comic: 3px 3px 0 rgba(0,0,0,0.6);
  --shadow-comic-sm: 2px 2px 0 rgba(0,0,0,0.6);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px -14px rgba(0, 0, 0, 0.55);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 20px 48px -16px rgba(0, 0, 0, 0.65);
  --emerald: #3ecf94; --emerald-bg: rgba(62, 207, 148, 0.16);
  --blue: #6f97f5; --blue-bg: rgba(111, 151, 245, 0.16);
  --amber: #f0b23e; --amber-bg: rgba(240, 178, 62, 0.16);
  --red: #f2705f; --red-bg: rgba(242, 112, 95, 0.16);
  --indigo: #a693f7; --indigo-bg: rgba(166, 147, 247, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #14120e; --paper: #1a1712; --surface: #1e1b15; --surface-alt: #26221a;
    --ink: #fdf9f0; --border: rgba(253, 249, 240, 0.12); --border-strong: rgba(253, 249, 240, 0.22);
    --text: #fdf9f0; --text-muted: #b3aa98; --text-faint: #7d7666;
    --accent: #fdf9f0; --accent-contrast: #14120e;
    --brand: #ff7452; --brand-ink: #14120e; --brand-bg: rgba(255, 116, 82, 0.16);
    --shadow-comic: 3px 3px 0 rgba(0,0,0,0.6); --shadow-comic-sm: 2px 2px 0 rgba(0,0,0,0.6);
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px -14px rgba(0, 0, 0, 0.55);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 20px 48px -16px rgba(0, 0, 0, 0.65);
    --emerald: #3ecf94; --emerald-bg: rgba(62, 207, 148, 0.16);
    --blue: #6f97f5; --blue-bg: rgba(111, 151, 245, 0.16);
    --amber: #f0b23e; --amber-bg: rgba(240, 178, 62, 0.16);
    --red: #f2705f; --red-bg: rgba(242, 112, 95, 0.16);
    --indigo: #a693f7; --indigo-bg: rgba(166, 147, 247, 0.18);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  transition: background-color 200ms ease, color 200ms ease;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--brand); color: var(--brand-ink); }

h1, h2, h3, .font-display { font-family: var(--font-heading); font-weight: 700; letter-spacing: -0.02em; }

.icon { font-size: 18px; line-height: 1; flex-shrink: 0; display: inline-block; }
.icon-sm { font-size: 15px; }
.icon-lg { font-size: 26px; }
.icon-brand { color: var(--brand); }

/* ---------- editorial type ---------- */
.kicker { display: inline-block; font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand); }
.kicker[data-tooltip] { cursor: help; border-bottom: 1px dotted var(--brand); }
.headline { font-family: var(--font-heading); font-weight: 700; letter-spacing: -0.03em; line-height: 1.02; }
.headline-xl { font-size: clamp(30px, 5vw, 46px); }
.headline-lg { font-size: clamp(24px, 3.4vw, 32px); }
.big-number { font-family: var(--font-heading); font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 248px; padding: 18px 12px;
  background: var(--paper); border-right: 2px solid var(--ink);
  display: flex; flex-direction: column; z-index: 80; transition: width 260ms cubic-bezier(.22,1,.36,1);
}
.sidebar.collapsed { width: 76px; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.sidebar.collapsed .sidebar-head { position: relative; height: 40px; padding: 0; }
.sidebar.collapsed .sidebar-head [data-brand-link] { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; transition: opacity 150ms ease; }
.sidebar.collapsed .sidebar-head [data-sidebar-toggle] { position: absolute; inset: 0; margin: auto; opacity: 0; transition: opacity 150ms ease; background: var(--surface-alt); }
.sidebar.collapsed .sidebar-head:hover [data-brand-link] { opacity: 0; pointer-events: none; }
.sidebar.collapsed .sidebar-head:hover [data-sidebar-toggle] { opacity: 1; }
.toggle-icon-expand { display: none; }
.sidebar.collapsed .toggle-icon-collapse { display: none; }
.sidebar.collapsed .toggle-icon-expand { display: inline-block; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.brand-text { display: inline-flex; align-items: center; gap: 6px; }
.beta-badge {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 999px; border: 1.5px solid var(--indigo); color: var(--indigo); background: var(--indigo-bg);
  line-height: 1.5;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px 11px 11px 4px; background: var(--brand);
  display: grid; place-items: center; color: var(--brand-ink); font-weight: 700; font-size: 15px; flex-shrink: 0;
  border: 2px solid var(--ink); box-shadow: var(--shadow-comic-sm); font-family: var(--font-display);
}
.brand-icon-img { width: 34px; height: 34px; flex-shrink: 0; display: block; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; border: 1px solid transparent; color: var(--text-muted); background: transparent; cursor: pointer; transition: background 150ms ease, color 150ms ease, transform 120ms ease; }
.icon-btn:hover { background: var(--surface-alt); color: var(--text); }
.icon-btn:active { transform: scale(0.92); }

.side-nav { margin-top: 26px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.side-link { position: relative; display: flex; align-items: center; gap: 13px; padding: 10px 12px; border-radius: 14px; font-size: 14.5px; font-weight: 600; color: var(--text); transition: background 150ms ease, transform 150ms ease; border: 1.5px solid transparent; }
.sidebar.collapsed .side-link { justify-content: center; padding: 12px 0; }
.side-link:hover { background: var(--surface-alt); }
.side-link.active { background: var(--brand-bg); border-color: var(--ink); color: var(--text); box-shadow: var(--shadow-comic-sm); }
.side-link .tag { margin-left: auto; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--emerald-bg); color: var(--emerald); }

.sidebar-card { margin: 10px 4px 12px; padding: 12px; border-radius: var(--radius-md); border: 1.5px solid var(--border-strong); }
.sidebar-card-icon { flex-shrink: 0; margin-top: 1px; }
.sidebar.collapsed .sidebar-card { display: none; }

.side-foot { border-top: 2px solid var(--ink); padding-top: 12px; display: flex; align-items: center; gap: 10px; padding-left: 12px; padding-right: 6px; }
.sidebar.collapsed .side-foot { flex-direction: column; padding-left: 0; }
.sidebar.collapsed .sidebar-label { display: none; }
.sidebar.collapsed .brand { justify-content: center; }
.avatar { width: 36px; height: 36px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; border: 2px solid var(--ink); }

.main {
  margin-left: 248px; flex: 1; min-width: 0; padding: 22px 28px 100px;
  transition: margin-left 260ms cubic-bezier(.22,1,.36,1);
}
.main.collapsed { margin-left: 76px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-family: var(--font-heading); font-size: 27px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.page-sub { color: var(--text-muted); font-size: 14px; margin: 4px 0 0; }

.mobile-nav { display: none; }

@media (max-width: 980px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px 16px 96px; }
  .mobile-nav {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 90;
    background: var(--paper); border: 2px solid var(--ink); border-radius: 22px; padding: 6px; box-shadow: var(--shadow-comic);
  }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border-radius: 16px; font-size: 10.5px; font-weight: 700; color: var(--text-muted); }
  .mobile-nav a.active { background: var(--brand-bg); color: var(--text); }
}

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1.5px solid var(--ink); border-radius: var(--radius-lg); box-shadow: var(--shadow-comic); }
.card-pad { padding: 20px; }
@media (max-width: 640px) { .card-pad { padding: 16px; } }
.card-flat { border: 1.5px solid var(--border-strong); box-shadow: none; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.metric-card { display: flex; flex-direction: column; gap: 8px; }
.metric-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.metric-label[data-tooltip] { cursor: help; border-bottom: 1px dotted var(--text-faint); }
.metric-value { font-family: var(--font-heading); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.metric-foot { font-size: 12.5px; color: var(--text-faint); }

/* ---------- sticker / stamp ---------- */
.sticker {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 5px 12px;
  border-radius: 999px 999px 999px 4px; border: 1.5px solid var(--ink); background: var(--brand); color: var(--brand-ink);
  transform: rotate(-2deg); box-shadow: var(--shadow-comic-sm);
}
.tilt-r { transform: rotate(1.5deg); }
.tilt-l { transform: rotate(-1.5deg); }

/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; font-weight: 700; font-size: 14px; padding: 10px 18px; border: 1.5px solid var(--ink);
  cursor: pointer; transition: transform 120ms cubic-bezier(.22,1,.36,1), box-shadow 120ms ease, background 150ms ease, opacity 150ms ease;
  white-space: nowrap; user-select: none; box-shadow: var(--shadow-comic-sm);
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.btn:active { transform: translate(1px, 1px); box-shadow: 0 0 0 var(--ink); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-secondary { background: var(--surface); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); transform: none; box-shadow: none; }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.btn-brand { background: var(--brand); color: var(--brand-ink); }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: var(--shadow-comic-sm); }
.btn .icon { font-size: 16px; }

.btn .btn-spinner { display: none; width: 16px; height: 16px; border-radius: 999px; border: 2px solid currentColor; border-right-color: transparent; animation: spin 650ms linear infinite; }
.btn.is-loading { pointer-events: none; opacity: 0.85; }
.btn.is-loading .btn-spinner { display: inline-block; }
.btn.is-loading .btn-label-idle { display: none; }
.btn .btn-label-loading { display: none; }
.btn.is-loading .btn-label-loading { display: inline; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
label.field { display: block; }
.field-label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 7px; color: var(--text); }
.input, select.input, textarea.input {
  width: 100%; border-radius: 13px; border: 1.5px solid var(--border-strong); background: var(--surface);
  color: var(--text); padding: 11px 14px; font-size: 14.5px; outline: none; transition: border-color 150ms ease, box-shadow 150ms ease;
  font-family: inherit;
}
.input:focus, select.input:focus, textarea.input:focus { border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
textarea.input { resize: vertical; min-height: 90px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.input-icon-wrap .input { padding-left: 42px; }
.checkbox-row { display: flex; align-items: center; justify-content: space-between; border: 1.5px solid var(--border-strong); border-radius: 13px; padding: 11px 14px; background: var(--surface); }
.checkbox-row input { width: 19px; height: 19px; accent-color: var(--brand); }

/* ---------- custom select (accessible, replaces native <select>) ---------- */
.select-custom { position: relative; }
.select-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left;
  border-radius: 13px; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 11px 14px; font-size: 14.5px; cursor: pointer; font-family: inherit;
}
.select-trigger:focus-visible, .select-trigger.is-open { border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); outline: none; }
.select-trigger .chev { color: var(--text-faint); transition: transform 150ms ease; }
.select-trigger.is-open .chev { transform: rotate(180deg); }
.select-menu {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; right: 0; max-height: 260px; overflow: auto;
  background: var(--surface); border: 1.5px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow-comic);
  padding: 6px; display: none;
}
.select-menu.is-open { display: block; animation: panel-in 160ms cubic-bezier(.22,1,.36,1) both; }
.select-search { width: 100%; border: none; border-bottom: 1.5px solid var(--border); background: transparent; padding: 8px 8px 10px; font-size: 14px; outline: none; color: var(--text); margin-bottom: 4px; }
.select-option { padding: 9px 10px; border-radius: 9px; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.select-option:hover, .select-option.is-active { background: var(--surface-alt); }
.select-option.is-selected { font-weight: 700; color: var(--brand); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-transform: capitalize; }
.badge-emerald { background: var(--emerald-bg); color: var(--emerald); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-indigo { background: var(--indigo-bg); color: var(--indigo); }
.badge-zinc { background: var(--surface-alt); color: var(--text-muted); }

/* ---------- table / list ---------- */
.sub-row { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; border: 1.5px solid transparent; transition: background 150ms ease, border-color 150ms ease, opacity 150ms ease; }
.sub-row:hover { background: var(--surface-alt); border-color: var(--border); }
.sub-row.is-updating { opacity: 0.5; pointer-events: none; }
.sub-row p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) {
  .sub-row { flex-wrap: wrap; row-gap: 8px; }
  .sub-row > a { flex: 1 1 100% !important; min-width: 0 !important; order: 1; }
  .sub-row > .logo { order: 0; }
  .sub-row > .badge { order: 2; }
  .sub-row > span:not(.logo):not(.badge) { order: 3; margin-left: 0 !important; width: auto !important; }
  .sub-row > div:last-child { order: 4; margin-left: auto; }
}
.logo { width: 42px; height: 42px; border-radius: 13px; border: 1.5px solid var(--ink); background: var(--surface-alt); display: grid; place-items: center; font-weight: 700; font-size: 13px; overflow: hidden; flex-shrink: 0; }
.logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.logo-lg { width: 60px; height: 60px; border-radius: 18px; font-size: 16px; }
.logo-sm { width: 32px; height: 32px; border-radius: 9px; font-size: 11px; }
.logo-xs { width: 18px; height: 18px; border-radius: 5px; font-size: 8px; border-width: 1px; }
.logo-xs img { padding: 2px; }

/* ---------- toasts ---------- */
#toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 999; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1.5px solid var(--ink); box-shadow: var(--shadow-comic); border-radius: 16px; padding: 12px 16px; font-size: 13.5px; font-weight: 600; max-width: 340px; animation: toast-in 320ms cubic-bezier(.22,1,.36,1) both; }
.toast.leaving { animation: toast-out 220ms ease both; }
.toast.success .icon { color: var(--emerald); }
.toast.error .icon { color: var(--red); }
.toast.info .icon { color: var(--blue); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(0.96); } }

/* ---------- modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(23, 20, 15, 0.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 998; animation: fade-in 180ms ease both; }
.modal-panel { background: var(--surface); border: 1.5px solid var(--ink); border-radius: 22px; padding: 22px; width: 100%; min-width: 0; max-width: 420px; box-shadow: var(--shadow-comic); animation: panel-in 320ms cubic-bezier(.22,1,.36,1) both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- animations ---------- */
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes panel-in { from { opacity: 0; transform: translateY(16px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes icon-pop { 0% { opacity: 0; transform: scale(0.82) rotate(-4deg); } 70% { opacity: 1; transform: scale(1.05) rotate(1deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes drop-bounce { 0% { opacity: 0; transform: translateY(-16px) scale(0.94); } 55% { opacity: 1; transform: translateY(4px) scale(1.01); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes fold-away { to { opacity: 0; transform: scaleY(0.4) translateY(-6px); } }
@keyframes shimmer { from { background-position: -300px 0; } to { background-position: 300px 0; } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--emerald) 45%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
@keyframes confetti-pop { 0% { opacity: 0; transform: scale(0.5) rotate(-8deg); } 60% { opacity: 1; transform: scale(1.08) rotate(3deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }

.animate-fade-up { animation: fade-up 420ms cubic-bezier(.22,1,.36,1) both; }
.animate-panel-in { animation: panel-in 420ms cubic-bezier(.22,1,.36,1) both; }
.animate-icon-pop { animation: icon-pop 480ms cubic-bezier(.22,1,.36,1) both; }
.animate-drop { animation: drop-bounce 380ms cubic-bezier(.22,1.4,.4,1) both; }
.stagger > * { animation: fade-up 380ms cubic-bezier(.22,1,.36,1) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; } .stagger > *:nth-child(2) { animation-delay: 35ms; }
.stagger > *:nth-child(3) { animation-delay: 70ms; } .stagger > *:nth-child(4) { animation-delay: 105ms; }
.stagger > *:nth-child(5) { animation-delay: 140ms; } .stagger > *:nth-child(6) { animation-delay: 175ms; }
.stagger > *:nth-child(n+7) { animation-delay: 210ms; }

.skeleton { background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 37%, var(--surface-alt) 63%); background-size: 400px 100%; animation: shimmer 1.4s ease infinite; border-radius: 14px; }

.pulse-dot { position: relative; width: 8px; height: 8px; border-radius: 999px; background: var(--emerald); }
.pulse-dot::after { content: ""; position: absolute; inset: 0; border-radius: 999px; animation: pulse-ring 1.6s cubic-bezier(.22,1,.36,1) infinite; }

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

/* ---------- misc ---------- */
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.text-sm { font-size: 13px; }
.divider { height: 2px; background: var(--ink); opacity: 0.08; border: none; margin: 16px 0; }
.empty-state { text-align: center; padding: 48px 20px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; border: 1.5px solid var(--border-strong); background: var(--surface); font-size: 13px; font-weight: 700; cursor: pointer; transition: all 150ms ease; }
.chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip:hover:not(.active) { background: var(--surface-alt); }

.add-tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-alt); border-radius: 999px; margin-bottom: 16px; }
.add-tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 12px;
  border-radius: 999px; border: none; background: transparent; color: var(--text-muted); font-weight: 700;
  font-size: 13.5px; cursor: pointer; transition: background 150ms ease, color 150ms ease; white-space: nowrap;
}
.add-tab:hover:not(.active) { color: var(--text); }
.add-tab.active { background: var(--ink); color: var(--paper); box-shadow: var(--shadow-comic-sm); }
.add-tab-panel { animation: fade-up 280ms cubic-bezier(.22,1,.36,1) both; }
@media (max-width: 560px) {
  .add-tabs { flex-wrap: wrap; border-radius: 16px; }
  .add-tab { flex: 1 1 45%; }
}

.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; }

/* ---------- marketing landing page ---------- */
.landing-wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.btn-lg { padding: 14px 24px; font-size: 15.5px; }

.landing-nav { display: flex; align-items: center; justify-content: space-between; padding: 22px 0; }
.landing-nav-actions { display: flex; align-items: center; gap: 10px; }

.brand-dropdown-wrap { position: relative; }
.brand-btn { background: none; border: none; cursor: pointer; padding: 0; }
.brand-mark-wrap { position: relative; display: inline-flex; }
.brand-notice-dot {
  position: absolute; top: -2px; right: -2px; width: 11px; height: 11px; border-radius: 999px;
  background: var(--indigo); border: 2px solid var(--bg); animation: pulse-dot 1.8s ease-in-out infinite;
}
@keyframes pulse-dot { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.3); opacity: 0.75; } }

.brand-dropdown {
  position: fixed; z-index: 9999; width: 270px;
  background: var(--surface); border: 1.5px solid var(--ink); border-radius: var(--radius-md);
  padding: 16px; box-shadow: var(--shadow-comic); text-align: left;
  display: none;
}
.brand-dropdown.is-open { display: block; animation: fade-up 220ms cubic-bezier(.22,1,.36,1) both; }
@media (max-width: 480px) { .brand-dropdown { width: calc(100vw - 48px); } }

.landing-hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center; padding: 40px 0 70px; }
.landing-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.landing-hero-note { margin-top: 16px; font-size: 13px; color: var(--text-muted); }
.landing-hero-visual { position: relative; display: flex; justify-content: center; align-items: center; min-height: 260px; }
.landing-preview-card { position: relative; z-index: 1; width: 100%; max-width: 300px; }
.landing-mascot { position: absolute; bottom: -18px; right: -10px; z-index: 2; }

@media (max-width: 860px) {
  .landing-hero { grid-template-columns: 1fr; padding-top: 20px; text-align: center; }
  .landing-hero-actions { justify-content: center; }
  .landing-hero-visual { margin-top: 10px; flex-direction: column; }
  .landing-mascot { position: static; margin-top: -14px; }
}

.landing-section { padding: 50px 0; }
.landing-section-head { text-align: center; max-width: 560px; margin: 0 auto 32px; }

.landing-cta-band {
  text-align: center; padding: 56px 24px; border-radius: var(--radius-md); border: 1.5px solid var(--ink);
  background: var(--brand-bg); margin: 20px 0 60px;
}

.landing-footer { padding: 26px 0 40px; display: flex; align-items: center; justify-content: space-between; border-top: 1.5px solid var(--border-strong); flex-wrap: wrap; gap: 10px; }

.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 8px; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; height: 100%; }
.bar-chart .bar {
  width: 100%; max-width: 34px; border-radius: 9px 9px 4px 4px; border: 1.5px solid var(--ink);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 85%, white 15%), var(--brand));
  transform-origin: bottom; animation: bar-grow 640ms cubic-bezier(.22,1,.36,1) both; cursor: default;
  transition: filter 150ms ease, transform 150ms ease;
}
.bar-chart .bar:hover { filter: brightness(1.08); transform: scaleY(1.01); }
.bar-chart .bar-col:nth-child(1) .bar { animation-delay: 0ms; } .bar-chart .bar-col:nth-child(2) .bar { animation-delay: 40ms; }
.bar-chart .bar-col:nth-child(3) .bar { animation-delay: 80ms; } .bar-chart .bar-col:nth-child(4) .bar { animation-delay: 120ms; }
.bar-chart .bar-col:nth-child(5) .bar { animation-delay: 160ms; } .bar-chart .bar-col:nth-child(6) .bar { animation-delay: 200ms; }
.bar-chart .bar-col:nth-child(n+7) .bar { animation-delay: 240ms; }
@keyframes bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.bar-chart .bar-label { font-size: 11px; color: var(--text-faint); font-weight: 700; }

.progress-track { height: 9px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; border: 1.5px solid var(--border); }
.progress-fill {
  height: 100%; border-radius: 999px; transform-origin: left; animation: fill-grow 720ms cubic-bezier(.22,1,.36,1) both;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 75%, black 10%));
}
@keyframes fill-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.qa-form { display: flex; gap: 8px; flex-wrap: wrap; }
.qa-form .input-icon-wrap { flex: 1; min-width: 220px; }
.qa-preview { margin-top: 12px; border-radius: 16px; border: 1.5px dashed var(--border-strong); padding: 14px; display: none; }
.qa-preview.visible { display: block; animation: fade-up 320ms cubic-bezier(.22,1,.36,1) both; }

.onboarding-dot { position: relative; height: 6px; flex: 1; border-radius: 999px; background: var(--surface-alt); overflow: hidden; border: 1px solid var(--border); }
.onboarding-dot.filled { background: var(--brand); border-color: var(--ink); }
.onboarding-dot.filled::after { content: ""; position: absolute; inset: 0; width: 45%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent); animation: shimmer-sweep 1.8s ease-in-out infinite; }
@keyframes shimmer-sweep { from { transform: translateX(-120%); } to { transform: translateX(320%); } }

.count-up { font-variant-numeric: tabular-nums; }

.brand-logo-light { display: block; }
.brand-logo-dark { display: none; }
:root[data-theme="dark"] .brand-logo-light { display: none; }
:root[data-theme="dark"] .brand-logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo-light { display: none; }
  :root:not([data-theme="light"]) .brand-logo-dark { display: block; }
}

/* ---------- calendar ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; padding-bottom: 4px; }
.cal-cell { min-height: 84px; border-radius: 12px; border: 1.5px solid var(--border); padding: 6px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); }
.cal-cell.is-today { border-color: var(--ink); box-shadow: var(--shadow-comic-sm); }
.cal-cell.is-empty { border-style: dashed; border-color: var(--border); background: transparent; }
.cal-date { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.cal-cell.is-today .cal-date { color: var(--brand); }
.cal-item { display: flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 650; background: var(--brand-bg); color: var(--text); border-radius: 6px; padding: 2px 5px 2px 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item .logo-xs { border-radius: 4px; }
.cal-total { font-size: 10px; color: var(--text-faint); margin-top: auto; font-weight: 700; }
@media (max-width: 700px) {
  .cal-grid { grid-template-columns: repeat(7, 1fr); }
  .cal-cell { min-height: 56px; padding: 4px; }
  .cal-item { display: none; }
  .cal-cell.has-items::after { content: ""; width: 6px; height: 6px; border-radius: 999px; background: var(--brand); display: block; margin: 0 auto; }
}

/* ---------- timeline (Home upcoming) ---------- */
.timeline { display: flex; flex-direction: column; }
.timeline-group { display: flex; gap: 16px; padding: 10px 0; border-bottom: 1.5px dashed var(--border); }
.timeline-group:last-child { border-bottom: none; }
.timeline-day { width: 84px; flex-shrink: 0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); padding-top: 10px; }
.timeline-items { flex: 1; display: flex; flex-direction: column; gap: 4px; }

.form-layout { grid-template-columns: 1.3fr 0.9fr; }
@media (max-width: 900px) { .form-layout { grid-template-columns: 1fr; } .form-layout .card[style*="sticky"] { position: static !important; } }


/* ---------- tooltip ----------
   Rendered by app.js as a single element appended directly to <body> and
   positioned with fixed coordinates, instead of a per-element ::after. A
   CSS-only tooltip gets trapped inside whatever stacking context its
   ancestor happens to create (any transform — including the residual
   `transform: translateY(0)` a "both" fill-mode entrance animation leaves
   behind — starts a new one), so z-index alone can't guarantee it renders
   above a sibling like the fixed sidebar. Living on <body> sidesteps that
   entirely. */
#global-tooltip {
  position: fixed; z-index: 9999; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 650;
  padding: 6px 11px; border-radius: 9px; max-width: 260px; line-height: 1.4; pointer-events: none;
  opacity: 0; transition: opacity 120ms ease; box-shadow: var(--shadow-comic-sm);
}
#global-tooltip.is-visible { opacity: 1; }

/* ---------- mascot ---------- */
@keyframes mascot-bob { from { opacity: 0; transform: translateY(-10px) rotate(-2deg) scale(0.94); } to { opacity: 1; transform: translateY(0) rotate(0) scale(1); } }
.mascot-bob { animation: mascot-bob 460ms cubic-bezier(.22,1,.36,1) both; display: inline-block; }
.mascot-pop { animation: drop-bounce 460ms cubic-bezier(.22,1.4,.4,1) both; display: inline-block; }
