/* Aperto License Server — Admin CSS (Dark/Light via data-theme) */
:root {
  --bg:           #0d0d0d;
  --surface:      #161616;
  --surface-2:    #1f1f1f;
  --surface-3:    #2a2a2a;
  --border:       #2e2e2e;
  --text:         #e8e8e8;
  --text-muted:   #888;
  --accent:       #7c6af7;
  --accent-hover: #6a57f5;
  --success:      #22c55e;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --sidebar-w:    220px;
}

[data-theme="light"] {
  --bg:        #f0f0f0;
  --surface:   #ffffff;
  --surface-2: #f7f7f7;
  --surface-3: #ebebeb;
  --border:    #e0e0e0;
  --text:      #111111;
  --text-muted:#666666;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .2s;
}

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.main-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
}

.main-content { padding: 1.5rem; flex: 1; }

.page-title { font-size: 1.1rem; font-weight: 600; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar-header { padding: 1rem; border-bottom: 1px solid var(--border); }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: .95rem;
}

.logo-icon { font-size: 1.4rem; }

.sidebar-nav { flex: 1; padding: .5rem 0; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  border-radius: 0;
  transition: background .1s, color .1s;
}

.nav-item:hover  { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-3); color: var(--text); }

.sidebar-footer {
  padding: .5rem 0;
  border-top: 1px solid var(--border);
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.card-header {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title { font-size: .9rem; font-weight: 600; }

/* ── Tabellen ────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

th, td {
  padding: .55rem .9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  font-size: .78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--surface-2);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ── Formulare ───────────────────────────────────────────── */
.form-group { margin-bottom: .75rem; }

.form-label {
  display: block;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .3rem;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: .5rem .75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: .88rem;
  font-family: inherit;
  transition: border-color .15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
}

textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .5rem .9rem;
  border-radius: 6px;
  font-size: .85rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: opacity .15s;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .85; }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .85; }

.btn-sm { padding: .3rem .6rem; font-size: .78rem; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  line-height: 1.4;
}

.badge-success { background: #14532d; color: #86efac; }
.badge-warning { background: #78350f; color: #fcd34d; }
.badge-danger  { background: #7f1d1d; color: #fca5a5; }
.badge-neutral { background: var(--surface-3); color: var(--text-muted); }

[data-theme="light"] .badge-success { background: #dcfce7; color: #15803d; }
[data-theme="light"] .badge-warning { background: #fef3c7; color: #b45309; }
[data-theme="light"] .badge-danger  { background: #fee2e2; color: #b91c1c; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: .65rem 1rem;
  border-radius: 8px;
  font-size: .88rem;
}

.alert-success { background: #14532d; color: #86efac; }
.alert-warning { background: #78350f; color: #fcd34d; }
.alert-danger  { background: #7f1d1d; color: #fca5a5; }

/* ── Stats-Grid ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}

.stat-value { font-size: 1.6rem; font-weight: 700; }
.stat-label { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }

/* ── Utilities ───────────────────────────────────────────── */
.mb-2 { margin-bottom: .75rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .82rem; }
.text-mono { font-family: 'Courier New', monospace; }

/* ── Login ───────────────────────────────────────────────── */
.login-body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.login-box {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

/* ── Mobile ──────────────────────────────────────────────── */
.mobile-menu-btn { display: none; background: none; border: none; cursor: pointer; color: var(--text); }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.4); }
  .main { margin-left: 0; }
  .mobile-menu-btn { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
