:root {
  --navy: #1d3570;
  --navy-deep: #14264f;
  --ink: #1b2430;
  --muted: #5d6b7c;
  --line: #e2e8f0;
  --bg: #f3f6fa;
  --card: #ffffff;
  --soft: #f7f9fc;
  --warn-bg: #fff8ee;
  --warn-ink: #7a4b00;
  --warn-line: #f0d7a2;
  --ok-bg: #e8f6ee;
  --ok-ink: #145c32;
  --ok-line: #b7e0c8;
  --bad-bg: #fdeeee;
  --bad-ink: #8c2f2f;
  --bad-line: #f0c8c4;
  --focus: rgba(29, 53, 112, 0.22);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 280px at 50% -120px, #e5edf8 0%, rgba(229, 237, 248, 0) 70%),
    var(--bg);
  font: 16px/1.45 "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

.logo, .logo-preview {
  width: 42px;
  height: 42px;
  flex: none;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}

.logo-preview { width: 72px; height: 72px; }

.bar-end {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.bar-end form { margin: 0; }

.bar-end button.secondary { height: 36px; }

.login-card { max-width: 440px; margin: 28px auto; }

.login-card form, .stack-form { display: grid; gap: 12px; }

.login-card button { width: 100%; }

.span-2 { grid-column: 1 / -1; }

.scroll-table { max-height: 360px; }

.steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--soft);
  border-radius: 12px;
}

.steps span {
  display: grid;
  width: 26px;
  height: 26px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: #e7eef8;
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 700;
}

.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  min-height: 68px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: none;
  place-items: center;
  border-radius: 12px;
  background: var(--navy);
}

.brand strong {
  display: block;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex: none;
}

.nav a {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  color: var(--navy);
  font-weight: 650;
  text-decoration: none;
  border-radius: 999px;
}

.nav a.is-on,
.nav a:hover { background: #e7eef8; }

main {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

h1 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

p { margin: 0 0 12px; }

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

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.page-head form { margin: 0; }

.lead, .quiet, .meta { color: var(--muted); }

.lead { margin: 6px 0 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.stats.folders { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat {
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
}

.stat.is-on { border-color: var(--navy); }

.stat b {
  display: block;
  color: var(--navy);
  font-size: 1.6rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.stat span { color: var(--muted); font-size: 0.88rem; }

.card, fieldset {
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(20, 38, 79, 0.05);
}

.card { margin: 0 0 16px; }

form.card fieldset {
  box-shadow: none;
  background: var(--soft);
}

fieldset { margin: 0 0 14px; }

legend {
  padding: 0 6px;
  color: var(--navy);
  font-weight: 750;
}

.stack { display: grid; gap: 16px; }

.split {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.2fr);
  gap: 16px;
  align-items: start;
}

.split > *, form.card { min-width: 0; }

.desk {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.work {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.desk > *, .work > * { min-width: 0; }

.queue-card {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 14px;
}

.queue {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
}

.queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 64px;
  padding: 8px 10px;
  color: inherit;
  text-decoration: none;
  border-radius: 12px;
}

.queue-item + .queue-item { margin-top: 4px; }

.queue-item.current,
.queue-item:hover { background: #e7eef8; }

.queue-main { min-width: 0; }

.queue-main strong,
.queue-main .quiet {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 750;
}

.pill.ok { color: var(--ok-ink); background: var(--ok-bg); }
.pill.bad { color: var(--bad-ink); background: var(--bad-bg); }
.pill.open { color: var(--navy); background: #e7eef8; }
.pill.archiv { color: var(--muted); background: var(--soft); }

.sheet embed {
  display: block;
  width: 100%;
  height: min(72vh, 820px);
  border: 0;
  border-radius: 12px;
  background: var(--soft);
}

.banner {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 12px;
}

.banner.ok { color: var(--ok-ink); background: var(--ok-bg); border: 1px solid var(--ok-line); }
.banner.warn { color: var(--warn-ink); background: var(--warn-bg); border: 1px solid var(--warn-line); }
.banner.bad { color: var(--bad-ink); background: var(--bad-bg); border: 1px solid var(--bad-line); }
.banner ul { margin: 6px 0 0; padding-left: 18px; }

.ok-text { color: var(--ok-ink); font-weight: 700; }
.bad-text { color: var(--bad-ink); font-weight: 700; }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

label.choice {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 0.95rem;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
  align-items: start;
}

.checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 12px;
}

.checks label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin: 0;
  padding: 8px 10px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  background: var(--soft);
  border-radius: 10px;
}

input, select, textarea, button { font: inherit; color: var(--ink); }

input, select, textarea {
  width: 100%;
  height: 42px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #c9d3e0;
  border-radius: 12px;
}

textarea {
  height: auto;
  min-height: 88px;
  resize: vertical;
}

input:focus, select:focus, textarea:focus, button:focus-visible, .button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

label.choice input,
.checks input {
  width: 16px;
  height: 16px;
  flex: none;
  margin: 0;
  padding: 0;
}

button, .button, button.secondary, button.danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

button, .button {
  color: #fff;
  background: var(--navy);
  border: 0;
}

button:hover, .button:hover { background: var(--navy-deep); }

button.secondary {
  color: var(--navy);
  background: #fff;
  border: 1px solid #d5deea;
}

button.secondary:hover { background: var(--soft); }

button.danger {
  color: var(--bad-ink);
  background: #fff;
  border: 1px solid var(--bad-line);
}

button.danger:hover { background: var(--bad-bg); }

.actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 14px;
}

.actions button, .actions .button { flex: 1; }

.inline { display: inline; margin: 0; }

.card > form.inline { display: block; margin-top: 10px; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.row h2 { margin: 0; }

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.row-actions form { margin: 0; }

.drop {
  display: block;
  position: relative;
  margin: 0 0 12px;
  padding: 28px 18px;
  text-align: center;
  background: var(--soft);
  border: 1.5px dashed #c5d0de;
  border-radius: 16px;
  cursor: pointer;
}

.drop:hover, .drop.is-over {
  background: #eef3fa;
  border-color: var(--navy);
}

.drop input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.drop strong { display: block; margin-bottom: 4px; color: var(--ink); }

.drop-hint { color: var(--muted); font-size: 0.92rem; font-weight: 500; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--soft);
}

tr:last-child td { border-bottom: 0; }

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.booking-line {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.line-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.line-nums {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.6fr) minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 8px;
  align-items: start;
}

.party-form, .firma-ask {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.firma-ask[hidden] { display: none; }

.firm-row {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.card h2 a, .card h3 { color: var(--navy); }

.files { list-style: none; margin: 0; padding: 0; }

.files li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.files li:last-child { border-bottom: 0; }

.file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.file-actions form { margin: 0; }

pre {
  overflow: auto;
  margin: 0;
  padding: 12px;
  background: var(--soft);
  border-radius: 12px;
  font: 12px/1.45 ui-monospace, monospace;
  white-space: pre;
}

details { margin: 0 0 14px; }

summary { color: var(--navy); font-weight: 750; cursor: pointer; }

.sum { margin: 10px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.sum.ok { color: var(--ok-ink); }
.sum.warn { color: var(--warn-ink); }

tr.haben td { font-weight: 750; }

@media (max-width: 1080px) {
  .stats.folders { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .desk, .work, .split { grid-template-columns: 1fr; }
  .queue-card { position: static; max-height: none; }
  .sheet embed { height: 52vh; }
}

@media (max-width: 720px) {
  .bar { padding: 12px 14px; }
  .brand small { display: none; }
  main { width: min(100% - 20px, 1240px); padding-top: 18px; }
  .page-head, .row { align-items: stretch; flex-direction: column; }
  .stats, .grid, .checks, .line-nums, .line-top { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
  .actions button, .actions .button { width: 100%; }
  .card, fieldset { padding: 16px; }
}
