/* ===========================================================
   THOR fleet & tools – Kundenportal
   Design-System (THOR Dunkelblau #001b37)
   =========================================================== */
:root{
  --thor-primary:#001b37;
  --thor-primary-2:#082f57;
  --thor-red:#e2001a;
  --thor-blue:#2271b1;
  --thor-text:#0f172a;
  --thor-muted:#64748b;
  --thor-border:#e2e8f0;
  --thor-bg:#eef1f5;
  --thor-card:#ffffff;
  --thor-shadow:0 10px 30px rgba(15,23,42,.08);
  --thor-shadow-sm:0 8px 24px rgba(15,23,42,.06);
  --thor-radius:16px;
  --thor-ok:#16a34a; --thor-ok-bg:#f0fdf4; --thor-ok-bd:#bbf7d0;
  --thor-warn:#b45309; --thor-warn-bg:#fffbeb; --thor-warn-bd:#fde68a;
  --thor-danger:#dc2626; --thor-danger-bg:#fef2f2; --thor-danger-bd:#fecaca;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:'Segoe UI',Roboto,Arial,Helvetica,sans-serif;
  background:var(--thor-bg);
  color:var(--thor-text);
  font-size:14px;line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
a{color:var(--thor-primary);text-decoration:none}
a:hover{text-decoration:underline}
img{max-width:100%}

/* ---------- Brand / Logo ---------- */
.thor-logo{font-weight:900;letter-spacing:.5px;color:#fff;font-size:22px;line-height:1}
.thor-logo .r{color:var(--thor-red);font-size:.7em;vertical-align:super}
.thor-logo--dark{color:var(--thor-primary)}

/* ===================== APP LAYOUT ===================== */
.app{display:flex;min-height:100vh}
.sidebar{
  width:248px;flex-shrink:0;
  background:linear-gradient(180deg,var(--thor-primary) 0%,var(--thor-primary-2) 100%);
  color:#fff;display:flex;flex-direction:column;
  position:sticky;top:0;height:100vh;
}
.sidebar__brand{padding:22px 22px 18px;border-bottom:1px solid rgba(255,255,255,.14)}
.sidebar__logo{display:block;width:158px;max-width:80%;height:auto}
.sidebar__brand small{display:block;color:rgba(255,255,255,.7);font-size:11px;font-weight:600;margin-top:3px}
.sidebar__scope{padding:12px 20px;font-size:12px;font-weight:800;color:rgba(255,255,255,.78);border-bottom:1px solid rgba(255,255,255,.14);text-transform:uppercase;letter-spacing:.04em}
.sidebar__nav{padding:12px 12px;display:flex;flex-direction:column;gap:2px;overflow-y:auto;flex:1}
.sidebar__section{margin-top:10px;padding-top:10px;border-top:1px solid rgba(255,255,255,.16)}
.nav-item{display:flex;align-items:center;gap:11px;min-height:42px;padding:9px 12px;border-radius:11px;color:#fff !important;font-weight:600;transition:.15s;text-decoration:none !important}
.nav-item:hover{background:rgba(255,255,255,.12);transform:translateX(1px)}
.nav-item.is-active{background:rgba(255,255,255,.18);box-shadow:inset 3px 0 0 rgba(255,255,255,.92)}
.nav-item .ic{width:20px;height:20px;flex-shrink:0;opacity:.92}
.sidebar__footer{padding:14px 18px;border-top:1px solid rgba(255,255,255,.14);font-size:11px;color:rgba(255,255,255,.55)}

.main{flex:1;min-width:0;display:flex;flex-direction:column}
.topbar{
  background:linear-gradient(180deg,var(--thor-primary) 0%,var(--thor-primary-2) 100%);
  color:#fff;padding:14px 24px;display:flex;align-items:center;justify-content:space-between;
  box-shadow:0 14px 32px rgba(0,27,55,.20);
  border-bottom:3px solid var(--thor-red);
}
.topbar__title{font-size:20px;font-weight:800;display:flex;align-items:center;gap:12px}
.topbar__menu{background:rgba(255,255,255,.12);border:none;color:#fff;width:38px;height:38px;border-radius:10px;cursor:pointer;display:none;align-items:center;justify-content:center}
.topbar__user{display:inline-flex;align-items:center;gap:12px}
.topbar__user .chip{display:inline-flex;align-items:center;gap:8px;background:rgba(255,255,255,.12);border:1px solid rgba(255,255,255,.22);border-radius:10px;padding:7px 12px;font-weight:600}
.topbar__user .chip small{opacity:.7;font-weight:500}
.btn-logout{color:#fff !important;background:rgba(255,255,255,.14);border:1px solid rgba(255,255,255,.22);border-radius:9px;padding:8px 14px;font-weight:700;text-decoration:none !important}
.btn-logout:hover{background:rgba(255,255,255,.24)}
.content{padding:24px;max-width:1680px;width:100%;margin:0 auto}

/* ===================== HEADINGS ===================== */
.page-head{margin-bottom:20px;display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap}
.page-head h1{font-size:26px;font-weight:800;margin:0 0 4px;color:var(--thor-primary)}
.page-head p{margin:0;color:var(--thor-muted)}
.page-head__actions{display:flex;gap:10px;flex-wrap:wrap}

/* ===================== CARDS ===================== */
.card{background:var(--thor-card);border:1px solid var(--thor-border);border-radius:var(--thor-radius);box-shadow:var(--thor-shadow);padding:20px}
.card + .card{margin-top:18px}
.card__title{font-size:15px;font-weight:800;margin:0 0 14px;display:flex;align-items:center;justify-content:space-between;gap:10px}
.card__title .actions{display:flex;gap:8px;align-items:center}
.grid{display:grid;gap:18px;align-items:stretch}
.grid-2{grid-template-columns:1fr 1fr}
.grid-3{grid-template-columns:1.4fr 1fr 1fr}
@media(max-width:1180px){.grid-3{grid-template-columns:1fr}}
@media(max-width:900px){.grid-2{grid-template-columns:1fr}}
/* Karten in Grids gleich hoch, Inhalt sauber verteilt */
.grid > .card{display:flex;flex-direction:column}
.grid > .card > .empty{flex:1 1 auto;display:flex;flex-direction:column;align-items:center;justify-content:center;margin:0;min-height:150px}
.grid > .card > .mini-list,.grid > .card > .alerts-list,.grid > .card > .table-wrap{margin-top:2px}

/* ===================== KPI ===================== */
.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:20px}
@media(max-width:1024px){.kpis{grid-template-columns:repeat(2,1fr)}}
@media(max-width:560px){.kpis{grid-template-columns:1fr}}
.kpi{display:flex;flex-direction:column;gap:6px;background:var(--thor-card);border:1px solid var(--thor-border);border-radius:14px;box-shadow:var(--thor-shadow-sm);padding:16px 18px;min-height:112px;text-decoration:none !important;color:inherit;transition:.15s}
a.kpi:hover{transform:translateY(-2px);box-shadow:var(--thor-shadow);border-color:#cbd5e1}
.kpi__icon{width:26px;height:26px;color:var(--thor-primary)}
.kpi__value{font-size:30px;font-weight:900;color:var(--thor-primary);line-height:1}
.kpi__label{font-size:11.5px;font-weight:700;color:var(--thor-muted);text-transform:uppercase;letter-spacing:.05em}
.kpi.is-alert .kpi__icon,.kpi.is-alert .kpi__value{color:var(--thor-red)}

/* ===================== TABLES ===================== */
.table-wrap{overflow-x:auto;border-radius:12px;border:1px solid var(--thor-border)}
table.tbl{width:100%;border-collapse:collapse;background:#fff;font-size:13.5px}
table.tbl thead th{background:var(--thor-primary);color:#fff;text-align:left;padding:11px 12px;font-weight:700;font-size:12.5px;white-space:nowrap;border-right:1px solid rgba(255,255,255,.14)}
table.tbl thead th:last-child{border-right:none}
table.tbl tbody td{padding:10px 12px;border-bottom:1px solid #eef1f5;border-right:1px solid #f1f5f9;vertical-align:middle}
table.tbl tbody td:last-child{border-right:none}
table.tbl tbody tr:hover{background:#f8fafc}
table.tbl tbody tr.clickable{cursor:pointer}
table.tbl .num{text-align:right;font-variant-numeric:tabular-nums}
.empty{padding:28px 20px;text-align:center;color:#8a97a8;border:1px dashed #d9e1ea;border-radius:12px;background:#fbfcfe;font-size:13.5px}
.empty::before{content:"";display:block;width:34px;height:34px;margin:0 auto 10px;border-radius:50%;background:#eef2f7 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 8v4M12 16h.01'/><circle cx='12' cy='12' r='9'/></svg>") center/18px no-repeat}

/* ===================== PILLS / BADGES ===================== */
.pill{display:inline-block;padding:3px 10px;border-radius:999px;font-size:12px;font-weight:700;background:#eef2f7;color:#334155;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}
.pill--ok{background:var(--thor-ok-bg);color:var(--thor-ok);border:1px solid var(--thor-ok-bd)}
.pill--muted{background:#f1f5f9;color:#64748b}
.pill--danger{background:var(--thor-danger-bg);color:var(--thor-danger);border:1px solid var(--thor-danger-bd)}
.pill--warn{background:var(--thor-warn-bg);color:var(--thor-warn);border:1px solid var(--thor-warn-bd)}
.pill--blue{background:#e8f0fb;color:#1d4ed8}
.lvl-hoch{background:var(--thor-danger-bg);color:var(--thor-danger);border:1px solid var(--thor-danger-bd)}
.lvl-mittel{background:var(--thor-warn-bg);color:var(--thor-warn);border:1px solid var(--thor-warn-bd)}
.lvl-niedrig{background:#eff6ff;color:#1d4ed8}
.lvl-info{background:#f1f5f9;color:#475569}

/* ===================== BUTTONS ===================== */
.btn{display:inline-flex;align-items:center;gap:8px;height:38px;padding:0 16px;border-radius:10px;border:1px solid #cbd5e1;background:#fff;color:#0f172a;font-weight:700;font-size:13.5px;cursor:pointer;text-decoration:none !important;transition:.15s;white-space:nowrap}
.btn:hover{border-color:#94a3b8;background:#f8fafc}
.btn .ic{width:17px;height:17px}
.btn--primary{background:var(--thor-primary);border-color:var(--thor-primary);color:#fff !important}
.btn--primary:hover{background:#062a4e;border-color:#062a4e}
.btn--blue{background:var(--thor-blue);border-color:var(--thor-blue);color:#fff !important}
.btn--danger{background:#fff;border-color:var(--thor-danger-bd);color:var(--thor-danger) !important}
.btn--danger:hover{background:var(--thor-danger-bg)}
.btn--sm{height:31px;padding:0 12px;font-size:12.5px;border-radius:8px}
.btn--ghost{background:transparent;border-color:transparent}
.btn[disabled]{opacity:.55;cursor:not-allowed}

/* ===================== FORMS ===================== */
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.form-grid .full{grid-column:1/-1}
@media(max-width:780px){.form-grid{grid-template-columns:1fr}}
.field label{display:block;font-size:13px;font-weight:700;color:#334155;margin-bottom:6px}
.field .hint{font-size:12px;color:var(--thor-muted);margin-top:4px}
.field input[type=text],.field input[type=email],.field input[type=password],.field input[type=date],
.field input[type=number],.field input[type=tel],.field select,.field textarea{
  width:100%;padding:10px 12px;border:1px solid #cbd5e1;border-radius:10px;font-size:14px;font-family:inherit;background:#fff;color:#0f172a;transition:.15s
}
.field input:focus,.field select:focus,.field textarea:focus{outline:none;border-color:var(--thor-primary);box-shadow:0 0 0 3px rgba(0,27,55,.10)}
.field textarea{resize:vertical;min-height:96px}
.field .req{color:var(--thor-red)}
.form-actions{display:flex;gap:12px;margin-top:20px;padding-top:18px;border-top:1px solid var(--thor-border)}
fieldset.group{border:1px solid var(--thor-border);border-radius:12px;padding:16px 18px;margin:0 0 18px}
fieldset.group legend{font-weight:800;color:var(--thor-primary);padding:0 8px;font-size:14px}
.checkline{display:flex;align-items:center;gap:10px}
.checkline input{width:auto}

/* ===================== FLASH / NOTICE ===================== */
.notice{padding:12px 16px;border-radius:10px;margin-bottom:16px;border-left:4px solid #94a3b8;background:#fff;box-shadow:var(--thor-shadow-sm);font-weight:600}
.notice--success{border-color:var(--thor-ok);background:var(--thor-ok-bg)}
.notice--error{border-color:var(--thor-danger);background:var(--thor-danger-bg)}
.notice--info{border-color:var(--thor-blue);background:#eff6ff}
.notice--warning{border-color:var(--thor-warn);background:var(--thor-warn-bg)}

/* ===================== QUICK ACCESS ===================== */
.qa-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:14px}
.qa-card{display:flex;align-items:center;gap:12px;padding:15px 16px;border-radius:14px;border:2px solid rgba(0,27,55,.14);background:#fff;box-shadow:var(--thor-shadow-sm);font-weight:700;color:#0f172a !important;text-decoration:none !important;transition:.15s;min-height:60px}
.qa-card:hover{border-color:rgba(0,27,55,.42);transform:translateY(-2px);color:var(--thor-primary) !important}
.qa-card .ic{width:24px;height:24px;color:var(--thor-primary);flex-shrink:0}

/* ===================== LIST WIDGETS ===================== */
.mini-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}
.mini-list li{padding:9px 4px;border-bottom:1px solid #f1f5f9;display:flex;justify-content:space-between;gap:10px}
.mini-list li:last-child{border-bottom:none}
.mini-list .t{font-weight:600}
.mini-list .d{color:var(--thor-muted);font-size:12.5px;white-space:nowrap}
.alerts-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.alerts-list li{padding:10px 12px;border-radius:10px;border:1px solid var(--thor-border);border-left-width:4px;background:#fff}
.alerts-list li.alert-hoch{border-left-color:var(--thor-danger)}
.alerts-list li.alert-mittel{border-left-color:var(--thor-warn)}
.alerts-list li.alert-niedrig,.alerts-list li.alert-info{border-left-color:var(--thor-blue)}
.alerts-list .a-t{font-weight:700}
.alerts-list .a-m{font-size:12.5px;color:var(--thor-muted);margin-top:2px}

/* ===================== TOOLBAR / SEARCH ===================== */
.toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:14px}
.toolbar .spacer{flex:1}
.search-input{position:relative}
.search-input input{padding-left:34px;min-width:240px}
.search-input .ic{position:absolute;left:10px;top:50%;transform:translateY(-50%);width:16px;height:16px;color:#94a3b8}

/* ===================== MODAL ===================== */
.modal{position:fixed;inset:0;background:rgba(17,24,39,.55);display:none;align-items:flex-start;justify-content:center;padding:40px 16px;z-index:1000;overflow:auto}
.modal.is-open{display:flex}
.modal__box{background:#fff;border-radius:16px;box-shadow:0 30px 90px rgba(0,0,0,.28);width:min(720px,100%);overflow:hidden}
.modal__head{padding:16px 20px;background:linear-gradient(180deg,var(--thor-primary),var(--thor-primary-2));color:#fff;display:flex;justify-content:space-between;align-items:center}
.modal__head h3{margin:0;font-size:16px}
.modal__close{background:rgba(255,255,255,.15);border:none;color:#fff;width:32px;height:32px;border-radius:8px;cursor:pointer;font-size:18px}
.modal__body{padding:20px;max-height:70vh;overflow:auto}
.kv{width:100%;border-collapse:collapse}
.kv td{padding:8px 10px;border-bottom:1px solid #f1f5f9;vertical-align:top}
.kv td:first-child{color:var(--thor-muted);width:38%;font-weight:600}

/* ===================== AUTH / LOGIN ===================== */
.auth{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;
  background:linear-gradient(135deg,#0b1320,#001b37 55%,#082f57);position:relative}
.auth__card{background:rgba(255,255,255,.98);border-radius:22px;box-shadow:0 30px 80px rgba(0,0,0,.45);width:min(430px,100%);padding:38px 34px;position:relative;overflow:hidden}
.auth__card::before{content:"";position:absolute;left:0;top:0;right:0;height:5px;background:linear-gradient(90deg,var(--thor-primary),var(--thor-red))}
.auth__brand{text-align:center;margin-bottom:10px}
.auth__brand img{width:210px;max-width:72%;height:auto}
.auth__brand .thor-logo{color:var(--thor-primary)}
.auth__eyebrow{text-align:center;color:var(--thor-muted);font-size:12px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;margin-bottom:18px}
.auth h1{font-size:22px;text-align:center;margin:0 0 6px;color:var(--thor-primary)}
.auth .sub{text-align:center;color:var(--thor-muted);margin:0 0 22px}
.auth .field{margin-bottom:16px}
.auth .btn{width:100%;justify-content:center;height:44px}
.auth__foot{text-align:center;margin-top:16px;font-size:13px}

/* ===================== INSTALL ===================== */
.install{max-width:640px;margin:40px auto;padding:0 16px}
.install .card{padding:28px}
.status-line{display:flex;justify-content:space-between;padding:8px 0;border-bottom:1px solid #f1f5f9}

/* ===================== SIGNATURE PAD ===================== */
.sigpad-wrap{border:1px solid #cbd5e1;border-radius:10px;background:#fff;overflow:hidden}
.sigpad{display:block;width:100%;height:180px;touch-action:none;cursor:crosshair}
.sigpad-bar{display:flex;justify-content:space-between;align-items:center;padding:6px 10px;background:#f8fafc;border-top:1px solid #e2e8f0;font-size:12px;color:var(--thor-muted)}

/* ===================== UPLOAD PREVIEW ===================== */
.upl-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:10px;margin-top:10px}
.upl-grid a{display:block;border:1px solid var(--thor-border);border-radius:10px;overflow:hidden;background:#fff}
.upl-grid img{display:block;width:100%;height:90px;object-fit:cover}
.upl-grid .name{padding:6px 8px;font-size:11px;color:var(--thor-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* ===================== HELPERS ===================== */
.muted{color:var(--thor-muted)}
.text-right{text-align:right}
.mt-0{margin-top:0}.mb-0{margin-bottom:0}
.flex{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.hidden{display:none !important}
.tag-row{display:flex;gap:6px;flex-wrap:wrap}
.stat-tiles{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:16px}
@media(max-width:780px){.stat-tiles{grid-template-columns:repeat(2,1fr)}}
.stat-tile{background:#fff;border:1px solid var(--thor-border);border-radius:12px;padding:14px 16px;box-shadow:var(--thor-shadow-sm)}
.stat-tile .v{font-size:28px;font-weight:900;color:var(--thor-primary)}
.stat-tile .l{font-size:12.5px;color:var(--thor-muted);font-weight:700}
.pager{display:flex;gap:6px;align-items:center;justify-content:center;margin-top:16px;flex-wrap:wrap}
.pager a,.pager span{min-width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;border-radius:9px;border:1px solid var(--thor-border);background:#fff;font-weight:700;padding:0 8px;text-decoration:none}
.pager .current{background:var(--thor-primary);color:#fff;border-color:var(--thor-primary)}
.pager .disabled{opacity:.4;pointer-events:none}

/* ===================== RESPONSIVE SIDEBAR ===================== */
@media(max-width:1024px){
  .app.sidebar-collapsed .sidebar{display:none}
  .topbar__menu{display:inline-flex}
  .sidebar{position:fixed;z-index:1200;left:0;top:0}
  .app:not(.sidebar-open) .sidebar{display:none}
  .app.sidebar-open .sidebar{display:flex}
}
