@import url('/assets/brand.css');

:root {
  --surface: #ffffff;
  --surface-2: color-mix(in srgb, var(--brand-primary) 7%, #ffffff);
  --border: color-mix(in srgb, var(--brand-text) 14%, transparent);
  --muted: #5d6675;
  --primary-ink: color-mix(in srgb, var(--brand-primary) 78%, #000000);
  --ok-bg: #e3f4e8; --ok-ink: #1d6b3a;
  --warn-bg: #fff3d6; --warn-ink: #7a4b00;
  --bad-bg: #fde8e8; --bad-ink: #9b1c1c;
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem; --space-5: 1.5rem; --space-6: 2rem; --space-7: 3rem; --space-8: 4.5rem;
  --text-sm: .875rem; --text-md: 1rem; --text-lg: 1.125rem; --text-xl: 1.375rem; --text-2xl: 1.75rem; --text-3xl: 2.25rem;
  --radius: 6px; --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(28, 37, 51, .06), 0 8px 24px rgba(28, 37, 51, .06);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--brand-background); color: var(--brand-text); font-family: var(--brand-font-body); font-size: var(--text-md); line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3, h4 { font-family: var(--brand-font-heading); color: var(--brand-heading); line-height: 1.15; margin: 0 0 var(--space-3); letter-spacing: -.01em; }
h1 { font-size: var(--text-3xl); } h2 { font-size: var(--text-2xl); } h3 { font-size: var(--text-xl); }
p { margin: 0 0 var(--space-3); }
a { color: var(--brand-link); }
a:hover { color: var(--primary-ink); }
:focus-visible { outline: 3px solid var(--brand-primary); outline-offset: 2px; border-radius: 3px; }
[hidden] { display: none !important; }
.icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: var(--text-sm); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 var(--space-4); }
.stack > * + * { margin-top: var(--space-4); }
.row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 44px; padding: .6rem 1.1rem; border-radius: var(--radius); border: 2px solid transparent; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn-primary { background: var(--brand-button-background); color: var(--brand-button-text); }
.btn-primary:hover { background: var(--primary-ink); color: var(--brand-button-text); }
.btn-ghost { background: transparent; color: var(--primary-ink); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--brand-primary); background: var(--surface-2); color: var(--primary-ink); }
.btn-danger { background: var(--surface); color: var(--bad-ink); border-color: color-mix(in srgb, var(--bad-ink) 40%, transparent); }
.btn-sm { min-height: 44px; padding: .4rem .8rem; font-size: var(--text-sm); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: progress; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--brand-header-background); color: var(--brand-header-text); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; gap: var(--space-4); min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--brand-header-text); font-weight: 800; font-family: var(--brand-font-heading); letter-spacing: -.02em; }
.logo img { height: 32px; width: auto; display: block; }
.nav { display: flex; gap: var(--space-1); margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--brand-header-text); text-decoration: none; padding: .55rem .7rem; border-radius: var(--radius); font-weight: 600; font-size: var(--text-sm); min-height: 44px; display: inline-flex; align-items: center; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--surface-2); color: var(--primary-ink); }
.who { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.who .tag { background: var(--surface-2); color: var(--primary-ink); padding: .2rem .6rem; border-radius: 999px; font-weight: 700; }
.menu-btn { display: none; margin-left: auto; }
@media (max-width: 760px) {
  .menu-btn { display: inline-flex; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--brand-header-background); border-bottom: 1px solid var(--border); padding: var(--space-3) var(--space-4); flex-direction: column; align-items: stretch; }
  .nav.open { display: flex; }
}

/* Home */
.hero { padding: var(--space-8) 0 var(--space-7); }
.hero h1 { font-size: clamp(2.75rem, 7.5vw, 5.25rem); line-height: 1.02; letter-spacing: -.035em; max-width: 15ch; margin-bottom: var(--space-5); }
.hero h1 em { font-style: normal; color: var(--brand-primary); }
.hero .lead { font-size: var(--text-lg); max-width: 40rem; color: var(--muted); margin-bottom: var(--space-5); }
.steps { padding: 0 0 var(--space-8); }
.steps h2 { margin-bottom: var(--space-5); }
.steps ol { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.steps li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); display: grid; gap: var(--space-2); align-content: start; }
.steps .n { font-family: var(--brand-font-heading); font-weight: 800; color: var(--brand-primary); font-size: var(--text-3xl); line-height: 1; }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.chip { font-size: var(--text-sm); padding: .2rem .65rem; border-radius: 999px; background: var(--surface-2); color: var(--primary-ink); font-weight: 600; }
.site-footer { border-top: 1px solid var(--border); padding: var(--space-6) 0; font-size: var(--text-sm); color: var(--muted); }
.site-footer .cols { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.site-footer a { color: var(--primary-ink); }
.trust { display: flex; gap: var(--space-2); align-items: flex-start; margin-bottom: var(--space-2); }

/* Cards, forms, states */
.page { padding: var(--space-6) 0 var(--space-8); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow); min-width: 0; }
.card h2, .card h3 { margin-top: 0; }
.field { display: grid; gap: var(--space-1); }
.field label, .label { font-weight: 700; font-size: var(--text-sm); }
input, select, textarea { font: inherit; color: var(--brand-text); background: var(--surface); border: 1.5px solid color-mix(in srgb, var(--brand-text) 28%, transparent); border-radius: var(--radius); padding: .6rem .75rem; min-height: 44px; width: 100%; max-width: 100%; }
textarea { min-height: 7rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 25%, transparent); }
.err { color: var(--bad-ink); font-size: var(--text-sm); font-weight: 600; }
.notice { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); align-items: flex-start; }
.notice-danger { background: var(--bad-bg); color: var(--bad-ink); border-color: transparent; }
.notice-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.notice-ok { background: var(--ok-bg); color: var(--ok-ink); border-color: transparent; }
.notice-body p { margin: 0 0 var(--space-2); }
.notice-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; font-weight: 700; padding: .15rem .6rem; border-radius: 999px; background: var(--surface-2); color: var(--primary-ink); white-space: nowrap; }
.badge.yes, .badge.confirmed, .badge.completed, .badge.sent { background: var(--ok-bg); color: var(--ok-ink); }
.badge.maybe, .badge.moved, .badge.scheduled { background: var(--warn-bg); color: var(--warn-ink); }
.badge.no, .badge.declined, .badge.skipped, .badge.failed { background: var(--bad-bg); color: var(--bad-ink); }
.skeleton { height: 1rem; border-radius: 4px; background: linear-gradient(90deg, #eceef2, #f6f7f9, #eceef2); background-size: 200% 100%; animation: sk 1.2s infinite; margin: .5rem 0; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.empty { text-align: center; padding: var(--space-6) var(--space-4); }
.kpi { display: grid; gap: var(--space-1); }
.kpi .v { font-size: var(--text-3xl); font-weight: 800; font-family: var(--brand-font-heading); font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .k { font-size: var(--text-sm); color: var(--muted); font-weight: 600; }
.meter { height: 10px; border-radius: 999px; background: #e6e8ee; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--brand-primary); border-radius: 999px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; font-weight: 700; white-space: nowrap; }
th button { background: none; border: 0; font: inherit; font-weight: 700; color: var(--brand-text); cursor: pointer; padding: 0; min-height: 32px; }
tbody tr:hover { background: var(--surface-2); }
.table-tools { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.table-tools input { max-width: 20rem; }
.pager { display: flex; gap: var(--space-2); align-items: center; justify-content: flex-end; padding: var(--space-3); }

/* Week calendar */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-2); }
.day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-3); min-height: 10rem; display: grid; gap: var(--space-2); align-content: start; min-width: 0; }
.day.today { border-color: var(--brand-primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-primary) 30%, transparent); }
.day h3 { font-size: var(--text-md); margin: 0; }
.item { border-radius: var(--radius); padding: var(--space-2); font-size: var(--text-sm); overflow-wrap: anywhere; }
.item.busy { background: #eef0f4; color: var(--brand-text); }
.item.sess { background: var(--surface-2); border-left: 4px solid var(--brand-primary); }
.item .t { font-weight: 700; display: block; }
@media (max-width: 960px) { .week { grid-template-columns: 1fr; } .day { min-height: 0; } }

/* Today */
.today-hero { border-radius: var(--radius-lg); padding: var(--space-6) var(--space-5); color: #ffffff; background: linear-gradient(90deg, rgba(20, 18, 40, .93), rgba(20, 18, 40, .78)), url('/assets/hero-generated.webp') center / cover no-repeat; }
.today-hero h1, .today-hero h2 { color: #ffffff; }
.today-hero .muted-on-dark { color: #e7e6f2; }
.today-hero .badge { background: #ffffff; color: var(--primary-ink); }
.big { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.reasons { margin: 0; padding-left: 1.2rem; }
.reasons li { margin-bottom: var(--space-2); }
.chat { display: grid; gap: var(--space-2); max-height: 22rem; overflow-y: auto; padding: var(--space-2); background: var(--brand-background); border-radius: var(--radius); }
.msg { max-width: 85%; padding: .5rem .8rem; border-radius: 12px; font-size: var(--text-sm); overflow-wrap: anywhere; }
.msg.in { justify-self: end; background: var(--brand-primary); color: #ffffff; }
.msg.out { justify-self: start; background: var(--surface); border: 1px solid var(--border); }
.rpe { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: var(--space-1); }
.rpe label { display: grid; place-items: center; min-height: 44px; border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; font-weight: 700; background: var(--surface); }
.rpe input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rpe input:checked + span { color: var(--brand-button-text); }
.rpe label:has(input:checked) { background: var(--brand-primary); border-color: var(--brand-primary); color: #ffffff; }
.rpe label:has(input:focus-visible) { outline: 3px solid var(--brand-primary); outline-offset: 2px; }
.seg { display: inline-flex; border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.seg label { padding: .55rem 1rem; min-height: 44px; display: inline-flex; align-items: center; cursor: pointer; font-weight: 700; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label:has(input:checked) { background: var(--brand-primary); color: #ffffff; }
@media (max-width: 480px) { .rpe { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* Toast and dialog */
.toasts { position: fixed; bottom: var(--space-4); right: var(--space-4); left: var(--space-4); display: grid; gap: var(--space-2); justify-items: end; z-index: 100; pointer-events: none; }
.toast { pointer-events: auto; background: var(--brand-text); color: #ffffff; padding: .75rem 1rem; border-radius: var(--radius); box-shadow: var(--shadow); max-width: 28rem; font-size: var(--text-sm); }
.toast.bad { background: var(--bad-ink); }
dialog { border: 0; border-radius: var(--radius-lg); padding: var(--space-5); max-width: min(32rem, 92vw); box-shadow: var(--shadow); color: var(--brand-text); }
dialog::backdrop { background: rgba(20, 18, 40, .45); }

/* Sign-in */
.signin { display: flex; justify-content: center; padding: var(--space-7) var(--space-4); }
.signin-card { width: 100%; max-width: 32rem; }
.signin-choices, .signin [data-choice] { display: grid; gap: var(--space-2); }
.signin [data-choice] { justify-items: start; width: 100%; padding: var(--space-4); font: inherit; text-align: left; color: var(--brand-text); background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; min-height: 44px; }
.signin [data-choice]:hover { border-color: var(--brand-primary); }
.signin [data-choice]:first-child strong { font-size: var(--text-xl); }
.signin [data-choice][aria-pressed="true"] { border-color: var(--brand-primary); background: var(--surface-2); }
.signin-picked, .signin-foot, .signin-pair { display: flex; gap: var(--space-2); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.signin-digits { display: flex; gap: var(--space-2); }
.signin form .btn-primary, .signin-pair .btn { flex: 1; width: 100%; }
.signin-digits input { flex: 1; min-width: 0; min-height: 3.5rem; text-align: center; font-size: var(--text-xl); padding: 0; }

/* Console */
.console { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--brand-text); color: #ffffff; padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); position: sticky; top: 0; height: 100vh; }
.side .logo { color: #ffffff; margin-bottom: var(--space-4); }
.side .logo img { background: #ffffff; border-radius: 6px; padding: 3px; }
.side a { color: #e8e9ef; text-decoration: none; padding: .6rem .75rem; border-radius: var(--radius); display: flex; gap: var(--space-2); align-items: center; font-weight: 600; min-height: 44px; }
.side a:hover, .side a[aria-current="page"] { background: rgba(255, 255, 255, .12); color: #ffffff; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.console-main { padding: var(--space-5); min-width: 0; }
.chart svg { width: 100%; height: auto; display: block; }
@media (max-width: 860px) {
  .console { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: var(--space-2); }
  .side .logo { margin: 0 var(--space-2) 0 0; }
  .console-main { padding: var(--space-4) var(--space-3); }
}
