:root {
  --primary:      #2563eb;
  --primary-dark: #1d4ed8;
  --danger:       #dc2626;
  --danger-dark:  #b91c1c;
  --success:      #16a34a;
  --warning:      #ea580c;
  --bg:           #f1f5f9;
  --surface:      #ffffff;
  --border:       #e2e8f0;
  --text:         #1e293b;
  --text-muted:   #64748b;
  --nav-bg:       #1e293b;
  --nav-text:     #f1f5f9;
  --radius:       6px;
  --shadow:       0 1px 3px rgba(0,0,0,.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Navbar ────────────────────────────────── */
.navbar {
  background: var(--nav-bg);
  color: var(--nav-text);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .6rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.navbar-brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--nav-text);
  text-decoration: none;
  white-space: nowrap;
}
.navbar-nav {
  display: flex;
  list-style: none;
  gap: .25rem;
  flex: 1;
}
.navbar-nav a {
  color: #94a3b8;
  text-decoration: none;
  padding: .35rem .75rem;
  border-radius: var(--radius);
  transition: background .15s, color .15s;
}
.navbar-nav a:hover, .navbar-nav a.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}
.navbar-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  white-space: nowrap;
}
.navbar-username { color: #cbd5e1; font-size: .85rem; }

/* ── Container ─────────────────────────────── */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ── Buttons ───────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-outline  { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--border); }
.btn-outline-light { background: transparent; border: 1px solid rgba(255,255,255,.3); color: #fff; }
.btn-outline-light:hover { background: rgba(255,255,255,.1); }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Alerts ────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .875rem;
}
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

/* ── Cards ─────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: var(--text); }

/* ── Page header ───────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.page-header h2 { font-size: 1.25rem; font-weight: 700; }

/* ── Stats ─────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow);
}
.stat-num   { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; text-transform: uppercase; letter-spacing: .05em; }
.stat-migriert .stat-num { color: var(--success); }
.stat-obsolete .stat-num  { color: var(--warning); }
.stat-offen .stat-num    { color: var(--primary); }

/* ── Filter bar ────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem;
  box-shadow: var(--shadow);
  align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: .2rem; }
.filter-group-search { flex: 1; min-width: 180px; }
.filter-label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
  padding-left: .1rem;
}
.filter-search { width: 100%; }
.filter-select { min-width: 130px; }

/* ── Forms ─────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.form-control {
  padding: .4rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s;
  width: 100%;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-control-sm { padding: .25rem .5rem; font-size: .8rem; }
.form-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.form-row .form-group { flex: 1; min-width: 180px; }
.form-inline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  align-items: end;
}
.form-group-submit { }
.form-row-inline { display: flex; gap: .4rem; align-items: center; }
.required { color: var(--danger); }
.text-muted { color: var(--text-muted); font-size: .8rem; }

/* ── Tables ────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: .8rem;
}
.table th {
  background: #f8fafc;
  padding: .6rem .75rem;
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }
.table-sm td, .table-sm th { padding: .35rem .6rem; }

/* Row status colors */
.row-migriert td:first-child { border-left: 3px solid var(--success); }
.row-obsolete td:first-child  { border-left: 3px solid var(--warning); }

/* Column widths */
.col-path   { min-width: 280px; }
.col-flag   { width: 80px; text-align: center; }
.col-date   { width: 90px; white-space: nowrap; color: var(--text-muted); }
.col-action { width: 50px; text-align: center; }

.path-text {
  display: block;
  word-break: break-all;
  overflow-wrap: anywhere;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: .78rem;
  cursor: default;
}

/* ── Inline selects in table ───────────────── */
.inline-select {
  border: 1px solid transparent;
  background: transparent;
  padding: .2rem .4rem;
  border-radius: var(--radius);
  font-size: .78rem;
  color: var(--text);
  cursor: pointer;
  max-width: 130px;
  transition: border-color .15s, background .15s;
}
.inline-select:hover { border-color: var(--border); background: var(--bg); }
.inline-select:focus { outline: none; border-color: var(--primary); background: var(--surface); }
.inline-select.saving { opacity: .5; }

/* ── Checkboxes ────────────────────────────── */
.checkbox-wrap {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  cursor: pointer;
}
.checkbox-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--success);
}
.checkbox-wrap.is-locked input[type="checkbox"] {
  accent-color: #94a3b8;
  cursor: not-allowed;
}
.lock-icon { font-size: .75rem; opacity: .6; }

/* ── Role badges ───────────────────────────── */
.role-badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.role-admin         { background: #dbeafe; color: #1e40af; }
.role-editor        { background: #fef3c7; color: #92400e; }
.role-editor-config { background: #ede9fe; color: #5b21b6; }
.role-viewer        { background: #f3f4f6; color: #4b5563; }

/* ── Config inline edit ────────────────────────────────────────────── */
.inline-edit-form {
  display: flex;
  gap: .35rem;
  flex: 1;
  align-items: center;
  margin-right: .35rem;
}
.inline-edit-form .form-control { flex: 1; }

/* ── Config grid ───────────────────────────── */
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.inline-add-form {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
}
.inline-add-form .form-control { flex: 1; }
.item-list { list-style: none; }
.item-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .4rem 0;
  border-bottom: 1px solid var(--border);
  gap: .5rem;
}
.item-list li:last-child { border-bottom: none; }
.item-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-item { color: var(--text-muted); font-style: italic; font-size: .8rem; }

/* ── Pagination ────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: 1rem;
  padding: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.page-info { color: var(--text-muted); font-size: .8rem; flex: 1; text-align: center; }

/* ── Modal dialog ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 460px;
  width: 92%;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: .6rem; }
.modal-body-text { color: var(--text-muted); margin-bottom: 1.5rem; line-height: 1.6; font-size: .9rem; }
.modal-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ── Toast ─────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #1e293b;
  color: #fff;
  padding: .7rem 1.2rem;
  border-radius: var(--radius);
  font-size: .875rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  opacity: 0;
  transform: translateY(.5rem);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 999;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-error  { background: var(--danger); }
.toast.toast-ok     { background: var(--success); }

/* ── Empty state ───────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── Login ─────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}
.login-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--text);
}
.login-card .form-group { margin-bottom: 1rem; }
.login-card .btn-block { margin-top: .5rem; padding: .6rem; }

/* ── Error page ────────────────────────────── */
.error-page { text-align: center; padding: 4rem 1rem; }
.error-code  { font-size: 5rem; font-weight: 900; color: var(--border); line-height: 1; }
.error-msg   { color: var(--text-muted); margin: 1rem 0 2rem; font-size: 1.1rem; }
