/* Political Toolbox design tokens — same visual system as refoffice
   (sibling project) for consistency, tenant-switch UI removed since this
   app is single-politician, not multi-tenant. */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: #eef1f5;
  color: #151a1f;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: #0b57d0; text-decoration: none; }
a:hover { color: #083f96; text-decoration: underline; }
input, select, button, textarea { font-family: inherit; }
table { border-collapse: collapse; width: 100%; }
.mono { font-family: 'IBM Plex Mono', monospace; }

/* ---- layout shell ---- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 238px; flex: none; background: #0e1620; color: #fff;
  padding: 18px 14px; display: flex; flex-direction: column; gap: 18px;
  /* bleibt beim Scrollen stehen; lange Navigation scrollt in sich (.nav) */
  position: sticky; top: 0; height: 100vh; align-self: flex-start;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 10px; color: #fff; }
.sidebar-brand:hover { color: #fff; text-decoration: none; }
/* eigenes Logo (Einstellungen) statt Standard-Schriftzug */
.brand-logo { display: block; max-width: 100%; max-height: 54px; object-fit: contain; object-position: left center; }
.sidebar-brand .logo {
  width: 28px; height: 28px; border-radius: 7px; background: #0b57d0;
  display: flex; align-items: center; justify-content: center;
  font: 700 13px/1 'IBM Plex Mono', monospace;
}
.sidebar-brand .brand-name { font: 600 14px/1 'IBM Plex Sans'; }

.content-col { display: flex; flex-direction: column; flex: 1; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: flex-end; gap: 14px;
  padding: 10px 22px; background: #fff; border-bottom: 1px solid #e2e7ec; flex: none;
  position: sticky; top: 0; z-index: 40;
}
.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* ---- user menu: native <details>/<summary> dropdown, no JS framework needed ---- */
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu-trigger {
  display: flex; align-items: center; gap: 9px; padding: 6px 10px 6px 6px;
  border-radius: 9px; border: 1px solid transparent;
}
.user-menu[open] .user-menu-trigger, .user-menu-trigger:hover { background: #f3f5f8; border-color: #d9dfe6; }
.user-menu-trigger .avatar {
  width: 28px; height: 28px; border-radius: 50%; background: #0b57d0; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font: 600 11px/1 'IBM Plex Mono'; flex: none;
}
.user-menu-trigger .name { display: block; font: 500 12.5px/1.2 'IBM Plex Sans'; color: #151a1f; }
.user-menu-trigger .hint { display: block; font: 400 10.5px/1.3 'IBM Plex Sans'; color: #68727e; }
.user-menu-trigger .chevron { font: 400 11px/1 'IBM Plex Mono'; color: #68727e; }
.user-menu-panel {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 50; min-width: 220px;
  background: #fff; border: 1px solid #e2e7ec; border-radius: 10px;
  box-shadow: 0 10px 26px rgba(15,23,32,.14); padding: 6px; display: flex; flex-direction: column; gap: 1px;
}
.user-menu-label {
  font: 600 9.5px/1 'IBM Plex Sans'; letter-spacing: .1em; text-transform: uppercase;
  color: #68727e; padding: 7px 9px 5px;
}
.user-menu-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer;
  border-radius: 7px; padding: 8px 9px; font: 500 13px/1.2 'IBM Plex Sans'; color: #2b3642;
}
.user-menu-item:hover { background: #f3f5f8; text-decoration: none; }
.user-menu-item.active { background: #eef4ff; color: #0b57d0; }
.user-menu-item-btn { font-family: inherit; }
.user-menu-sep { height: 1px; background: #eef1f4; margin: 5px 2px; }

.nav { display: flex; flex-direction: column; gap: 20px; flex: 1; min-height: 0; overflow-y: auto; }
.nav-group { display: flex; flex-direction: column; gap: 7px; }
/* Bereich als klare Überschrift, die Unterpunkte eingerückt an einer Führungslinie */
.nav-group-label { font: 600 13.5px/1.2 'IBM Plex Sans'; color: #fff; padding: 0 6px; }
.nav-items { display: flex; flex-direction: column; gap: 1px; margin-left: 9px; padding-left: 9px; border-left: 1px solid rgba(255,255,255,.14); }
.nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  border: 0; border-radius: 7px; padding: 6px 9px; cursor: pointer;
  background: transparent; color: rgba(255,255,255,.66); font: 400 14px/1.25 'IBM Plex Sans';
}
.nav-item:hover { background: rgba(255,255,255,.09); text-decoration: none; }
.nav-item:hover { color: #fff; }
.nav-item.active { background: #0b57d0; color: #fff; font-weight: 500; }
.nav-item .label { flex: 1; min-width: 0; }
.nav-item .badge {
  font: 600 10px/1 'IBM Plex Mono'; color: rgba(255,255,255,.6); background: rgba(255,255,255,.09);
  padding: 3px 5px; border-radius: 4px;
}
.nav-item.active .badge { color: #fff; background: rgba(255,255,255,.22); }

.main { flex: 1; min-width: 0; padding: 24px 30px 60px; display: flex; flex-direction: column; gap: 20px; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.page-header .crumb-row { display: flex; align-items: center; gap: 9px; }
.crumb { font: 600 9.5px/1 'IBM Plex Sans'; letter-spacing: .12em; text-transform: uppercase; color: #68727e; }
a.crumb { text-decoration: none; }
a.crumb:hover { color: #0b57d0; }
.page-header h1 { margin: 0; font: 600 25px/1.15 'IBM Plex Sans'; letter-spacing: -0.015em; }
.page-header p { margin: 0; font: 400 13.5px/1.5 'IBM Plex Sans'; color: #636d79; max-width: 70ch; }
.page-actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* ---- buttons / forms ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 8px; padding: 9px 14px; font: 600 13px/1 'IBM Plex Sans'; cursor: pointer;
  border: 0; background: #0b57d0; color: #fff;
}
.btn:hover { background: #0a4bb3; color: #fff; text-decoration: none; }
.btn-secondary { border: 1px solid #d5dbe2; background: #fff; color: #2b3642; font-weight: 500; }
.btn-secondary:hover { border-color: #0b57d0; color: #0b57d0; background: #fff; }
.btn-danger { background: #b3372a; }
.btn-danger:hover { background: #922c21; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 6px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font: 600 10.5px/1 'IBM Plex Sans'; letter-spacing: .09em; text-transform: uppercase; color: #68727e; }
.field input, .field select, .field textarea {
  border: 1px solid #d5dbe2; border-radius: 8px; padding: 10px 12px; font-size: 14px; color: #151a1f; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #0b57d0; outline-offset: 1px; }
.field .error { color: #b3372a; font: 400 12px/1.4 'IBM Plex Sans'; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox-field { display: flex; align-items: center; gap: 8px; }
.checkbox-field label { font: 500 13px/1.2 'IBM Plex Sans'; text-transform: none; letter-spacing: 0; color: #151a1f; }

/* ---- cards / tables ---- */
.card { background: #fff; border: 1px solid #e2e7ec; border-radius: 11px; }
.card-pad { padding: 16px 18px; }
.card-head { padding: 15px 18px; border-bottom: 1px solid #eef1f4; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { font: 600 14.5px/1.2 'IBM Plex Sans'; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi-card { background: #fff; border: 1px solid #e2e7ec; border-radius: 11px; padding: 16px 17px; display: flex; flex-direction: column; gap: 9px; }
.kpi-label { font: 600 10px/1 'IBM Plex Sans'; letter-spacing: .1em; text-transform: uppercase; color: #68727e; }
.kpi-value { font: 600 27px/1 'IBM Plex Mono'; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-hint { font: 400 12px/1.4 'IBM Plex Sans'; }

table th { text-align: left; font: 600 10.5px/1 'IBM Plex Sans'; letter-spacing: .08em; text-transform: uppercase; color: #68727e; padding: 11px 16px; }
table th.num, table td.num { text-align: right; }
table td { padding: 11px 16px; border-top: 1px solid #f1f3f6; font: 400 13px/1.3 'IBM Plex Sans'; vertical-align: top; }
table tbody tr:hover { background: #fafbfd; }
table thead tr { background: #f7f9fb; }
.table-wrap { overflow-x: auto; }

.badge { font: 500 10.5px/1 'IBM Plex Sans'; padding: 4px 8px; border-radius: 5px; white-space: nowrap; display: inline-block; }
.badge-neutral { background: #eef1f5; color: #636d79; }
.badge-info { background: #eef4ff; color: #0b57d0; }
.badge-warn { background: #fdf1e6; color: #a55a10; }
.badge-good { background: #e9f6ef; color: #1a7f5a; }
.badge-bad { background: #fdecea; color: #b3372a; }

.alert { border-radius: 9px; padding: 11px 13px; font: 400 12.5px/1.5 'IBM Plex Sans'; }
.alert-info { background: #f4f8ff; border: 1px solid #d6e4fb; color: #2b3642; }
.alert-warn { background: #fdf8ee; border: 1px solid #f0e0c0; color: #7a5a20; }
.alert-error { background: #fdecea; border: 1px solid #f3c9c3; color: #922c21; }
.alert-success { background: #e9f6ef; border: 1px solid #bfe4d0; color: #1a7f5a; }

/* ---- auth split screen ---- */
.auth-split { min-height: 100vh; display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.auth-hero { background: #0e1620; color: #fff; padding: 56px 48px; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; }
.auth-hero h1 { font: 600 40px/1.1 'IBM Plex Sans'; letter-spacing: -0.02em; margin: 0; }
.auth-hero p { margin: 0; font: 400 15px/1.6 'IBM Plex Sans'; color: rgba(255,255,255,.72); }
.auth-form-col { padding: 56px 48px; display: flex; flex-direction: column; gap: 26px; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 430px; background: #fff; border: 1px solid #e2e7ec; border-radius: 12px; padding: 28px 26px; display: flex; flex-direction: column; gap: 16px; }
.auth-card h2 { font: 600 18px/1.2 'IBM Plex Sans'; margin: 0; }

/* ---- portal (Bürger-Login) top nav — simpler than the staff app-shell ---- */
.portal-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 24px; background: #0e1620; color: #fff;
}
.portal-topbar .brand { display: flex; align-items: center; gap: 10px; font: 600 14px/1 'IBM Plex Sans'; }
.portal-topbar nav { display: flex; align-items: center; gap: 16px; font: 500 13px/1 'IBM Plex Sans'; }
.portal-topbar nav a { color: rgba(255,255,255,.78); }
.portal-topbar nav a:hover { color: #fff; }
.portal-main { max-width: 880px; margin: 0 auto; padding: 30px 20px 60px; display: flex; flex-direction: column; gap: 20px; }

/* ---- Adresssuche (public/js/address-lookup.js) ---- */
.address-lookup { position: relative; }
.address-lookup-list {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 30; margin: 4px 0 0; padding: 4px; list-style: none;
  background: #fff; border: 1px solid #d5dbe2; border-radius: 8px; box-shadow: 0 8px 24px rgba(21, 26, 31, .12);
  max-height: 280px; overflow-y: auto;
}
.address-lookup-list li { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.address-lookup-list li strong { font: 500 13.5px/1.3 'IBM Plex Sans'; color: #151a1f; }
.address-lookup-list li span { font: 400 12px/1.3 'IBM Plex Sans'; color: #68727e; }
.address-lookup-list li:hover, .address-lookup-list li.active { background: #eef3fd; }
.address-lookup-list li.address-lookup-hint { cursor: default; padding: 4px 10px 2px; font: 400 10.5px/1 'IBM Plex Sans'; color: #9aa3ad; text-align: right; }
.address-lookup-list li.address-lookup-hint:hover { background: none; }

/* ---- Kacheln (Stammdaten-Übersicht) ---- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tile {
  background: #fff; border: 1px solid #e2e7ec; border-radius: 11px; padding: 16px 17px;
  display: flex; flex-direction: column; gap: 7px; text-decoration: none; color: inherit;
}
.tile:hover { border-color: #0b57d0; box-shadow: 0 4px 14px rgba(11, 87, 208, .08); }
.tile-title { font: 600 14.5px/1.2 'IBM Plex Sans'; color: #151a1f; }
.tile-hint { font: 400 12px/1.45 'IBM Plex Sans'; color: #68727e; }
.tile-count { font: 500 11px/1 'IBM Plex Mono'; color: #0b57d0; margin-top: auto; padding-top: 6px; }

/* ---- Antragsteller-Auswahl (Anträge) ---- */
.applicant-picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 18px;
  border: 1px solid #d5dbe2; border-radius: 8px; padding: 12px 14px; max-height: 320px; overflow-y: auto;
}
.applicant-group { display: flex; flex-direction: column; gap: 6px; }
.applicant-group-title { font: 600 12px/1.2 'IBM Plex Sans'; color: #151a1f; padding-bottom: 4px; border-bottom: 1px solid #eef1f4; }

/* ---- Dashboard ---- */
.section-label { font: 600 10.5px/1 'IBM Plex Sans'; letter-spacing: .12em; text-transform: uppercase; color: #68727e; margin: 6px 0 -8px; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.action-list { display: flex; flex-direction: column; }
.action-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid #f1f3f6;
  text-decoration: none; color: inherit;
}
.action-row:first-child { border-top: 0; }
a.action-row:hover { background: #fafbfd; text-decoration: none; }
.action-count { font: 600 15px/1 'IBM Plex Mono'; min-width: 34px; text-align: center; padding: 7px 6px; border-radius: 7px; background: #fdf1e6; color: #a55a10; flex: none; }
.action-count.urgent { background: #fdecea; color: #b3372a; }
.action-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.action-text strong { font: 500 13.5px/1.3 'IBM Plex Sans'; color: #151a1f; }
.action-text span { font: 400 12px/1.4 'IBM Plex Sans'; color: #68727e; }
.action-meta { font: 400 12px/1.3 'IBM Plex Mono'; color: #68727e; flex: none; text-align: right; }
.bar-row { margin-bottom: 9px; }
.bar-row-head { display: flex; justify-content: space-between; font: 400 12.5px/1.4 'IBM Plex Sans'; }
.bar-track { background: #eef1f4; border-radius: 4px; height: 6px; margin-top: 3px; }
.bar-fill { background: #0b57d0; border-radius: 4px; height: 6px; }

/* ---- Kalender (Monatsraster, aus vereine-ittling) ---- */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid #eef1f4; }
.cal-toolbar h2 { margin: 0; font: 600 17px/1.2 'IBM Plex Sans'; min-width: 150px; text-align: center; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head { padding: 8px 8px; font: 600 10px/1 'IBM Plex Sans'; letter-spacing: .1em; text-transform: uppercase; color: #68727e; background: #f7f9fb; }
.cal-day { min-height: 104px; border-top: 1px solid #eef1f4; border-left: 1px solid #eef1f4; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:nth-child(7n+1) { border-left: 0; }
.cal-day.out { background: #fafbfc; }
.cal-day.out .cal-num { color: #b0b8c1; }
.cal-num { font: 500 12px/1 'IBM Plex Mono'; color: #41505f; padding: 2px 3px 4px; display: flex; justify-content: space-between; align-items: center; }
.cal-day.today .cal-num span:first-child { background: #0b57d0; color: #fff; border-radius: 5px; padding: 3px 5px; margin: -3px -2px; }
.cal-num a { color: #b0b8c1; font-size: 14px; line-height: 1; visibility: hidden; }
.cal-day:hover .cal-num a { visibility: visible; }
.cal-num a:hover { color: #0b57d0; text-decoration: none; }
.cal-chip {
  display: block; font: 500 11px/1.25 'IBM Plex Sans'; padding: 3px 5px 3px 7px; border-radius: 4px;
  background: #eef4ff; color: #151a1f; border-left: 3px solid #0b57d0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-chip.partei { background: #fdf1e6; border-left-color: #c8741a; }
.cal-chip:hover { filter: brightness(.96); text-decoration: none; color: #151a1f; }
.cal-chip .t { font-family: 'IBM Plex Mono'; color: #636d79; margin-right: 3px; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; font: 400 12px/1 'IBM Plex Sans'; color: #636d79; padding: 12px 18px; border-top: 1px solid #eef1f4; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .swatch { width: 18px; height: 11px; border-radius: 3px; background: #eef4ff; border-left: 3px solid #0b57d0; }
.cal-legend .swatch.partei { background: #fdf1e6; border-left-color: #c8741a; }
.feed-row { display: flex; gap: 8px; align-items: flex-end; }
.feed-row .field { flex: 1; min-width: 0; }
.feed-row input { font: 400 12px/1.2 'IBM Plex Mono'; }

@media (max-width: 720px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; position: static; height: auto; }
  .main { padding: 18px 16px 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { padding: 10px 14px; flex-wrap: wrap; }
  /* Monatsraster am Handy ausblenden, die Listen darunter reichen */
  .cal-grid-wrap { display: none; }
}
