/* FROSTEQ Wallboard – mörkt tema avsett för att läsas på avstånd. */

:root {
  --bg: #0b0f14;
  --bg-raised: #131a22;
  --bg-card: #1a232e;
  --bg-card-hover: #212d3b;
  --line: #26333f;
  --line-soft: #1e2833;
  --text: #eef4fa;
  --text-dim: #93a4b5;
  --text-faint: #64778a;
  --accent: #4dd0e1;
  --warn: #ffb74d;
  --danger: #ff7a7a;

  --gh-GRAY: #8b98a5;
  --gh-BLUE: #58a6ff;
  --gh-GREEN: #56d364;
  --gh-YELLOW: #e3b341;
  --gh-ORANGE: #f0883e;
  --gh-RED: #f85149;
  --gh-PINK: #f778ba;
  --gh-PURPLE: #bc8cff;

  --gap: clamp(10px, 0.9vw, 18px);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; }

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

.login-body {
  display: grid;
  place-items: center;
  overflow: auto;
  background:
    radial-gradient(1200px 600px at 50% -10%, #16232f 0%, transparent 70%),
    var(--bg);
}

.login-card {
  width: min(380px, 90vw);
  padding: 40px 34px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-mark {
  font-size: 12px;
  letter-spacing: 0.32em;
  color: var(--accent);
  font-weight: 700;
}

.login-card h1 { margin: 0; font-size: 30px; font-weight: 650; letter-spacing: -0.01em; }
.login-hint { margin: 0 0 6px; color: var(--text-dim); font-size: 15px; }

.login-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(248, 81, 73, 0.12);
  border: 1px solid rgba(248, 81, 73, 0.4);
  color: #ffc9c4;
  font-size: 14px;
}

.login-card input {
  padding: 13px 15px;
  font-size: 16px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #0d141b;
  color: var(--text);
}
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.login-card button {
  padding: 13px 15px;
  font-size: 16px;
  font-weight: 600;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #06232a;
  cursor: pointer;
}
.login-card button:hover { filter: brightness(1.08); }

/* ---------- Ramverk ------------------------------------------------------- */

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: var(--gap);
  gap: var(--gap);
}

.topbar {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 32px);
  flex-wrap: wrap;
}

.brand { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand .mark { font-size: 11px; letter-spacing: 0.3em; color: var(--accent); font-weight: 700; }
.brand .title {
  font-size: clamp(20px, 1.9vw, 34px);
  font-weight: 650;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats { display: flex; gap: clamp(10px, 1vw, 20px); margin-left: auto; flex-wrap: wrap; }

.stat {
  background: var(--bg-raised);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 8px clamp(12px, 1.1vw, 20px);
  min-width: 88px;
  text-align: center;
}
.stat .value { font-size: clamp(22px, 2.1vw, 38px); font-weight: 680; line-height: 1.05; }
.stat .label {
  font-size: clamp(10px, 0.65vw, 13px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 3px;
}
.stat.is-warn .value { color: var(--warn); }
.stat.is-iteration { text-align: left; }
.stat.is-iteration .value { font-size: clamp(15px, 1.2vw, 22px); }

.clock { text-align: right; }
.clock .time { font-size: clamp(22px, 2.1vw, 38px); font-weight: 650; font-variant-numeric: tabular-nums; }
.clock .sync { font-size: clamp(10px, 0.65vw, 13px); color: var(--text-faint); margin-top: 3px; }
.clock .sync.is-error { color: var(--danger); }

/* ---------- Kolumner ------------------------------------------------------ */

.board {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: var(--gap);
  overflow-x: auto;
}

.column {
  flex: 1 1 0;
  min-width: 230px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
}

.column-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  border-top: 3px solid var(--col-color, var(--gh-GRAY));
}
.column-head .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--col-color, var(--gh-GRAY));
  flex: none;
}
.column-head .name {
  font-size: clamp(13px, 1vw, 19px);
  font-weight: 620;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.column-head .count {
  margin-left: auto;
  font-size: clamp(12px, 0.85vw, 16px);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  background: #0e151d;
  border-radius: 20px;
  padding: 2px 10px;
}

.column-cards {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scrollbar-width: thin;
  scrollbar-color: #2b3844 transparent;
}
.column-cards::-webkit-scrollbar { width: 8px; }
.column-cards::-webkit-scrollbar-thumb { background: #2b3844; border-radius: 8px; }

.column-empty {
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
  padding: 18px 8px;
}

/* ---------- Kort ---------------------------------------------------------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background 120ms ease, transform 120ms ease;
}
.card:hover, .card:focus-visible {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  outline: none;
}
.card.is-stale { border-left-color: var(--warn); }

.card-title {
  font-size: clamp(13px, 0.95vw, 18px);
  font-weight: 560;
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(10px, 0.68vw, 13px);
  color: var(--text-faint);
  flex-wrap: wrap;
}
.card-meta .ref { font-variant-numeric: tabular-nums; }
.card-meta .stale-flag {
  color: var(--warn);
  background: rgba(255, 183, 77, 0.1);
  border: 1px solid rgba(255, 183, 77, 0.32);
  border-radius: 20px;
  padding: 1px 8px;
  font-weight: 600;
}

.card-foot { display: flex; align-items: center; gap: 8px; }

.labels { display: flex; gap: 5px; flex-wrap: wrap; min-width: 0; }
.label {
  font-size: clamp(9px, 0.6vw, 12px);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid currentColor;
  font-weight: 560;
  white-space: nowrap;
}

.avatars { display: flex; margin-left: auto; flex: none; }
.avatars img {
  width: clamp(22px, 1.7vw, 32px);
  height: clamp(22px, 1.7vw, 32px);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  background: var(--bg-card);
  margin-left: -7px;
}
.avatars img:first-child { margin-left: 0; }
.avatars .more {
  width: clamp(22px, 1.7vw, 32px);
  height: clamp(22px, 1.7vw, 32px);
  border-radius: 50%;
  background: #2c3a48;
  color: var(--text-dim);
  font-size: 11px;
  display: grid;
  place-items: center;
  margin-left: -7px;
  border: 2px solid var(--bg-card);
}
.avatars .none {
  font-size: clamp(9px, 0.6vw, 12px);
  color: var(--text-faint);
  border: 1px dashed var(--line);
  border-radius: 20px;
  padding: 2px 9px;
}

/* ---------- Overlay ------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 12, 0.78);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 4vh 4vw;
  z-index: 50;
}
.overlay[hidden] { display: none; }

.sheet {
  width: min(860px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(20px, 2vw, 34px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sheet-head { display: flex; align-items: flex-start; gap: 16px; }
.sheet-head h2 {
  margin: 0;
  font-size: clamp(20px, 1.7vw, 30px);
  font-weight: 620;
  line-height: 1.28;
  flex: 1;
}

.sheet-close {
  flex: none;
  width: 38px; height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.sheet-close:hover { background: var(--bg-card-hover); color: var(--text); }

.sheet-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.pill.is-stale {
  color: var(--warn);
  border-color: rgba(255, 183, 77, 0.4);
  background: rgba(255, 183, 77, 0.1);
}

.sheet-section h3 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 620;
}

.sheet-body {
  font-size: 15px;
  line-height: 1.62;
  color: var(--text-dim);
  background: #0e151d;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 16px 18px;
  max-height: 42vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2b3844 transparent;
}
.sheet-body::-webkit-scrollbar { width: 8px; }
.sheet-body::-webkit-scrollbar-thumb { background: #2b3844; border-radius: 8px; }

.sheet-empty {
  font-size: 15px;
  color: var(--text-faint);
  font-style: italic;
  padding: 4px 0;
}

/* ---------- Renderad markdown --------------------------------------------- */

.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }

.md-p { margin: 0 0 11px; }

.md-h {
  color: var(--text);
  font-weight: 620;
  line-height: 1.3;
  margin: 18px 0 8px;
}
.md-h1 { font-size: 18px; }
.md-h2 { font-size: 16.5px; }
.md-h3 { font-size: 15px; color: var(--text-dim); letter-spacing: 0.02em; }

.md hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

.md-list { margin: 0 0 11px; padding-left: 22px; }
.md-list li { margin: 4px 0; }

.md-task { list-style: none; margin-left: -22px; display: flex; gap: 9px; align-items: flex-start; }
.md-box {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 3px;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  display: grid;
  place-content: center;
  font-size: 11px;
  line-height: 1;
  color: transparent;
}
.md-box.is-checked {
  background: #2f7d52;
  border-color: #2f7d52;
  color: #eaf6ee;
}

.md-quote {
  margin: 0 0 11px;
  padding: 2px 0 2px 13px;
  border-left: 3px solid var(--line);
  color: var(--text-faint);
}

.md-code-inline {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.88em;
  background: #16212b;
  border-radius: 4px;
  padding: 1px 5px;
  color: #b9d4e2;
}

.md-code-block {
  margin: 0 0 12px;
  padding: 11px 13px;
  background: #16212b;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  overflow-x: auto;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  color: #c6dbe6;
}
.md-code-block code { font: inherit; }

.md-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.md-link:hover { filter: brightness(1.15); }

.md strong { color: var(--text); font-weight: 620; }

.sheet-foot .foot-note { color: var(--text-faint); font-size: 13px; }

.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.field {
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 9px 12px;
}
.field .k { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.field .v { font-size: 15px; margin-top: 3px; }

.people { display: flex; flex-wrap: wrap; gap: 12px; }
.person { display: flex; align-items: center; gap: 9px; font-size: 15px; color: var(--text-dim); }
.person img { width: 30px; height: 30px; border-radius: 50%; }

.sheet-foot { display: flex; align-items: center; gap: 12px; }
.sheet-foot a {
  color: #06232a;
  background: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  padding: 10px 18px;
  border-radius: 9px;
}
.sheet-foot a:hover { filter: brightness(1.08); }
.sheet-foot .hint { color: var(--text-faint); font-size: 13px; margin-left: auto; }

/* ---------- Tillstånd ----------------------------------------------------- */

.banner {
  background: rgba(248, 81, 73, 0.12);
  border: 1px solid rgba(248, 81, 73, 0.4);
  color: #ffc9c4;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 14px;
}
.banner[hidden] { display: none; }

/* Klass-selektorerna nedan sätter display, så hidden-attributet behöver
   sägas ifrån uttryckligen för att vinna. */
.board[hidden], .splash[hidden] { display: none; }

.splash {
  flex: 1;
  display: grid;
  place-items: center;
  color: var(--text-faint);
  font-size: 17px;
  text-align: center;
  padding: 24px;
  line-height: 1.6;
}
