/* A-Team OS design, rebuilt from Matthias' Base44 app (ateam-core-os): dark navy sidebar with the active app in blue,
   light canvas, bold Inter headings, white rounded cards with a soft shadow, KPI cards with tinted icons, filter chips
   with counts, soft status badges. Portals (advisor, planner, customer) use a dark top bar instead of the sidebar. */
@font-face { font-family: "Inter"; src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --navy: #0F172A; --navy-2: #1E293B; --navy-text: #CBD5E1; --navy-muted: #64748B;
  --bg: #F8FAFC; --surface: #FFFFFF; --card: var(--surface); --text: #0F172A; --muted: #64748B; --line: #E2E8F0; --soft: #F1F5F9;
  --blue: #2563EB; --blue-soft: #EFF6FF; --red: #DC2626; --red-soft: #FEF2F2; --accent: var(--red);
  --ok: #16A34A; --ok-soft: #F0FDF4; --warn: #D97706; --warn-soft: #FFFBEB; --violet: #7C3AED; --violet-soft: #F5F3FF;
  --ink: #111111; --primary: var(--blue); --on-primary: #fff;
  --radius: 16px; --sidebar: 288px; --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: 32px; font-weight: 800; margin: 0 0 6px; }
h2 { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
h3 { font-size: 16px; font-weight: 700; margin: 0 0 8px; }
a { color: inherit; text-underline-offset: 3px; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
svg.i { width: 20px; height: 20px; flex: none; vertical-align: -4px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Admin shell: dark sidebar */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; background: linear-gradient(to right, var(--navy) var(--sidebar), var(--bg) var(--sidebar)); }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--navy); color: var(--navy-text); display: flex; flex-direction: column; }
.sidebar .top { display: flex; align-items: center; gap: 12px; padding: 22px 20px; border-bottom: 1px solid var(--navy-2); }
.sidebar .top img { width: 40px; height: 40px; }
.sidebar .top b { display: block; color: #fff; font-size: 17px; font-weight: 700; }
.sidebar .top small { display: block; color: var(--navy-muted); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; }
.sidebar .bell { margin-left: auto; position: relative; color: var(--navy-text); text-decoration: none; }
.sidebar .bell .badge { position: absolute; top: -6px; right: -8px; }
.nav { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.nav .group { color: var(--navy-muted); font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; padding: 18px 12px 8px; }
.nav .group:first-child { padding-top: 8px; }
.nav a { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 12px; color: var(--navy-text); text-decoration: none; font-weight: 500; font-size: 15.5px; }
.nav a svg { width: 22px; height: 22px; }
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a.on { background: var(--blue); color: #fff; }
.nav .count { margin-left: auto; }
.sidebar .me { border-top: 1px solid var(--navy-2); padding: 16px 20px 18px; }
.me-row { display: flex; align-items: center; gap: 12px; }
.avatar-letter { width: 40px; height: 40px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.me b { display: block; color: #fff; font-weight: 600; font-size: 14.5px; } .me small { color: var(--navy-muted); font-size: 12.5px; }
.me form button { margin-top: 12px; background: none; border: 0; box-shadow: none; color: var(--navy-muted); padding: 0; font-size: 14px; }
.me form button:hover { color: #fff; background: none; }
.topbar { display: none; }
.content { min-width: 0; }
.banner { padding: 6px 32px; font-size: 13px; line-height: 20px; background: var(--warn-soft); color: #92400E; border-bottom: 1px solid #FDE68A; }
.banner.alert { background: var(--red); color: #fff; border-color: transparent; } .banner.alert a { color: #fff; }
main { max-width: 1240px; margin: 0 auto; padding: 40px 40px 72px; }

.bottombar { display: none; }
.plus { margin: 0 14px 14px; position: relative; } .plus summary { list-style: none; width: 100%; justify-content: center; } .plus summary::-webkit-details-marker { display: none; }
.plus[open] a { display: block; padding: 10px 14px; color: var(--navy-text); text-decoration: none; border-radius: 10px; } .plus[open] a:hover { background: var(--navy-2); color: #fff; }
@media (max-width: 960px) {
  .bottombar { display: block; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottombar .nav { flex-direction: row; justify-content: space-around; padding: 6px 4px; gap: 0; }
  .bottombar .nav a { flex-direction: column; gap: 2px; padding: 6px 8px; font-size: 11.5px; color: var(--muted); border-radius: 10px; position: relative; }
  .bottombar .nav a.on { background: none; color: var(--blue); }
  .bottombar .nav a .count { position: absolute; top: 0; right: 4px; }
  .bottombar .fab { position: absolute; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); width: 54px; height: 54px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 20px rgba(37, 99, 235, .35); }
  .bottombar .fab svg { width: 26px; height: 26px; }
  body:has(.bottombar) main { padding-bottom: 96px; }
  .shell { display: block; background: var(--bg); }
  .sidebar { display: none; }
  .topbar { display: block; position: sticky; top: 0; z-index: 10; background: var(--navy); color: var(--navy-text); }
  .topbar .head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
  .topbar .head b { color: #fff; } .topbar .head img { width: 30px; height: 30px; vertical-align: middle; margin-right: 8px; }
  .topbar button { background: var(--navy-2); color: #fff; border-color: var(--navy-2); box-shadow: none; padding: 7px 12px; font-size: 13px; }
  .banner { padding: 6px 16px; }
  main { padding: 22px 16px 56px; }
  h1 { font-size: 26px; } .hero h1 { font-size: 32px; }
}

/* Portal shell (advisor, planner, customer): dark top bar */
.portal-bar { background: var(--ink); color: #fff; }
.portal-bar .inner { max-width: 1240px; margin: 0 auto; padding: 14px 40px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.portal-bar .back { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; background: #1F1F1F; color: #fff; text-decoration: none; font-size: 14px; font-weight: 600; }
.portal-bar .logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; } .portal-bar .logo img { width: 34px; height: 34px; }
.portal-bar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.portal-bar .where { color: #9CA3AF; font-size: 14px; }
.portal-bar nav { display: flex; gap: 22px; margin-left: auto; flex-wrap: wrap; }
.portal-bar nav a { color: #E5E7EB; text-decoration: none; font-size: 15.5px; font-weight: 500; padding: 4px 0; }
.portal-bar nav a.on, .portal-bar nav a:hover { color: #fff; box-shadow: inset 0 -2px 0 var(--red); }
.portal-bar .who { text-align: right; font-size: 14px; font-weight: 600; line-height: 1.25; } .portal-bar .who small { display: block; color: var(--red); font-weight: 500; }
@media (max-width: 960px) { .portal-bar .inner { padding: 12px 16px; } .portal-bar nav { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; } }

/* Page heads */
.eyebrow { color: var(--red); font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 30px; }
.page-head p, .sub { color: var(--muted); font-size: 16px; margin: 4px 0 0; }
.hero h1 { font-size: 46px; font-weight: 800; letter-spacing: -0.03em; }
.section { margin: 36px 0 16px; } .section p { color: var(--muted); margin: 2px 0 0; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
a.card, a.item { display: block; text-decoration: none; color: inherit; transition: box-shadow .15s; }
a.card:hover, a.item:hover { box-shadow: 0 8px 24px rgba(15, 23, 42, .08); }
.row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 140px; }
form.row > input, form.row > select { flex: 1; width: auto; min-width: 140px; } form.row > button { flex: none; }
.muted { color: var(--muted); font-size: 14px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* KPI cards: uppercase label with a tinted icon (kpi) or a tinted dot above the value (stat) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 18px; margin-bottom: 28px; }
.tiles .card { margin: 0; }
.tiles:has(.kpi) { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.kpi { position: relative; padding: 24px 26px; min-height: 130px; }
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding-right: 60px; }
.kpi .value, .stat .value { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 2px; line-height: 1.1; }
.kpi .ic { position: absolute; top: 22px; right: 22px; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; }
.kpi .ic svg { width: 24px; height: 24px; }
.stat .dot { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 20px; }
.stat .dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.stat .label { font-weight: 500; color: var(--muted); }
.t-blue { background: var(--blue-soft); color: var(--blue); } .t-red { background: var(--red-soft); color: var(--red); }
.t-green { background: var(--ok-soft); color: var(--ok); } .t-orange { background: var(--warn-soft); color: var(--warn); }
.t-violet { background: var(--violet-soft); color: var(--violet); } .t-grey { background: var(--soft); color: var(--muted); }
.v-blue { color: var(--blue); } .v-orange { color: var(--warn); } .v-red { color: var(--red); } .v-green { color: var(--ok); }
a.kpi:hover .value, a.stat:hover .value { color: var(--blue); }

/* App tiles on the start page */
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 26px; }
.app { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s; }
.app:hover { box-shadow: 0 14px 34px rgba(15, 23, 42, .14); transform: translateY(-2px); }
.app .head { position: relative; height: 150px; background: #2B2B2B; overflow: hidden; }
.app .head.red { background: linear-gradient(135deg, #D7261E, #B91C1C); }
.app .head::before, .app .head::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.app .head::before { width: 260px; height: 260px; right: -60px; top: -70px; } .app .head::after { width: 200px; height: 200px; right: 10px; bottom: -120px; }
.app .head svg { position: absolute; color: rgba(255, 255, 255, .95); fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.app .head .big { left: 26px; bottom: 22px; width: 46px; height: 46px; stroke-width: 1.6; }
.app .head .arrow { right: 22px; top: 20px; width: 22px; height: 22px; color: rgba(255, 255, 255, .7); transition: transform .2s; }
.app:hover .head .arrow { transform: translateX(4px); }
.app .head .count { position: absolute; left: 26px; top: 20px; }
.app .body { padding: 22px 26px 26px; } .app .body h3 { font-size: 21px; font-weight: 800; margin: 0 0 6px; } .app .body p { margin: 0; color: var(--muted); font-size: 15.5px; }

/* Chips, tabs, badges, info boxes */
.chips { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 22px; }
.chips a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: 14.5px; font-weight: 500; box-shadow: var(--shadow); white-space: nowrap; }
.chips a .d { width: 8px; height: 8px; border-radius: 50%; background: #94A3B8; }
.chips a .n { min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 12.5px; text-align: center; }
.chips a.on { background: var(--ink); color: #fff; border-color: var(--ink); } .chips a.on .n { background: #333; color: #fff; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.tabs a { padding: 9px 18px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 15px; font-weight: 500; text-decoration: none; color: var(--text); }
.tabs a.on, .tabs a:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--soft); color: var(--muted); text-decoration: none; white-space: nowrap; }
.pill.red { background: var(--red-soft); color: var(--red); } .pill.green, .pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.orange, .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.violet { background: var(--violet-soft); color: var(--violet); } .pill.grey { background: var(--soft); color: var(--muted); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 20px; text-align: center; }
.info { display: flex; gap: 14px; align-items: flex-start; padding: 18px 22px; border-radius: 14px; margin-bottom: 22px; }
.info.blue { background: var(--blue-soft); border: 1px solid #BFDBFE; color: #1E40AF; } .info.orange { background: var(--warn-soft); border: 1px solid #FDE68A; color: #92400E; }
.info.red { background: var(--red-soft); border: 1px solid #FECACA; color: #991B1B; }
.info b { display: block; }
.score { display: inline-grid; place-items: center; min-width: 64px; padding: 8px 10px; border-radius: 14px; font-size: 22px; font-weight: 800; line-height: 1; }
.score small { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; margin-top: 4px; }

/* Forms and buttons */
label { display: block; margin: 14px 0 6px; font-size: 14px; font-weight: 600; }
input, select, textarea { width: 100%; font: inherit; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
textarea { min-height: 100px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--blue); }
.toggle { display: flex; gap: 10px; align-items: center; font-weight: 400; } .toggle input { width: 17px; height: 17px; }
button, .btn { font: 600 15px var(--font); padding: 11px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; box-shadow: var(--shadow); white-space: nowrap; }
button:hover, .btn:hover { background: var(--soft); }
button.primary, .btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
button.primary:hover, .btn.primary:hover { background: #1D4ED8; }
button.dark, .btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
button.danger, .btn.danger, button.go, .btn.go { background: var(--red); border-color: var(--red); color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }
.actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }

/* Data */
dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; } dt { color: var(--muted); font-size: 14px; } dd { margin: 0; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; } td input, td select { padding: 8px 10px; }
tr:last-child td { border-bottom: 0; }
.list > * { border-top: 1px solid var(--line); padding: 12px 0; } .list > *:first-child { border-top: 0; padding-top: 0; }
.rows { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 16px; }
.rows > * { display: flex; align-items: center; gap: 16px; padding: 18px 24px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; flex-wrap: wrap; }
.rows > *:first-child { border-top: 0; } .rows > a:hover { background: var(--soft); }
.rows .grow { flex: 1; min-width: 180px; }
.empty { text-align: center; color: var(--muted); padding: 60px 16px; } .empty svg { width: 44px; height: 44px; color: #CBD5E1; display: block; margin: 0 auto 12px; }
.finding { color: var(--warn); font-size: 14px; margin: 6px 0; }

/* Calendar */
.cal { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.month .wd { text-align: center; color: var(--muted); font-size: 14px; padding: 6px 0; }
.month a { min-height: 96px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; text-decoration: none; color: var(--text); font-size: 14px; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.month a.out { color: #94A3B8; } .month a.today { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); } .month a.sel { background: var(--blue-soft); }
.month a .ev { font-size: 11.5px; padding: 1px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 960px) { .cal { grid-template-columns: 1fr; } .month { gap: 4px; } .month a { min-height: 48px; padding: 6px; } .month a .ev { display: none; } }

/* Chat */
.msg { display: flex; gap: 8px; align-items: flex-end; } .msg.mine { justify-content: flex-end; }
.avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 16px; margin: 5px 0; word-wrap: break-word; font-size: 15px; }
.bubble .text { white-space: pre-wrap; }
.bubble.in { background: var(--soft); border-bottom-left-radius: 4px; }
.bubble.out { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.bubble.out.matthias { background: var(--ink); color: #fff; }
.bubble .muted { color: inherit; opacity: .75; }
.delivery-failed { margin-top: 6px; padding: 4px 8px; border-radius: 8px; background: #fff; color: var(--red); font-size: 12.5px; font-weight: 600; } .bubble img { border-radius: 10px; display: block; margin-top: 6px; }

/* Login */
.login { max-width: 420px; margin: 12vh auto; padding: 0 16px; }

/* Conversations: list 340, chat flexible, info 320 (foldable). Only the columns scroll, never the page. */
main.full { max-width: none; width: 100%; margin: 0; padding: 0; }
.convo { display: grid; grid-template-columns: 340px minmax(0, 1fr) 320px; grid-template-rows: minmax(0, 1fr); height: 100%; background: var(--surface); }
.convo:not(.open), .convo.side-closed { grid-template-columns: 340px minmax(0, 1fr); }
.convo.side-closed .convo-side { display: none; }
@media (min-width: 961px) { .content:has(main.full) { height: 100vh; display: flex; flex-direction: column; } main.full { flex: 1; min-height: 0; } }
.convo-list, .convo-side, .convo-thread { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.convo-list { border-right: 1px solid var(--line); }
.convo-side { border-left: 1px solid var(--line); padding: 8px 16px 24px; }
.convo-head { padding: 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.convo-head h2 { margin-bottom: 8px; }
.convo-head .tabs { gap: 6px; flex-wrap: nowrap; }
.convo-head .tabs a, .convo-head .more-filter summary { padding: 5px 10px; font-size: 13px; white-space: nowrap; }
.convo-items a { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.convo-items a:hover { background: var(--soft); } .convo-items a.on { background: var(--blue-soft); box-shadow: inset 3px 0 0 var(--blue); }
.convo-items .grow { flex: 1; min-width: 0; display: block; }
.convo-items .snippet, .convo-items b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-items .row b { min-width: 0; flex: 1; }
.list-empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.convo-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); container-type: inline-size; }
/* Header: one line, at most 64 px */
.chat-head { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; }
.chat-head .avatar-letter { width: 36px; height: 36px; flex: none; }
.chat-head .who { display: flex; align-items: baseline; gap: 8px; min-width: 48px; flex: 0 1 auto; white-space: nowrap; overflow: hidden; }
.chat-head .who b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chat-head .who .muted { font-size: 13px; overflow: hidden; text-overflow: ellipsis; flex-shrink: 10; min-width: 0; }  /* the number gives way first */
/* Narrow chat column (info open, small screens): the number is in Kontakt anyway, AVA keeps its coloured icon. */
@container (max-width: 620px) {
  .chat-head .who .muted, .icon-btn.ava-on span, .icon-btn.ava-off span, .head-actions .desktop-only { display: none; }
  .head-actions .menu .mobile-only { display: block; }  /* "Termin buchen" moves into ⋯ */
  .stage-chip select { width: 140px; }
}
/* A select is as wide as its longest option; fixed widths keep the name and the text field visible. */
.stage-chip { flex: none; } .stage-chip select { padding: 4px 26px 4px 10px; font-size: 13px; border-radius: 999px; width: 168px; background-color: var(--soft); border-color: transparent; }
.head-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; flex: none; }
.head-actions form { margin: 0; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 36px; height: 36px; padding: 0 8px; border-radius: 10px; border: 1px solid transparent; background: none; box-shadow: none; color: var(--muted); cursor: pointer; text-decoration: none; font-size: 13px; font-weight: 600; }
.icon-btn:hover { background: var(--soft); color: var(--text); }
.icon-btn .i { width: 18px; height: 18px; }
summary.icon-btn { list-style: none; } summary.icon-btn::-webkit-details-marker { display: none; }
.icon-btn.ava-on { color: var(--ok); background: var(--ok-soft); } .icon-btn.ava-off { color: var(--muted); background: var(--soft); }
.link-btn { background: none; border: 0; box-shadow: none; padding: 4px 6px; color: var(--muted); font-size: 13px; text-decoration: underline; cursor: pointer; }
.convo-thread { flex: 1; min-height: 0; padding: 16px 24px; }
.typing { margin: 8px 0 0; font-style: italic; }
/* Composer: one field like WhatsApp Web; AVA's draft sits in it */
.composer { flex: none; padding: 8px 16px 12px; border-top: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.composer-box { display: flex; align-items: flex-end; gap: 6px; border: 1px solid var(--line); border-radius: 14px; padding: 4px 6px; background: var(--surface); }
.composer-box textarea { flex: 1; border: 0; box-shadow: none; resize: none; min-height: 36px; padding: 8px 4px; outline: none; background: transparent; }
.chan-select, .chan-fixed { flex: none; width: 118px; border: 0; background-color: var(--soft); border-radius: 999px; padding: 4px 24px 4px 10px; font-size: 12.5px; font-weight: 600; margin: 6px 0; }
.chan-fixed { width: auto; padding: 4px 10px; color: var(--muted); }
.icon-btn.send { color: #fff; background: var(--blue); }
.icon-btn.send .note-label { display: none; }
.composer.is-note .composer-box { background: #FEFCE8; border-color: #FDE68A; }
.composer.is-note .icon-btn.send { background: #CA8A04; } .composer.is-note .icon-btn.send .i { display: none; } .composer.is-note .icon-btn.send .note-label { display: inline; }
.composer .email-only { display: none; gap: 8px; } .composer.is-email .email-only { display: flex; }
.composer .email-only input { flex: 2; } .composer .email-only select { flex: 1; }
.draft-strip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding: 4px 8px; border-radius: 8px; background: var(--soft); }
.draft-strip.warn { background: var(--warn-soft); color: #92400E; }
.draft-strip .i { width: 14px; height: 14px; vertical-align: -2px; }
.draft-strip .why { position: relative; } .draft-strip .why summary { cursor: pointer; text-decoration: underline; list-style: none; }
.draft-strip .why[open] div { position: absolute; bottom: 130%; right: 0; width: 280px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, .12); padding: 8px 12px; color: var(--text); z-index: 5; }
.draft-strip .why p { margin: 4px 0; }
.composer.has-draft .composer-box { border-color: #F59E0B; }
.draft-image { max-width: 180px; border-radius: 10px; }
.sandbox-say { flex: none; margin: 0 16px 8px; padding: 8px 12px; border: 1px dashed var(--warn); border-radius: 12px; background: var(--warn-soft); display: grid; gap: 8px; }
.sandbox-say textarea { min-height: 36px; }
.bubble .chan { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .75; margin-bottom: 2px; }
.bubble .meta { font-size: 11.5px; margin-top: 3px; opacity: .75; }
.bubble.ava { background: var(--blue); } .bubble.note { background: #FEF9C3; color: #713F12; border: 1px dashed #EAB308; }
.bubble.failed { box-shadow: 0 0 0 2px var(--red); }
/* Info column: one fold open at a time */
details.fold { border-bottom: 1px solid var(--line); padding: 12px 0; }
details.fold > summary { cursor: pointer; font-weight: 700; font-size: 15px; list-style: none; display: flex; align-items: center; gap: 8px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "›"; margin-left: auto; color: var(--muted); transition: transform .15s; }
details.fold[open] > summary::after { transform: rotate(90deg); }
details.fold > summary + * { margin-top: 8px; }
details.fold .count { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 1px 8px; }
details.fold dl { margin: 8px 0 0; }
details.plan > summary { margin: 0; } details.plan form { margin-top: 8px; }
details.plan[open] { flex-basis: 100%; }
.convo-side .next-step, .convo-side .warn-line { margin: 0; }
.convo-side select.inline { padding: 4px 8px; font-size: 13.5px; width: auto; }
.convo-side .summary { margin: 0 0 8px; font-size: 14px; }
.convo-side .inspiration { width: 100%; border-radius: 12px; margin-top: 8px; }
.mobile-only { display: none; }
.back-list { display: none; }
@media (max-width: 960px) {
  .convo, .convo.open { display: block; height: auto; }
  .convo.open .convo-list { display: none; }
  .convo .convo-side { display: none; border-left: 0; }
  .convo.show-side .convo-chat { display: none; } .convo.show-side .convo-side { display: block; }
  .chat-head { position: sticky; top: 0; z-index: 4; gap: 8px; padding: 0 8px; }
  .chat-head .who .muted, .desktop-only, .chat-head .avatar-letter, .icon-btn.ava-on span, .icon-btn.ava-off span { display: none; }
  .stage-chip select { width: 112px; }
  .convo.open .convo-chat { min-height: calc(100dvh - 190px); }  /* composer right above the bottom bar */
  body:has(.convo.open) .fab { display: none; }  /* the composer has its own send button */
  .mobile-only { display: block; }
  .back-list { display: inline-flex; }
  .convo-thread { padding: 12px; }
  .composer { position: sticky; bottom: calc(62px + env(safe-area-inset-bottom)); }  /* right above the bottom bar */
}

/* Leads board (GHL Opportunities) */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; scrollbar-width: thin; }
.lane { flex: 0 0 272px; background: var(--soft); border-radius: 14px; padding: 8px; border: 2px solid transparent; }
.lane.empty { flex-basis: 150px; }  /* stays visible as a drop target */
/* Pipeline (Pipedrive, Trello): the board fills the window, each lane scrolls on its own, lane headers stay. */
@media (min-width: 961px) {
  .content:has(main.board-page) { height: 100vh; display: flex; flex-direction: column; }
  main.board-page { flex: 1; min-height: 0; display: flex; flex-direction: column; max-width: none; width: 100%; margin: 0; padding: 24px 32px 0; }
  main.board-page .board { flex: 1; min-height: 0; align-items: stretch; }
  main.board-page .lane { display: flex; flex-direction: column; min-height: 0; }
  main.board-page .lane-cards { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; padding-right: 2px; }
}
.lane.over { border-color: var(--blue); background: var(--blue-soft); }
.lane header { display: flex; align-items: center; gap: 8px; padding: 6px 6px 12px; font-size: 14.5px; }
.lane header .d { width: 8px; height: 8px; border-radius: 50%; }
.lane header .n { margin-left: auto; min-width: 24px; padding: 0 8px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12.5px; text-align: center; }
.lane-cards { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.deal { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; text-decoration: none; color: inherit; box-shadow: var(--shadow); cursor: grab; font-size: 14px; }
.deal:hover { border-color: var(--blue); }
.deal b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.deal .next { color: var(--ok); font-size: 13px; }
.deal .warn-line { font-size: 13px; margin: 0; }

/* Heute */
.page-head .search { min-width: 280px; max-width: 380px; flex: 1; flex-wrap: nowrap; }
.today-group { margin-bottom: 26px; }
.today-group h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.today-group h2 .n { font-size: 13px; min-width: 24px; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); text-align: center; }
.today-group.sofort h2 .n, .today-group.probleme h2 .n { background: var(--red); color: #fff; }
.today-item { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.today-item .actions button, .today-item .actions .btn { padding: 8px 12px; font-size: 14px; }
.reason-red { color: var(--red); font-size: 14px; font-weight: 500; }
.today-draft { flex-basis: 100%; } .today-draft .card { margin: 0; box-shadow: none; padding: 12px 14px; }
.draft-preview { max-width: 100%; margin: 4px 0 10px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.snooze { position: relative; } .snooze summary { list-style: none; cursor: pointer; } .snooze summary::-webkit-details-marker { display: none; }
.snooze[open] form { position: absolute; right: 0; top: 110%; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, .12); padding: 6px; display: flex; flex-direction: column; min-width: 170px; }
.snooze[open] form button { border: 0; box-shadow: none; justify-content: flex-start; }
.warn-line { color: var(--warn); font-size: 13.5px; font-weight: 600; }
.deal.nostep { border-left: 3px solid var(--warn); }
.ic-soft { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); flex: none; }
.unread { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); margin-right: 6px; vertical-align: 2px; }
.next-step { margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.slot-pick { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.slot-pick .slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; margin-top: 8px; }
.slot-pick label { margin: 0; font-weight: 400; display: flex; gap: 8px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
/* Calendar week */
.stack { display: flex; flex-direction: column; gap: 8px; }

/* Uploads and AI output in the customer panel */
.files { display: grid; gap: 8px; margin: 0 0 6px; }
.file { display: flex; gap: 10px; align-items: center; padding: 6px; border: 1px solid var(--line); border-radius: 10px; color: inherit; text-decoration: none; min-width: 0; }
.file:hover { border-color: var(--blue); }
.file img, .file-icon { width: 52px; height: 52px; flex: none; border-radius: 8px; object-fit: cover; display: grid; place-items: center; background: var(--soft); }
.file span { min-width: 0; } .file b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.file small { color: var(--muted); font-size: 12px; }
.ai-out { border-left: 3px solid var(--blue); padding: 2px 0 2px 12px; margin: 0 0 14px; }
.ai-out p { margin: 4px 0; } .ai-out small { display: block; } .ai-out details summary { cursor: pointer; margin: 6px 0; }

.run { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; } .run:last-child { border-bottom: 0; }

.more-filter { position: relative; display: inline-block; }
.more-filter summary { list-style: none; cursor: pointer; padding: 5px 12px; font-size: 13.5px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.more-filter summary.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.more-filter summary::-webkit-details-marker { display: none; }
.more-filter[open] { z-index: 5; }
.more-filter > a { position: relative; display: block; border-radius: 10px; border: 0; margin-top: 4px; background: var(--surface); box-shadow: var(--shadow); }
.snooze[open] .menu { position: absolute; right: 0; top: 110%; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, .12); padding: 6px; display: flex; flex-direction: column; min-width: 200px; }
.snooze .menu form { position: static; display: flex; flex-direction: column; box-shadow: none; border: 0; padding: 0; min-width: 0; }
.snooze .menu a, .snooze .menu button { border: 0; box-shadow: none; justify-content: flex-start; text-align: left; padding: 8px 10px; border-radius: 8px; background: none; color: var(--text); text-decoration: none; font-size: 14px; }
.snooze .menu a:hover, .snooze .menu button:hover { background: var(--soft); }

/* Kunden: one search line, small toggles */
.tabs.seg { margin: 0; gap: 0; background: var(--soft); border-radius: 999px; padding: 3px; }
.tabs.seg a { border: 0; padding: 7px 14px; font-size: 14px; background: none; }
.tabs.seg a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.btn.icon-only { padding: 9px 11px; }
.filter-bar { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; }
.filter-bar > input { flex: 1; }
.filter-bar .filter[open] .menu { min-width: 260px; gap: 8px; padding: 12px; }
.filter-bar summary.on { border-color: var(--blue); color: var(--blue); }
.chips .more-filter summary { padding: 9px 16px; font-size: 14.5px; font-weight: 500; box-shadow: var(--shadow); }
.new-lead { margin-top: 24px; } .new-lead:not(:target) { display: none; }
main.board-page .new-lead:target { position: fixed; inset: 10vh 0 auto; margin: 0 auto; max-width: 720px; z-index: 30; box-shadow: 0 20px 60px rgba(15, 23, 42, .25); }
@media (max-width: 960px) { .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } }
.tabs.seg a { display: inline-flex; align-items: center; gap: 6px; } .tabs.seg .i { width: 16px; height: 16px; }

/* Heute: counters that filter, uniform rows, folded drafts */
.today-head h1 { font-size: 24px; margin: 0; }
.counters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 24px; }
.counter { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; font-size: 14px; box-shadow: var(--shadow); }
.counter b { font-size: 15px; }
.counter.urgent b { color: var(--red); }
.counter.on { border-color: var(--ink); background: var(--ink); color: #fff; } .counter.on b { color: #fff; }
.counter.zero { color: var(--muted); background: var(--soft); box-shadow: none; cursor: default; }
.draft-row summary { cursor: pointer; list-style: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-row summary::-webkit-details-marker { display: none; }
.draft-row[open] summary { white-space: normal; }
.draft-row .card { margin: 8px 0 0; box-shadow: none; padding: 12px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); vertical-align: middle; }
.show-all { display: inline-block; margin: 8px 0 0 4px; font-size: 14px; }
.tomorrow { margin-top: 16px; text-align: left; } .tomorrow p { margin: 6px 0 0; }
@media (max-width: 960px) { .today-item .actions .btn { padding: 8px 10px; } .today-head h1 { font-size: 20px; } .counters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .counter { flex: none; } }

/* Kalender: time grid (Google Calendar, GHL). One hour is --hour high; only the grid scrolls. */
.cal-grid { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.cal-row { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.cal-days b { padding: 10px 8px; font-size: 13.5px; color: var(--muted); text-align: center; } .cal-days b.today { color: var(--blue); }
.cal-allday > span { font-size: 10.5px; padding: 6px 2px; } .cal-allday > div { padding: 4px; display: flex; flex-direction: column; gap: 3px; border-left: 1px solid var(--line); }
.cal-allday .pill { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.cal-scroll { overflow-y: auto; max-height: 64vh; scrollbar-width: thin; }
.cal-body { position: relative; display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr));
  background: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--hour)); }
.cal-hours { position: relative; } .cal-hours span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11.5px; color: var(--muted); }
.cal-hours span:first-child { transform: none; }
.cal-col { position: relative; border-left: 1px solid var(--line); background: rgba(148, 163, 184, .12); cursor: copy; }
.cal-col .open { position: absolute; left: 0; right: 0; background: var(--surface); opacity: .85; }
.cal-col .busy { position: absolute; left: 2px; right: 2px; background: repeating-linear-gradient(45deg, #E2E8F0 0 6px, #F1F5F9 6px 12px); border-radius: 6px; font-size: 11px; color: var(--muted); padding: 2px 6px; cursor: not-allowed; }
.cal-col .ev { position: absolute; margin: 0 1px; z-index: 2; cursor: pointer; }
.cal-col .ev > summary { list-style: none; height: 100%; overflow: hidden; border-radius: 8px; padding: 3px 6px; font-size: 12px; line-height: 1.3; color: #fff; background: var(--blue); }
.cal-col .ev > summary::-webkit-details-marker { display: none; }
.cal-col .ev > summary small { display: block; opacity: .85; }
.cal-col .ev.violet > summary { background: var(--violet); } .cal-col .ev.orange > summary { background: var(--warn); } .cal-col .ev.grey > summary { background: #64748B; }
.cal-col .ev[open] { z-index: 6; }
.ev-pop { position: absolute; top: 100%; left: 0; min-width: 240px; margin-top: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, .15); padding: 12px; cursor: default; color: var(--text); }
.ev-pop p { margin: 4px 0 8px; font-size: 13px; } .ev-pop .actions { margin: 0; gap: 6px; } .ev-pop .btn { padding: 6px 10px; font-size: 13px; }
.cal-col .now { position: absolute; left: -1px; right: 0; height: 2px; background: var(--red); z-index: 4; }
.cal-col .now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
@media (min-width: 961px) {
  .content:has(main.grid-page) { height: 100vh; display: flex; flex-direction: column; }
  main.grid-page { flex: 1; min-height: 0; display: flex; flex-direction: column; max-width: none; width: 100%; margin: 0; padding: 24px 32px 16px; }
  main.grid-page .cal-grid { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  main.grid-page .cal-scroll { flex: 1; max-height: none; }
}
.choice { display: flex; gap: 8px; align-items: center; margin: 0; font-weight: 500; } .choice input { width: auto; }
