/* ════════════════════════════════════════════════════════════════════════════
   meladis Büro – Hauptstylesheet
   Kein Hintergrundbild, kein Wallpaper – flaches helles/dunkles Design.
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Reset & Basis ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-bg:        #f4f4f6;
  --c-surface:   #ffffff;
  --c-border:    #dde0e6;
  --c-text:      #1a1d24;
  --c-muted:     #6b717e;
  --c-primary:   #2563eb;
  --c-primary-h: #1d4ed8;
  --c-danger:    #dc2626;
  --c-success:   #16a34a;
  --c-warning:   #d97706;
  --c-sidebar-bg:#1e2130;
  --c-sidebar-tx:#c8cdd8;
  --c-sidebar-ac:#ffffff;
  --c-sidebar-hl:#2a3047;

  --sidebar-w:   220px;
  --topbar-h:    52px;
  --radius:      6px;
  --shadow:      0 1px 3px rgba(0,0,0,.10);
  --font:        system-ui, -apple-system, 'Segoe UI', sans-serif;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout-Grid ───────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  background: var(--c-sidebar-bg);
  color: var(--c-sidebar-tx);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar__brand {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar__logo {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
}
.sidebar__sub {
  font-size: .72rem;
  color: var(--c-sidebar-tx);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sidebar__nav {
  list-style: none;
  flex: 1;
  padding: 10px 0;
}
.sidebar__nav li a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  color: var(--c-sidebar-tx);
  font-size: .88rem;
  border-radius: 0;
  transition: background .15s, color .15s;
}
.sidebar__nav li a:hover { background: var(--c-sidebar-hl); color: var(--c-sidebar-ac); text-decoration: none; }
.sidebar__nav li.active a { background: var(--c-primary); color: #fff; }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar__user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: .82rem;
}
.sidebar__username { color: var(--c-sidebar-tx); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__logout { color: var(--c-sidebar-tx); font-size: 1.1rem; opacity: .7; }
.sidebar__logout:hover { opacity: 1; text-decoration: none; }

/* ── Main-Wrap ─────────────────────────────────────────────────────────────── */
.main-wrap {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sidebar-w);
}

/* ── Topbar ────────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.topbar__toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--c-muted);
}
.topbar__title {
  font-size: 1rem;
  font-weight: 600;
  flex: 1;
}
.topbar__right { display: flex; align-items: center; gap: 10px; }

.sync-status { font-size: .78rem; color: var(--c-muted); }
.sync-status.ok   { color: var(--c-success); }
.sync-status.err  { color: var(--c-danger);  }
.sync-status.busy { color: var(--c-warning); }

/* ── Content ───────────────────────────────────────────────────────────────── */
.content { padding: 22px 24px; flex: 1; }

/* ── Page-Header ───────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}
.page-header__title { font-size: 1.2rem; font-weight: 700; }

/* ── Karten ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card__title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 10px;
}

/* Stat-Kacheln */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-card__label { font-size: .78rem; color: var(--c-muted); margin-bottom: 4px; }
.stat-card__value { font-size: 1.6rem; font-weight: 700; }
.stat-card__sub   { font-size: .75rem; color: var(--c-muted); margin-top: 2px; }

/* ── Tabellen ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 2px solid var(--c-border);
  font-weight: 600;
  color: var(--c-muted);
  white-space: nowrap;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8f9fb; }
.table-wrap table tbody tr.clickable { cursor: pointer; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  line-height: 1.3;
  transition: background .15s, border-color .15s;
  text-decoration: none;
}
.btn--primary   { background: var(--c-primary);  color: #fff;               border-color: var(--c-primary);  }
.btn--primary:hover { background: var(--c-primary-h); text-decoration: none; }
.btn--secondary { background: var(--c-surface);  color: var(--c-text);      border-color: var(--c-border);   }
.btn--secondary:hover { background: #f0f1f4; text-decoration: none; }
.btn--danger    { background: var(--c-danger);   color: #fff;               border-color: var(--c-danger);   }
.btn--danger:hover { opacity: .88; text-decoration: none; }
.btn--sm { padding: 4px 9px; font-size: .78rem; }

/* ── Formulare ─────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--c-muted);
}
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: .88rem;
  font-family: var(--font);
  background: var(--c-surface);
  color: var(--c-text);
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--c-primary); }
textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

/* ── Filter-Bar ────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}
.filter-bar input[type=search],
.filter-bar select { width: auto; min-width: 160px; }

/* ── Badges / Status ───────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .73rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge--green  { background: #dcfce7; color: #166534; }
.badge--yellow { background: #fef9c3; color: #854d0e; }
.badge--red    { background: #fee2e2; color: #991b1b; }
.badge--blue   { background: #dbeafe; color: #1e40af; }
.badge--grey   { background: #f1f5f9; color: #475569; }
.badge--orange { background: #ffedd5; color: #9a3412; }

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: .88rem;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert--error   { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.alert--success { background: #dcfce7; color: #166534; border-color: #86efac; }
.alert--warning { background: #fef9c3; color: #854d0e; border-color: #fde047; }

/* ── Pagination ────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-top: 14px;
  font-size: .85rem;
}
.pagination a, .pagination span {
  padding: 4px 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  color: var(--c-text);
}
.pagination a:hover { background: var(--c-bg); text-decoration: none; }
.pagination .current { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

/* ── Login-Seite ───────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bg);
}
.login-box {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  padding: 36px 40px;
  width: 100%;
  max-width: 380px;
}
.login-box__logo {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}
.login-box__sub {
  text-align: center;
  color: var(--c-muted);
  font-size: .83rem;
  margin-bottom: 26px;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s;
  }
  .sidebar.open { transform: none; }
  .main-wrap { margin-left: 0; }
  .topbar__toggle { display: block; }
}
