:root {
  --bg-page:        #191D24;
  --bg-panel:       #14171D;
  --bg-surface:     #20242C;
  --bg-surface-alt: #1D222A;
  --border:         #2C323A;
  --border-subtle:  #21262F;

  --text-primary:   #E7E9EC;
  --text-secondary: #8B95A1;
  --text-muted:     #6B7480;
  --text-faint:     #565D68;

  --accent:         #3C94D0;
  --accent-text:    #EAF5FC;

  --status-ok-bg:      #1E332B;
  --status-ok-text:    #6FCF97;
  --status-warn-bg:    #362A16;
  --status-warn-text:  #E5A445;
  --status-danger-bg:  #3A2020;
  --status-danger-text:#E5726B;

  --radius: 6px;
  --radius-lg: 10px;

  --sidebar-width: 200px;
  --sidebar-width-collapsed: 64px;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: 'Manrope', sans-serif;
  font-weight: 400;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--text-primary);
}

a {
  color: var(--accent);
}

small, .small {
  color: var(--text-secondary);
}

/* ---------- App shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}

.app-sidebar__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 4px 20px;
  text-align: center;
  text-decoration: none;
}

.app-sidebar__logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 18px;
}

.app-sidebar__brand-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.app-sidebar__nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
}

.app-sidebar__nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-left: 2px solid transparent;
}

.app-sidebar__nav a i {
  font-size: 15px;
  width: 18px;
  text-align: center;
}

.app-sidebar__nav a:hover {
  color: var(--text-primary);
  background: var(--bg-surface-alt);
}

.app-sidebar__nav a.is-active {
  color: var(--text-primary);
  background: var(--bg-surface-alt);
  border-left-color: var(--accent);
}

.app-sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  margin-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.app-sidebar__avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-sidebar__user-info {
  min-width: 0;
}

.app-sidebar__user-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar__user-role {
  font-size: 11px;
  color: var(--text-muted);
}

.app-sidebar__logout {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
}

.app-sidebar__logout:hover {
  color: var(--status-danger-text);
}

.app-content {
  flex: 1 1 auto;
  min-width: 0;
  padding: 28px 32px;
}

@media (max-width: 900px) {
  .app-sidebar {
    width: var(--sidebar-width-collapsed);
    flex-basis: var(--sidebar-width-collapsed);
    align-items: center;
  }
  .app-sidebar__brand-name,
  .app-sidebar__nav a span,
  .app-sidebar__user-info,
  .app-sidebar__logout {
    display: none;
  }
  .app-sidebar__nav a {
    justify-content: center;
    padding: 10px;
  }
  .app-sidebar__user {
    justify-content: center;
  }
  .app-content {
    padding: 20px 16px;
  }
}

/* ---------- Page header ---------- */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.page-header__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.page-header__meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---------- Buttons ---------- */

.btn {
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 13px;
  box-shadow: none !important;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: var(--accent-text) !important;
  filter: brightness(1.08);
}

.btn-outline-light {
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-outline-light:hover {
  background: var(--bg-surface-alt);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-outline-secondary {
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-outline-secondary:hover {
  background: var(--bg-surface-alt);
  border-color: var(--border);
  color: var(--text-primary);
}

/* ---------- Cards ---------- */

.card {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: none !important;
}

.card .card-title,
.card .card-text {
  color: var(--text-primary);
}

.card .text-muted {
  color: var(--text-secondary) !important;
}

/* ---------- Tables ---------- */

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-primary);
  color: var(--text-primary);
  font-size: 13px;
}

.table > :not(caption) > * > * {
  border-bottom-color: var(--border-subtle);
  background: transparent;
  padding: 10px 12px;
}

.table thead th {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom-color: var(--border);
}

.table tbody td {
  color: var(--text-secondary);
}

.table tbody td:first-child,
.table tbody th {
  color: var(--text-primary);
}

/* ---------- Badges / status ---------- */

.badge {
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
}

.badge-status {
  display: inline-block;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
}

.badge-status--ok {
  background: var(--status-ok-bg);
  color: var(--status-ok-text);
}

.badge-status--warn {
  background: var(--status-warn-bg);
  color: var(--status-warn-text);
}

.badge-status--danger {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
}

/* ---------- Forms ---------- */

.form-control,
.form-select {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius);
}

.form-control:focus,
.form-select:focus {
  background: var(--bg-surface);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(60, 148, 208, 0.18);
}

.form-control::placeholder {
  color: var(--text-faint);
}

.form-label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

/* ---------- Light-literal Bootstrap utilities ----------
   Diese App hat keinen Light-Mode. .bg-light/.bg-white/.table-light
   bleiben in Bootstrap absichtlich themen-unabhängig hell (per Design),
   was auf unserem dunklen Grund unlesbaren Text erzeugt. Wir binden sie
   stattdessen an unsere dunklen Oberflächen-Tokens. */

.bg-light,
.bg-white {
  background-color: var(--bg-surface) !important;
  color: var(--text-primary);
}

.table-light,
.table-light > * {
  --bs-table-bg: var(--bg-surface);
  --bs-table-color: var(--text-primary);
  color: var(--text-primary);
}

/* ---------- Alerts / flash ---------- */

.alert {
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
}

.alert-success {
  background: var(--status-ok-bg);
  color: var(--status-ok-text);
}

.alert-warning {
  background: var(--status-warn-bg);
  color: var(--status-warn-text);
}

.alert-danger {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
}

.alert-info {
  background: var(--bg-surface-alt);
  color: var(--text-secondary);
  border-color: var(--border);
}

/* ---------- Login ---------- */

.login-shell {
  display: flex;
  min-height: 100vh;
}

.login-panel {
  position: relative;
  flex: 0 0 46%;
  max-width: 46%;
  overflow: hidden;
  background: var(--bg-panel);
  color: var(--text-primary);
}

.login-panel__bg,
.login-panel__dots,
.login-panel__overlay {
  position: absolute;
  inset: 0;
}

.login-panel__bg {
  background-size: cover;
  background-position: center;
}

.login-panel__dots {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Ccircle cx='2' cy='2' r='1' fill='%232C323A'/%3E%3C/svg%3E");
  opacity: 0.6;
}

.login-panel__overlay {
  background: linear-gradient(to bottom, rgba(20, 23, 29, 0.5) 0%, rgba(20, 23, 29, 0.98) 100%);
}

.login-panel__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 40px;
}

.login-panel__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-panel__logo {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 8px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-panel__title {
  font-size: 22px;
  font-weight: 500;
  margin: 24px 0 6px;
}

.login-panel__claim {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 340px;
  line-height: 1.5;
}

.login-panel__footer {
  margin-top: auto;
}

.login-clock {
  font-size: 32px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.login-coords {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.login-weather {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 0;
  margin-top: 16px;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-secondary);
}

.login-weather i {
  font-size: 16px;
  color: var(--text-muted);
}

.login-status {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.login-status__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  background: var(--status-ok-text);
}

.login-status__dot--muted {
  background: var(--text-faint);
}

.login-form-panel {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--bg-page);
}

.login-form {
  width: 100%;
  max-width: 280px;
}

.login-form h1 {
  font-size: 20px;
  margin-bottom: 4px;
}

.login-form__hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.login-form .btn-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
}

.login-form__forgot {
  display: block;
  text-align: center;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
}

.login-form__forgot:hover {
  color: var(--text-secondary);
}

@media (max-width: 860px) {
  .login-shell {
    flex-direction: column;
  }
  .login-panel {
    flex: 0 0 auto;
    max-width: 100%;
    min-height: 280px;
  }
  .login-form-panel {
    padding: 32px 20px;
  }
}
