:root {
    --bg: #0e0f12;
    --panel: #171a21;
    --panel-2: #1f2430;
    --line: #2c3342;
    --text: #f1f3f8;
    --muted: #aeb6c7;
    --accent: #ff5b1f;
    --accent-2: #ff8c1a;
    --danger: #ff4d4f;
    --success: #25c26e;
    --shadow: 0 10px 30px rgba(0,0,0,0.35);
    --radius: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background: linear-gradient(180deg, #0b0c10 0%, #11131a 100%);
    color: var(--text);
    min-height: 100vh;
}

.container  { max-width: 1100px; margin: 30px auto; padding: 0 16px 32px; }
.login-wrap { max-width: 520px; margin: 60px auto; padding: 0 16px; }

/* ── Card ── */
.card {
    background: rgba(23,26,33,.97);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* ── Banner / Header ── */
.banner { width: 100%; display: block; object-fit: cover; max-height: 240px; background: #111; }

.header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    display: flex; gap: 12px; align-items: center;
    justify-content: space-between; flex-wrap: wrap;
}

.brand  { display: flex; align-items: center; gap: 12px; }
.logo   { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: #000; border: 1px solid var(--line); }

h1, h2, h3 { margin: 0; }
h3 { font-size: 15px; margin-bottom: 6px; }
.sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ── Header User ── */
.header-user { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-avatar { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--line); object-fit: cover; }
.user-name   { font-weight: 700; font-size: 14px; }
.user-tag    { color: var(--muted); font-size: 12px; }

/* ── Sync Dot ── */
.sync-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
    transition: background .3s;
}
.sync-dot--idle   { background: #57F287; box-shadow: 0 0 6px #57F28740; }
.sync-dot--active { background: #FEE75C; box-shadow: 0 0 6px #FEE75C60; animation: pulse .8s infinite; }
.sync-dot--error  { background: #ED4245; box-shadow: 0 0 6px #ED424560; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── Sync Toast ── */
.sync-toast {
    position: fixed; bottom: 24px; right: 24px;
    background: #1f2430; border: 1px solid var(--line);
    border-radius: 14px; padding: 14px 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
    font-size: 13px; max-width: 340px;
    transform: translateY(20px); opacity: 0;
    transition: all .3s ease; z-index: 9999;
}
.sync-toast--visible { transform: translateY(0); opacity: 1; }

/* ── Content / Panel ── */
.content { padding: 20px; }
.panel {
    background: var(--panel-2); border: 1px solid var(--line);
    border-radius: 14px; padding: 18px;
}

/* ── Login Panel ── */
.login-panel { text-align: center; padding: 24px; }
.login-panel h3 { font-size: 18px; margin-bottom: 8px; }

/* ── Discord Button ── */
.btn-discord {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 10px; background: #5865F2; color: #fff;
    padding: 14px 28px; border-radius: 12px;
    font-weight: 700; font-size: 15px; text-decoration: none;
    border: none; cursor: pointer; width: 100%;
    transition: background .15s, transform .15s;
}
.btn-discord:hover { background: #4752c4; transform: translateY(-1px); }

/* ── Forms ── */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 13px; }
.required { color: var(--danger); }

input, textarea, select {
    width: 100%; border: 1px solid var(--line);
    background: #10131a; color: var(--text);
    border-radius: 10px; padding: 10px 12px;
    font-size: 14px; font-family: inherit;
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255,91,31,.15);
}
input[readonly], textarea[readonly] { background: #0c1119; color: #d7deee; cursor: default; }
textarea { resize: vertical; min-height: 80px; }

.edit-grid {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 12px;
}

/* ── Search ── */
.search-wrap { margin-bottom: 14px; }
.search-wrap input {
    background: #10131a;
    border-color: var(--line);
    border-radius: 10px;
    padding: 9px 14px;
}
.search-wrap input:focus { border-color: var(--accent); }

/* ── Buttons ── */
button {
    border: 1px solid var(--line); background: #10131a; color: var(--text);
    border-radius: 10px; padding: 10px 12px;
    font-size: 14px; font-family: inherit; cursor: pointer;
}
.btn { cursor: pointer; font-weight: 700; transition: .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary   { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border: none; color: #fff; }
.btn-secondary { background: #202635; border-color: var(--line); }
.btn-danger    { background: rgba(255,77,79,.1); border-color: rgba(255,77,79,.4); color: #ff8f90; }
.btn-warn      { background: rgba(254,231,92,.12); border-color: rgba(254,231,92,.35); color: #FEE75C; }
.btn-inline    { width: auto; padding: 7px 12px; font-size: 12px; }

/* ── Alerts ── */
.alert { margin-bottom: 14px; padding: 11px 14px; border-radius: 10px; font-size: 14px; border: 1px solid transparent; }
.alert-success { background: rgba(37,194,110,.1); color: #7ee0a9; border-color: rgba(37,194,110,.3); }
.alert-error   { background: rgba(255,77,79,.1);  color: #ff9ea0; border-color: rgba(255,77,79,.3); }

/* ── Sync Results ── */
.sync-results {
    background: #141922; border: 1px solid var(--line);
    border-radius: 12px; padding: 12px 14px;
    margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px;
}
.sync-item { font-size: 13px; padding: 3px 0; }
.sync-einstellung { color: #57F287; }
.sync-uprank      { color: #8fa3ff; }
.sync-derank      { color: #FEE75C; }
.sync-kuendigung  { color: #ED4245; }
.sync-info        { color: var(--muted); }

/* ── Tabs ── */
.tab-nav { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn {
    width: auto; padding: 9px 14px; border-radius: 10px;
    border: 1px solid var(--line); background: #1b2130;
    color: var(--text); cursor: pointer; font-weight: 700;
    font-size: 13px; transition: .15s ease;
    display: flex; align-items: center; gap: 7px;
}
.tab-btn:hover { transform: translateY(-1px); border-color: rgba(255,140,26,.4); }
.tab-btn.active { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border: none; color: #fff; }
.tab-count { background: rgba(255,255,255,.15); border-radius: 20px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.tab-btn.active .tab-count { background: rgba(0,0,0,.2); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Employee List ── */
.employee-item {
    border: 1px solid var(--line); border-radius: 12px;
    overflow: hidden; background: #141922;
    transition: border-color .15s; margin-bottom: 8px;
}
.employee-item:last-child { margin-bottom: 0; }
.employee-item:hover { border-color: #3a4258; }
.employee-item--former { opacity: .85; }

.employee-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 12px 14px; flex-wrap: wrap;
}

.emp-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }

.emp-initial {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px; color: #fff;
    flex-shrink: 0; text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.emp-initial--former { filter: grayscale(.5); }

.employee-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.emp-discord   { color: var(--muted); font-size: 12px; margin-top: 2px; }

.emp-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.emp-actions { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }

/* ── Rank Badges ── */
.rank-badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 700; letter-spacing: .3px; white-space: nowrap;
}
.rank-gold   { background: linear-gradient(90deg,#ffd700,#ffaa00); color: #1a1200; }
.rank-silver { background: linear-gradient(90deg,#c0c8d8,#9aa3b5); color: #111; }
.rank-bronze { background: linear-gradient(90deg,#cd7f32,#a85e1e); color: #fff; }
.rank-blue   { background: rgba(88,101,242,.25); color: #8fa3ff; border: 1px solid rgba(88,101,242,.45); }
.rank-teal   { background: rgba(87,242,135,.15); color: #57f287; border: 1px solid rgba(87,242,135,.3); }
.rank-gray   { background: rgba(255,255,255,.07); color: var(--muted); border: 1px solid var(--line); }

.tenure-badge { background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 20px; padding: 2px 8px; font-size: 11px; }

/* ── Warning Badges ── */
.warn-badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px; border-radius: 20px;
    font-size: 11px; font-weight: 700; white-space: nowrap;
}
.warn-low  { background: rgba(254,231,92,.15); color: #FEE75C; border: 1px solid rgba(254,231,92,.35); }
.warn-med  { background: rgba(255,140,26,.15);  color: #ff8c1a; border: 1px solid rgba(255,140,26,.35); }
.warn-high { background: rgba(237,66,69,.15);   color: #ED4245; border: 1px solid rgba(237,66,69,.35); }

/* ── Warning List ── */
.warn-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.warn-item { background: #0f1420; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.warn-item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.warn-item-head .small { flex: 1; }
.warn-grund { font-size: 13px; color: #c8d0e0; }
.warn-add-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 10px; }

/* ── Employee Details ── */
.employee-details { display: none; border-top: 1px solid var(--line); padding: 16px; background: #121720; }
.employee-details.open { display: block; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin-bottom: 14px; }
.detail-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.detail-value { font-size: 14px; font-weight: 600; }
.notizen-text { font-weight: 400; font-size: 13px; color: #c8d0e0; white-space: pre-wrap; }

/* ── Timeline ── */
.timeline-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 10px; }
.timeline { display: flex; flex-direction: column; position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line); border-radius: 2px; }
.tl-item { display: flex; align-items: flex-start; gap: 10px; position: relative; padding-bottom: 14px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid; flex-shrink: 0; margin-top: 2px; position: absolute; left: -18px; background: #121720; }
.tl-einstellung .tl-dot { border-color: #57F287; background: rgba(87,242,135,.2); }
.tl-uprank      .tl-dot { border-color: #5865F2; background: rgba(88,101,242,.2); }
.tl-derank      .tl-dot { border-color: #FEE75C; background: rgba(254,231,92,.15); }
.tl-kuendigung  .tl-dot { border-color: #ED4245; background: rgba(237,66,69,.2); }
.tl-body { flex: 1; }
.tl-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tl-type { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.tl-einstellung .tl-type { color: #57F287; }
.tl-uprank      .tl-type { color: #8fa3ff; }
.tl-derank      .tl-type { color: #FEE75C; }
.tl-kuendigung  .tl-type { color: #ED4245; }
.tl-date  { font-size: 11px; color: var(--muted); }
.tl-text  { font-size: 13px; color: #c8d0e0; margin-top: 2px; }
.tl-arrow { color: var(--muted); margin: 0 5px; }

/* ── Bewerbungs-Status-Badges ── */
.bew-status-badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 700; white-space: nowrap;
}
.bstatus-gray   { background: rgba(174,182,199,.12); color: #aeb6c7; border: 1px solid rgba(174,182,199,.3); }
.bstatus-yellow { background: rgba(254,231,92,.12);  color: #FEE75C; border: 1px solid rgba(254,231,92,.35); }
.bstatus-blue   { background: rgba(88,101,242,.18);  color: #8fa3ff; border: 1px solid rgba(88,101,242,.4); }
.bstatus-green  { background: rgba(87,242,135,.12);  color: #57F287; border: 1px solid rgba(87,242,135,.3); }
.bstatus-red    { background: rgba(237,66,69,.12);   color: #ED4245; border: 1px solid rgba(237,66,69,.3); }

/* ── Apply page: status header ── */
.bew-status-header {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px; border-radius: 12px; border: 1px solid;
    margin-bottom: 16px;
}
.bew-status-icon { font-size: 28px; flex-shrink: 0; }
.bew-status-label { font-size: 16px; font-weight: 700; }

/* ── Apply page: Termin box ── */
.bew-termin-box {
    background: rgba(88,101,242,.08);
    border: 1px solid rgba(88,101,242,.3);
    border-radius: 12px; padding: 16px; margin-top: 12px;
}
.bew-termin-title { font-size: 13px; font-weight: 700; color: #8fa3ff; margin-bottom: 6px; }
.bew-termin-value { font-size: 15px; font-weight: 700; }

/* ── Admin panel: Termin counter-proposal box ── */
.termin-counter-box {
    background: rgba(254,231,92,.07);
    border: 1px solid rgba(254,231,92,.35);
    border-radius: 12px; padding: 14px 16px; margin-bottom: 4px;
}
.termin-counter-label { font-size: 12px; font-weight: 700; color: #FEE75C; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.termin-counter-value { font-size: 15px; font-weight: 700; color: #fff; }

/* ── Bewerbungssperren ── */
.sperre-list  { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.sperre-item  { display: flex; align-items: center; justify-content: space-between; gap: 12px;
                background: rgba(237,66,69,.07); border: 1px solid rgba(237,66,69,.2);
                border-radius: 10px; padding: 10px 14px; }
.sperre-info  { flex: 1; min-width: 0; }
.sperre-name  { font-weight: 700; font-size: 14px; }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px,1fr)); gap: 12px; margin-top: 12px; }
.stat-card  { background: #141922; border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--accent); line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 32px 0; color: var(--muted); }
.empty-icon  { font-size: 32px; margin-bottom: 8px; }

/* ── Misc ── */
.top-actions  { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-actions  { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
.link-reset   { text-decoration: none; }
.small        { font-size: 13px; color: var(--muted); }
.footer-note  { margin-top: 16px; font-size: 12px; color: #8892a7; }

/* ── Responsive ── */
@media (max-width: 640px) {
    .employee-head { flex-direction: column; align-items: flex-start; }
    .emp-meta      { align-items: flex-start; }
    .emp-actions   { width: 100%; }
    .emp-actions .btn { flex: 1; text-align: center; }
    .header        { flex-direction: column; align-items: flex-start; }
    .header-user   { width: 100%; }
    .tab-btn       { flex: 1; justify-content: center; }
    .login-wrap    { margin: 20px auto; }
}
