/* =====================================================================
   Zürich Versicherung – Geschäftsstelle Beglerovic · Versicherungs-Hub
   Markenfarben: #0060AE (Zürich Endeavour) · #0A8AD2 (Zürich Cerulean)
   ===================================================================== */
:root {
  --ebms:        #0060AE;   /* Zürich Blau (Endeavour) – Primär */
  --ebms-700:    #004e8f;
  --ebms-900:    #003a6b;
  --ebms-300:    #0A8AD2;   /* Zürich Cerulean – heller Akzent */
  --ebms-100:    #d6e6f4;
  --ebms-50:     #eef5fb;
  --accent:      #46a35e;   /* Erfolg / Ersparnis grün */
  --accent-dark: #2f7a43;
  --warn:        #e08a1e;
  --danger:      #d64545;
  --ink:         #1a2230;
  --muted:       #66738a;
  --line:        #e2e8f0;
  --bg:          #f4f7fb;
  --card:        #ffffff;
  --radius:      14px;
  --shadow:      0 1px 3px rgba(20,49,80,.08), 0 6px 24px rgba(20,49,80,.06);
  --shadow-lg:   0 10px 40px rgba(20,49,80,.18);
  --font:        "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: var(--ebms); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

/* ---------------- Logo (Zürich) ---------------- */
.logo { display: inline-flex; align-items: center; gap: 11px; }
.logo .zmark { width: 36px; height: 36px; flex: 0 0 auto; }
.logo .zc { fill: var(--ebms); }
.logo .zt { fill: #fff; font-family: Georgia, "Times New Roman", serif; font-weight: 700; }
.logo .ztext { display: flex; flex-direction: column; line-height: 1.05; }
.logo .zname { font-weight: 800; font-size: 20px; color: var(--ebms); letter-spacing: .3px; }
.logo .zsub { font-size: 10px; color: var(--muted); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin-top: 3px; }

/* ============================================================
   LOGIN
   ============================================================ */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
}
.auth__brand {
  background: linear-gradient(150deg, var(--ebms-900), var(--ebms) 70%, var(--ebms-300));
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth__brand::after {
  content: ""; position: absolute; right: -120px; bottom: -120px;
  width: 420px; height: 420px; border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.auth__brand .logo .zc { fill: #fff; }
.auth__brand .logo .zt { fill: var(--ebms); }
.auth__brand .logo .zname { color: #fff; }
.auth__brand .logo .zsub { color: rgba(255,255,255,.8); }
.auth__hero h1 { font-size: 38px; line-height: 1.15; margin: 24px 0 14px; font-weight: 800; }
.auth__hero p { font-size: 17px; color: rgba(255,255,255,.85); max-width: 460px; }
.auth__points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; }
.auth__points li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: rgba(255,255,255,.92); }
.auth__points .dot { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 13px; }
.auth__partner { font-size: 13px; color: rgba(255,255,255,.75); }
.auth__partner b { color: #fff; }

.auth__form { display: grid; place-items: center; padding: 40px; }
.auth__card { width: 100%; max-width: 380px; }
.auth__card h2 { margin: 0 0 6px; font-size: 26px; }
.auth__card .lead { color: var(--muted); margin: 0 0 26px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 15px; font-family: inherit; background: #fff; transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--ebms); box-shadow: 0 0 0 3px rgba(39,92,140,.14);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ebms); color: #fff; border: none; padding: 12px 20px;
  border-radius: 10px; font-size: 15px; font-weight: 600; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--ebms-700); }
.btn:active { transform: translateY(1px); }
.btn--block { width: 100%; }
.btn--lg { padding: 14px 22px; font-size: 16px; }
.btn--ghost { background: transparent; color: var(--ebms); border: 1.5px solid var(--ebms); }
.btn--ghost:hover { background: var(--ebms-50); }
.btn--accent { background: var(--accent); }
.btn--accent:hover { background: var(--accent-dark); }
.btn--sm { padding: 8px 14px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.auth__demo { margin-top: 22px; padding: 14px; background: var(--ebms-50); border: 1px dashed var(--ebms-300); border-radius: 10px; font-size: 13px; color: var(--muted); }
.auth__demo b { color: var(--ink); }
.auth__demo button { background: none; border: none; color: var(--ebms); font-weight: 600; padding: 0; text-decoration: underline; }
.auth__error { background: #fdecec; color: var(--danger); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }

/* ============================================================
   APP SHELL
   ============================================================ */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: #fff; border-right: 1px solid var(--line); padding: 22px 16px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar__logo { padding: 0 8px 22px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.nav { display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px;
  color: var(--ink); font-weight: 500; font-size: 15px; transition: background .12s;
}
.nav a .ic { width: 20px; text-align: center; opacity: .85; }
.nav a:hover { background: var(--ebms-50); }
.nav a.active { background: var(--ebms); color: #fff; }
.nav a.active .ic { opacity: 1; }
.nav .badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.nav a.active .badge { background: rgba(255,255,255,.25); }
.sidebar__foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.advisor { display: flex; gap: 10px; align-items: center; padding: 10px; background: var(--ebms-50); border-radius: 10px; }
.advisor .av { width: 38px; height: 38px; border-radius: 50%; background: var(--ebms); color: #fff; display: grid; place-items: center; font-weight: 700; }
.advisor .nm { font-size: 13px; font-weight: 700; }
.advisor .rl { font-size: 11px; color: var(--muted); }

.main { padding: 0; overflow: auto; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 16px 32px;
  background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 20px; margin: 0; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.zurich-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); background: var(--ebms-50); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--ebms-100); }
.zurich-badge b { color: var(--ebms); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip .av { width: 36px; height: 36px; border-radius: 50%; background: var(--ebms-100); color: var(--ebms); display: grid; place-items: center; font-weight: 700; }
.user-chip .nm { font-size: 14px; font-weight: 600; }
.icon-btn { background: var(--ebms-50); border: 1px solid var(--ebms-100); width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; }
.icon-btn:hover { background: var(--ebms-100); }

.content { padding: 28px 32px 60px; max-width: 1180px; }

/* ---------------- Stat cards ---------------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.stat .val { font-size: 28px; font-weight: 800; margin-top: 6px; }
.stat .val small { font-size: 14px; font-weight: 600; color: var(--muted); }
.stat.accent { background: linear-gradient(140deg, var(--accent), var(--accent-dark)); color: #fff; border: none; }
.stat.accent .lbl, .stat.accent .val small { color: rgba(255,255,255,.85); }

/* ---------------- Section header ---------------- */
.section-head { display: flex; align-items: center; gap: 12px; margin: 30px 0 14px; }
.section-head h2 { font-size: 18px; margin: 0; }
.section-head .count { color: var(--muted); font-size: 14px; }
.section-head .spacer { flex: 1; }

/* ---------------- Contract cards ---------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.ccard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px;
  transition: transform .12s, box-shadow .12s; cursor: pointer;
}
.ccard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.ccard__top { display: flex; align-items: flex-start; gap: 12px; }
.ccard__icon { width: 46px; height: 46px; border-radius: 12px; background: var(--ebms-50); display: grid; place-items: center; font-size: 22px; flex: 0 0 auto; }
.ccard__title { font-weight: 700; font-size: 16px; line-height: 1.25; }
.ccard__sub { font-size: 13px; color: var(--muted); }
.ccard__tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: .3px; }
.tag--ebms { background: var(--ebms); color: #fff; }
.tag--ext { background: #eef1f6; color: var(--muted); }
.tag--active { background: #e6f4ea; color: var(--accent-dark); }
.tag--save { background: #e6f4ea; color: var(--accent-dark); }
.tag--warn { background: #fdf0dc; color: var(--warn); }
.ccard__meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.ccard__meta .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.ccard__meta .v { font-size: 14px; font-weight: 600; }
.ccard__foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.ccard__price { font-size: 20px; font-weight: 800; }
.ccard__price small { font-size: 12px; font-weight: 600; color: var(--muted); }

/* AI hint strip on external cards */
.ai-strip { display: flex; align-items: center; gap: 10px; background: linear-gradient(100deg, #eaf5ee, #f2faf4); border: 1px solid #cfe9d7; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.ai-strip.neutral { background: var(--ebms-50); border-color: var(--ebms-100); }
.ai-strip .ai-ic { font-size: 16px; }
.ai-strip b { color: var(--accent-dark); }
.ai-strip.neutral b { color: var(--ebms); }

/* ---------------- Empty state ---------------- */
.empty { text-align: center; padding: 50px 20px; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty .em-ic { font-size: 42px; margin-bottom: 10px; }

/* ============================================================
   MODAL
   ============================================================ */
.overlay {
  position: fixed; inset: 0; background: rgba(20,33,48,.5); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 24px; z-index: 50; animation: fade .15s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: 18px; width: 100%; max-width: 640px; max-height: 90vh;
  overflow: auto; box-shadow: var(--shadow-lg); animation: pop .18s;
}
.modal--wide { max-width: 820px; }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.modal__head { display: flex; align-items: flex-start; gap: 14px; padding: 22px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.modal__head .ccard__icon { width: 50px; height: 50px; }
.modal__head h3 { margin: 0; font-size: 19px; }
.modal__head .sub { color: var(--muted); font-size: 13px; }
.modal__close { margin-left: auto; background: var(--bg); border: none; width: 34px; height: 34px; border-radius: 8px; font-size: 18px; color: var(--muted); }
.modal__close:hover { background: var(--ebms-50); }
.modal__body { padding: 22px 24px; }
.modal__foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; position: sticky; bottom: 0; background: #fff; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-grid .di { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.detail-grid .di .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.detail-grid .di .v { font-size: 15px; font-weight: 600; margin-top: 3px; }
.detail-grid .full { grid-column: 1 / -1; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--ebms-50); color: var(--ebms-700); border: 1px solid var(--ebms-100); padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.subhead { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 22px 0 10px; }

/* ---------------- AI comparison block ---------------- */
.ai-compare { border: 1.5px solid #cfe9d7; border-radius: 14px; overflow: hidden; }
.ai-compare__head { background: linear-gradient(100deg, #eaf5ee, #f2faf4); padding: 16px 18px; display: flex; align-items: center; gap: 12px; }
.ai-compare__head.neutral { background: var(--ebms-50); }
.ai-compare__head .robo { width: 40px; height: 40px; border-radius: 10px; background: #fff; display: grid; place-items: center; font-size: 20px; box-shadow: var(--shadow); }
.ai-compare__head h4 { margin: 0; font-size: 16px; }
.ai-compare__head .sub { font-size: 12px; color: var(--muted); }
.ai-compare__body { padding: 18px; }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; }
.vs .col { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.vs .col.win { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(70,163,94,.12); position: relative; }
.vs .col.win::before { content: "✓ Empfehlung"; position: absolute; top: -11px; left: 14px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.vs .col .who { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.vs .col .pname { font-weight: 700; margin: 4px 0 8px; }
.vs .col .price { font-size: 24px; font-weight: 800; }
.vs .col .price small { font-size: 12px; color: var(--muted); font-weight: 600; }
.vs .col ul { margin: 10px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink); }
.vs .col ul li { margin-bottom: 4px; }
.vs .mid { display: grid; place-items: center; color: var(--muted); font-weight: 800; }
.saving-banner { margin-top: 16px; background: var(--accent); color: #fff; border-radius: 12px; padding: 14px 18px; display: flex; align-items: center; gap: 14px; }
.saving-banner.neutral { background: var(--ebms); }
.saving-banner .big { font-size: 26px; font-weight: 800; }
.saving-banner .lbl { font-size: 13px; opacity: .9; }
.ai-text { font-size: 14px; color: var(--ink); margin-top: 14px; background: var(--bg); border-radius: 10px; padding: 14px; border-left: 3px solid var(--ebms); }

/* ---------------- Questions / threads ---------------- */
.thread { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.thread__head { padding: 14px 18px; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.thread__head .ti { font-weight: 700; }
.thread__head .meta { font-size: 12px; color: var(--muted); }
.thread__head .st { margin-left: auto; }
.thread__body { padding: 0 18px 16px; border-top: 1px solid var(--line); }
.msg { display: flex; gap: 10px; margin-top: 14px; }
.msg .av { width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.msg.customer { flex-direction: row-reverse; }
.msg .bubble { padding: 10px 14px; border-radius: 12px; font-size: 14px; max-width: 75%; }
.msg.ebms .av { background: var(--ebms); color: #fff; }
.msg.ebms .bubble { background: var(--ebms-50); }
.msg.customer .av { background: var(--ebms-100); color: var(--ebms); }
.msg.customer .bubble { background: var(--ebms); color: #fff; }
.msg .ts { font-size: 11px; color: var(--muted); margin-top: 4px; }
.msg.customer .ts { text-align: right; }
.reply-row { display: flex; gap: 8px; margin-top: 14px; }
.reply-row input { flex: 1; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; }
.reply-row input:focus { outline: none; border-color: var(--ebms); }

/* ---------------- Toast ---------------- */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; display: grid; gap: 10px; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: 13px 18px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-lg); animation: slidein .2s; display: flex; gap: 10px; align-items: center; }
.toast.ok { background: var(--accent-dark); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }

/* ---------------- Upload / forms ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.dropzone { border: 2px dashed var(--ebms-300); border-radius: 12px; padding: 26px; text-align: center; color: var(--muted); background: var(--ebms-50); cursor: pointer; transition: background .12s; }
.dropzone:hover { background: var(--ebms-100); }
.dropzone .dz-ic { font-size: 34px; margin-bottom: 6px; }
.file-pill { display: inline-flex; gap: 8px; align-items: center; background: var(--ebms-50); border: 1px solid var(--ebms-100); padding: 6px 12px; border-radius: 999px; font-size: 13px; margin-top: 10px; }

/* ---------------- Profile / list rows ---------------- */
.prow { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); }
.prow .k { color: var(--muted); }
.prow .v { font-weight: 600; }

/* ---------------- Responsive ---------------- */
/* Globale Sicherheit gegen horizontales Scrollen */
html, body { max-width: 100%; overflow-x: hidden; }
.main { max-width: 100%; overflow-x: hidden; }
.topbar > * { min-width: 0; }            /* erlaubt dem Titel zu schrumpfen */
.ccard, .stat, .thread, .ai-compare, .modal { max-width: 100%; }

@media (max-width: 920px) {
  .auth { grid-template-columns: 1fr; }
  .auth__brand { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; width: 248px; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .menu-toggle { display: grid !important; }
  .content { padding: 20px 16px 60px; }
  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar__right { gap: 8px; }
  .topbar h1 { font-size: 18px; }
  .topbar .zurich-badge { display: none; }   /* Marke steht schon in der Sidebar */
  .vs { grid-template-columns: 1fr; }
  .vs .mid { display: none; }
  .detail-grid, .form-grid { grid-template-columns: 1fr; }
}

/* Handy (schmal): einspaltige Karten, kompaktere Topbar */
@media (max-width: 600px) {
  .cards { grid-template-columns: 1fr; gap: 12px; }
  .stats { gap: 12px; margin-bottom: 20px; }
  .topbar .sub { display: none; }            /* Untertitel ausblenden, spart Höhe */
  .user-chip .nm { display: none; }          /* nur Avatar zeigen */
  .section-head { flex-wrap: wrap; row-gap: 8px; }
  .section-head .spacer { flex-basis: 100%; height: 0; }
  .ai-strip { flex-wrap: wrap; }
  .ai-strip .btn, .ai-strip a { margin-left: 0 !important; }
  .saving-banner { flex-wrap: wrap; row-gap: 12px; }
  .saving-banner > div[style*="margin-left"] { margin-left: 0 !important; }
  .modal__foot { flex-wrap: wrap; }
  .modal__foot .btn { flex: 1 1 auto; }
  .overlay { padding: 12px; }
  .toast-wrap { left: 16px; right: 16px; }
  .toast { max-width: 100%; }
  .stat .val { font-size: 24px; }
}
.menu-toggle { display: none; }
