/* ============================================================
   transform8 manage — Design System
   1:1 Farb-Tokens vom agent-Projekt uebernommen (Pink-Akzent), Struktur
   (Sidebar-Shell, Karten/Badges/Buttons) ebenfalls von dort — nur Radien/
   Shadows etwas enger/flacher fuer einen ruhigeren, business-tauglichen Look.
   ============================================================ */

:root {
  /* Brand — identisch zu agent/backend/public/css/style.css */
  --brand-50:  oklch(0.97 0.02 350);
  --brand-100: oklch(0.93 0.06 350);
  --brand-200: oklch(0.86 0.12 351);
  --brand-300: oklch(0.76 0.19 352);
  --brand-500: oklch(0.62 0.255 353);   /* primary */
  --brand-600: oklch(0.56 0.255 354);
  --brand-700: oklch(0.49 0.23 355);

  /* Neutrals (cool slate) */
  --bg:        oklch(0.985 0.003 280);
  --bg-soft:   oklch(0.965 0.004 280);
  --surface:   #ffffff;
  --border:    oklch(0.92 0.006 280);
  --border-2:  oklch(0.88 0.008 280);
  --ink:       oklch(0.27 0.02 281);
  --ink-2:     oklch(0.45 0.02 281);
  --ink-3:     oklch(0.60 0.016 281);
  --ink-4:     oklch(0.72 0.012 281);

  /* Semantic */
  --red:      oklch(0.60 0.21 24);
  --red-bg:   oklch(0.95 0.04 24);
  --amber:    oklch(0.72 0.15 70);
  --amber-bg: oklch(0.95 0.05 80);
  --green:    oklch(0.62 0.15 155);
  --green-bg: oklch(0.95 0.04 155);

  /* Radii — etwas enger/geradliniger als agent */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* Shadow */
  --sh-xs: 0 1px 2px oklch(0.3 0.02 281 / 0.05);
  --sh-sm: 0 1px 3px oklch(0.3 0.02 281 / 0.07), 0 1px 2px oklch(0.3 0.02 281 / 0.04);
  --sh-md: 0 4px 14px oklch(0.3 0.02 281 / 0.08), 0 2px 4px oklch(0.3 0.02 281 / 0.04);
  --sh-brand: 0 6px 18px oklch(0.62 0.255 353 / 0.35);
  --grad-brand: linear-gradient(135deg, var(--brand-500), var(--brand-600));

  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-size: 14px; line-height: 1.45;
}
a { color: var(--brand-600); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
::selection { background: var(--brand-200); }
h1, h2, h3 { margin: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: oklch(0.85 0.01 281); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; height: 58px; }
.sb-logo { width: 30px; height: 30px; border-radius: var(--r-md); background: var(--grad-brand); display: grid; place-items: center; color: #fff; flex: none; font-weight: 800; font-size: 13px; box-shadow: var(--sh-brand); }
.sb-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.sb-brand-text b { font-size: 14px; font-weight: 800; letter-spacing: -.01em; }
.sb-brand-text span { font-size: 10.5px; color: var(--ink-4); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

.sb-nav { display: flex; flex-direction: column; gap: 2px; padding: 10px 10px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; border: none; background: none;
  padding: 9px 11px; border-radius: var(--r-md); color: var(--ink-2); font-size: 13.5px; font-weight: 600;
  text-align: left; transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--bg-soft); color: var(--ink); }
.nav-item.active { background: var(--grad-brand); color: #fff; box-shadow: var(--sh-brand); }

.sb-foot { padding: 12px; border-top: 1px solid var(--border); }
.sb-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sb-user span { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-logout { border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); font-size: 11.5px; font-weight: 700; padding: 5px 9px; border-radius: var(--r-sm); flex: none; }
.sb-logout:hover { background: var(--bg-soft); border-color: var(--border-2); color: var(--ink); }

/* ---------- Main ---------- */
.main { min-width: 0; background: var(--bg); }
.page { padding: 28px 32px 48px; max-width: 1200px; margin: 0 auto; width: 100%; }
.page h1 { font-size: 19px; font-weight: 800; letter-spacing: -.015em; margin-bottom: 18px; }

/* ---------- Buttons ---------- */
.btn, button[type="submit"], form button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--r-md); font-weight: 700; font-size: 13px; padding: 8px 14px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2);
  transition: all .13s; white-space: nowrap; font-family: inherit;
}
form button[type="submit"] { background: var(--grad-brand); color: #fff; border-color: transparent; box-shadow: var(--sh-brand); }
form button[type="submit"]:hover { filter: brightness(1.05); }
.btn:hover, button:hover { background: var(--bg-soft); }
#add-row { border-color: var(--border); background: var(--surface); color: var(--ink-2); margin-bottom: 16px; }
.remove-row { background: none; border: none; color: var(--red); font-size: 18px; padding: 0; }

/* ---------- Cards / KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 26px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-sm); padding: 16px; display: flex; flex-direction: column; gap: 3px; }
.kpi-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-4); }
.kpi-value { font-size: 25px; font-weight: 800; letter-spacing: -.01em; }
.kpi-sub { font-size: 12px; color: var(--ink-3); }
.kpi-warn .kpi-value { color: var(--red); }

/* ---------- Tables ---------- */
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-sm); }
.data-table th, .data-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.data-table th { background: var(--bg-soft); font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-4); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-soft); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; line-height: 1.3; background: var(--bg-soft); color: var(--ink-3); }
.badge-paid, .badge-accepted { background: var(--green-bg); color: oklch(0.42 0.12 155); }
.badge-overdue, .badge-rejected, .badge-cancelled { background: var(--red-bg); color: var(--red); }
.badge-draft, .badge-sent { background: var(--bg-soft); color: var(--ink-3); }

/* ---------- Forms ---------- */
form label { display: block; margin-bottom: 14px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
form input, form select, form textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--r-md); font-size: 13.5px;
  font-family: inherit; color: var(--ink); background: var(--surface); transition: border-color .14s, box-shadow .14s;
}
form input:focus, form select:focus, form textarea:focus { outline: none; border-color: var(--brand-300); box-shadow: 0 0 0 3px var(--brand-50); }
form textarea { min-height: 70px; font-weight: 400; }

.error { color: var(--red); font-size: 13px; font-weight: 600; margin-bottom: 12px; }

.auth-box { max-width: 360px; margin: 96px auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--sh-md); padding: 32px; }
.auth-box h1 { text-align: center; font-size: 18px; margin-bottom: 20px; }

/* ---------- Line items ---------- */
.line-items { width: 100%; border-collapse: collapse; margin: 14px 0; }
.line-items th { text-align: left; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-4); padding: 6px 4px; }
.line-items td { padding: 4px; }
.line-items input { margin: 0; }
