/* ============ TrueTalent CRM — Designsystem ============
   Farben & Stil nach TrueTalent Design Guidelines:
   Primär #00b4d8 · Hell #f3f3f3 · Dunkel #181b1b · Fraunces (Display) + Manrope (Text)
   Glasmorphismus, weiche Schatten, abgerundete Ecken, vertikale Streifen */

@font-face { font-family: 'Fraunces'; src: url('/assets/fonts/fraunces.woff2') format('woff2'); font-weight: 300 900; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('/assets/fonts/fraunces-italic.woff2') format('woff2'); font-weight: 300 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('/assets/fonts/manrope.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }

:root {
  /* Pipedrive-nahe Anmutung für leichten Umstieg — grüne Aktionen, helle flache Flächen.
     TrueTalent-Cyan bleibt als Akzent (Links, aktive Navigation, Login). */
  --primary: #00b4d8;
  --primary-deep: #0077b6;
  --primary-navy: #1a2c56;
  --primary-100: #d9f1f8;
  --primary-200: #90e0ef;
  --cta: #12943c;            /* Primäraktionen (Speichern, +Deal) — grün wie gewohnt */
  --cta-deep: #0c7530;
  --bg: #f4f5f7;
  --ink: #26292c;
  --ink-60: #5a6161;
  --ink-40: #8b9292;
  --card: #ffffff;
  --card-solid: #fff;
  --line: rgba(38,41,44,.13);
  --danger: #d94f46;
  --warn: #f0a92e;
  --ok: #12943c;
  --shadow: 0 1px 3px rgba(38,41,44,.10);
  --shadow-sm: 0 1px 2px rgba(38,41,44,.08);
  --r-lg: 10px; --r-md: 8px; --r-sm: 6px;
  --sidebar-w: 200px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink); background: var(--bg);
  font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3 { font-weight: 700; letter-spacing: -.01em; }
.login-card h1 { font-family: 'Fraunces', serif; font-weight: 600; }
a { color: var(--primary-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: inherit; font-size: inherit; color: inherit; }

.boot-splash { height: 100vh; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; color: var(--ink-60); }

/* ============ Shell ============ */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; position: relative; z-index: 1; }
.sidebar {
  background: #1f2329;
  color: #eaf6fa; display: flex; flex-direction: column; padding: 14px 10px; gap: 4px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px 16px; }
.sidebar .brand img { width: 30px; height: 30px; }
.sidebar .brand b { font-family: 'Fraunces', serif; font-size: 17px; font-weight: 600; letter-spacing: .01em; }
.sidebar .brand small { display:block; color: var(--primary-200); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r-sm);
  color: #cfe6ee; cursor: pointer; user-select: none; border: 1px solid transparent;
  font-weight: 500; position: relative; transition: background .12s;
}
.nav-item:hover { background: rgba(144,224,239,.09); text-decoration: none; color: #fff; }
.nav-item.active { background: linear-gradient(120deg, rgba(0,180,216,.24), rgba(0,180,216,.10)); border-color: rgba(0,180,216,.35); color: #fff; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item .count { margin-left: auto; background: var(--primary); color: #04263a; font-size: 10.5px; font-weight: 800; padding: 1px 7px; border-radius: 20px; }
.nav-sep { flex: 1; }
.nav-user { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.09); cursor: pointer; border-radius: var(--r-sm); }
.nav-user:hover { background: rgba(144,224,239,.09); }
.nav-user small { color: #9fb6c1; display: block; font-size: 11px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 10px 22px;
  background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 21px; margin: 0; }
.topbar .search { flex: 1; max-width: 520px; margin: 0 auto; position: relative; }
.topbar .search input {
  width: 100%; padding: 9px 14px 9px 38px; border-radius: 22px; border: 1px solid var(--line);
  background: rgba(255,255,255,.9); outline: none; transition: box-shadow .15s;
}
.topbar .search input:focus { box-shadow: 0 0 0 3px var(--primary-100); border-color: var(--primary); }
.topbar .search svg { position: absolute; left: 13px; top: 9px; width: 17px; height: 17px; color: var(--ink-40); }
.content { flex: 1; overflow: auto; padding: 18px 22px; position: relative; }

/* ============ Bausteine ============ */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--card-solid); cursor: pointer; font-weight: 600;
  box-shadow: var(--shadow-sm); transition: transform .1s, box-shadow .12s, background .12s; white-space: nowrap;
}
.btn:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--cta); color: #fff; border: none; }
.btn.primary:hover { background: var(--cta-deep); }
.btn.danger { background: var(--danger); color: #fff; border: none; }
.btn.ok { background: var(--ok); color: #fff; border: none; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn.ghost:hover { background: rgba(0,180,216,.08); transform: none; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn svg { width: 15px; height: 15px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 16px;
}
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--primary-100); color: var(--primary-navy); padding: 2px 9px; border-radius: 12px; font-size: 11.5px; font-weight: 700; }
.chip.warn { background: #fdeece; color: #7a5410; }
.chip.danger { background: #fadcda; color: #7a201a; }
.chip.ok { background: #d8f2e4; color: #175c38; }
.chip.gray { background: #e8eaea; color: var(--ink-60); }

.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 800; flex: none; }

input.field, select.field, textarea.field {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff; outline: none; transition: box-shadow .15s;
}
.field:focus { box-shadow: 0 0 0 3px var(--primary-100); border-color: var(--primary); }
label.lbl { display: block; font-size: 11.5px; font-weight: 700; color: var(--ink-60); text-transform: uppercase; letter-spacing: .06em; margin: 12px 0 4px; }

table.tbl { width: 100%; border-collapse: collapse; background: var(--card-solid); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-60); padding: 10px 12px; border-bottom: 2px solid var(--line); background: #fafbfb; position: sticky; top: 0; cursor: pointer; user-select: none; white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: rgba(0,180,216,.045); }
.tbl tr { cursor: pointer; }

/* ============ Kanban ============ */
.pipeline-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(238px, 1fr); gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 90px; min-height: 65vh; }
.kcol { background: #eef0f2; border: 1px solid var(--line); border-radius: var(--r-md); display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.kcol header { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); background: #fff; border-radius: var(--r-md) var(--r-md) 0 0; }
.kcol header .t { font-weight: 800; font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.kcol header .m { color: var(--ink-60); font-size: 11.5px; margin-top: 2px; }
.kcol .cards { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; }
.kcard {
  background: var(--card-solid); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 10px 11px; cursor: grab; box-shadow: var(--shadow-sm); transition: box-shadow .12s, transform .1s; position: relative;
}
.kcard:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kcard.dragging { opacity: .45; transform: rotate(2deg); }
.kcard .t { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.kcard .s { color: var(--ink-60); font-size: 12px; }
.kcard .foot { display: flex; align-items: center; gap: 7px; margin-top: 7px; }
.kcard .foot .v { font-weight: 700; font-size: 12px; color: var(--primary-navy); }
.kcard .warn-dot { position: absolute; right: 9px; top: 9px; color: var(--warn); }
.kcol.drag-over { outline: 2px dashed var(--primary); outline-offset: -4px; }
.dropzones { position: fixed; left: var(--sidebar-w); right: 0; bottom: 0; display: none; grid-template-columns: 1fr 1fr 1fr; gap: 10px; padding: 12px 22px; z-index: 50; }
.dropzones.show { display: grid; }
.dz { border-radius: var(--r-md); padding: 20px; text-align: center; font-weight: 800; color: #fff; opacity: .93; border: 2px dashed rgba(255,255,255,.6); }
.dz.won { background: var(--ok); } .dz.lost { background: var(--danger); } .dz.del { background: #444; }
.dz.drag-over { transform: scale(1.03); opacity: 1; }

/* ============ Deal-Detail ============ */
.detail-grid { display: grid; grid-template-columns: 330px 1fr; gap: 16px; align-items: start; }
.stagebar { display: flex; gap: 3px; margin: 4px 0 14px; }
.stagebar .seg { flex: 1; height: 26px; background: #e2e6e6; position: relative; cursor: pointer; clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%, 9px 50%); display: flex; align-items: center; justify-content: center; font-size: 10.5px; color: var(--ink-60); font-weight: 700; }
.stagebar .seg.done { background: linear-gradient(120deg, var(--primary), var(--primary-deep)); color: #fff; }
.stagebar .seg:hover { filter: brightness(1.06); }
.side-sec { border-top: 1px solid var(--line); padding: 12px 0; }
.side-sec h3 { margin: 0 0 8px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.kv { display: grid; grid-template-columns: 128px 1fr; gap: 4px 10px; font-size: 13px; }
.kv .k { color: var(--ink-40); font-size: 12px; padding-top: 2px; }
.kv .v { min-height: 20px; border-radius: 5px; padding: 1px 4px; }
.kv .v.editable:hover { background: var(--primary-100); cursor: pointer; }
.composer-tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.composer-tabs .ct { padding: 9px 14px; cursor: pointer; font-weight: 700; color: var(--ink-60); border-bottom: 2px solid transparent; margin-bottom: -2px; display: flex; gap: 7px; align-items: center; white-space: nowrap; }
.composer-tabs .ct.active { color: var(--primary-deep); border-bottom-color: var(--primary); }
.timeline { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.tl-item { display: grid; grid-template-columns: 34px 1fr; gap: 10px; }
.tl-item .dot { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-100); color: var(--primary-deep); display: flex; align-items: center; justify-content: center; margin-top: 3px; }
.tl-item .body { background: var(--card-solid); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 13px; box-shadow: var(--shadow-sm); overflow-wrap: anywhere; }
.tl-item .body.note { background: #fdf9e7; border-color: #f1e6b8; }
.tl-item .meta { font-size: 11.5px; color: var(--ink-40); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tl-item .meta .sp { flex: 1; }
.tl-filter { display: flex; gap: 4px; flex-wrap: wrap; margin: 12px 0 2px; }
.tl-filter .tf { padding: 4px 11px; border-radius: 16px; cursor: pointer; font-size: 12px; font-weight: 700; color: var(--ink-60); }
.tl-filter .tf.active { background: var(--primary-navy); color: #fff; }

/* ============ Mail ============ */
.mail-grid { display: grid; grid-template-columns: 190px 380px 1fr; gap: 14px; height: calc(100vh - 130px); }
.mail-folders { display: flex; flex-direction: column; gap: 3px; }
.mail-folder { padding: 8px 12px; border-radius: var(--r-sm); cursor: pointer; font-weight: 600; display: flex; justify-content: space-between; }
.mail-folder:hover { background: rgba(0,180,216,.08); }
.mail-folder.active { background: var(--primary-navy); color: #fff; }
.mail-list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
.mail-row { background: var(--card-solid); border: 1px solid var(--line); border-radius: var(--r-md); padding: 9px 12px; cursor: pointer; }
.mail-row:hover { box-shadow: var(--shadow-sm); }
.mail-row.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-100); }
.mail-row .from { font-weight: 700; font-size: 12.5px; display: flex; justify-content: space-between; gap: 6px; }
.mail-row .subj { font-size: 12.5px; margin: 1px 0; }
.mail-row.unread .subj, .mail-row.unread .from { font-weight: 800; }
.mail-row .snip { color: var(--ink-40); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-view { overflow-y: auto; }
.mail-msg { border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; margin-bottom: 10px; }
.mail-msg .head { padding: 9px 13px; border-bottom: 1px solid var(--line); font-size: 12.5px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mail-msg .bodyc { padding: 13px; overflow-x: auto; font-size: 13.5px; }
.mail-msg .bodyc img { max-width: 100%; }

/* ============ Kalender ============ */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-grid { display: grid; grid-template-columns: 46px repeat(7, 1fr); background: var(--card-solid); border-radius: var(--r-md); box-shadow: var(--shadow-sm); overflow: hidden; }
.cal-grid .h { padding: 8px 4px; text-align: center; font-weight: 800; font-size: 12px; border-bottom: 2px solid var(--line); background: #fafbfb; }
.cal-grid .h.today { color: var(--primary-deep); }
.cal-hour { font-size: 10px; color: var(--ink-40); text-align: right; padding: 0 5px; border-right: 1px solid var(--line); height: 44px; }
.cal-cell { border-left: 1px solid var(--line); border-top: 1px solid rgba(24,27,27,.05); position: relative; height: 44px; cursor: pointer; }
.cal-cell:hover { background: rgba(0,180,216,.05); }
.cal-ev { position: absolute; left: 2px; right: 3px; background: linear-gradient(120deg, rgba(0,180,216,.92), rgba(0,119,182,.92)); color: #fff; border-radius: 7px; font-size: 10.5px; padding: 2px 6px; overflow: hidden; cursor: pointer; z-index: 2; box-shadow: var(--shadow-sm); }
.cal-ev.done { background: #cfe7db; color: #175c38; text-decoration: line-through; }
.cal-ev.overdue { background: linear-gradient(120deg, #e2695f, #d94f46); }
.cal-ev.external { background: repeating-linear-gradient(45deg, #b8c4cc 0 6px, #a9b7c0 6px 12px); color: #26323a; }
.cal-month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-mday { background: var(--card-solid); border: 1px solid var(--line); border-radius: var(--r-md); min-height: 108px; padding: 6px 8px; cursor: pointer; }
.cal-mday .d { font-weight: 800; font-size: 12px; color: var(--ink-60); }
.cal-mday.today { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-100); }
.cal-mday .ev { font-size: 10.5px; background: var(--primary-100); color: var(--primary-navy); padding: 1px 6px; border-radius: 6px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-mday .ev.done { background: #d8f2e4; color: #175c38; text-decoration: line-through; }

/* ============ Modal / Dropdown / Toast ============ */
.modal-back { position: fixed; inset: 0; background: rgba(9,12,30,.45); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 7vh 16px 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: var(--r-lg); box-shadow: 0 24px 80px rgba(3,4,94,.35); width: 560px; max-width: 100%; animation: pop .16s ease-out; }
.modal.lg { width: 780px; }
.modal .mhead { padding: 16px 20px 0; display: flex; justify-content: space-between; align-items: center; }
.modal .mhead h2 { margin: 0; font-size: 19px; }
.modal .mbody { padding: 10px 20px 20px; }
.modal .mfoot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; }
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.x { cursor: pointer; border: none; background: none; font-size: 21px; color: var(--ink-40); line-height: 1; }
.x:hover { color: var(--ink); }

.dd { position: absolute; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); z-index: 120; min-width: 180px; max-height: 320px; overflow-y: auto; padding: 5px; }
.dd .di { padding: 7px 11px; border-radius: 7px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.dd .di:hover, .dd .di.hover { background: var(--primary-100); }
.dd .di small { color: var(--ink-40); margin-left: auto; }

#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 9px; z-index: 200; }
.toast { background: var(--ink); color: #fff; border-radius: var(--r-md); padding: 11px 16px; box-shadow: var(--shadow); animation: pop .2s; max-width: 380px; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ============ Login ============ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden;
  background: radial-gradient(1100px 600px at 78% -10%, rgba(0,180,216,.28), transparent 60%),
              radial-gradient(900px 550px at -10% 110%, rgba(3,4,94,.20), transparent 55%), var(--bg);
}
.login-wrap::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(3,4,94,.03) 0 1px, transparent 1px 72px); }
.login-wrap::after { content: ''; position: absolute; width: 420px; height: 420px; right: -80px; bottom: -80px; border-radius: 50%;
  background: radial-gradient(circle at 6px 6px, rgba(0,180,216,.30) 2.2px, transparent 2.6px); background-size: 21px 21px; opacity:.55; }
.login-card {
  position: relative; z-index: 2; width: 400px; max-width: 92vw; padding: 34px 32px 28px;
  background: rgba(255,255,255,.66); backdrop-filter: blur(22px); border: 1px solid rgba(255,255,255,.8);
  border-radius: 24px; box-shadow: 0 28px 90px rgba(3,4,94,.22);
}
.login-card h1 { margin: 14px 0 2px; font-size: 26px; }
.login-card p.sub { color: var(--ink-60); margin: 0 0 18px; }

.empty { text-align: center; color: var(--ink-40); padding: 44px 10px; }
.spin { width: 22px; height: 22px; border: 3px solid var(--primary-100); border-top-color: var(--primary); border-radius: 50%; animation: rot .8s linear infinite; margin: 30px auto; }
@keyframes rot { to { transform: rotate(360deg); } }
.flex { display: flex; gap: 10px; align-items: center; } .grow { flex: 1; } .wrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.muted { color: var(--ink-40); } .small { font-size: 12px; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }
.pill-tabs { display: inline-flex; background: rgba(3,4,94,.06); border-radius: 12px; padding: 3px; gap: 2px; }
.pill-tabs .pt { padding: 6px 13px; border-radius: 9px; cursor: pointer; font-weight: 700; font-size: 12.5px; color: var(--ink-60); }
.pill-tabs .pt.active { background: #fff; color: var(--primary-navy); box-shadow: var(--shadow-sm); }
.searchdd { position: absolute; top: 44px; left: 0; right: 0; }
.rich { min-height: 130px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; background: #fff; outline: none; overflow-y: auto; max-height: 320px; }
.rich:focus { box-shadow: 0 0 0 3px var(--primary-100); border-color: var(--primary); }
.settings-grid { display: grid; grid-template-columns: 210px 1fr; gap: 18px; align-items: start; }
.set-nav { display: flex; flex-direction: column; gap: 3px; }
.set-nav .si { padding: 9px 13px; border-radius: var(--r-sm); cursor: pointer; font-weight: 600; }
.set-nav .si:hover { background: rgba(0,180,216,.08); }
.set-nav .si.active { background: var(--primary-navy); color: #fff; }
@media (max-width: 1000px) {
  .detail-grid, .mail-grid, .settings-grid { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 64px 1fr; }
  .sidebar .brand b, .sidebar .brand small, .nav-item span, .nav-user div { display: none; }
}
