/* ====== ATS Design-System (intern) ============================================
   Tokens + App-Shell. Bootstrap bleibt Basis (Grid, Utilities), Optik kommt von hier. */

:root {
    --ink: #1c2430;
    --muted: #64748b;
    --bg: #f3f5f8;
    --surface: #ffffff;
    --border: #e4e8ef;
    --accent: #0e7a6e;
    --accent-ink: #0a5b52;
    --accent-soft: #e4f1ef;
    --sidebar: #17212d;
    --sidebar-ink: #c7d0dc;
    --ok: #157f3d;      --ok-soft: #e3f4e9;
    --danger: #b42318;  --danger-soft: #fcebea;
    --warn: #9a6700;    --warn-soft: #fff3d6;
    --info: #175cd3;    --info-soft: #e8f0fd;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

html, body { height: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14.5px;
}

h1, h2, h3, .h3 { font-weight: 650; letter-spacing: -.01em; color: var(--ink); }

/* ---------- App-Shell: Sidebar + Topbar ---------- */
.app { display: flex; min-height: 100vh; }

.app-sidebar {
    width: 218px; flex-shrink: 0;
    background: var(--sidebar);
    color: var(--sidebar-ink);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.app-brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.1rem 1.15rem .9rem;
    color: #fff; font-weight: 700; font-size: 1.02rem; text-decoration: none;
    letter-spacing: .01em;
}
.app-brand:hover { color: #fff; }
.app-brand .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 0 4px rgba(14,122,110,.25); }

.app-nav { padding: .4rem .65rem; display: flex; flex-direction: column; gap: 2px; }
.app-nav a {
    display: flex; align-items: center; gap: .65rem;
    padding: .55rem .7rem;
    color: var(--sidebar-ink); text-decoration: none;
    border-radius: 8px; font-weight: 500;
}
.app-nav a svg { width: 17px; height: 17px; opacity: .75; flex-shrink: 0; }
.app-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.app-nav a.active { background: rgba(14,122,110,.22); color: #fff; }
.app-nav a.active svg { opacity: 1; }

.app-sidebar .sidebar-foot {
    margin-top: auto; padding: .9rem 1.15rem;
    font-size: .72rem; color: #5c6b7c;
}

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .7rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.topbar .page-title { font-weight: 650; font-size: 1.05rem; margin: 0; }

.content { padding: 1.4rem 1.5rem 2.5rem; }

@media (max-width: 900px) {
    .app { flex-direction: column; }
    .app-sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; }
    .app-nav { flex-direction: row; }
    .app-sidebar .sidebar-foot { display: none; }
}

/* ---------- Panels, Tabellen, Badges ---------- */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.panel .panel-head {
    padding: .8rem 1.1rem; border-bottom: 1px solid var(--border);
    font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.panel .panel-body { padding: 1.1rem; }

.table-modern { width: 100%; border-collapse: collapse; }
.table-modern th {
    text-align: left; padding: .65rem 1.1rem;
    font-size: .72rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
    color: var(--muted); border-bottom: 1px solid var(--border);
    background: #fafbfc;
}
.table-modern td { padding: .7rem 1.1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-modern tbody tr:last-child td { border-bottom: none; }
.table-modern tbody tr:hover td { background: #f7f9fb; }
.table-modern a { color: var(--accent-ink); font-weight: 550; text-decoration: none; }
.table-modern a:hover { text-decoration: underline; }

.badge-soft { display: inline-block; padding: .22rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 600; line-height: 1.1; }
.badge-soft.ok      { background: var(--ok-soft); color: var(--ok); }
.badge-soft.danger  { background: var(--danger-soft); color: var(--danger); }
.badge-soft.warn    { background: var(--warn-soft); color: var(--warn); }
.badge-soft.info    { background: var(--info-soft); color: var(--info); }
.badge-soft.neutral { background: #eef1f5; color: var(--muted); }
.badge-soft.accent  { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- Buttons (Bootstrap-Überschreibungen) ---------- */
.btn { border-radius: 8px; font-weight: 550; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover, .btn-primary:focus { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-outline-primary { color: var(--accent-ink); border-color: var(--accent); }
.btn-outline-primary:hover { background: var(--accent); border-color: var(--accent); }
.form-control, .form-select { border-radius: 8px; border-color: var(--border); }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(14,122,110,.15); }

/* ---------- Dashboard-Kacheln ---------- */
.stat-tile {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1rem 1.15rem;
}
.stat-tile .label { font-size: .74rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.stat-tile .value { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.stat-tile .value.accent { color: var(--accent-ink); }

/* ---------- Timeline (Bewerbungs-Detail) ---------- */
.timeline { position: relative; }
.timeline .tl-item { position: relative; padding-left: 1.4rem; padding-bottom: 1.05rem; }
.timeline .tl-item::before {
    content: ""; position: absolute; left: 4px; top: 8px; bottom: -4px;
    width: 2px; background: var(--border);
}
.timeline .tl-item:last-child::before { display: none; }
.timeline .tl-item::after {
    content: ""; position: absolute; left: 0; top: 5px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--surface); border: 2.5px solid var(--accent);
}
.timeline .tl-time { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Syncfusion Kanban-Feinschliff ---------- */
.e-kanban { background: transparent !important; }
.e-kanban .e-kanban-header .e-header-cells {
    background: transparent; border: none; padding: 0 .45rem .4rem;
}
.e-kanban .e-header-cells .e-header-text {
    font-size: .74rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
}
.e-kanban .e-kanban-content .e-content-cells {
    background: #eceff4; border: none !important; border-radius: var(--radius); padding: .45rem;
}
.e-kanban .e-card {
    border: 1px solid var(--border) !important; border-radius: 8px !important;
    box-shadow: var(--shadow) !important;
}
.e-kanban .e-card:hover { border-color: var(--accent) !important; }
.kanban-card .name { font-weight: 600; }
.kanban-card .meta { font-size: .76rem; color: var(--muted); }

/* Kanban: nie quetschen – ab Mindestbreite horizontal scrollen */
#kanban { overflow-x: auto; }
.e-kanban .e-kanban-table { min-width: 1150px; }
.e-kanban .e-card .e-card-content { padding: 0 !important; }

/* ---------- Avatare ---------- */
.avatar {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    display: inline-grid; place-items: center;
    font-size: .78rem; font-weight: 650; color: #fff; letter-spacing: .02em;
}
.avatar.lg { width: 52px; height: 52px; font-size: 1.05rem; }
.avatar.sm { width: 26px; height: 26px; font-size: .62rem; }
.av-0 { background: #0e7a6e; } .av-1 { background: #175cd3; }
.av-2 { background: #b54708; } .av-3 { background: #7f56d9; }
.av-4 { background: #c11574; } .av-5 { background: #3538cd; }
.av-6 { background: #087443; } .av-7 { background: #b42318; }

.name-cell { display: flex; align-items: center; gap: .65rem; }

/* ---------- Filterleiste ---------- */
.filter-bar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-bar .search { max-width: 300px; }
.chip {
    border: 1px solid var(--border); background: var(--surface); color: var(--muted);
    border-radius: 999px; padding: .3rem .85rem; font-size: .82rem; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Phasenverteilung (Dashboard) ---------- */
.stage-dist .row-line { display: flex; align-items: center; gap: .8rem; margin-bottom: .55rem; }
.stage-dist .lbl { width: 9.5rem; font-size: .84rem; color: var(--muted); flex-shrink: 0; }
.stage-dist .bar { flex: 1; height: 10px; background: #eceff4; border-radius: 999px; overflow: hidden; }
.stage-dist .bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.stage-dist .cnt { width: 2.6rem; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: .86rem; }

/* Kanban-Karte v2 */
.kanban-card { display: flex; gap: .6rem; align-items: flex-start; }
.kanban-card .days { font-size: .7rem; color: var(--muted); background: #eef1f5; border-radius: 999px; padding: .1rem .5rem; margin-top: .25rem; display: inline-block; }

/* ---------- Detailkopf + Phasen-Stepper ---------- */
.detail-head { padding: 1.15rem 1.25rem .9rem; }
.detail-head .who { display: flex; gap: .95rem; align-items: center; }
.detail-head h1 { font-size: 1.25rem; margin: 0; }
.detail-head .sub { color: var(--muted); font-size: .9rem; }
.detail-head .contact-row { display: flex; gap: 1.2rem; flex-wrap: wrap; margin-top: .35rem; font-size: .86rem; }
.detail-head .contact-row a { color: var(--accent-ink); text-decoration: none; }
.detail-head .contact-row a:hover { text-decoration: underline; }

.stepper { display: flex; gap: 4px; margin-top: 1rem; }
.stepper form { flex: 1; display: flex; }
.stepper button {
    flex: 1; border: none; cursor: pointer;
    padding: .5rem .3rem; font-size: .78rem; font-weight: 600;
    background: #eceff4; color: var(--muted);
    transition: background .1s ease;
}
.stepper form:first-child button { border-radius: 8px 0 0 8px; }
.stepper form:last-child button { border-radius: 0 8px 8px 0; }
.stepper button:hover { background: var(--accent-soft); color: var(--accent-ink); }
.stepper .done button { background: var(--accent-soft); color: var(--accent-ink); }
.stepper .current button { background: var(--accent); color: #fff; }
.stepper.disabled button { cursor: default; opacity: .55; }

.meta-list { font-size: .86rem; }
.meta-list .row-line { display: flex; justify-content: space-between; gap: 1rem; padding: .34rem 0; border-bottom: 1px dashed var(--border); }
.meta-list .row-line:last-child { border-bottom: none; }
.meta-list .k { color: var(--muted); }

.file-row { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; }
.file-row .icon { width: 30px; height: 30px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-size: .68rem; font-weight: 700; flex-shrink: 0; }

/* Kopier-Buttons an Kontaktdaten */
.copy-btn { border: none; background: none; color: var(--muted); cursor: pointer; padding: 0 .2rem; font-size: .85rem; }
.copy-btn:hover { color: var(--accent-ink); }

/* Foto-Avatare */
img.avatar-img { object-fit: cover; background: #eceff4; }

/* ---------- Sidebar-Zähler, Mitarbeiter-Auswahl ---------- */
.app-nav a .nav-badge {
    margin-left: auto; min-width: 20px; padding: .05rem .4rem; border-radius: 999px;
    background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; text-align: center;
    font-variant-numeric: tabular-nums;
}
.staff-btn { display: inline-flex; align-items: center; gap: .45rem; border: 1px solid var(--border); background: var(--surface); color: var(--ink); }
.staff-btn:hover { border-color: var(--accent); }
.staff-btn.unset { border-style: dashed; color: var(--warn); border-color: #e6c46a; background: var(--warn-soft); }
.avatar.xs { width: 20px; height: 20px; font-size: .55rem; }

/* ---------- WhatsApp: zentraler Posteingang ---------- */
.wa-inbox {
    display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 1rem;
    height: calc(100vh - 150px); min-height: 520px;
}
.wa-list, .wa-pane { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.wa-list-head { padding: .85rem .85rem .6rem; border-bottom: 1px solid var(--border); }
.wa-filters { display: flex; gap: .35rem; flex-wrap: wrap; }
.wa-filters .chip { text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .7rem; }
.chip .chip-n { background: rgba(0,0,0,.08); border-radius: 999px; padding: 0 .38rem; font-size: .7rem; }
.chip.active .chip-n { background: rgba(255,255,255,.25); }
.wa-list-items { overflow-y: auto; flex: 1; }
.wa-list-empty { padding: 2rem 1.2rem; color: var(--muted); text-align: center; font-size: .9rem; }

.wa-item {
    display: flex; gap: .7rem; padding: .7rem .85rem; text-decoration: none; color: var(--ink);
    border-bottom: 1px solid var(--border); border-left: 3px solid transparent;
}
.wa-item:hover { background: #f7f9fb; color: var(--ink); }
.wa-item.selected { background: var(--accent-soft); border-left-color: var(--accent); }
.wa-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .05rem; }
.wa-item-top, .wa-item-bottom { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.wa-item-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-item-time { font-size: .74rem; color: var(--muted); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.wa-item-sub { font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-item-preview { font-size: .84rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-item.unread .wa-item-name, .wa-item.unread .wa-item-preview { color: var(--ink); font-weight: 650; }
.wa-item.unread .wa-item-time { color: var(--accent-ink); font-weight: 600; }
.wa-unread-dot {
    flex-shrink: 0; min-width: 20px; height: 20px; padding: 0 .35rem; border-radius: 999px;
    background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700;
    display: inline-grid; place-items: center; font-variant-numeric: tabular-nums;
}
.wa-item-tags { display: flex; gap: .25rem; align-items: center; margin-top: .3rem; }
.wa-item-tags .badge-soft { font-size: .66rem; padding: .12rem .45rem; }
.avatar.wa-unknown { background: #eef1f5; color: var(--muted); font-size: 1rem; }

.wa-pane-empty { margin: auto; text-align: center; color: var(--muted); padding: 2rem; max-width: 460px; }
.wa-pane-empty-icon svg { width: 44px; height: 44px; color: #b8c2cf; margin-bottom: .6rem; }

/* ---------- WhatsApp: Chat-Panel (Posteingang + Bewerbungsseite) ---------- */
.wa-chat { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.wa-chat.in-detail { height: 640px; }
.wa-head {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: .8rem 1.1rem; border-bottom: 1px solid var(--border);
}
.wa-who { display: flex; gap: .7rem; align-items: center; min-width: 0; }
.wa-title { font-weight: 650; }
.wa-title a { color: var(--ink); text-decoration: none; }
.wa-title a:hover { color: var(--accent-ink); text-decoration: underline; }
.wa-sub { font-size: .8rem; color: var(--muted); }
.min-w-0 { min-width: 0; }

.wa-assign {
    display: flex; align-items: center; gap: .45rem; flex-wrap: wrap;
    padding: .45rem 1.1rem; border-bottom: 1px solid var(--border); background: #fafbfc; font-size: .84rem;
}
.wa-assign .lbl { font-size: .7rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-right: .2rem; }
.wa-person {
    display: inline-flex; align-items: center; gap: .35rem; padding: .1rem .2rem .1rem .15rem;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
.wa-person .x { border: none; background: none; color: var(--muted); padding: 0 .3rem; line-height: 1; font-size: 1rem; }
.wa-person .x:hover { color: var(--danger); }

.wa-feed {
    flex: 1; overflow-y: auto; padding: .9rem 1.1rem 1rem;
    background: #f6f7f9;
    display: flex; flex-direction: column; gap: .3rem;
}
.wa-loading { color: var(--muted); text-align: center; margin: auto; font-size: .88rem; }
.wa-day {
    align-self: center; margin: .7rem 0 .35rem; padding: .15rem .7rem; border-radius: 999px;
    background: #e8ecf1; color: var(--muted); font-size: .72rem; font-weight: 600;
}
.wa-msg { display: flex; }
.wa-msg.out { justify-content: flex-end; }
.wa-bubble {
    max-width: min(78%, 560px); padding: .45rem .7rem .3rem; border-radius: 12px;
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: 0 1px 1px rgba(16, 24, 40, .04);
}
.wa-msg.in .wa-bubble { border-top-left-radius: 4px; }
.wa-msg.out .wa-bubble { background: var(--accent-soft); border-color: #cfe5e1; border-top-right-radius: 4px; }
.wa-msg.failed .wa-bubble { background: var(--danger-soft); border-color: #f3c7c3; }
.wa-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.42; }
.wa-meta { font-size: .7rem; color: var(--muted); text-align: right; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.wa-status { letter-spacing: -.12em; font-weight: 700; }
.wa-status.read { color: var(--info); }
.wa-status.failed { color: var(--danger); letter-spacing: 0; }
.wa-error { font-size: .76rem; color: var(--danger); margin-top: .2rem; }

.wa-compose { border-top: 1px solid var(--border); padding: .7rem 1.1rem .6rem; background: var(--surface); }
.wa-compose textarea {
    width: 100%; resize: vertical; min-height: 58px; max-height: 220px;
    border: 1px solid var(--border); border-radius: 8px; padding: .5rem .65rem;
}
.wa-compose textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(14,122,110,.15); }
.wa-compose textarea:disabled { background: #f3f5f8; }
.wa-compose-actions { display: flex; justify-content: flex-end; align-items: center; gap: .5rem; margin-top: .4rem; }
.wa-hint { font-size: .78rem; color: var(--muted); margin-top: .25rem; min-height: 1em; }
.wa-hint.error { color: var(--danger); }
.wa-empty { padding: 2rem 1.4rem; text-align: center; color: var(--ink); margin: auto; max-width: 440px; }

.wa-link { border-top: 1px solid var(--border); padding: .8rem 1.1rem; background: var(--warn-soft); font-size: .86rem; }
.wa-hits { display: flex; flex-direction: column; gap: 2px; max-height: 170px; overflow-y: auto; }
.wa-hit {
    text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 7px;
    padding: .35rem .6rem; font-size: .84rem;
}
.wa-hit:hover { border-color: var(--accent); }
.wa-foot-actions { padding: .2rem 1.1rem .5rem; text-align: right; }

.wa-sim { margin: .5rem 1.1rem .8rem; font-size: .8rem; color: var(--muted); }
.wa-sim summary { cursor: pointer; }
.wa-sim-global { margin-top: auto; border-top: 1px dashed var(--border); padding-top: .5rem; }

/* Bewerbungsseite: Reiter über Lebenslauf / WhatsApp */
.detail-tabs { display: flex; gap: .2rem; padding: .35rem .6rem 0; border-bottom: 1px solid var(--border); }
.detail-tabs .nav-link {
    border: none; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted);
    font-size: .78rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; padding: .6rem .7rem;
    display: inline-flex; align-items: center; gap: .4rem; background: none;
}
.detail-tabs .nav-link.active { color: var(--ink); border-bottom-color: var(--accent); }
.detail-tabs .tab-badge {
    min-width: 18px; padding: 0 .35rem; border-radius: 999px; background: var(--accent); color: #fff;
    font-size: .66rem; letter-spacing: 0;
}

@media (max-width: 900px) {
    .wa-inbox { grid-template-columns: 1fr; height: auto; }
    .wa-list { max-height: 45vh; }
    .wa-pane { min-height: 70vh; }
}
.wa-check { background: #f6f7f9; border: 1px solid var(--border); border-radius: 8px; padding: .6rem .8rem; font-size: .82rem; white-space: pre-wrap; }
.wa-inbox-tools { display: flex; justify-content: flex-end; margin: -.4rem 0 .6rem; font-size: .84rem; }
