:root {
  --bg: #f2f5fb;
  --surface: #fff;
  --ink: #0c1530;
  --muted: #4b5772;
  --border: #d7dfed;
  --accent: #0737ee;
  --accent-soft: #dfe6fe;
  --grid: #edf1f8;
  --radius: 13px;
  --rail: 244px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 290px; }
a { color: #173ab5; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, select, summary { cursor: pointer; }
button { color: inherit; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: default; opacity: .63; }
:focus-visible { outline: 2px solid #315af0; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(29px, 3.25vw, 42px); line-height: 1.1; letter-spacing: -.032em; }
h2 { font-size: 23px; line-height: 1.2; letter-spacing: -.018em; }
h3 { font-size: 16px; }
small { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--rail); z-index: 1; background: var(--surface);
  display: flex; flex-direction: column; border-right: 1px solid var(--border); padding: 20px 14px 14px;
}
.brand {
  display: flex; align-items: center; gap: 18px; width: fit-content; color: var(--ink);
  margin: 0 15px 34px; font-size: 25px; line-height: 1.1; font-weight: 760; letter-spacing: -.04em;
}
.brand:hover { text-decoration: none; }
.brand-icon {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 40px; height: 40px; gap: 3px; background: #0a1740; border-radius: 6px;
}
.brand-icon i { width: 20px; height: 4px; background: #fff; transform: translateX(1px); }
.brand-icon i:nth-child(1) { width: 14px; transform: translateX(4px); }
.brand-icon i:nth-child(3) { width: 13px; transform: translateX(-3px); }
.nav-title { color: var(--muted); margin: 4px 15px 14px; text-transform: uppercase; font-size: 13px; letter-spacing: .04em; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 15px; padding: 9px 16px; min-height: 45px;
  color: var(--ink); font-weight: 540; border-radius: 8px; white-space: nowrap;
}
.sidebar nav a:hover { background: var(--grid); text-decoration: none; }
.sidebar nav a.selected { background: var(--accent-soft); font-weight: 680; }
.sidebar nav a span { width: 26px; font-size: 24px; text-align: center; line-height: 1; }
.account { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 17px 3px 4px; border-top: 1px solid var(--border); }
.account strong, .account small { display: block; font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; }
.account .quiet { margin-left: auto; }
.avatar { display: grid; place-items: center; border-radius: 50%; width: 36px; height: 36px; flex: none; background: var(--grid); font-size: 12px; font-weight: 700; }
.main { margin-left: var(--rail); }
.topbar {
  position: sticky; top: 0; z-index: 1; min-height: 57px; display: flex; justify-content: space-between;
  align-items: center; gap: 16px; color: var(--muted); padding: 0 30px;
  background: var(--surface); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.topbar b { color: var(--ink); }
.topbar span:not(.top-date, .status-dot) { margin: 0 8px; }
.top-status { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.status-dot { width: 9px; height: 9px; background: #23bb56; border-radius: 50%; }
.top-date { margin-left: 9px; padding-left: 20px; border-left: 1px solid var(--border); color: var(--ink); }
#content { padding: 34px 26px 26px 28px; max-width: 1870px; margin: auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.page-head p { margin-top: 6px; font-size: 18px; color: var(--muted); }
.page-head button { margin-top: 9px; flex: none; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.content-panel { padding: 17px 20px 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head a { white-space: nowrap; font-size: 14px; }
.primary, .button, .quiet { border: 1px solid transparent; border-radius: 8px; padding: 10px 15px; font-weight: 630; line-height: 1.25; }
.primary { display: inline-flex; gap: 9px; align-items: center; justify-content: center; min-height: 44px; color: #fff; background: var(--accent); }
.primary:hover { background: #0029cf; }
.primary span { font-size: 20px; line-height: .8; }
.button { background: #fff; border-color: var(--border); color: var(--ink); }
.button:hover, .quiet:hover { background: var(--grid); }
.quiet { background: transparent; padding: 5px 8px; font-size: 19px; line-height: 1; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.metric { min-height: 129px; padding: 17px 18px; display: flex; align-items: flex-start; gap: 16px; }
.metric h2 { font-size: 15px; font-weight: 680; margin-top: 5px; }
.metric strong { font-size: clamp(19px, 2vw, 34px); line-height: 1.15; display: block; margin: 9px 0 2px; letter-spacing: -.035em; }
.metric p { color: var(--muted); font-size: 14px; }
.metric-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: none; background: #e7eaff; border-radius: 8px; color: #1338ed; font-size: 23px; }
.overview-grid { display: grid; grid-template-columns: 1.32fr 1fr; gap: 18px; margin-bottom: 22px; }
.priorities { margin: 13px 0 0; padding: 0; list-style: none; }
.priorities li { display: flex; align-items: center; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.priorities li:last-child { border-bottom: 0; }
.priorities a { color: var(--ink); font-weight: 680; }
.priorities p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.priority-icon { background: var(--accent-soft); color: #2042c7; border-radius: 7px; padding: 6px 11px; }
.chart-caption { color: var(--muted); font-size: 13px; margin: 10px 0; }
.chart { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 9px; padding: 0 10px; }
.chart-col { text-align: center; min-width: 0; }
.chart-slot {
  height: 156px; display: flex; align-items: flex-end; justify-content: center;
  background: repeating-linear-gradient(to top, var(--border) 0, var(--border) 1px, transparent 1px, transparent 31px);
}
.chart-bar { width: 80%; height: max(var(--bar), 2px); background: #516dec; border-radius: 4px 4px 0 0; position: relative; }
.chart-bar span { font-size: 11px; font-weight: 650; color: #12285f; position: absolute; top: -19px; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.chart-missing { color: #697899; margin-bottom: 5px; }
.chart-date { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.chart-note, .footnote { color: var(--muted); font-size: 13px; margin-top: 12px; }
.footnote { text-align: right; }

.tabs { display: flex; flex-wrap: wrap; gap: 3px 16px; padding: 0 17px; margin-bottom: 13px; }
.tabs a { color: var(--muted); font-weight: 650; font-size: 14px; white-space: nowrap; padding: 12px 3px 9px; border-bottom: 3px solid transparent; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--accent); }
.toolbar { display: flex; align-items: flex-end; gap: 11px; flex-wrap: wrap; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.toolbar > input[type="search"] { width: min(320px, 100%); }
.toolbar label { display: grid; gap: 5px; }
.table-wrap { overflow: auto; }
table { width: 100%; text-align: left; border-collapse: separate; border-spacing: 0; font-size: 14px; }
th, td { padding: 10px 12px; vertical-align: middle; border-bottom: 1px solid var(--border); }
th { background: var(--grid); color: #3b4865; font-weight: 700; white-space: nowrap; }
.content-panel th:first-child { border-top-left-radius: 8px; }
.content-panel th:last-child { border-top-right-radius: 8px; }
.register td:first-child { min-width: 228px; }
td:last-child { overflow-wrap: anywhere; }
tbody tr:hover { background: #f7f9ff; }
.row-title { text-align: left; padding: 0; background: transparent; border: 0; font-weight: 620; line-height: 1.4; }
.row-title:hover { color: var(--accent); text-decoration: underline; }
.badge { display: inline-flex; border-radius: 7px; background: #edf0f5; color: #39435c; padding: 3px 8px; font-size: 12px; font-weight: 630; white-space: nowrap; }
.badge.blue { background: #e3eaff; color: #2137ad; }
.badge.purple { background: #eee8ff; color: #482b98; }
.badge.yellow { background: #fff0cb; color: #783b0a; }
.badge.green { background: #dcf5e6; color: #126341; }
.badge.red { background: #ffe8ec; color: #96243d; }
.table-foot { padding: 11px 18px; font-size: 13px; color: var(--muted); }
.empty { padding: 23px 15px; color: var(--muted); text-align: center; }
.weekly { margin-bottom: 15px; }
.weekly h2 { margin-bottom: 13px; }
.weekly h3 { margin: 16px 0 8px; }
.weekly .footnote { text-align: left; margin: 0 0 9px; }
.kunden-totals { display: flex; flex-wrap: wrap; gap: 12px 30px; margin-bottom: 16px; }
.kunden-totals span, .cell-note { display: block; color: var(--muted); font-size: 13px; }
.kunden-totals strong { font-size: 19px; }
.kundenstatus td:first-child { min-width: 220px; overflow-wrap: anywhere; }
.kundenstatus td:nth-child(4) { min-width: 136px; }
.kunden-detail { margin-bottom: 16px; background: var(--grid); border-radius: 9px; padding: 10px 12px; }
.kunden-detail summary { font-weight: 650; }
.kunden-detail dl { margin: 10px 0 0; }
.kunden-detail dl div { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); }
.kunden-detail dt { font-weight: 610; font-size: 13px; }
.kunden-detail dd { margin: 0; overflow-wrap: anywhere; font-size: 14px; }
.segmented { display: flex; width: fit-content; background: var(--grid); border-radius: 9px; padding: 3px; margin: 14px 17px; gap: 3px; flex-wrap: wrap; }
.segmented button { border: 1px solid transparent; border-radius: 6px; background: transparent; padding: 6px 12px; color: var(--muted); }
.segmented button.active { background: #fff; border-color: var(--border); color: var(--ink); font-weight: 650; }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { max-width: 440px; width: 100%; padding: 28px; }
.auth-card .brand { margin: 0 0 28px; }
.auth-card h1 { font-size: 29px; }
.auth-card p, .settings-grid p { color: var(--muted); margin: 10px 0; }
.auth-form { display: grid; gap: 11px; margin-top: 17px; }
.auth-form label { display: grid; gap: 5px; }
.loading { padding: 36px; }
input, select, textarea, .readonly {
  border-radius: 8px; border: 1px solid #cbd4e4; background: #fff; color: var(--ink);
  padding: 8px 11px; min-height: 39px; min-width: 0;
}
textarea { min-height: 85px; resize: vertical; }
.readonly { background: var(--grid); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.settings-grid .table-wrap { margin-top: 20px; }

dialog { border: 0; border-left: 1px solid var(--border); background: #fff; color: var(--ink); margin: 0 0 0 auto;
  inset: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(570px, 100vw); max-width: 100vw; padding: 0; }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #11254b31; }
.drawer-header { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 22px 24px 17px; border-bottom: 1px solid var(--border); background: #fff; }
.drawer-header h2 { font-size: 27px; }
.drawer-header p { color: var(--muted); margin-top: 5px; }
.drawer-body { padding: 19px 24px 24px; min-height: 0; overflow: auto; }
.linked { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.linked button { font-size: 12px; padding: 6px 8px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 14px; }
.field-grid label { display: block; font-size: 13px; font-weight: 650; min-width: 0; }
.field-grid label > :is(input, select, textarea, .readonly) { display: block; width: 100%; margin-top: 5px; font-size: 14px; font-weight: 400; }
.field-grid .wide { grid-column: 1 / -1; }
.field-grid small { display: block; font-weight: 400; margin-top: 3px; }
.required { color: #3c57c7; }
.save { width: 100%; margin-top: 14px; }
.form-error { color: #9c2437; font-weight: 600; font-size: 13px; white-space: pre-wrap; }
.form-error:not(:empty) { margin-top: 9px; }
.drawer-history { margin-top: 23px; border: 1px solid var(--border); border-radius: 9px; }
.drawer-history h3 { background: var(--grid); padding: 9px 11px; border-radius: 9px 9px 0 0; }
.drawer-history .history { margin: 0; }
.history { list-style: none; margin: 8px 0 0; padding: 0; }
.history li { border-bottom: 1px solid var(--border); }
.history li:last-child { border-bottom: 0; }
.history summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 11px; }
.history details[open] { background: #f8faff; }
.history summary small { margin-left: 10px; }
.history time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.history details p { padding: 4px 11px; }
.changes { font-size: 13px; }
.changes > div { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 6px 11px; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.changes > div span:nth-child(2) { color: var(--muted); }
.more { margin: 14px 0 0; }
#toast { position: fixed; bottom: 20px; right: 20px; z-index: 4; max-width: min(420px, 90vw); background: #101f46;
  color: #fff; border-radius: 9px; padding: 10px 16px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
#toast.visible { opacity: 1; transform: translateY(0); }
@media (max-width: 1150px) {
  :root { --rail: 188px; }
  .metric { padding: 13px; gap: 9px; }
  .metric-icon { width: 32px; height: 32px; font-size: 18px; }
}
@media (max-width: 900px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .account strong { max-width: 95px; }
}
@media (max-width: 660px) {
  .sidebar { position: static; width: auto; padding: 11px 14px 5px; display: grid; grid-template-columns: 1fr auto; }
  .sidebar .brand { margin: 0 0 7px; font-size: 20px; }
  .brand-icon { width: 34px; height: 34px; }
  .nav-title { display: none; }
  .sidebar nav { grid-row: 2; grid-column: 1 / -1; display: flex; overflow: auto; gap: 4px; }
  .sidebar nav a { min-height: 39px; padding: 7px 9px; font-size: 13px; gap: 4px; }
  .sidebar nav a span { width: 15px; font-size: 16px; }
  .account { grid-column: 2; grid-row: 1; margin: 0 0 5px; border: 0; padding: 0; }
  .account .avatar { display: none; }
  .main { margin-left: 0; }
  .topbar { position: static; min-height: 41px; padding: 0 14px; font-size: 12px; }
  .top-status { font-size: 0; gap: 5px; }
  .top-date { font-size: 11px; margin-left: 2px; padding-left: 6px; }
  #content { padding: 20px 13px 20px; }
  .page-head { flex-wrap: wrap; gap: 9px; margin-bottom: 18px; }
  .page-head p { font-size: 14px; }
  .page-head button { margin-top: 0; }
  .metric { min-height: 105px; padding: 10px; gap: 7px; }
  .metric h2, .metric p { font-size: 12px; }
  .metric-icon { width: 25px; height: 25px; font-size: 15px; }
  .content-panel { padding: 13px; }
  .section-head h2, h2 { font-size: 19px; }
  .tabs { gap: 0 11px; }
  .tabs a { font-size: 13px; }
  .field-grid { gap: 10px; }
  .drawer-header, .drawer-body { padding-left: 14px; padding-right: 14px; }
}
@media print {
  .sidebar, .topbar, .page-head button, .tabs, .toolbar, .segmented, #toast, dialog, .chart-note, .section-head a { display: none !important; }
  .main { margin: 0; }
  #content { padding: 0; }
  body { background: #fff; font-size: 11px; }
  th, td { padding: 4px; font-size: 9px; white-space: normal; }
  .table-wrap { overflow: visible; }
  .panel { break-inside: avoid; }
  .weekly { break-inside: auto; }
  tr { break-inside: avoid; }
}
