/* crm.danielhorn.ch – provisional brand tokens from ~/CLAUDE.md */

@font-face { font-family: "Space Grotesk"; src: url("../fonts/space-grotesk-500.ab4861869c91.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("../fonts/space-grotesk-700.f9e147a59a93.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/ibm-plex-sans-400.77bc02670657.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/ibm-plex-sans-500.f7016cd446d2.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/ibm-plex-sans-600.196e3cbc5fee.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/ibm-plex-mono-400.79936b18df9f.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --navy: #14283C;
  --navy-deep: #0E1E2E;
  --navy-line: #2A3F55;
  --copper: #A85A1E;
  --copper-dark: #8F4C17;
  --copper-light: #E39A5C;
  --paper: #F4F6F8;
  --white: #FFFFFF;
  --ink: #14283C;
  --muted: #55667A;
  --line: #D6DEE6;
  --on-navy: #E8EEF4;
  --on-navy-muted: #A9B8C7;
  --success: #1E7A4C;
  --warning: #9A6700;
  --danger: #B42318;

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --sidebar-w: 15rem;
  --radius: 0.5rem;
  --gutter: clamp(1rem, 3vw, 2rem);
}

/* Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 0.9375rem/1.55 var(--font-body); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.6em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
p { margin: 0 0 1em; }
a { color: var(--copper); text-underline-offset: 0.18em; }
code { font-family: var(--font-mono); font-size: 0.875em; }
svg { display: block; flex-shrink: 0; width: 1.25rem; height: 1.25rem; }
:focus-visible { outline: 2px solid var(--copper-light); outline-offset: 2px; border-radius: 2px; }
[x-cloak] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }

/* Brand ----------------------------------------------------------------- */
.brand { display: flex; align-items: center; gap: 0.6rem; color: inherit; text-decoration: none; }
.brand svg { width: 2rem; height: 2rem; }
.brand-text { font-family: var(--font-display); font-size: 1.125rem; }
.brand-text span { font-weight: 500; opacity: 0.75; }

/* App layout ------------------------------------------------------------ */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 1.5rem; padding: 1.25rem 1rem; background: var(--navy); color: var(--on-navy); }
.sidebar .brand { padding: 0 0.5rem; }
.nav { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }
.nav-link { display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0.6rem; border-radius: var(--radius); color: var(--on-navy-muted); text-decoration: none; font-weight: 500; }
.nav-link:hover { background: var(--navy-line); color: var(--on-navy); }
.nav-link.is-active { background: var(--navy-line); color: var(--white); box-shadow: inset 3px 0 0 var(--copper-light); }
.sidebar-footer { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.75rem 0.5rem 0; border-top: 1px solid var(--navy-line); font-size: 0.8125rem; }
.sidebar-footer .muted { color: var(--on-navy-muted); }
.sidebar-footer .link-button { color: var(--on-navy); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: 1rem var(--gutter); background: var(--white); border-bottom: 1px solid var(--line); }
.page-title { margin: 0; font-size: 1.375rem; flex: 1; }
.topbar-actions { display: flex; gap: 0.5rem; }
.nav-toggle { display: none; }
.content { padding: var(--gutter); display: grid; gap: var(--gutter); align-content: start; }

@media (max-width: 52rem) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 50; transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(14, 30, 46, 0.4); }
  .nav-toggle { display: inline-flex; }
}

/* Components ------------------------------------------------------------ */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.card > :last-child { margin-bottom: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.65rem 1.1rem; font: 600 0.9375rem/1 var(--font-body); color: var(--white); background: var(--copper); border: 1px solid var(--copper); border-radius: var(--radius); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--copper-dark); border-color: var(--copper-dark); }
.btn-secondary { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--paper); border-color: var(--muted); }
.link-button { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0; background: none; border: 0; color: var(--copper); font: inherit; cursor: pointer; }
.link-button svg { width: 1rem; height: 1rem; }
.icon-button { display: inline-flex; padding: 0.4rem; background: none; border: 1px solid var(--line); border-radius: var(--radius); color: inherit; cursor: pointer; }

.stack { display: grid; gap: 1rem; margin-bottom: 1rem; }
.field { display: grid; gap: 0.35rem; }
.field label { font-weight: 600; font-size: 0.875rem; }
.field input, .field select, .field textarea { width: 100%; padding: 0.6rem 0.75rem; font: inherit; color: inherit; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--copper-light); outline-offset: 0; border-color: var(--copper); }
.field.has-error input { border-color: var(--danger); }
.field-error { margin: 0; color: var(--danger); font-size: 0.875rem; }

.messages { display: grid; gap: 0.5rem; padding: var(--gutter) var(--gutter) 0; }
.page-auth .messages { padding: 0 0 1rem; }
.message { margin: 0; padding: 0.7rem 1rem; border-radius: var(--radius); background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--muted); }
.message-success { border-left-color: var(--success); }
.message-warning { border-left-color: var(--warning); }
.message-error { border-left-color: var(--danger); }

/* Auth pages ------------------------------------------------------------ */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--navy); }
.auth-card { width: 100%; max-width: 25rem; padding: 2rem; background: var(--white); border-radius: calc(var(--radius) * 2); }
.auth-card .brand { margin-bottom: 1.5rem; }
.steps { padding-left: 1.25rem; }
.qr { display: flex; justify-content: center; margin: 1rem 0; }
.qr svg { width: 12rem; height: 12rem; }
.secret { word-spacing: 0.2em; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; padding: 0; margin: 0 0 1.5rem; list-style: none; }
.codes code { display: block; padding: 0.4rem; text-align: center; background: var(--paper); border-radius: var(--radius); }
