/* Shared shell for Distributionsportal + Global Admin (Reseller-ähnlich, eigene Accents). */
:root{
  color-scheme:light;
  --bg:#eef2f7; --bg2:#e7edf4; --card:#ffffff; --surface2:#f6f9fc; --surface3:#eef3f9; --surface-hover:#e3eaf2;
  --input-bg:#ffffff;
  --line:#dbe3ec; --line-strong:#c5d1de;
  --text:#1f2a37; --text-soft:#445566; --muted:#6b7c8f;
  --accent:#2563eb; --accent-soft:#e8f0ff; --accent2:#eef3f9;
  --danger:#b42318; --ok:#1a7f37; --warn:#b76e00;
  --ring:#dbe7ff;
  --shadow:0 1px 2px rgba(16,24,40,.06), 0 6px 18px rgba(16,24,40,.06);
  --sidebar-w:268px; --sidebar-collapsed-w:52px; --topbar-h:56px;
}
html[data-portal="disti"]{
  --accent:#0b5cab; --accent-soft:#e6f0fb; --ring:rgba(11,92,171,.22);
}
html[data-portal="ga"]{
  --accent:#0f766e; --accent-soft:#e6f7f5; --ring:rgba(15,118,110,.22);
}
html[data-theme="dark"]{
  color-scheme:dark;
  --bg:#0b1623; --bg2:#0f2030; --card:#11212f; --surface2:#152a3b; --surface3:#1a3247; --surface-hover:#21405a;
  --input-bg:#0c1b29;
  --line:#27465f; --line-strong:#395977;
  --text:#eaf2fb; --text-soft:#bccfdf; --muted:#90a6bb;
  --accent-soft:#16334d; --accent2:#16334d;
  --danger:#ef6a5e; --ok:#4ade80; --warn:#fbbf24;
  --ring:rgba(59,160,255,.28);
  --shadow:0 1px 2px rgba(0,0,0,.45), 0 8px 22px rgba(0,0,0,.4);
}
html[data-theme="dark"][data-portal="disti"]{
  --accent:#3b9eff; --accent-soft:#16334d; --ring:rgba(59,158,255,.28);
}
html[data-theme="dark"][data-portal="ga"]{
  --accent:#2dd4bf; --accent-soft:#134e4a; --ring:rgba(45,212,191,.28);
}

*{ box-sizing:border-box; }
body.app-body-root{
  margin:0; font-family:'Segoe UI',system-ui,Roboto,Arial,sans-serif;
  background:var(--bg); color:var(--text); min-height:100vh; font-size:14px; line-height:1.45;
}
body.app-body-root.pre-auth{ background:linear-gradient(160deg, var(--accent-soft) 0%, var(--bg) 55%); }
h1,h2,h3{ margin:0; color:var(--text); }
a{ color:var(--accent); }
.muted{ color:var(--muted); }
.hidden{ display:none !important; }
.sr-only{ position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* Auth */
.login-overlay,.auth-page{ min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px; }
.login-box,.auth-wrap{
  width:100%; max-width:430px; background:var(--card); border:1px solid var(--line);
  border-radius:16px; padding:30px 32px 32px; box-shadow:0 24px 60px rgba(16,24,40,.16);
}
.login-head,.auth-head{ display:flex; align-items:center; justify-content:space-between; gap:16px; margin:0 0 20px; }
.login-brand,.auth-brand{ display:flex; align-items:center; gap:12px; }
.login-brand-logo,.auth-logo{ width:44px; height:44px; border-radius:10px; object-fit:contain; display:block; }
.login-brand-text,.auth-brand-text{ display:flex; flex-direction:column; line-height:1.2; }
.login-brand-title,.auth-brand-title{ font-size:20px; font-weight:800; }
.login-brand-badge,.auth-brand-badge{
  align-self:flex-start; margin-top:3px; font-size:10.5px; font-weight:700; letter-spacing:.04em;
  text-transform:uppercase; color:var(--accent); background:var(--accent-soft); border-radius:999px; padding:2px 9px;
}
.login-lang,.auth-lang{ display:flex; gap:4px; flex-wrap:wrap; }
.login-lang-link,.auth-lang-link{
  min-width:36px; padding:5px 9px; font-size:12px; font-weight:700; cursor:pointer;
  color:var(--muted); border:1px solid var(--line-strong); border-radius:8px; background:var(--surface2);
}
.login-lang-link:hover,.auth-lang-link:hover{ border-color:var(--accent); color:var(--text); }
.login-lang-link.active,.auth-lang-link.active{ color:#fff; background:var(--accent); border-color:var(--accent); }
.login-hint{ color:var(--muted); font-size:13px; margin:0 0 18px; }
.login-error,.err{
  color:var(--danger); background:#fef3f2; border:1px solid #fecdca; border-radius:8px;
  padding:8px 10px; font-size:13px; margin-top:10px; display:none;
}
html[data-theme="dark"] .login-error,html[data-theme="dark"] .err{ background:#3a1a18; border-color:#7f1d1d; }
.ok{ color:var(--ok); background:#e7f6ec; border:1px solid #b7e0c3; border-radius:8px; padding:8px 10px; font-size:13px; margin-top:10px; display:none; }
.qr,.totp-qr{ background:#fff; padding:10px; border:1px solid var(--line); border-radius:10px; display:inline-block; }
.secret code,.totp-secret-line code{
  font-family:Consolas,monospace; background:var(--card); border:1px solid var(--line); padding:4px 8px; border-radius:6px; word-break:break-all;
}

/* Topbar */
.app-topbar{
  display:flex; align-items:center; justify-content:space-between; height:var(--topbar-h);
  padding:0 16px 0 10px; background:var(--card); border-bottom:1px solid var(--line);
  position:sticky; top:0; z-index:400; box-shadow:0 1px 2px rgba(16,24,40,.04);
}
.app-topbar-left,.app-topbar-right{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.app-topbar-center{ flex:1; min-width:0; margin:0 16px; }
.sidebar-toggle{
  width:40px; height:40px; border:none; border-radius:8px; background:transparent; color:var(--text); cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center;
}
.sidebar-toggle:hover{ background:var(--surface3); }
.sidebar-toggle::before{
  content:''; width:20px; height:20px; background-color:var(--muted);
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 6h18v2H3V6zm0 5h18v2H3v-2zm0 5h18v2H3v-2z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 6h18v2H3V6zm0 5h18v2H3v-2zm0 5h18v2H3v-2z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.app-brand{ display:flex; align-items:center; gap:10px; text-decoration:none; color:inherit; padding:4px 8px; border-radius:8px; }
.app-brand-logo{ border-radius:8px; object-fit:contain; }
.app-brand-text{ display:flex; flex-direction:column; line-height:1.15; }
.app-brand-title{ font-weight:700; font-size:1rem; }
.app-brand-sub{ font-size:.72rem; color:var(--muted); }
.lang-links{ display:flex; align-items:center; gap:2px; flex-wrap:wrap; }
.lang-link{
  font-size:.75rem; padding:3px 8px; border-radius:6px; border:1px solid transparent;
  color:var(--muted); text-decoration:none; line-height:1.2; cursor:pointer; background:transparent;
}
.lang-link:hover{ color:var(--text); border-color:var(--line); background:var(--surface3); }
.lang-link-active,.lang-link.active{ color:var(--accent); border-color:var(--accent); background:var(--accent-soft); font-weight:600; }
.theme-toggle{
  width:38px; height:38px; padding:0; border:1px solid var(--line-strong); border-radius:8px;
  background:var(--card); color:var(--text-soft); cursor:pointer; display:inline-flex; align-items:center; justify-content:center; font-size:16px;
}
.theme-toggle:hover{ background:var(--surface-hover); }
.theme-toggle::before{ content:'\263E'; }
html[data-theme="dark"] .theme-toggle::before{ content:'\2600'; }
.demo-toggle{
  height:38px; padding:0 12px; border:1px solid var(--line-strong); border-radius:8px; background:var(--card);
  color:var(--text-soft); cursor:pointer; font-weight:600; font-size:13px; display:inline-flex; align-items:center; gap:7px; white-space:nowrap;
}
.demo-toggle.is-on{ background:#fff7ed; border-color:#f59e0b; color:#b45309; }
html[data-theme="dark"] .demo-toggle.is-on{ background:#3a2a12; border-color:#d98a1a; color:#fbbf24; }

/* Shell */
.app-shell{ display:flex; align-items:flex-start; min-height:calc(100vh - var(--topbar-h)); }
.app-sidebar{
  position:sticky; top:var(--topbar-h); z-index:50; width:var(--sidebar-w); flex-shrink:0;
  max-height:calc(100vh - var(--topbar-h)); background:var(--card); border-right:1px solid var(--line);
  padding:14px 0 24px; overflow-y:auto;
}
.sidebar-nav{ padding:0 10px; display:flex; flex-direction:column; min-height:100%; }
.nav-group{ margin-bottom:20px; }
.nav-group-label{ font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); padding:8px 12px 6px; }
.nav-item{
  display:flex; align-items:center; gap:12px; padding:9px 12px; margin:3px 0; border-radius:9px;
  color:var(--text-soft); text-decoration:none; border:none; border-left:3px solid transparent;
  background:transparent; width:100%; text-align:left; cursor:pointer; font-size:.92rem; font-family:inherit;
}
.nav-item:hover{ background:var(--surface3); color:var(--text); }
.nav-item.active{ background:var(--accent-soft); color:var(--accent); font-weight:600; border-left-color:var(--accent); }
.app-main{ flex:1; min-width:0; display:flex; flex-direction:column; }
.main-content{ width:100%; max-width:1600px; margin:0 auto; padding:16px 18px 28px; }
.sidebar-backdrop{ display:none; }
body.sidebar-collapsed .app-sidebar{ width:var(--sidebar-collapsed-w); padding-left:4px; padding-right:4px; }
body.sidebar-collapsed .nav-group-label{ display:none; }
body.sidebar-collapsed .nav-item span{ display:none; }
body.sidebar-collapsed .nav-item{ justify-content:center; padding:10px 8px; gap:0; border-left:none; }

/* Page */
.page-head{ margin:0 0 14px; }
.page-head h1,.page-head h2{ font-size:1.25rem; font-weight:700; }
.page-lead{ color:var(--muted); font-size:13px; margin:4px 0 0; }
.page-card{
  background:var(--card); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); padding:18px 20px;
}
.toolbar{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:12px; }
.toolbar .spacer{ flex:1; }
.toolbar input,.toolbar select{ width:auto; min-width:120px; }
.filter{ display:flex; gap:6px; flex-wrap:wrap; margin-bottom:10px; }
.filter button{
  padding:5px 11px; font-size:12px; font-weight:600; border:1px solid var(--line-strong);
  border-radius:999px; background:var(--card); color:var(--text-soft); cursor:pointer;
}
.filter button.active{ background:var(--accent); color:#fff; border-color:var(--accent); }

/* Forms / buttons */
input,select,textarea{
  width:100%; padding:9px 11px; border:1px solid var(--line-strong); border-radius:8px;
  background:var(--input-bg); color:var(--text); font-size:14px; outline:none;
}
input:focus,select:focus,textarea:focus{ border-color:var(--accent); box-shadow:0 0 0 3px var(--ring); }
label{ display:block; margin-bottom:14px; color:var(--text-soft); font-size:13px; font-weight:600; }
label input,label select,label textarea{ margin-top:6px; font-weight:400; }
.btn,.ga-btn{
  display:inline-flex; align-items:center; gap:6px; padding:8px 14px; border:1px solid transparent;
  border-radius:8px; font-size:13px; font-weight:600; cursor:pointer; background:var(--accent); color:#fff; font-family:inherit;
}
.btn:hover,.ga-btn:hover{ filter:brightness(.95); }
.btn-secondary,.ga-btn-secondary{ background:var(--card); color:var(--accent); border-color:var(--line-strong); }
.btn-neutral,.ga-btn-neutral{ background:var(--surface3); color:var(--text-soft); border-color:var(--line); }
.btn-success,.ga-btn-success{ background:#16a34a; }
.btn-danger,.ga-btn-danger{ background:#dc2626; }
.btn-warning,.ga-btn-warning{ background:#d97706; }
.btn-sm{ padding:5px 10px; font-size:12px; }
.btn-block{ width:100%; justify-content:center; }
.row{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.inv-form{ display:grid; grid-template-columns:1fr 1fr; gap:10px 12px; margin:8px 0 12px; }
.inv-form label{ display:flex; flex-direction:column; gap:4px; font-size:12px; color:var(--muted); }
.inv-form input,.inv-form select{ width:100%; }
.inv-form .span2{ grid-column:1 / -1; }
@media (max-width:720px){ .inv-form{ grid-template-columns:1fr; } .inv-form .span2{ grid-column:auto; } }
.inv-section{ border:1px solid var(--line); border-radius:12px; padding:14px 16px; margin:0 0 16px; background:var(--card); }
.inv-section h3{ font-size:14px; margin:0 0 8px; }
.aspx-guide p{ margin:0 0 10px; line-height:1.5; font-size:13px; font-weight:400; color:var(--text); }
.aspx-guide ul{ margin:0 0 0 1.15em; padding:0; }
.aspx-guide li{ margin:0 0 6px; line-height:1.45; font-size:13px; font-weight:400; color:var(--text); }
.aspx-guide a{ font-weight:600; }
.aspx-guide code{ font-size:12px; }
.inv-actions-cell{ display:flex; flex-wrap:wrap; gap:6px; }

/* Tables / lists / cards */
table{ width:100%; border-collapse:collapse; font-size:13px; }
th,td{ text-align:left; padding:9px 10px; border-bottom:1px solid var(--surface3); }
th{ color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.04em; }
tbody tr:hover{ background:var(--surface2); }
td.num,th.num{ text-align:right; font-variant-numeric:tabular-nums; }
.layout{ display:grid; grid-template-columns:360px 1fr; gap:16px; }
@media (max-width:900px){ .layout{ grid-template-columns:1fr; } }
.list{ border:1px solid var(--line); border-radius:10px; overflow:hidden; max-height:70vh; overflow-y:auto; background:var(--card); }
.list-item{
  display:flex; justify-content:space-between; align-items:center; gap:10px; padding:11px 14px;
  border-bottom:1px solid var(--surface3); cursor:pointer; border-left:3px solid transparent;
}
.list-item:hover{ background:var(--surface2); }
.list-item.active{ background:var(--accent-soft); border-left-color:var(--accent); }
.list-name{ font-weight:600; } .list-mail{ font-size:11px; color:var(--muted); }
.badge{
  display:inline-block; padding:3px 10px; border-radius:999px; font-size:11px; font-weight:700; white-space:nowrap;
}
.badge.pending,.ga-badge.pending{ background:#fef7e6; color:#b76e00; }
.badge.approved,.ga-badge.approved{ background:#e7f6ec; color:#1a7f37; }
.badge.rejected,.ga-badge.rejected{ background:#fdeceb; color:#c0362c; }
.badge.suspended,.ga-badge.suspended{ background:#fdf0e3; color:#b76e00; }
.badge.role{ background:var(--surface3); color:var(--text-soft); }
.badge.ok{ background:#e7f6ec; color:#1a7f37; }
.badge.fail{ background:#fdeceb; color:#c0362c; }
.cards{ display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:12px; margin-bottom:18px; }
.card{
  background:var(--surface2); border:1px solid var(--line); border-radius:12px; padding:13px 15px;
}
.card .card-k{ font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); }
.card .card-v{ font-size:24px; font-weight:800; line-height:1.15; margin-top:3px; }
.card .card-s{ font-size:12px; color:var(--text-soft); margin-top:2px; }
.card.accent{ background:var(--accent-soft); border-color:var(--accent); }
.section-title{ font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin:20px 0 10px; }
.kv{ display:grid; grid-template-columns:150px 1fr; gap:6px 16px; font-size:13px; }
.kv-k{ color:var(--muted); }
.caps{ display:grid; grid-template-columns:1fr 1fr; gap:8px; }
@media (max-width:560px){ .caps{ grid-template-columns:1fr; } }
.cap{
  display:flex; align-items:center; gap:9px; padding:9px 11px; border:1px solid var(--line);
  border-radius:9px; background:var(--surface2); font-size:13px; cursor:pointer;
}
.cap.on{ background:var(--accent-soft); border-color:var(--accent); }
.cap input{ width:16px; height:16px; }
.toast{
  position:fixed; right:18px; bottom:18px; background:#111827; color:#fff; padding:10px 14px;
  border-radius:8px; font-size:13px; box-shadow:var(--shadow); display:none; z-index:50;
}
.chip{ display:inline-flex; align-items:center; gap:5px; padding:2px 9px; border-radius:999px; font-size:11px; font-weight:700; background:var(--surface3); color:var(--text-soft); }
.chip.g{ background:#e7f6ec; color:#1a7f37; } .chip.o{ background:#fef7e6; color:#b76e00; } .chip.r{ background:#fdeceb; color:#c0362c; } .chip.b{ background:var(--accent-soft); color:var(--accent); }
.grid2{ display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.grid3{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:18px; }
@media (max-width:900px){ .grid2,.grid3{ grid-template-columns:1fr; } }
.chart-card{ border:1px solid var(--line); border-radius:12px; padding:14px 16px; background:var(--card); }
.opt-group{ border:1px solid var(--line); border-radius:12px; padding:14px 16px; margin-bottom:14px; background:var(--card); }
.opt-group h3{ font-size:13px; margin-bottom:12px; }
.opt-row{ display:flex; align-items:center; justify-content:space-between; gap:14px; padding:8px 0; border-bottom:1px dashed var(--surface3); }
.opt-row:last-child{ border-bottom:none; }
.switch{ position:relative; display:inline-block; width:44px; height:24px; }
.switch input{ opacity:0; width:0; height:0; }
.switch .sl{ position:absolute; inset:0; background:var(--line-strong); border-radius:999px; transition:.15s; cursor:pointer; }
.switch .sl:before{ content:''; position:absolute; height:18px; width:18px; left:3px; top:3px; background:#fff; border-radius:50%; transition:.15s; }
.switch input:checked + .sl{ background:var(--accent); }
.switch input:checked + .sl:before{ transform:translateX(20px); }
body.compact th, body.compact td{ padding:5px 8px; }
body.compact .card{ padding:9px 11px; } body.compact .card .card-v{ font-size:20px; }
body.compact .page-card{ padding:12px 14px; }

/* GA compatibility aliases */
.ga-header{ display:none; }
.ga-tabbar{ display:none; }
.ga-page,.ga-detail,.ga-audit,.ga-sidebar{
  background:var(--card); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); padding:18px 20px;
}
.ga-page{ margin:0; }
.ga-page-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:6px; }
.ga-page-head h2{ font-size:18px; }
.ga-page-lead{ color:var(--muted); font-size:13px; margin:0 0 14px; }
.ga-badge{ display:inline-block; padding:3px 10px; border-radius:999px; font-size:11px; font-weight:700; white-space:nowrap; }
.ga-layout{ display:grid; grid-template-columns:340px 1fr; gap:16px; align-items:start; }
@media (max-width:880px){ .ga-layout{ grid-template-columns:1fr; } }
.ga-reseller-item{
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  padding:11px 14px; border-bottom:1px solid var(--surface3); cursor:pointer; border-left:3px solid transparent;
}
.ga-reseller-item:hover{ background:var(--surface2); }
.ga-reseller-item.active{ background:var(--accent-soft); border-left-color:var(--accent); }
.ga-filter{ display:flex; gap:6px; padding:10px 14px; flex-wrap:wrap; border-bottom:1px solid var(--line); background:var(--surface2); }
.ga-filter button{
  padding:5px 11px; font-size:12px; font-weight:600; border:1px solid var(--line-strong);
  border-radius:999px; background:var(--card); color:var(--text-soft); cursor:pointer;
}
.ga-filter button.active{ background:var(--accent); color:#fff; border-color:var(--accent); }
.ga-list{ max-height:calc(100vh - 280px); overflow-y:auto; }
.ga-section-title{ font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin:22px 0 10px; }
.ga-kv{ display:grid; grid-template-columns:150px 1fr; gap:8px 16px; font-size:13px; }
.ga-kv-k{ color:var(--muted); }
.ga-actions{ display:flex; flex-wrap:wrap; gap:8px; margin-top:18px; }
.ga-auth-wrap{ max-width:430px; margin:8vh auto; background:var(--card); border:1px solid var(--line); border-radius:16px; padding:30px 32px; box-shadow:0 24px 60px rgba(16,24,40,.16); }
.ga-auth-head{ display:flex; align-items:center; justify-content:space-between; gap:16px; margin:0 0 20px; }
.ga-auth-brand{ display:flex; align-items:center; gap:12px; }
.ga-auth-logo{ width:44px; height:44px; border-radius:10px; }
.ga-auth-brand-badge{ align-self:flex-start; margin-top:3px; font-size:10.5px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--accent); background:var(--accent-soft); border-radius:999px; padding:2px 9px; }
.ga-auth-lang{ display:flex; gap:4px; }
.ga-auth-lang-link{ min-width:36px; padding:5px 9px; font-size:12px; font-weight:700; cursor:pointer; color:var(--muted); border:1px solid var(--line-strong); border-radius:8px; background:var(--surface2); }
.ga-auth-lang-link.active{ color:#fff; background:var(--accent); border-color:var(--accent); }
.ga-err{ color:var(--danger); background:#fef3f2; border:1px solid #fecdca; border-radius:8px; padding:8px 10px; font-size:13px; margin-top:10px; display:none; }

@media print{
  .app-topbar,.app-sidebar,.sidebar-toggle,.theme-toggle,.demo-toggle,.toast,[data-noprint]{ display:none !important; }
  .app-shell{ display:block; }
  .main-content{ max-width:none; padding:0; }
}
