/* RWD Teamplanung — Basic Styles (Phase 11a) */
:root {
    --rwd-blue-900: #14375E;
    --rwd-blue-700: #1F4E7A;
    --rwd-teal-600: #2BA587;
    --bg: #f3f4f6;
    --border: #e5e7eb;
    --text: #1d2330;
    --text-muted: #6b7280;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: 'Inter', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px; background: var(--rwd-blue-900); color: #fff;
    display: flex; flex-direction: column; padding: 18px 14px;
    position: fixed; left: 0; top: 0; bottom: 0;
}
.sidebar-header { display: flex; flex-direction: column; align-items: center; padding-bottom: 14px; margin-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo { width: 120px; max-width: 100%; height: auto; margin-bottom: 8px; }
.sidebar-brand { font-size: 14px; font-weight: 700; color: rgba(255,255,255,0.92); letter-spacing: 0.4px; text-transform: uppercase; }
.sidebar-header .brand { font-size: 18px; font-weight: 700; margin-bottom: 14px; }  /* legacy */
.mandant-pill { display: flex; gap: 4px; background: rgba(255,255,255,0.1); border-radius: 999px; padding: 3px; margin-bottom: 18px; }
.mandant-pill a {
    flex: 1; text-align: center; padding: 6px 8px; border-radius: 999px;
    color: rgba(255,255,255,0.7); text-decoration: none; font-size: 11.5px; font-weight: 600;
}
.mandant-pill a.active { background: #fff; color: var(--rwd-blue-900); }
.sidebar-nav { flex: 1; }
.nav-link {
    display: block; padding: 9px 12px; color: rgba(255,255,255,0.78);
    text-decoration: none; border-radius: 7px; margin-bottom: 2px; font-size: 13.5px;
}
.nav-link:hover { background: rgba(255,255,255,0.12); color: #fff; }
.nav-link.active { background: rgba(255,255,255,0.22); color: #fff; font-weight: 600; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.12); padding-top: 12px; }
.sidebar-footer .user { font-size: 12px; color: rgba(255,255,255,0.7); margin-bottom: 8px; }
.btn-logout {
    width: 100%; background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.2);
    padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 12px;
}

.main { margin-left: 240px; flex: 1; padding: 24px; }

h1 { font-size: 22px; font-weight: 700; margin: 0 0 16px; }

.card { background: #fff; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; }
.card-header { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13.5px; }
.card-body { padding: 16px; }

.text-muted { color: var(--text-muted); }
.small { font-size: 12px; }
.btn { display: inline-block; padding: 8px 16px; border-radius: 7px; border: 1px solid transparent; cursor: pointer; font-size: 14px; font-weight: 500; text-decoration: none; }
.btn-primary { background: var(--rwd-blue-700); color: #fff; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.w-100 { width: 100%; }

/* Login-Page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--rwd-blue-900); padding: 20px; }
.login-card { background: #fff; padding: 32px; border-radius: 14px; max-width: 420px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.3); border-top: 4px solid var(--rwd-teal-600); }
.login-card h2 { margin-top: 0; }
.mt-3 { margin-top: 14px; }

/* ─── Wochenplanungs-UI ─────────────────────────────────────────────────── */
.plan-toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.kw-tabs { display: flex; gap: 4px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.kw-tab {
    padding: 8px 14px; border-radius: 7px; border: none; background: transparent;
    cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-muted);
    display: flex; flex-direction: column; align-items: center; min-width: 64px; line-height: 1.2;
}
.kw-tab:hover { background: #f3f4f6; color: var(--text); }
.kw-tab.active { background: var(--rwd-blue-700); color: #fff; }
.kw-tab .kw-num { font-size: 15px; }
.kw-tab .kw-jahr { font-size: 10.5px; font-weight: 500; opacity: 0.7; }
.kw-tab.active .kw-jahr { opacity: 0.9; }

.kw-nav { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.kw-nav .kw-sep { color: var(--border); margin: 0 4px; }
.kw-nav .kw-jump-label { color: var(--text-muted); font-size: 11.5px; }
.kw-nav .kw-jump-input { width: 56px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 12.5px; text-align: center; }
.kw-nav .kw-jump-input-jahr { width: 70px; }
.btn-nav {
    width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: #fff;
    cursor: pointer; font-size: 16px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
    color: var(--text); padding: 0;
}
.btn-nav:hover { background: #f3f4f6; }
.btn-nav.btn-nav-go { background: var(--rwd-teal-600); color: #fff; border-color: var(--rwd-teal-600); }
.btn-nav.btn-nav-go:hover { background: #239673; }

.gewerk-pill { display: flex; gap: 4px; background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.gewerk-pill button {
    padding: 6px 14px; border-radius: 999px; border: none; background: transparent;
    cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-muted);
}
.gewerk-pill button.active { background: var(--rwd-teal-600); color: #fff; }

.plan-grid { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }

/* MA-Pool links */
.ma-pool { background: #fff; border: 1px solid var(--border); border-radius: 10px; position: sticky; top: 16px; max-height: calc(100vh - 100px); overflow: hidden; display: flex; flex-direction: column; }
.ma-pool-header { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.ma-pool-header h3 { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.ma-pool-header input[type=search] { width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 12.5px; margin-bottom: 8px; }
.ma-pool-filters { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.ma-pool-filters label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.ma-pool-filters select { padding: 5px 8px; border: 1px solid var(--border); border-radius: 5px; font-size: 12px; }
.ma-pool-list { flex: 1; overflow-y: auto; padding: 8px; }
.ma-pool-empty { text-align: center; padding: 30px 12px; color: var(--text-muted); font-size: 12.5px; }

.ma-card {
    background: #f9fafb; border: 1px solid var(--border); border-radius: 8px;
    padding: 8px 10px; margin-bottom: 5px; cursor: grab; user-select: none;
    display: flex; align-items: center; gap: 8px; transition: background .12s, transform .12s;
}
.ma-card:hover { background: #eef2f6; }
.ma-card:active { cursor: grabbing; }
.ma-card.dragging { opacity: 0.45; transform: scale(0.97); }
.ma-card.abwesend { background: #fef3f2; opacity: 0.7; cursor: not-allowed; }
.ma-card.abwesend .ma-card-name { text-decoration: line-through; text-decoration-color: rgba(0,0,0,0.3); }
.ma-card-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--rwd-blue-700); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.ma-card.teamleiter .ma-card-icon { background: var(--rwd-teal-600); }
.ma-card.abwesend .ma-card-icon { background: #b91c1c; }
.ma-card-body { flex: 1; min-width: 0; }
.ma-card-name { font-size: 12.5px; font-weight: 600; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-card-meta { font-size: 10.5px; color: var(--text-muted); }
.ma-card-status { font-size: 14px; }

/* Team-Bloecke rechts */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.team-block { background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.team-block-header { padding: 10px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; border-left: 4px solid var(--rwd-blue-700); }
.team-block-header.gewerk-sysr { border-left-color: var(--rwd-teal-600); }
.team-block-title { flex: 1; }
.team-block-name { font-size: 13.5px; font-weight: 700; line-height: 1.2; cursor: text; user-select: text; }
.team-block-name:hover { background: rgba(255,255,255,0.4); border-radius: 4px; padding: 1px 4px; margin: -1px -4px; }
.team-block-name-edit {
    font-size: 13.5px; font-weight: 700; line-height: 1.2; width: 100%;
    border: 1px solid var(--rwd-teal-600); border-radius: 4px; padding: 2px 6px;
    background: #fff; color: var(--text); outline: none;
}
.kw-name-badge { color: var(--rwd-teal-600); font-size: 10px; margin-left: 4px; }
.team-block-kunde { font-size: 11px; color: var(--text-muted); }
.team-block-count { font-size: 11px; background: #eef2f6; padding: 2px 7px; border-radius: 999px; color: var(--text-muted); }
.team-block-body { padding: 8px; min-height: 80px; }
.team-block.drag-hover { outline: 2px dashed var(--rwd-teal-600); outline-offset: -2px; }
.team-block.drag-hover .team-block-body { background: #ecfdf5; }
.team-block.drag-forbidden { outline: 2px dashed #dc2626; outline-offset: -2px; }
.team-block.drag-forbidden .team-block-body { background: #fef2f2; }
.ma-pool.drag-hover { outline: 2px dashed #d97706; outline-offset: -3px; background: #fffbeb; }

.ma-picker-option:hover { background: #f3f4f6; }

.rolle-popup {
    position: absolute; z-index: 80;
    background: #fff; border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 8px 22px rgba(0,0,0,0.18); padding: 4px;
    display: flex; gap: 2px;
}
.rolle-popup button {
    border: none; background: transparent; padding: 5px 10px; font-size: 11px;
    font-weight: 700; border-radius: 5px; cursor: pointer; min-width: 36px;
}
.rolle-popup button.rolle-tl { color: #065f46; }
.rolle-popup button.rolle-tl:hover { background: #ecfdf5; }
.rolle-popup button.rolle-fa { color: #9a3412; }
.rolle-popup button.rolle-fa:hover { background: #fff7ed; }
.rolle-popup button.rolle-tlfa { color: #065f46; background: linear-gradient(90deg, #ecfdf5 50%, #fff7ed 50%); }
.rolle-popup button.rolle-tlfa:hover { box-shadow: inset 0 0 0 1px var(--rwd-teal-600); }
.rolle-popup button.rolle-ma { color: var(--text); }
.rolle-popup button.rolle-ma:hover { background: #f3f4f6; }


.team-empty-hint { text-align: center; padding: 20px 8px; color: var(--text-muted); font-size: 11.5px; font-style: italic; }
.team-stamm-badge { font-size: 10px; color: var(--text-muted); text-align: center; padding: 2px 0 4px; font-style: italic; }
/* Stamm-Default: dezenter visueller Marker, kein „inaktiv"-Effekt */
.team-row.from-stamm { border-left-style: dashed; }

.team-row {
    display: flex; align-items: center; gap: 7px; padding: 5px 7px; border-radius: 6px;
    background: #f3f6fa; margin-bottom: 4px; font-size: 12px;
    border-left: 3px solid #cbd5e1;
}
.team-row.rolle-teamleiter { background: #ecfdf5; border-left-color: var(--rwd-teal-600); }
.team-row.rolle-fahrer    { background: #fff7ed; border-left-color: #f97316; }
.team-row.rolle-mannschaft { background: #f3f6fa; border-left-color: #94a3b8; }
.team-row.rolle-teamleiterundfahrer {
    background: linear-gradient(90deg, #ecfdf5 0%, #ecfdf5 50%, #fff7ed 50%, #fff7ed 100%);
    border-left-color: var(--rwd-teal-600);
}
.team-row.rolle-teamleiterundfahrer .team-row-rolle { background: #fff; border-color: var(--rwd-teal-600); color: #065f46; font-weight: 800; }
.team-row-rolle {
    font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-muted);
    flex-shrink: 0; padding: 2px 6px; border-radius: 4px;
    background: rgba(255,255,255,0.55); border: 1px solid rgba(0,0,0,0.06);
    cursor: pointer; transition: all .12s; user-select: none; line-height: 1;
}
.team-row-rolle::after { content: " ▾"; font-size: 8px; opacity: 0.55; }
.team-row-rolle:hover { background: #fff; border-color: var(--rwd-teal-600); color: var(--text); }
.team-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-row-remove {
    background: transparent; border: none; cursor: pointer; color: #b91c1c; padding: 2px 4px;
    font-size: 12px; opacity: 0; border-radius: 4px; transition: opacity .1s;
}
.team-row:hover .team-row-remove { opacity: 0.55; }
.team-row-remove:hover { opacity: 1 !important; background: #fee2e2; }
.team-row-warn { color: #d97706; font-size: 13px; cursor: help; margin-right: 2px; }
.team-row[draggable=true] { cursor: grab; }
.team-row[draggable=true]:active { cursor: grabbing; }
.team-row.dragging { opacity: 0.5; }

/* Toolbar Buttons */
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #f3f4f6; }
.btn-icon { padding: 6px 10px; font-size: 13px; }

/* Toast — schwebende Hinweise (Drop bei Krank, etc.) */
.toast-wrap { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
    background: #1f2937; color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 12.5px;
    min-width: 240px; max-width: 360px; box-shadow: 0 8px 22px rgba(0,0,0,0.25);
    animation: toastIn .14s ease-out;
}
.toast.warn { background: #d97706; }
.toast.err { background: #b91c1c; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 60; }
.modal { background: #fff; border-radius: 12px; padding: 22px; min-width: 380px; max-width: 520px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal h3 { margin: 0 0 14px; font-size: 17px; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.form-row input, .form-row select, .form-row textarea {
    width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.flex-spacer { flex: 1; }
