*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #1663d8;
  --teal: #0f766e;
  --cyan: #16a3c7;
  --green: #16a34a;
  --amber: #c47a00;
  --ink: #102033;
  --muted: #627086;
  --line: #dce5ee;
  --panel: rgba(255,255,255,.95);
  --shadow: 0 22px 50px rgba(12,43,58,.11);
  --shadow-soft: 0 12px 28px rgba(12,43,58,.07);
}

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  background:
    radial-gradient(circle at 84% 8%, rgba(15,118,110,.13), transparent 28%),
    linear-gradient(180deg,#f8fbfd 0%,#edf4f8 68%,#e7f0f5 100%);
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 24px;
  border-bottom: 1px solid rgba(220,229,238,.85);
  background: rgba(255,255,255,.9);
  box-shadow: 0 10px 28px rgba(12,43,58,.05);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(145deg,#0f69df,#103da8);
  box-shadow: 0 12px 24px rgba(22,99,216,.24);
  font-size: 12px;
  font-weight: 800;
}

.brand-title { display: grid; line-height: 1.15; min-width: 150px; }
.brand-title strong { font-size: 15px; color: #0f2636; }
.brand-title span { margin-top: 2px; font-size: 11px; font-weight: 600; color: var(--muted); }

.app-menu {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f5f8fb;
}

.app-menu a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 8px;
  color: #526276;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.app-menu a:hover { color: var(--ink); background: #fff; }
.app-menu a.active { color: var(--blue); background: #fff; box-shadow: 0 8px 18px rgba(12,43,58,.08); }
.topbar-spacer { flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #374151; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(145deg,#0f766e,#16a3c7);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(12,43,58,.14);
}

.page-shell { max-width: 1480px; margin: 0 auto; padding: 22px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.page-head h1 {
  color: #0d2b3a;
  font-size: clamp(30px,4vw,46px);
  line-height: 1.05;
  margin-bottom: 8px;
}

.page-head p {
  max-width: 760px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.status-card {
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 7px rgba(196,122,0,.12);
}

.status-card.is-ready .status-dot { background: var(--green); box-shadow: 0 0 0 7px rgba(22,163,74,.13); }
.status-card strong,
.status-card span { display: block; }
.status-card strong { font-size: 14px; color: #0d2b3a; }
.status-card span { margin-top: 2px; font-size: 12px; color: var(--muted); }

.portal-grid {
  display: grid;
  grid-template-columns: minmax(310px, 390px) minmax(430px, 1fr) minmax(320px, 390px);
  gap: 16px;
  align-items: start;
}

.report-panel,
.map-panel,
.status-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head,
.map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2,
.map-head h2 {
  color: #0d2b3a;
  font-size: 18px;
  line-height: 1.2;
}

.case-id,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e8f7f4;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.citizen-card {
  margin: 16px 18px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #c9e7df;
  border-radius: 10px;
  background: #f4fbf8;
}

.citizen-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg,#0f766e,#16a3c7);
  color: #fff;
  font-size: 14px;
  flex: 0 0 auto;
}

.citizen-card strong,
.citizen-card span { display: block; }
.citizen-card strong { font-size: 14px; color: #0d2b3a; }
.citizen-card span { margin-top: 3px; font-size: 12px; color: var(--muted); line-height: 1.35; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 18px 14px;
}

label {
  display: grid;
  gap: 6px;
  color: #415163;
  font-size: 12px;
  font-weight: 800;
}

label.full { grid-column: 1 / -1; }

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d4e1ec;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 9px 10px;
  outline: none;
}

textarea { min-height: 112px; resize: vertical; line-height: 1.45; }
input:focus,
select:focus,
textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }

.upload-zone {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px dashed #9bd2c7;
  border-radius: 8px;
  background: #f4fbf8;
}

.upload-zone input { width: auto; min-height: 0; }
.upload-zone span { display: inline-flex; align-items: center; gap: 7px; color: #315d57; }

.action-row,
.action-stack {
  display: flex;
  gap: 9px;
  padding: 0 18px 18px;
}

.action-row .btn { flex: 1; }
.action-stack { flex-direction: column; padding-top: 14px; }

.btn,
.icon-btn,
.location-chip {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 800;
  transition: transform .15s, box-shadow .15s, background .15s;
}

.btn:hover { transform: translateY(-1px); }
.btn.primary { color: #fff; background: linear-gradient(145deg,#0f8a80,#0e665f); box-shadow: 0 10px 20px rgba(15,118,110,.2); }
.btn.secondary { color: #0d4c7c; background: #e7f6ff; }
.btn.success { color: #fff; background: linear-gradient(145deg,#19a65a,#0b7c42); box-shadow: 0 10px 20px rgba(22,163,74,.18); }
.btn.ghost { color: #4f6175; background: #f0f4f8; }

.map-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--teal);
  background: #e8f7f4;
}

#portalMap {
  width: 100%;
  height: 430px;
  background: #dbe7ef;
}

.location-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #f7fafc;
}

.location-chip {
  min-height: 32px;
  border: 1px solid #d4e1ec;
  border-radius: 999px;
  background: #fff;
  color: #496277;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
}

.location-chip.active {
  border-color: var(--teal);
  color: var(--teal);
  background: #e8f7f4;
}

.geo-card {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 14px 14px;
  padding: 12px;
  border: 1px solid #a8d7cf;
  border-radius: 10px;
  background: #fff;
}

.geo-card i { color: var(--teal); font-size: 18px; }
.geo-card strong,
.geo-card span { display: block; }
.geo-card strong { font-size: 13px; color: #0d2b3a; }
.geo-card span { margin-top: 2px; color: var(--muted); font-size: 12px; }

.steps {
  display: grid;
  gap: 8px;
  padding: 14px 18px 0;
}

.step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid #dce5ee;
  border-radius: 10px;
  background: #fff;
}

.step span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8f7f4;
  color: var(--teal);
  font-weight: 900;
  font-size: 13px;
}

.step strong,
.step small { display: block; }
.step strong { color: #0d2b3a; font-size: 13px; }
.step small { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.step.done { border-color: #bbf7d0; background: #f4fdf7; }
.step.done span { color: #fff; background: var(--green); }
.step.active { border-color: #8bd3c7; background: #effaf7; box-shadow: 0 8px 18px rgba(15,118,110,.08); }
.step.active span { color: #fff; background: var(--teal); }

.mail-card {
  margin: 14px 18px 0;
  padding: 13px;
  border: 1px solid #dce5ee;
  border-radius: 10px;
  background: #f8fbfd;
}

.mail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.mail-head i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--blue);
  background: #eaf2ff;
}

.mail-head strong,
.mail-head span { display: block; }
.mail-head strong { font-size: 13px; color: #0d2b3a; }
.mail-head span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.mail-card p { color: #415163; font-size: 13px; line-height: 1.45; }

.result-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 18px 18px;
  padding: 13px;
  border: 1px solid #f1d7aa;
  border-radius: 10px;
  background: #fff8ec;
}

.result-card.is-ready {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.result-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #9a5b05;
  background: #fff1d5;
  flex: 0 0 auto;
}

.result-card.is-ready .result-icon { color: var(--green); background: #dcfce7; }
.result-card strong,
.result-card span { display: block; }
.result-card strong { font-size: 13px; color: #0d2b3a; }
.result-card span { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.35; }

@media (max-width: 1180px) {
  .portal-grid { grid-template-columns: 1fr 1fr; }
  .status-panel { grid-column: 1 / -1; }
  .steps { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 840px) {
  .topbar { flex-wrap: wrap; padding: 12px; }
  .brand-title { min-width: 0; }
  .app-menu { order: 3; width: 100%; overflow-x: auto; }
  .page-shell { padding: 16px; }
  .page-head { display: grid; align-items: start; }
  .status-card { min-width: 0; width: 100%; }
  .portal-grid { grid-template-columns: 1fr; }
  #portalMap { height: 360px; }
  .steps { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar-user span { display: none; }
  .page-head h1 { font-size: 31px; }
  .page-head p { font-size: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .action-row { flex-direction: column; }
  .panel-head { align-items: flex-start; flex-direction: column; }
}

/* Kommunalportal: Map First, Status links, Meldung daneben */
body{
  height:100vh;
  min-height:100vh;
  overflow:hidden;
  background:#eaf1f6;
}
.topbar{
  position:relative;
  z-index:700;
}
.page-shell{
  position:relative;
  max-width:none;
  height:calc(100vh - 64px);
  margin:0;
  padding:0;
  overflow:hidden;
}
.page-head{
  position:absolute;
  right:22px;
  top:18px;
  z-index:520;
  width:360px;
  display:block;
  margin:0;
  padding:14px 16px;
  border:1px solid rgba(220,229,238,.78);
  border-radius:10px;
  background:rgba(255,255,255,.88);
  box-shadow:0 22px 50px rgba(12,43,58,.16);
  backdrop-filter:blur(9px);
}
.page-head .head-copy{display:none}
.status-card{
  min-width:0;
  width:100%;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
}
.portal-grid{
  position:relative;
  display:block;
  height:100%;
  min-height:0;
  overflow:hidden;
}
.status-panel[hidden]{
  display:none !important;
}
.map-panel{
  position:absolute;
  inset:0;
  z-index:1;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
}
.map-head{
  position:absolute;
  left:742px;
  top:18px;
  z-index:510;
  width:min(360px, calc(100vw - 1128px));
  min-width:280px;
  border:1px solid rgba(220,229,238,.78);
  border-radius:10px;
  background:rgba(255,255,255,.88);
  box-shadow:0 18px 42px rgba(12,43,58,.14);
  backdrop-filter:blur(9px);
}
#portalMap{
  height:100%;
  min-height:0;
}
.location-strip{
  position:absolute;
  left:742px;
  bottom:18px;
  z-index:510;
  width:min(560px, calc(100vw - 784px));
  border:1px solid rgba(220,229,238,.78);
  border-radius:10px;
  background:rgba(255,255,255,.88);
  box-shadow:0 18px 42px rgba(12,43,58,.14);
  backdrop-filter:blur(9px);
}
.geo-card{
  position:absolute;
  left:742px;
  top:112px;
  z-index:510;
  width:min(360px, calc(100vw - 1128px));
  min-width:280px;
  margin:0;
  background:rgba(255,255,255,.9);
  box-shadow:0 18px 42px rgba(12,43,58,.14);
  backdrop-filter:blur(9px);
}
.portal-grid:not(.status-open) .map-head,
.portal-grid:not(.status-open) .geo-card{
  left:386px;
  width:min(360px, calc(100vw - 772px));
}
.portal-grid:not(.status-open) .location-strip{
  left:386px;
  width:min(560px, calc(100vw - 428px));
}
.status-panel,
.report-panel{
  position:absolute;
  top:18px;
  bottom:18px;
  z-index:500;
  border:1px solid rgba(220,229,238,.78);
  border-radius:10px;
  background:rgba(255,255,255,.86);
  box-shadow:0 22px 50px rgba(12,43,58,.18);
  backdrop-filter:blur(9px);
}
.status-panel{
  left:370px;
  width:330px;
  overflow-y:auto;
}
.report-panel{
  left:18px;
  width:350px;
  overflow-y:auto;
}
.report-panel .panel-head{
  position:sticky;
  top:0;
  z-index:2;
  background:rgba(255,255,255,.94);
  backdrop-filter:blur(9px);
}
.report-panel .panel-head::before{
  content:'Arbeitsmenue';
  display:block;
  position:absolute;
  left:18px;
  top:8px;
  color:#94a3b8;
  font-size:10px;
  font-weight:900;
  letter-spacing:.06em;
  text-transform:uppercase;
}
.report-panel .panel-head h2{
  margin-top:14px;
}
.form-grid{
  grid-template-columns:1fr;
}
.action-row{
  flex-direction:column;
}
.steps{
  padding-top:12px;
}
.step{
  grid-template-columns:30px 1fr;
  padding:9px;
}
.mail-card{
  margin-top:12px;
}
.action-stack{
  padding-bottom:14px;
}

@media (max-width: 1180px) {
  body{
    height:auto;
    min-height:100vh;
    overflow:auto;
  }
  .page-shell{
    height:auto;
    min-height:calc(100vh - 64px);
    padding:14px;
    overflow:visible;
  }
  .page-head,
  .portal-grid,
  .status-panel,
  .report-panel,
  .map-panel,
  .map-head,
  .location-strip,
  .geo-card{
    position:relative;
    inset:auto;
    left:auto;
    top:auto;
    bottom:auto;
    right:auto;
    width:auto;
    min-width:0;
  }
  .portal-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:14px;
    height:auto;
  }
  .page-head{
    margin-bottom:14px;
  }
  .map-panel{
    grid-column:1 / -1;
    min-height:520px;
    height:520px;
    overflow:hidden;
    border:1px solid rgba(220,229,238,.78);
    border-radius:10px;
    background:rgba(255,255,255,.86);
    box-shadow:0 22px 50px rgba(12,43,58,.18);
  }
  .map-head,
  .location-strip,
  .geo-card{
    margin:12px;
  }
  #portalMap{
    height:100%;
  }
}

@media (max-width: 840px) {
  .portal-grid{grid-template-columns:1fr}
  .status-panel,
  .report-panel,
  .map-panel{overflow:visible}
  .map-panel{min-height:460px;height:460px}
}
