:root {
  /* PowerCon-farver */
  --pc-navy: #313e5f;
  --pc-navy-dark: #242e48;
  --pc-green: #8ec640;
  --pc-green-dark: #5b8a1f;
  --pc-green-soft: #f0f7e6;

  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --border: #dfe4ec;
  --text: #2a3350;
  --muted: #6c758a;
  --accent: var(--pc-navy);
  --accent-soft: #e9edf5;
  --danger: #c43c3c;
  --ok: var(--pc-green-dark);
  --warn: #b7791f;
  --shadow: 0 1px 2px rgba(49, 62, 95, .06), 0 4px 14px rgba(49, 62, 95, .05);
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 "proxima-nova", "Proxima Nova", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; color: var(--pc-navy); }
h2, h3 { color: var(--pc-navy); }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }

.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 0 8px 14px; border-bottom: 1px solid var(--border); color: var(--pc-navy); }
.brand:hover { text-decoration: none; }
.brand img { width: 128px; height: auto; display: block; }
.brand span { font-weight: 700; font-size: 17px; letter-spacing: .01em; }
.user-box { margin-top: auto; border-top: 1px solid var(--border); padding: 12px 8px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.user-name { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Login */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: linear-gradient(160deg, #ffffff 0%, var(--pc-green-soft) 55%, #e6ebf3 100%); }
.auth[hidden] { display: none; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--pc-green); border-radius: 14px;
  box-shadow: 0 20px 50px rgba(49, 62, 95, .12); padding: 32px 30px; width: 100%; max-width: 400px; }
.auth-logo { width: 170px; display: block; margin: 0 auto 6px; }
.auth-title { text-align: center; font-size: 22px; font-weight: 700; color: var(--pc-navy); }
.auth-sub { text-align: center; color: var(--muted); margin: 4px 0 20px; }
#authForm { display: flex; flex-direction: column; gap: 12px; }
#authForm .btn { margin-top: 6px; padding: 10px; }
.auth-error { margin-top: 14px; background: #fbe9e9; color: var(--danger); border-radius: 8px; padding: 9px 12px; font-size: 13px; }
.auth-error[hidden], .layout[hidden] { display: none; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  padding: 8px 10px; border-radius: 8px; color: var(--text);
}
.sidebar nav a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar nav a.active { background: var(--pc-green-soft); color: var(--pc-navy); font-weight: 600; box-shadow: inset 3px 0 0 var(--pc-green); }

main { padding: 28px 32px 60px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; }
.grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.table-wrap { overflow-x: auto; }
.stack { display: flex; flex-direction: column; gap: 16px; }

.kpi { border-top: 3px solid var(--pc-green); }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .hint { color: var(--muted); font-size: 12px; }

.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; font: inherit;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--pc-navy-dark); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn.full { width: 100%; }
.icon-btn { border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; width: 100%;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(142, 198, 64, .3); border-color: var(--pc-green-dark); }
input[type=checkbox] { width: auto; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .span2 { grid-column: span 2; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px 12px; margin: 0; }
legend { font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 4px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.s-identificeret { background: #eceff3; color: #4f5868; }
.s-gonogo { background: #fdf3dc; color: #8a5a00; }
.s-udarbejdelse { background: #e6ebf5; color: var(--pc-navy); }
.s-afleveret { background: #efe7fb; color: #6a3fc0; }
.s-vundet { background: var(--pc-green-soft); color: var(--pc-green-dark); }
.s-tabt { background: #fbe5e5; color: #b43030; }
.s-annulleret, .s-fravalgt { background: #eceff3; color: #7a8292; text-decoration: line-through; }
.due { font-variant-numeric: tabular-nums; }
.due.late { color: var(--danger); font-weight: 600; }
.due.soon { color: var(--warn); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { color: var(--muted); padding: 20px; text-align: center; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: thin; }
.tabs button {
  border: 0; background: none; padding: 9px 12px; cursor: pointer; font: inherit; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs .count { font-size: 11px; background: var(--surface-2); border-radius: 999px; padding: 0 6px; margin-left: 4px; }

dl.props { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; margin: 0; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; word-break: break-word; }

.list-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item.done .text { text-decoration: line-through; color: var(--muted); }
.add-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.add-row > * { flex: 1; min-width: 120px; }
.add-row > .btn { flex: 0 0 auto; }

.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--pc-green); }

.kanban { display: grid; grid-template-columns: repeat(6, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kanban .col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.kanban .col h3 { display: flex; justify-content: space-between; font-size: 13px; }
.kanban .kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: pointer; }
.kanban .kcard:hover { border-color: var(--pc-green); }
.kanban .kcard .t { font-weight: 600; margin-bottom: 4px; overflow-wrap: anywhere; }

.score-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.score-row .opts { display: flex; gap: 4px; }
.score-row .opts button { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text); font: inherit; }
.score-row .opts button.on { background: var(--pc-navy); border-color: var(--pc-navy); color: #fff; }
.big-score { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); align-items: center; }

.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 160px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 15, 25, .45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 760px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; }
.modal form { padding: 20px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.toast { position: fixed; bottom: 20px; right: 20px; background: var(--pc-navy); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 60; }

@media (max-width: 1150px) {
  .grid.c3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar .btn.full { width: auto; }
  .brand { flex-direction: row; align-items: center; border: 0; padding: 0 8px; }
  .brand img { width: 90px; }
  .user-box { margin: 0; border: 0; padding: 0; }
  main { padding: 20px 16px 60px; }
  .grid.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c2, .grid.c3, .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: auto; }
  dl.props { grid-template-columns: 1fr; gap: 2px; }
  dl.props dd { margin-bottom: 8px; }
  .table-wrap { overflow-x: auto; }
}
