*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:     #6366f1;
    --primary-dk:  #4f46e5;
    --border:      rgba(255,255,255,.12);
    --text:        rgba(255,255,255,.92);
    --text-muted:  rgba(255,255,255,.45);
    --text-sub:    rgba(255,255,255,.35);
    --danger:      #f87171;
    --success:     #34d399;
    --warning:     #fbbf24;
    --radius:      10px;
}

html, body { height: 100%; }

body {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--text);
    min-height: 100vh;
    background: linear-gradient(135deg, #0f2942 0%, #1a3a5c 40%, #0d2d4a 70%, #081c30 100%);
    background-attachment: fixed;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    width: 500px; height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(30,100,180,.45), transparent 70%);
    top: -120px; left: 80px;
    pointer-events: none; z-index: 0;
}
body::after {
    content: '';
    position: fixed;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(15,80,150,.35), transparent 70%);
    bottom: -60px; right: 120px;
    pointer-events: none; z-index: 0;
}

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box {
    background: rgba(255,255,255,.1);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
}
.login-box h1 { font-size: 1.4rem; font-weight: 700; color: #fff; margin-bottom: 1.8rem; text-align: center; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .75rem; font-weight: 500; margin-bottom: .35rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: .55rem .85rem;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: var(--radius);
    font-size: .9rem;
    color: #fff;
    background: rgba(255,255,255,.08);
    transition: border-color .15s, box-shadow .15s;
}
.form-group input::placeholder { color: rgba(255,255,255,.3); }
.form-group select option { background: #1e293b; color: #fff; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: rgba(99,102,241,.6); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem 1rem; border-radius: 20px; font-size: .85rem; font-weight: 500; cursor: pointer; border: none; text-decoration: none; transition: all .15s; white-space: nowrap; }
.btn-primary  { background: rgba(99,102,241,.25); color: #a5b4fc; border: 1px solid rgba(99,102,241,.35); }
.btn-primary:hover { background: rgba(99,102,241,.35); color: #c7d2fe; }
.btn-danger   { background: rgba(248,113,113,.2); color: #fca5a5; border: 1px solid rgba(248,113,113,.3); }
.btn-danger:hover { background: rgba(248,113,113,.3); }
.btn-outline  { background: rgba(255,255,255,.08); color: var(--text-muted); border: 1px solid rgba(255,255,255,.12); }
.btn-outline:hover { background: rgba(255,255,255,.12); color: var(--text); }
.btn-block    { width: 100%; justify-content: center; }

/* Alerts */
.alert { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .88rem; }
.alert-error   { background: rgba(248,113,113,.15); color: #fca5a5; border: 1px solid rgba(248,113,113,.25); }
.alert-success { background: rgba(52,211,153,.15); color: #6ee7b7; border: 1px solid rgba(52,211,153,.25); }

/* App Layout */
.app-layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }

/* Sidebar */
.sidebar {
    width: 220px;
    background: rgba(255,255,255,.08);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid rgba(255,255,255,.1);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar .logo { font-size: 1rem; font-weight: 700; color: #fff; padding: 1.4rem 1.2rem 1rem; letter-spacing: .02em; border-bottom: 1px solid rgba(255,255,255,.07); margin-bottom: .5rem; }
.sidebar nav { flex: 1; padding: .5rem .75rem; }
.sidebar a { display: flex; align-items: center; gap: .65rem; padding: .55rem .75rem; border-radius: var(--radius); color: rgba(255,255,255,.5); text-decoration: none; font-size: .88rem; transition: background .15s, color .15s; margin-bottom: .2rem; }
.sidebar a:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.75); }
.sidebar a.active { background: rgba(99,102,241,.2); color: #a5b4fc; font-weight: 500; }
.sidebar a i { font-size: 18px; }
.sidebar-footer { padding: 1rem 1.2rem; border-top: 1px solid rgba(255,255,255,.07); font-size: .8rem; color: var(--text-muted); }
.sidebar-footer strong { display: block; color: rgba(255,255,255,.8); font-size: .88rem; margin-bottom: .2rem; }
.sidebar-footer a { color: #f87171; font-size: .78rem; text-decoration: none; }

/* Main */
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { position: relative; height: 52px; background: rgba(255,255,255,.08); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; flex-shrink: 0; position: sticky; top: 0; z-index: 10; }
.topbar h2 { font-size: 1rem; font-weight: 600; color: #fff; }
.page-body { padding: 1.5rem; flex: 1; }

/* Stat Cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 12px; margin-bottom: 1.5rem; }
.stat-card {
    background: rgba(255,255,255,.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 16px;
    padding: 1.1rem 1.25rem;
    position: relative;
    overflow: hidden;
    transition: transform .15s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-glow { position: absolute; width: 80px; height: 80px; border-radius: 50%; opacity: .35; top: -20px; right: -20px; filter: blur(20px); pointer-events: none; }
.stat-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: .75rem; }
.stat-icon i { font-size: 20px; }
.stat-label { font-size: .72rem; font-weight: 600; color: rgba(255,255,255,.45); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .35rem; }
.stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1; margin-bottom: .25rem; }
.stat-sub { font-size: .72rem; color: rgba(255,255,255,.35); }
.stat-accent { position: absolute; bottom: 0; left: 0; right: 0; height: 2px; }

.stat-card.c-indigo .stat-glow  { background: #6366f1; }
.stat-card.c-indigo .stat-icon  { background: rgba(99,102,241,.2); }
.stat-card.c-indigo .stat-icon i{ color: #a5b4fc; }
.stat-card.c-indigo .stat-value { color: #a5b4fc; }
.stat-card.c-indigo .stat-accent{ background: linear-gradient(90deg,transparent,#6366f1,transparent); }

.stat-card.success .stat-glow   { background: #10b981; }
.stat-card.success .stat-icon   { background: rgba(16,185,129,.2); }
.stat-card.success .stat-icon i { color: #6ee7b7; }
.stat-card.success .stat-value  { color: #6ee7b7; }
.stat-card.success .stat-accent { background: linear-gradient(90deg,transparent,#10b981,transparent); }

.stat-card.warn .stat-glow      { background: #f59e0b; }
.stat-card.warn .stat-icon      { background: rgba(245,158,11,.15); }
.stat-card.warn .stat-icon i    { color: #fde68a; }
.stat-card.warn .stat-value     { color: #fde68a; }
.stat-card.warn .stat-accent    { background: linear-gradient(90deg,transparent,#f59e0b,transparent); }

.stat-card.danger .stat-glow    { background: #ef4444; }
.stat-card.danger .stat-icon    { background: rgba(239,68,68,.15); }
.stat-card.danger .stat-icon i  { color: #fca5a5; }
.stat-card.danger .stat-value   { color: #fca5a5; }
.stat-card.danger .stat-accent  { background: linear-gradient(90deg,transparent,#ef4444,transparent); }

/* Two col */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Card */
.card { background: rgba(255,255,255,.1); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,.13); border-radius: 14px; overflow: hidden; margin-bottom: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: .85rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.07); }
.card-head span { font-size: .88rem; font-weight: 600; color: rgba(255,255,255,.9); }
.card-head a { font-size: .78rem; color: #93c5fd; text-decoration: none; }

/* Alert rows */
.alert-row { display: flex; align-items: center; gap: .75rem; padding: .75rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.alert-row:last-child { border-bottom: none; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-red   { background: #f87171; box-shadow: 0 0 6px rgba(248,113,113,.6); }
.dot-amber { background: #fbbf24; box-shadow: 0 0 6px rgba(251,191,36,.5); }
.dot-green { background: #34d399; box-shadow: 0 0 6px rgba(52,211,153,.5); }
.alert-info { flex: 1; min-width: 0; }
.alert-title { font-size: .85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: rgba(255,255,255,.85); }
.alert-meta  { font-size: .72rem; color: var(--text-muted); margin-top: 1px; }

/* Contract rows */
.contract-row { display: flex; align-items: center; gap: .75rem; padding: .75rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.contract-row:last-child { border-bottom: none; }
.contract-icon { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1rem; }
.contract-name { font-size: .85rem; font-weight: 500; color: rgba(255,255,255,.85); }
.contract-meta { font-size: .72rem; color: var(--text-muted); margin-top: 1px; }
.contract-val  { font-size: .85rem; font-weight: 600; color: rgba(255,255,255,.75); text-align: right; white-space: nowrap; }
.contract-interval { font-size: .7rem; color: var(--text-sub); text-align: right; }

/* Badge */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 99px; font-size: .72rem; font-weight: 600; }
.badge-days-red   { background: rgba(248,113,113,.2); color: #fca5a5; border: 1px solid rgba(248,113,113,.3); }
.badge-days-amber { background: rgba(251,191,36,.15); color: #fde68a; border: 1px solid rgba(251,191,36,.25); }
.badge-days-green { background: rgba(52,211,153,.15); color: #6ee7b7; border: 1px solid rgba(52,211,153,.25); }
.badge-aktiv      { background: rgba(52,211,153,.15); color: #6ee7b7; border: 1px solid rgba(52,211,153,.2); }
.badge-gekuendigt { background: rgba(248,113,113,.15); color: #fca5a5; border: 1px solid rgba(248,113,113,.2); }
.badge-abgelaufen { background: rgba(251,191,36,.12); color: #fde68a; border: 1px solid rgba(251,191,36,.2); }
.badge-pausiert   { background: rgba(255,255,255,.08); color: rgba(255,255,255,.4); border: 1px solid rgba(255,255,255,.1); }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; padding: .65rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); color: var(--text-muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
td { padding: .7rem 1rem; border-bottom: 1px solid rgba(255,255,255,.05); color: rgba(255,255,255,.8); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.04); }

/* Filter bar */
.filter-bar { background: rgba(255,255,255,.08); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 1rem 1.1rem; margin-bottom: 1rem; display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.filter-bar .form-group { margin: 0; min-width: 160px; flex: 1; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.page-header h2 { font-size: 1.1rem; font-weight: 700; color: #fff; }

/* Ampelsystem */
.ampel { display:inline-block; width:.65rem; height:.65rem; border-radius:50%; margin-right:.45rem; vertical-align:middle; flex-shrink:0; }
.ampel-red    { background:#f87171; box-shadow:0 0 6px rgba(248,113,113,.5); }
.ampel-amber  { background:#fbbf24; box-shadow:0 0 6px rgba(251,191,36,.5); }
.ampel-green  { background:#34d399; box-shadow:0 0 6px rgba(52,211,153,.5); }
.ampel-grey   { background:rgba(255,255,255,.2); }
