/* Layout: CMG dark frame. Sidebar (who is signed in) + main column: summary tiles, artist budgets, then the
   status board that mirrors the JVPAY Jira board column for column. Tokens copied from docs/cmg-brand-kit.md. */
:root {
  --cmg-pink: #ff3d81; --cmg-magenta: #cc3167; --cmg-violet: #9e6fb1; --cmg-cyan: #00c1ff; --cmg-blue: #066da8;
  --cmg-gradient: linear-gradient(135deg, #ff3d81 0%, #e44b8e 22%, #9e6fb1 50%, #30a8e7 80%, #00c1ff 100%);
  --background: #0a0a0a; --foreground: #fafafa;
  --card: #141414; --popover: #1a1a1a;
  --primary: #cc3167; --primary-hover: #b82a5b; --primary-foreground: #ffffff;
  --secondary: #242424; --secondary-foreground: #e5e5e5;
  --muted: #262626; --muted-foreground: #a1a1a1;
  --accent: #1f1f1f; --accent-2: rgba(255, 61, 129, .16); --brand-text: #ffb3cf;
  --border: #262626; --input: #3a3a3a; --ring: #ff3d81;
  --destructive: #ff8a8a; --destructive-background: #3b0d0d;
  --success-foreground: #86efac; --success-background: #0b2a17;
  --warning-foreground: #fde047; --warning-background: #3a2a05;
  --info-foreground: #5fd4ff; --info-background: #06283a;
  --link-accent: #00c1ff;
  --sidebar: #0d0d0d; --sidebar-primary: #ff3d81; --sidebar-accent: #1c1c1c; --sidebar-border: #1f1f1f;
  --overlay: rgba(0, 0, 0, .6);
  --shadow-xs: 0 1px 2px rgba(0,0,0,.5);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.5);
  --shadow-focus-field: 0 0 0 3px rgba(255,61,129,.28);
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius-sm: 6px; --radius-md: 8px; --radius-lg: 12px; --radius-full: 9999px;
  color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { background: var(--background); }
body { margin: 0; color: var(--foreground); font: 400 14px/20px var(--font-sans); -webkit-font-smoothing: antialiased; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--link-accent); }
.mono { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }
.meta { color: var(--muted-foreground); font-size: 12px; line-height: 16px; }
.metric-label { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); }
.cmg-title { background: var(--cmg-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
.cmg-edge { border-top: 2px solid transparent; background: linear-gradient(var(--card), var(--card)) padding-box, var(--cmg-gradient) border-box; }
.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* review banner (mock only) */
.review { background: var(--info-background); color: var(--info-foreground); border-bottom: 1px solid var(--border); }
.review-inner { display: flex; gap: 8px; align-items: flex-start; padding-block: 8px; font-size: 13px; }
.review svg { flex: none; margin-top: 2px; }

/* buttons, badges, fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius-md); border: 1px solid transparent; background: transparent; font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color 150ms ease-out, border-color 150ms ease-out; white-space: nowrap; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { border-color: var(--input); }
.btn-outline:hover, .btn-ghost:hover { background: var(--accent); }
.btn-outline[aria-pressed="true"] { background: var(--accent-2); border-color: var(--cmg-magenta); color: var(--brand-text); }
.btn-block { width: 100%; }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--radius-full); font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge svg { width: 12px; height: 12px; }
.b-outline { border: 1px solid var(--input); color: var(--secondary-foreground); }
.b-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.b-brand { background: var(--accent-2); color: var(--brand-text); }
.b-success { background: var(--success-background); color: var(--success-foreground); }
.b-warning { background: var(--warning-background); color: var(--warning-foreground); }
.b-danger { background: var(--destructive-background); color: var(--destructive); }
.b-info { background: var(--info-background); color: var(--info-foreground); }
.field { height: 36px; border: 1px solid var(--input); border-radius: var(--radius-md); background: transparent; padding: 0 12px; min-width: 0; }
.field:focus { outline: none; border-color: var(--ring); box-shadow: var(--shadow-focus-field); }
.field::placeholder { color: var(--muted-foreground); }
select.field { padding-right: 8px; background: var(--background); }
.search { position: relative; flex: 1 1 220px; min-width: 0; max-width: 320px; }
.search svg { position: absolute; left: 10px; top: 10px; color: var(--muted-foreground); }
.search .field { width: 100%; padding-left: 32px; box-sizing: border-box; }

/* sign-in */
.signin { min-height: 100%; display: grid; place-items: center; padding-block: 48px; }
.signin-card { width: 100%; max-width: 400px; box-sizing: border-box; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px 24px; display: grid; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-size: 17px; font-weight: 700; }
.signin h1 { margin: 0; font-size: 30px; line-height: 36px; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
.signin p { margin: 0; color: var(--muted-foreground); }
.google-btn { height: 40px; border: 1px solid var(--input); background: var(--background); }
.google-btn:hover { background: var(--accent); }
.chooser { display: grid; gap: 4px; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 4px; background: var(--popover); }
.chooser button { display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: center; text-align: left; padding: 8px; border-radius: var(--radius-sm); border: 0; background: transparent; cursor: pointer; }
.chooser button:hover { background: var(--accent); }
.chooser .who { min-width: 0; }
.chooser .who div:last-child { color: var(--muted-foreground); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.signin-error { background: var(--destructive-background); color: var(--destructive); border-radius: var(--radius-md); padding: 10px 12px; font-size: 13px; }
.avatar { width: 32px; height: 32px; border-radius: var(--radius-full); display: grid; place-items: center; font-size: 12px; font-weight: 600; background: linear-gradient(135deg, #3a1324, #0b2a3a); border: 1px solid var(--input); flex: none; }

/* app frame */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 24px; align-items: start; }
.sidebar { position: sticky; top: env(safe-area-inset-top, 0px); background: var(--sidebar); border-right: 1px solid var(--sidebar-border); min-height: calc(100vh - 41px); padding-block: 24px; padding-right: 16px; display: flex; flex-direction: column; gap: 24px; box-sizing: border-box; }
.nav { display: grid; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: var(--radius-md); color: var(--foreground); text-decoration: none; }
.nav a svg { color: var(--muted-foreground); }
.nav a:hover { background: var(--sidebar-accent); }
.nav a.current { background: var(--sidebar-accent); font-weight: 500; }
.nav a.current::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: var(--sidebar-primary); }
.nav .count { margin-left: auto; font-size: 12px; color: var(--muted-foreground); background: var(--secondary); border-radius: var(--radius-full); padding: 0 8px; line-height: 20px; }
.user { margin-top: auto; display: grid; gap: 12px; border-top: 1px solid var(--sidebar-border); padding-top: 16px; }
.user-row { display: flex; gap: 10px; align-items: center; min-width: 0; }
.user-row > div { min-width: 0; }
.user-email { color: var(--muted-foreground); font-size: 12px; overflow-wrap: anywhere; }
.main { min-width: 0; padding-block: 32px 64px; max-width: 1192px;
  background: radial-gradient(ellipse 70% 320px at 30% 0%, rgba(204,49,103,.14), transparent 70%), radial-gradient(ellipse 50% 280px at 85% 0%, rgba(0,193,255,.08), transparent 70%);
  background-repeat: no-repeat; display: grid; gap: 32px; }
.page-head { display: grid; gap: 6px; }
.page-head h1 { margin: 0; font-size: 36px; line-height: 40px; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
.section { display: grid; gap: 12px; scroll-margin-top: 16px; }
.section-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; }
.section-head h2 { margin: 0; font-size: 18px; line-height: 28px; font-weight: 500; }

/* KPI tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; display: grid; gap: 4px; }
.tile .value { font-size: 26px; line-height: 32px; font-weight: 600; }

/* artist budgets */
.budgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.budget { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; display: grid; gap: 12px; align-content: start; }
.budget-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.budget-head h3 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; }
.budget-total { font-size: 24px; line-height: 30px; font-weight: 600; }
.meter { height: 6px; border-radius: var(--radius-full); background: var(--muted); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--cmg-gradient); border-radius: var(--radius-full); }
.rows { display: grid; gap: 6px; margin: 0; }
.rows div { display: flex; justify-content: space-between; gap: 12px; }
.rows dt { color: var(--muted-foreground); }
.rows dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }
.rows .strong dd, .rows .strong dt { color: var(--foreground); font-weight: 600; }
.over { color: var(--destructive); }

/* board */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.col-picker { display: none; }
.board-scroll { overflow-x: auto; padding-bottom: 4px; }
.board { display: grid; grid-template-columns: repeat(5, minmax(232px, 1fr)); gap: 12px; align-items: start; }
.col { background: var(--sidebar); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.col-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 2px 4px 6px; }
.col-head h3 { margin: 0; font-size: 13px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.col-head .n { color: var(--muted-foreground); font-weight: 500; }
.col-empty { color: var(--muted-foreground); font-size: 13px; padding: 12px 4px; }
.ticket { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; display: grid; gap: 6px; cursor: pointer; text-align: left; transition: border-color 150ms ease-out, background-color 150ms ease-out; }
.ticket:hover { border-color: var(--input); background: #171717; }
.t-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted-foreground); }
.t-vendor { font-weight: 500; overflow-wrap: anywhere; }
.t-sub { color: var(--muted-foreground); font-size: 13px; overflow-wrap: anywhere; }
.t-amount { font-size: 18px; line-height: 24px; font-weight: 600; }
.t-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.t-actions { padding-top: 4px; }

/* views and tables */
.view { display: grid; gap: 32px; }
.table-scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.table { width: 100%; min-width: 700px; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--accent); }
.table .r { text-align: right; font-variant-numeric: tabular-nums; }
.table .keys { color: var(--muted-foreground); font-family: var(--font-mono); font-size: 12px; }
.table .vendor { font-weight: 500; }
.note { margin: 0; color: var(--muted-foreground); font-size: 13px; max-width: 72ch; }

/* drawer, dialog, toast */
.scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); box-sizing: border-box; background: var(--popover); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 41; display: flex; flex-direction: column;
  padding-top: max(20px, env(safe-area-inset-top, 0px)); padding-bottom: max(20px, env(safe-area-inset-bottom, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); padding-left: 20px; gap: 16px; overflow-y: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer-head h2 { margin: 4px 0 0; font-size: 20px; line-height: 28px; font-weight: 600; overflow-wrap: anywhere; }
.icon-btn { width: 32px; height: 32px; border-radius: var(--radius-md); border: 0; background: transparent; display: grid; place-items: center; color: var(--muted-foreground); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--accent); color: var(--foreground); }
.facts { display: grid; gap: 0; margin: 0; border-top: 1px solid var(--border); }
.facts div { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.facts dt { color: var(--muted-foreground); font-size: 13px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.next { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; color: var(--secondary-foreground); }
.drawer-foot { margin-top: auto; display: grid; gap: 8px; }
.dialog { position: fixed; z-index: 51; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100% - 32px)); box-sizing: border-box; background: var(--popover); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 20px; display: grid; gap: 14px; }
.dialog h2 { margin: 0; font-size: 18px; line-height: 26px; font-weight: 600; }
.dialog p { margin: 0; color: var(--secondary-foreground); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.scrim.top { z-index: 50; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 60; background: var(--popover); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: var(--radius-md); padding: 10px 14px; display: flex; gap: 8px; align-items: center; max-width: calc(100% - 32px); box-sizing: border-box; }
.toast svg { color: var(--success-foreground); flex: none; }

@media (max-width: 759px) {
  .app { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .sidebar { position: static; min-height: 0; border-right: 0; border-bottom: 1px solid var(--sidebar-border); padding: 16px 0; gap: 16px; }
  .nav { grid-auto-flow: column; justify-content: start; }
  .user { margin-top: 0; padding-top: 12px; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .main { padding-block: 24px 48px; gap: 28px; }
  .view { gap: 28px; }
  .page-head h1 { font-size: 28px; line-height: 34px; }
  .col-picker { display: flex; flex: 1 1 100%; }
  .col-picker .field { width: 100%; }
  .search { max-width: none; }
  .board-scroll { overflow: visible; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .col:not(.is-active) { display: none; }
  .facts div { grid-template-columns: 112px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* live portal: sign-in forms and messages */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; }
.form .field { width: 100%; box-sizing: border-box; }
.form p { margin: 0; color: var(--secondary-foreground); }
.linkish { background: none; border: 0; padding: 0; color: var(--link-accent); cursor: pointer; font-size: 13px; }
.linkish:hover { text-decoration: underline; }
.btn:disabled { opacity: .6; cursor: default; }
.msg { border-radius: var(--radius-md); padding: 10px 12px; font-size: 13px; }
.msg-error { background: var(--destructive-background); color: var(--destructive); }
.msg-info { background: var(--info-background); color: var(--info-foreground); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.loading { color: var(--muted-foreground); padding: 16px 4px; }
.budget-section { display: grid; gap: 8px; }
.budget-section + .budget-section { border-top: 1px solid var(--border); padding-top: 12px; }
.foot { margin: 0; color: var(--muted-foreground); font-size: 12px; }

.sheet-link { font-size: 13px; color: var(--link-accent); text-decoration: none; white-space: nowrap; margin-left: auto; margin-right: 8px; }
.sheet-link:hover { text-decoration: underline; }

.meter.over span { background: var(--destructive); }
.link-form { display: flex; gap: 8px; flex-wrap: wrap; }
.link-form .field { flex: 1 1 220px; min-width: 0; }
