:root {
  --asphalt: #14171b;
  --asphalt-2: #1e2329;
  --asphalt-3: #262c34;
  --steel: #3e4a57;
  --steel-light: #64707d;
  --hazard: #f7b500;
  --hazard-dark: #d99a00;
  --rust: #c1440e;
  --rust-dark: #a3390c;
  --concrete: #f1eee7;
  --paper: #fffdf9;
  --border: #dcd6c8;
  --border-dark: #33393f;
  --text: #191c1f;
  --text-muted: #5c6570;
  --text-on-dark: #f1eee7;
  --text-on-dark-muted: #9aa4ad;
  --ok: #2e7d4f;
  --ok-bg: #e4f2e9;
  --warn: #b8860b;
  --warn-bg: #faf0d6;
  --bad: #c1440e;
  --bad-bg: #fbe6db;
  --info: #2c5f8a;
  --info-bg: #e2edf5;
  --radius: 3px;
  --shadow: 0 1px 0 rgba(20, 23, 27, 0.05), 0 6px 18px rgba(20, 23, 27, 0.08);
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--concrete);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .kpi-value, .brand-logo, .login-brand h1 {
  font-family: 'Archivo', 'IBM Plex Sans', sans-serif;
}
a { color: var(--info); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
.icon { width: 18px; height: 18px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
:focus-visible { outline: 3px solid var(--hazard); outline-offset: 2px; }

/* ---------- Hazard stripe (signatur-greb) ---------- */
.hazard-stripe {
  height: 8px;
  background: repeating-linear-gradient(135deg, var(--asphalt) 0 14px, var(--hazard) 14px 28px);
}
.grain {
  position: relative;
}
.grain::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none; opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Login (asymmetrisk split, ikke centreret kort) ---------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
}
.login-hero {
  background: var(--asphalt);
  color: var(--text-on-dark);
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-hero-top { display: flex; align-items: center; gap: 12px; }
.login-hero h1 {
  font-size: clamp(40px, 6.5vw, 84px);
  line-height: 0.94;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 32px 0 16px;
  text-transform: uppercase;
}
.login-hero h1 span { color: var(--hazard); }
.login-hero p { max-width: 420px; color: var(--text-on-dark-muted); font-size: 16px; line-height: 1.5; margin: 0; }
.route-svg { position: absolute; right: -40px; bottom: -20px; width: 60%; max-width: 480px; opacity: 0.9; }
.login-hero-foot {
  display: flex; gap: 28px; padding-top: 28px; border-top: 1px solid var(--border-dark); margin-top: 28px;
}
.login-hero-foot div strong { display: block; font-size: 26px; font-weight: 900; color: var(--hazard); }
.login-hero-foot div span { font-size: 12px; color: var(--text-on-dark-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.login-panel {
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 32px;
  border-left: 6px solid var(--hazard);
}
.login-card { width: 100%; max-width: 360px; }
.login-brand { margin-bottom: 28px; }
.login-brand h1 { margin: 0 0 4px; font-size: 24px; text-transform: uppercase; letter-spacing: 0.02em; }
.login-brand p { margin: 0; color: var(--text-muted); font-size: 13.5px; }
.brand-logo {
  width: 44px; height: 44px;
  background: var(--asphalt);
  color: var(--hazard); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 17px; letter-spacing: 0.02em; margin-bottom: 14px;
  border: 2px solid var(--asphalt);
}
.brand-logo.small { width: 34px; height: 34px; font-size: 13px; background: transparent; border: 2px solid var(--hazard); color: var(--hazard); }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.login-form input {
  padding: 12px 13px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 15px; color: var(--text); background: #fff;
}
.login-form input:focus { outline: none; border-color: var(--hazard); box-shadow: 0 0 0 3px rgba(247, 181, 0, 0.25); }
.form-error { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: var(--radius); font-size: 13px; border-left: 3px solid var(--bad); font-weight: 600; }
.form-hint { background: var(--info-bg); color: var(--info); padding: 10px 12px; border-radius: var(--radius); font-size: 13px; border-left: 3px solid var(--info); }
.demo-creds { margin-top: 22px; padding: 12px 14px; background: var(--concrete); border-radius: var(--radius); font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.demo-creds strong { color: var(--text); }

/* ---------- Buttons ---------- */
.btn {
  border: 2px solid var(--asphalt); background: #fff; color: var(--asphalt);
  padding: 9px 16px; border-radius: var(--radius); font-size: 13.5px; font-weight: 700;
  transition: transform .12s ease, background .15s ease; text-transform: uppercase; letter-spacing: 0.03em;
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
}
.btn:hover { transform: translateY(-1px); background: var(--concrete); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--hazard); border-color: var(--hazard); color: var(--asphalt); }
.btn-primary:hover { background: var(--hazard-dark); border-color: var(--hazard-dark); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 11.5px; }
.btn-ok-ghost { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); }
.btn-danger-ghost { color: var(--bad); border-color: var(--bad); background: var(--bad-bg); }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 252px; background: var(--asphalt); color: var(--text-on-dark); display: flex; flex-direction: column;
  flex-shrink: 0; position: sticky; top: 0; height: 100vh; border-right: 4px solid var(--hazard);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; font-weight: 900; font-size: 17px; text-transform: uppercase; letter-spacing: 0.03em; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius);
  color: var(--text-on-dark-muted); font-size: 13.5px; font-weight: 600; position: relative;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--asphalt-2); color: var(--text-on-dark); }
.nav-item.active { background: var(--asphalt-2); color: var(--hazard); border-left-color: var(--hazard); }
.nav-icon { width: 20px; display: flex; align-items: center; justify-content: center; }
.nav-badge {
  margin-left: auto; background: var(--rust); color: #fff; font-size: 10.5px; font-weight: 800;
  padding: 1px 6px; border-radius: 20px;
}
.sidebar-footer { padding: 14px; border-top: 1px solid var(--border-dark); display: flex; flex-direction: column; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: 13px; font-weight: 700; }
.user-role { font-size: 11px; color: var(--text-on-dark-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sidebar-footer .btn-ghost { color: var(--text-on-dark); border-color: var(--border-dark); }
.sidebar-footer .btn-ghost:hover { background: var(--asphalt-2); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 24px;
  background: var(--paper); border-bottom: 2px solid var(--border); position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-size: 19px; font-weight: 800; color: var(--asphalt); text-transform: uppercase; letter-spacing: 0.02em; }
.topbar-right { margin-left: auto; }
.bell { position: relative; display: flex; color: var(--asphalt); }
.bell-dot { position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; background: var(--rust); border-radius: 50%; border: 2px solid var(--paper); }
.hamburger { display: none; background: none; border: none; color: var(--asphalt); padding: 4px; }
.view-container { padding: 24px; flex: 1; }
.sidebar-overlay { display: none; }

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-card {
  background: var(--paper); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  border-top: 4px solid var(--info);
}
.kpi-card.kpi-warn { border-top-color: var(--warn); }
.kpi-label { font-size: 11.5px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.kpi-value { font-size: 32px; font-weight: 900; color: var(--asphalt); margin: 6px 0 2px; letter-spacing: -0.01em; }
.kpi-sub { font-size: 12px; color: var(--text-muted); }

/* ---------- Panels / tables ---------- */
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 16px; border: 1px solid var(--border); }
.panel-narrow { max-width: 560px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 2px solid var(--border); }
.panel-header h3 { margin: 0; font-size: 14.5px; color: var(--asphalt); text-transform: uppercase; letter-spacing: 0.03em; }
.panel-body { padding: 16px 18px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; padding: 9px 10px; color: var(--text-muted); font-weight: 700; border-bottom: 2px solid var(--border); white-space: nowrap; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.table td { padding: 10px; border-bottom: 1px solid #ece7db; vertical-align: middle; }
.table tfoot td { border-top: 2px solid var(--asphalt); border-bottom: none; font-weight: 800; padding-top: 12px; }
.table tbody tr:hover { background: #faf8f2; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.link-strong { color: var(--text); font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.link-strong:hover { color: var(--info); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 800; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: #eeeae0; color: #5c6570; }

/* ---------- Text helpers ---------- */
.text-muted { color: var(--text-muted); font-size: 12.5px; }
.text-ok { color: var(--ok); font-weight: 700; }
.text-warn { color: var(--warn); font-weight: 700; }
.text-bad { color: var(--bad); font-weight: 700; }

/* ---------- Toolbar / forms ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { padding: 9px 12px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 13.5px; background: #fff; }
.toolbar .btn-primary { margin-left: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.form-grid input, .form-grid select, .form-grid textarea {
  padding: 10px 11px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 14px; color: var(--text); font-weight: 400; background: #fff;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { outline: none; border-color: var(--hazard); }
.form-grid textarea { min-height: 70px; resize: vertical; font-family: inherit; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.hours-preview { background: var(--concrete); padding: 10px 12px; border-radius: var(--radius); font-size: 13.5px; font-weight: 700; color: var(--asphalt); border-left: 3px solid var(--hazard); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 23, 27, 0.65); display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 70px rgba(0,0,0,0.4); border-top: 5px solid var(--hazard); }
.modal-wide { max-width: 640px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 2px solid var(--border); }
.modal-header h3 { margin: 0; color: var(--asphalt); font-size: 16px; text-transform: uppercase; letter-spacing: 0.02em; }
.modal-close { background: none; border: none; color: var(--text-muted); padding: 4px; }
.modal-body { padding: 20px; }

/* Generated-password reveal box */
.pw-reveal { background: var(--asphalt); color: var(--hazard); padding: 16px; border-radius: var(--radius); text-align: center; margin: 4px 0 14px; }
.pw-reveal .pw-value { font-family: 'IBM Plex Sans', monospace; font-size: 24px; font-weight: 800; letter-spacing: 0.12em; }
.pw-reveal .pw-note { color: var(--text-on-dark-muted); font-size: 12px; margin-top: 6px; text-transform: none; letter-spacing: 0; }

/* ---------- Toast ---------- */
.toast-holder { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--asphalt); color: #fff; padding: 11px 16px; border-radius: var(--radius); font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3); opacity: 0; transform: translateY(8px); transition: all .25s ease;
  border-left: 4px solid var(--hazard);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-bad { border-left-color: var(--rust); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-icon { margin-bottom: 10px; display: flex; justify-content: center; }
.empty-icon .icon { width: 34px; height: 34px; color: var(--steel-light); }

/* ---------- Avatars ---------- */
.avatar { width: 36px; height: 36px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.avatar-sm { width: 26px; height: 26px; font-size: 12px; }
.avatar-lg { width: 64px; height: 64px; font-size: 24px; }

/* ---------- Profile ---------- */
.profile-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.profile-header h2 { margin: 0 0 4px; color: var(--asphalt); display: flex; align-items: center; gap: 10px; font-size: 21px; }
.def-list { display: grid; grid-template-columns: 170px 1fr; gap: 8px 12px; margin: 0; font-size: 14px; }
.def-list dt { color: var(--text-muted); font-weight: 700; }
.def-list dd { margin: 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }

/* ---------- List clean ---------- */
.list-clean { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.list-clean li { display: flex; justify-content: space-between; align-items: center; padding: 9px 4px; border-bottom: 1px solid #ece7db; font-size: 13.5px; }
.list-clean li:last-child { border-bottom: none; }

/* ---------- Notifications ---------- */
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-list li { display: flex; gap: 12px; padding: 12px 6px; border-bottom: 1px solid #ece7db; font-size: 13.5px; align-items: flex-start; }
.notif-list li.unread { background: #fbf4de; border-radius: var(--radius); }
.notif-list li:last-child { border-bottom: none; }
.notif-icon { color: var(--steel-light); }
.notif-list li.unread .notif-icon { color: var(--hazard-dark); }

/* ---------- Schedule ---------- */
.schedule-grid-wrap { overflow-x: auto; }
.schedule-table th, .schedule-table td { text-align: center; }
.schedule-table td:first-child, .schedule-table th:first-child { text-align: left; }
.shift-chip { background: var(--info-bg); color: var(--info); padding: 4px 9px; border-radius: 20px; font-size: 12px; font-weight: 800; }

/* ---------- Change password (forced first-login) ---------- */
.pwchange-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--asphalt); padding: 24px; }
.pwchange-card { background: var(--paper); border-radius: var(--radius); padding: 34px 30px; width: 100%; max-width: 400px; border-top: 5px solid var(--hazard); }
.pwchange-card h2 { margin: 10px 0 6px; font-size: 20px; color: var(--asphalt); text-transform: uppercase; }
.pwchange-card p { margin: 0 0 20px; color: var(--text-muted); font-size: 13.5px; }
.pwchange-icon { width: 46px; height: 46px; border-radius: 50%; background: var(--hazard); color: var(--asphalt); display: flex; align-items: center; justify-content: center; }
.pwchange-icon .icon { width: 24px; height: 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .grid-2col { grid-template-columns: 1fr; }
  .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .login-screen { grid-template-columns: 1fr; }
  .login-hero { padding: 40px 32px; min-height: 44vh; }
  .route-svg { display: none; }
  .login-panel { border-left: none; border-top: 6px solid var(--hazard); }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: block; }
  .sidebar-overlay.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 40; }
  .form-grid { grid-template-columns: 1fr; }
  .view-container { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .kpi-grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .kpi-grid, .kpi-grid-4 { grid-template-columns: 1fr; }
  .toolbar .btn-primary { margin-left: 0; }
  .login-hero h1 { font-size: 44px; }
  .login-hero-foot { flex-wrap: wrap; gap: 16px; }
}
