/* Kontrollvyn och administrationen. Samma formspråk som restaurangens dashboard och stämpelsidan:
   varmgrå botten, en svart meny i kanten, vita kort, svarta pillerknappar och vermilion som enda accent. */

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(fonts/inter-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(fonts/inter-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --canvas: #ebeae4;
  --shell: #f6f5f0;
  --white: #ffffff;
  --ink: #111111;
  --ink-soft: #2a2a28;
  --muted: #6b6a62;
  --line: #e2e1da;
  --field: #d6d5cd;
  --accent: #ee3a22;
  --accent-ink: #b42a17;
  --warn-soft: #f3e6c2;
  --warn-ink: #7a5812;
  --bad-soft: #f7d9d0;
  --bad-ink: #a82418;
  --good-soft: #dce8df;
  --good-ink: #2e6b4f;
  --radius-card: 22px;

  font-family: "Inter Variable", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--canvas);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

::selection {
  background: var(--accent);
  color: var(--white);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.icon {
  flex: none;
  display: block;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.95em;
}

/* ---------- Ramen ---------- */

.shell {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 40px 20px;
}

.rail {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: calc(100dvh - 40px);
  max-height: 760px;
  padding: 12px 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
}

.rail-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.1);
  color: var(--accent);
}

.rail ul {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rail-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 64px;
  padding: 9px 0 7px;
  border: 0;
  border-radius: 18px;
  background: none;
  color: rgb(255 255 255 / 0.55);
  font: inherit;
  font-size: 10.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: color 150ms, background-color 150ms;
}

.rail-link:hover {
  color: var(--white);
}

.rail-link.active {
  background: var(--accent);
  color: var(--ink);
}

.rail-logout {
  margin-top: auto;
}

.content {
  min-width: 0;
  display: grid;
  gap: 20px;
  align-content: start;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  padding: 6px 4px 0;
}

.company {
  font-size: 15px;
}

.company span,
.who {
  color: var(--muted);
}

.who {
  font-size: 14px;
}

main {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.card {
  display: grid;
  gap: 16px;
  padding: 24px;
  border-radius: var(--radius-card);
  background: var(--white);
  min-width: 0;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lead {
  color: var(--muted);
  max-width: 62ch;
}

/* ---------- Knappar och formulär ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms, transform 120ms;
  justify-self: start;
}

.btn:hover {
  background: var(--ink-soft);
}

.btn:active {
  transform: scale(0.98);
}

.btn.light {
  background: var(--shell);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.btn.light:hover {
  background: var(--white);
}

.btn.small {
  min-height: 36px;
  padding: 0 16px;
  font-size: 14px;
}

.form {
  display: grid;
  gap: 16px;
  max-width: 460px;
}

.form label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
}

.form small {
  font-weight: 400;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--field);
  border-radius: 14px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--ink);
}

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 15px;
}

.notice.fel {
  background: var(--bad-soft);
  color: var(--bad-ink);
}

.notice.ok {
  background: var(--good-soft);
  color: var(--good-ink);
}

.notice.info {
  background: var(--shell);
  color: var(--ink);
}

.notice.varning {
  background: var(--warn-soft);
  color: var(--warn-ink);
}

.notice .icon {
  margin-top: 2px;
}

/* ---------- Inloggning ---------- */

body.public main {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px 16px;
}

.auth {
  display: grid;
  gap: 18px;
  width: min(480px, 100%);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand > span:last-child {
  display: grid;
  line-height: 1.2;
}

.auth-brand strong {
  font-weight: 600;
}

.auth-brand > span:last-child span {
  font-size: 14px;
  color: var(--muted);
}

.mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--accent);
}

.aside {
  font-size: 14px;
  color: var(--muted);
}

.steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 20px;
}

.secret {
  display: block;
  margin: 8px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--shell);
  font-size: 17px;
  letter-spacing: 0.04em;
  word-break: break-all;
}

.codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.codes code {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--shell);
  font-size: 16px;
  text-align: center;
}

/* ---------- Text och listor ---------- */

.muted {
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.print-only {
  display: none;
}

.ipad-ok {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--good-ink);
}

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

.list > li {
  display: grid;
  gap: 4px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.list > li:first-child {
  border-top: 0;
  padding-top: 0;
}

.list > li.inactive {
  color: var(--muted);
}

.list.compact > li {
  display: block;
  padding: 6px 0;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 20px;
  margin: 0;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.big-code {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--shell);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.big-code code {
  font-size: inherit;
}

details summary {
  cursor: pointer;
  font-weight: 500;
  width: max-content;
}

details[open] summary {
  margin-bottom: 12px;
}

.form.inline {
  grid-auto-flow: column;
  align-items: end;
  max-width: none;
  justify-content: start;
}

.check {
  display: flex !important;
  align-items: center;
  gap: 10px;
}

.check input {
  width: 22px;
  min-height: 22px;
  margin: 0;
  accent-color: var(--ink);
}

/* ---------- Perioden och passen ---------- */

.period {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.period label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.period input {
  min-height: 38px;
  width: auto;
  padding: 6px 10px;
  font-size: 15px;
}

.passes {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}

.passes th {
  padding: 0 12px 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.passes td {
  padding: 12px 12px 12px 0;
  vertical-align: top;
}

.passes tbody.pass {
  border-top: 1px solid var(--line);
}

.passes tbody.pass:first-of-type {
  border-top: 0;
}

.table-wrap {
  min-width: 0;
  overflow-x: auto;
}

.passes td[data-label="Personnummer"] {
  white-space: nowrap;
}

/* Datum och klockslag får brytas på två rader när det är trångt. */
.passes td[data-label="Start"],
.passes td[data-label="Slut"] {
  min-width: 6.5em;
}

.passes td[data-label="Fördes in"] span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.passes tr.notes td {
  padding-top: 0;
}

.passes tr.notes ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--shell);
  list-style: none;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.passes tbody.invalid tr:first-child td {
  color: var(--muted);
  text-decoration: line-through;
}

.passes tbody.invalid tr.notes strong {
  color: var(--bad-ink);
}

.row-link {
  margin-left: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-ink);
}

/* ---------- Utskriftsvyn ---------- */

body.print-page {
  background: var(--white);
}

.print-sheet {
  display: grid;
  gap: 18px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

.print-sheet header {
  display: grid;
  gap: 6px;
}

/* ---------- Mobil ---------- */

@media screen and (max-width: 860px) {
  .passes thead {
    display: none;
  }

  .passes,
  .passes tbody,
  .passes tr,
  .passes td {
    display: block;
  }

  .passes tbody.pass {
    padding: 12px 0;
  }

  .passes td {
    display: grid;
    grid-template-columns: 9.5em 1fr;
    gap: 10px;
    padding: 3px 0;
  }

  .passes td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
  }

  .passes tr.notes td {
    display: block;
    padding-top: 8px;
  }

  .passes tr.notes td::before {
    content: none;
  }

  .form.inline {
    grid-auto-flow: row;
  }

  .shell {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 12px 12px 32px;
  }

  .rail {
    position: static;
    flex-direction: row;
    height: auto;
    max-height: none;
    padding: 6px;
    overflow-x: auto;
  }

  .rail-mark {
    display: none;
  }

  .rail ul {
    flex-direction: row;
  }

  .rail-logout {
    margin: 0 0 0 auto;
  }

  .card {
    padding: 18px;
  }
}

/* ---------- Utskrift ---------- */

@media print {
  :root,
  body {
    background: var(--white);
    font-size: 11pt;
  }

  /* Kontrollvyn skrivs inte ut; den hänvisar till utskriftsvyn (C3.8). */
  .screen-only,
  .rail,
  .topbar,
  body.app .notice {
    display: none !important;
  }

  .print-only {
    display: block;
    padding: 12pt;
    border: 1px solid #000;
  }

  .shell {
    display: block;
    padding: 0;
  }

  .print-sheet {
    padding: 0;
    max-width: none;
  }

  .passes {
    font-size: 9.5pt;
  }

  .passes thead {
    display: table-header-group;
  }

  .passes tbody.pass {
    break-inside: avoid;
  }

  .passes tr.notes ul {
    background: none;
    padding: 0 0 0 12pt;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .rail-link {
    transition: none;
  }
}
