/* ==========================================================================
   Tabla - design system
   Two typefaces: Instrument Sans (interface) and JetBrains Mono (numbers that
   are read as codes: due days, tax numbers, amounts). Colour carries meaning
   in exactly one place - the status of a task (done / in progress / due soon
   / overdue / waiting) - and every status also has its own icon, so nothing
   depends on colour alone. The status cell of the board is the product's
   signature element.
   ========================================================================== */

/* --- Fonts (self-hosted, OFL) -------------------------------------------- */
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/instrument-sans-latin-ext-wght-normal.woff2") format("woff2");
  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: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
  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;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-ext-wght-normal.woff2") format("woff2");
  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: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  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;
}

/* --- Tokens --------------------------------------------------------------- */
:root {
  color-scheme: light;

  --canvas: #f1f4f9;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --ink: #16202f;
  --muted: #556277;
  --line: #d7deea;
  --line-strong: #b5c0d2;

  --brand: #1d4f91;
  --brand-strong: #153a6d;
  --brand-tint: #e3ecf9;
  --on-brand: #ffffff;

  --ok: #1c6630;
  --ok-tint: #e1f3e3;
  --ok-line: #9fd3a8;
  --warn: #855000;
  --warn-tint: #fdf0d5;
  --warn-line: #e8c47a;
  --danger: #b3261e;
  --danger-strong: #8f1d17;
  --danger-tint: #fcebe9;
  --danger-line: #eeaaa4;
  --info: #1b57b5;
  --info-tint: #e6eefb;
  --info-line: #a9c4ee;

  --nav-bg: #10233d;
  --nav-ink: #c2cfe1;
  --nav-ink-strong: #ffffff;
  --nav-hover: #193152;
  --nav-active: #213f69;
  --nav-accent: #8fd16a;

  --focus: #1b57b5;
  --shadow-1: 0 1px 2px rgb(16 32 58 / 6%), 0 1px 1px rgb(16 32 58 / 4%);
  --shadow-2: 0 10px 30px rgb(16 32 58 / 16%), 0 2px 6px rgb(16 32 58 / 8%);

  --font-ui: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-md: 1.0625rem;
  --text-lg: 1.3125rem;
  --text-xl: 1.625rem;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --sidebar-width: 14rem;
  --header-height: 3.75rem;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --canvas: #0c121b;
  --surface: #151d2a;
  --surface-2: #1a2433;
  --ink: #e6ebf3;
  --muted: #9aa8bc;
  --line: #283446;
  --line-strong: #3b4a61;

  --brand: #82b3f2;
  --brand-strong: #aacbf7;
  --brand-tint: #16294a;
  --on-brand: #06182e;

  --ok: #78d694;
  --ok-tint: #12301c;
  --ok-line: #2c6a3d;
  --warn: #f0b955;
  --warn-tint: #352a12;
  --warn-line: #7a5f22;
  --danger: #ff8f86;
  --danger-strong: #ffb0a9;
  --danger-tint: #3a1a18;
  --danger-line: #7d3530;
  --info: #8ab6f5;
  --info-tint: #16273f;
  --info-line: #345b93;

  --nav-bg: #090f18;
  --nav-hover: #141e2c;
  --nav-active: #1a2940;

  --focus: #8ab6f5;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-2: 0 12px 32px rgb(0 0 0 / 55%);
}

/* --- Base ----------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 {
  font-size: var(--text-xl);
}

h2 {
  font-size: var(--text-md);
}

h3 {
  font-size: var(--text-base);
}

p {
  margin: 0 0 0.75rem;
}

a {
  color: var(--brand);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--brand-strong);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--brand);
  color: var(--on-brand);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-feature-settings: "zero" 1;
  letter-spacing: -0.01em;
}

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

.small {
  font-size: var(--text-sm);
}

.nowrap {
  white-space: nowrap;
}

.break {
  overflow-wrap: anywhere;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-lg {
  width: 1.75rem;
  height: 1.75rem;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--brand);
  color: var(--on-brand);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus {
  top: 0.5rem;
  color: var(--on-brand);
}

/* --- App shell ------------------------------------------------------------ */
.shell {
  min-height: 100dvh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--nav-bg);
  color: var(--nav-ink);
  padding: 0 0.75rem calc(0.75rem + env(safe-area-inset-bottom));
  padding-left: calc(0.75rem + env(safe-area-inset-left));
  transform: translateX(-100%);
  /* visibility keeps the closed drawer out of the tab order on small screens */
  visibility: hidden;
  transition: transform 0.2s ease, visibility 0.2s;
  overflow-y: auto;
}

.sidebar.is-open {
  transform: none;
  visibility: visible;
  box-shadow: var(--shadow-2);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgb(8 14 20 / 55%);
  border: 0;
  padding: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  height: var(--header-height);
  padding: 0 0.5rem;
  color: var(--nav-ink-strong);
  font-weight: 650;
  font-size: var(--text-md);
  letter-spacing: -0.01em;
  text-decoration: none;
  flex: none;
}

.brand:hover {
  color: var(--nav-ink-strong);
}

.brand-mark {
  width: 1.9rem;
  height: 1.9rem;
  flex: none;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.nav-label {
  margin: 1.1rem 0.6rem 0.35rem;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8fa0af;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.75rem;
  padding: 0 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--nav-ink);
  text-decoration: none;
  font-weight: 500;
}

.nav a:hover {
  background: var(--nav-hover);
  color: var(--nav-ink-strong);
}

.nav a[aria-current="page"] {
  background: var(--nav-active);
  color: var(--nav-ink-strong);
  box-shadow: inset 3px 0 0 var(--nav-accent);
}

.nav a[aria-current="page"] .icon {
  color: var(--nav-accent);
}

.sidebar-foot {
  margin-top: auto;
  padding: 1rem 0.6rem 0.25rem;
  font-size: var(--text-xs);
  color: #8fa0af;
}

.env-tag {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid #3a4a59;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: #d9c07a;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: var(--header-height);
  padding: 0 0.75rem;
  padding-left: calc(0.75rem + env(safe-area-inset-left));
  padding-right: calc(0.75rem + env(safe-area-inset-right));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.main {
  padding: 1.25rem 0.75rem calc(3rem + env(safe-area-inset-bottom));
  padding-left: calc(0.75rem + env(safe-area-inset-left));
  padding-right: calc(0.75rem + env(safe-area-inset-right));
  max-width: 82rem;
  margin: 0 auto;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
}

.sidebar-head .brand {
  flex: 1 1 auto;
}

/* Scoped to .sidebar so the later .btn-ghost rules cannot override the colours. */
.sidebar .nav-collapse {
  color: var(--nav-ink);
  background: transparent;
}

.sidebar .nav-collapse:hover,
.sidebar .nav-collapse:focus-visible {
  color: var(--nav-ink-strong);
  background: var(--nav-hover);
}

@media (min-width: 64rem) {
  .sidebar {
    transform: none;
    visibility: visible;
    transition: width 0.2s ease;
  }

  .sidebar-backdrop,
  .menu-toggle {
    display: none !important;
  }

  .shell-body {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.2s ease;
  }

  /* --- Collapsed sidebar: a narrow rail of icons (names show as a hint on hover) --- */
  :root[data-nav="rail"] {
    --sidebar-width: 4.25rem;
  }

  :root[data-nav="rail"] .sidebar {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    overflow-x: hidden;
  }

  :root[data-nav="rail"] .sidebar-head {
    flex-direction: column;
    gap: 0.25rem;
    padding-top: 0.35rem;
  }

  :root[data-nav="rail"] .brand {
    height: auto;
    padding: 0.4rem 0;
    justify-content: center;
  }

  :root[data-nav="rail"] .brand-text,
  :root[data-nav="rail"] .nav-label,
  :root[data-nav="rail"] .sidebar-foot,
  :root[data-nav="rail"] .nav a > span:not(.nav-count) {
    display: none;
  }

  :root[data-nav="rail"] .nav-collapse .icon {
    transform: rotate(180deg);
  }

  :root[data-nav="rail"] .nav {
    margin-top: 0.75rem;
  }

  :root[data-nav="rail"] .nav a {
    position: relative;
    justify-content: center;
    padding: 0;
    min-height: 2.75rem;
  }

  :root[data-nav="rail"] .nav-count {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    min-width: 1.1rem;
    padding: 0 0.25rem;
    font-size: 0.65rem;
    line-height: 1.1rem;
  }

  :root[data-nav="rail"] .nav-help {
    margin-top: auto;
    padding-top: 1rem;
  }

  .topbar {
    padding: 0 1.75rem;
  }

  .main {
    padding: 1.75rem 1.75rem 4rem;
  }
}

/* --- Quick search --------------------------------------------------------- */
.search {
  position: relative;
  flex: 1;
  min-width: 0;
  max-width: 34rem;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.75rem;
  padding: 0 0.75rem;
  background: var(--canvas);
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
}

.search-box:focus-within {
  background: var(--surface);
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent);
}

.search-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.search-box input::placeholder {
  color: var(--muted);
}

.kbd {
  display: none;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted);
  white-space: nowrap;
}

@media (min-width: 48rem) {
  .kbd {
    display: inline-block;
  }
}

.search-results {
  position: absolute;
  inset: calc(100% + 0.4rem) 0 auto 0;
  z-index: 50;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  max-height: min(26rem, 70dvh);
  overflow-y: auto;
}

.search-results a,
.search-note {
  display: block;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
}

.search-results a.is-active,
.search-results a:hover {
  background: var(--brand-tint);
}

.search-results .result-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.search-results .result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.75rem;
  font-size: var(--text-sm);
  color: var(--muted);
}

.search-note {
  color: var(--muted);
  font-size: var(--text-sm);
}

.search-all {
  border-top: 1px solid var(--line);
  margin-top: 0.25rem;
  font-weight: 600;
  color: var(--brand) !important;
}

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--muted);
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

.btn-primary:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
  color: var(--on-brand);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

:root[data-theme="dark"] .btn-danger {
  color: #2a0d0b;
}

.btn-danger:hover {
  background: var(--danger-strong);
  border-color: var(--danger-strong);
  color: #fff;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
}

.btn-ghost:hover {
  background: var(--canvas);
  border-color: transparent;
}

.btn-danger-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--danger);
}

.btn-danger-ghost:hover {
  background: var(--danger-tint);
  border-color: transparent;
  color: var(--danger);
}

.btn-icon {
  width: 2.75rem;
  padding: 0;
}

.btn-block {
  width: 100%;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.inline-form {
  display: inline;
}

/* --- Page header ---------------------------------------------------------- */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.page-head .lead {
  margin: 0.3rem 0 0;
  color: var(--muted);
  max-width: 46rem;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
  color: var(--muted);
}

.crumbs li + li::before {
  content: "/";
  margin-right: 0.35rem;
  color: var(--line-strong);
}

/* --- Cards ---------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

.card + .card,
.stack > * + * {
  margin-top: 1rem;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.card-body {
  padding: 1.1rem;
}

.card-foot {
  padding: 0.8rem 1.1rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 60rem) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }

  .grid-main {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    align-items: start;
  }
}

/* --- Stat tiles ----------------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

@media (min-width: 48rem) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 75rem) {
  .stats {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.stat {
  display: block;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  color: var(--ink);
  text-decoration: none;
}

a.stat:hover {
  border-color: var(--brand);
  color: var(--ink);
}

.stat-label {
  display: block;
  font-size: var(--text-sm);
  color: var(--muted);
}

.stat-value {
  display: block;
  margin-top: 0.15rem;
  font-size: var(--text-xl);
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-note {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted);
}

/* --- Badges and identifier chips ------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  background: var(--canvas);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--line);
}

.badge::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: currentColor;
}

.badge-plain::before {
  display: none;
}

.badge-ok {
  background: var(--ok-tint);
  color: var(--ok);
  border-color: transparent;
}

.badge-warn {
  background: var(--warn-tint);
  color: var(--warn);
  border-color: transparent;
}

.badge-danger {
  background: var(--danger-tint);
  color: var(--danger);
  border-color: transparent;
}

.badge-info {
  background: var(--info-tint);
  color: var(--info);
  border-color: transparent;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  min-height: 1.75rem;
  padding: 0.1rem 0.5rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-feature-settings: "zero" 1;
  line-height: 1.3;
  cursor: pointer;
  text-align: left;
  overflow-wrap: anywhere;
}

.chip:hover {
  border-style: solid;
  border-color: var(--brand);
}

.chip .icon {
  width: 0.85rem;
  height: 0.85rem;
  color: var(--muted);
}

.chip.is-copied {
  border-style: solid;
  border-color: var(--ok);
  background: var(--ok-tint);
  color: var(--ok);
}

.chip-label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: 600;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.monogram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  border-radius: var(--radius-sm);
  font-weight: 650;
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  background: var(--brand-tint);
  color: var(--brand-strong);
}

.monogram-lg {
  width: 3.25rem;
  height: 3.25rem;
  font-size: var(--text-md);
  border-radius: var(--radius);
}

.tone-1 { background: var(--brand-tint); color: var(--brand-strong); }
.tone-2 { background: var(--info-tint); color: var(--info); }
.tone-3 { background: var(--warn-tint); color: var(--warn); }
.tone-4 { background: var(--ok-tint); color: var(--ok); }
.tone-5 { background: var(--danger-tint); color: var(--danger); }
.tone-6 { background: var(--canvas); color: var(--muted); }

/* --- Alerts --------------------------------------------------------------- */
.alert {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--info-tint);
  color: var(--ink);
}

.alert .icon {
  margin-top: 0.15rem;
  color: var(--info);
}

.alert-body {
  flex: 1;
  min-width: 0;
}

.alert-body > :last-child {
  margin-bottom: 0;
}

.alert-success {
  background: var(--ok-tint);
}

.alert-success .icon {
  color: var(--ok);
}

.alert-error {
  background: var(--danger-tint);
}

.alert-error .icon {
  color: var(--danger);
}

.alert-warning {
  background: var(--warn-tint);
}

.alert-warning .icon {
  color: var(--warn);
}

.alert-close {
  margin: -0.35rem -0.4rem -0.35rem 0;
  min-height: 2.25rem;
  width: 2.25rem;
}

.alert ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
}

/* --- Tables --------------------------------------------------------------- */
.table-wrap {
  position: relative;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.table th,
.table td {
  padding: 0.7rem 1.1rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.table th {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}

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

.table tbody tr[data-href] {
  cursor: pointer;
}

.table tbody tr[data-href]:hover {
  background: var(--surface-2);
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table .actions {
  text-align: right;
  white-space: nowrap;
}

.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 1.75rem;
  color: inherit;
  text-decoration: none;
}

.sort-link:hover {
  color: var(--ink);
}

.sort-link .icon {
  width: 0.8rem;
  height: 0.8rem;
  opacity: 0.35;
}

th[aria-sort="ascending"] .sort-link,
th[aria-sort="descending"] .sort-link {
  color: var(--ink);
}

th[aria-sort] .sort-link .icon {
  opacity: 1;
  color: var(--brand);
}

th[aria-sort="descending"] .sort-link .icon {
  transform: rotate(180deg);
}

.cell-main {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.cell-main a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.cell-main a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.cell-sub {
  display: block;
  font-size: var(--text-sm);
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* Below 48rem a table turns into a list of cards: one row = one card,
   each cell labelled by its column header (data-label). */
@media (max-width: 47.99rem) {
  .table-stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .table-stack,
  .table-stack tbody,
  .table-stack tr,
  .table-stack td {
    display: block;
    width: 100%;
  }

  .table-stack tr {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line);
  }

  .table-stack tbody tr:last-child {
    border-bottom: 0;
  }

  .table-stack td {
    display: grid;
    grid-template-columns: 8.5rem minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.2rem 0;
    border: 0;
    text-align: left;
  }

  .table-stack td::before {
    content: attr(data-label);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    padding-top: 0.2rem;
  }

  .table-stack td.cell-title {
    display: block;
    padding-bottom: 0.4rem;
  }

  .table-stack td.cell-title::before,
  .table-stack td.actions::before {
    display: none;
  }

  .table-stack td.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.5rem;
    text-align: left;
  }

  .table-stack .num {
    text-align: left;
  }
}

/* --- Filters / toolbar ---------------------------------------------------- */
.toolbar {
  display: grid;
  gap: 0.6rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 48rem) {
  .toolbar {
    grid-template-columns: minmax(12rem, 2fr) repeat(auto-fit, minmax(9rem, 1fr));
    align-items: end;
  }

  .toolbar .toolbar-actions {
    grid-column: 1 / -1;
  }
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
}

.result-count {
  font-size: var(--text-sm);
  color: var(--muted);
}

/* --- Forms ---------------------------------------------------------------- */
.form-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 48rem) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .form-grid .field-wide {
    grid-column: 1 / -1;
  }
}

.field {
  min-width: 0;
}

.label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: var(--text-sm);
  font-weight: 600;
}

.label .req {
  color: var(--danger);
  margin-left: 0.15rem;
}

.input,
.select,
.textarea {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  /* 16px on small screens keeps iOS from zooming into the field. */
  font-size: 1rem;
}

@media (min-width: 48rem) {
  .input,
  .select,
  .textarea {
    font-size: var(--text-base);
  }
}

.input.mono,
.textarea.mono {
  font-family: var(--font-mono);
  font-feature-settings: "zero" 1;
}

.textarea {
  min-height: 6.5rem;
  resize: vertical;
}

.select {
  appearance: none;
  padding-right: 2.2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.05rem) 50%, calc(100% - 0.75rem) 50%;
  background-size: 0.3rem 0.3rem;
  background-repeat: no-repeat;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent);
}

.input[aria-invalid="true"],
.select[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

.help {
  margin: 0.3rem 0 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.error {
  display: flex;
  gap: 0.35rem;
  margin: 0.3rem 0 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--danger);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  min-height: 2.75rem;
  padding: 0.6rem 0;
  cursor: pointer;
}

.check input {
  width: 1.2rem;
  height: 1.2rem;
  margin: 0.15rem 0 0;
  flex: none;
  accent-color: var(--brand);
}

.check-text small {
  display: block;
  color: var(--muted);
  font-size: var(--text-sm);
}

.fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.fieldset legend {
  padding: 0;
  margin-bottom: 0.3rem;
  font-size: var(--text-sm);
  font-weight: 600;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.form-narrow {
  max-width: 34rem;
}

/* --- Tabs ----------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0 0 1rem;
  padding: 0 0 1px;
  list-style: none;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0 0.85rem;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs a:hover {
  color: var(--ink);
}

.tabs a[aria-current="page"] {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.tab-count {
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--canvas);
  font-size: var(--text-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* --- Partner header ------------------------------------------------------- */
.entity {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.1rem;
  margin-bottom: 1rem;
}

.entity-id {
  display: flex;
  gap: 0.9rem;
  min-width: 0;
  flex: 1 1 20rem;
}

.entity-title {
  font-size: var(--text-lg);
  overflow-wrap: anywhere;
}

.entity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
  align-items: center;
}

/* --- Definition list ------------------------------------------------------ */
.dl {
  display: grid;
  gap: 0;
  margin: 0;
}

.dl > div {
  display: grid;
  grid-template-columns: minmax(7.5rem, 11rem) minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.dl > div:last-child {
  border-bottom: 0;
}

.dl dt {
  color: var(--muted);
  font-size: var(--text-sm);
  padding-top: 0.1rem;
}

.dl dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.prewrap {
  white-space: pre-wrap;
}

/* --- Item list (contacts / addresses / accounts) -------------------------- */
.items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.item:last-child {
  border-bottom: 0;
}

.item.is-inactive .item-body {
  opacity: 0.7;
}

.item-body {
  display: flex;
  gap: 0.8rem;
  min-width: 0;
  flex: 1 1 18rem;
}

.item-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.item-lines {
  margin: 0.2rem 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
  color: var(--muted);
}

.item-lines li {
  overflow-wrap: anywhere;
}

.item-lines a {
  color: inherit;
}

.item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

/* --- Timeline (history) --------------------------------------------------- */
.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.event {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.event:last-child {
  border-bottom: 0;
}

.event-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.75rem;
  align-items: baseline;
  justify-content: space-between;
}

.event-title {
  font-weight: 600;
}

.event-meta {
  font-size: var(--text-sm);
  color: var(--muted);
}

.changes {
  width: 100%;
  margin-top: 0.5rem;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.changes th,
.changes td {
  padding: 0.3rem 0.5rem 0.3rem 0;
  text-align: left;
  vertical-align: top;
  border-top: 1px dashed var(--line);
  overflow-wrap: anywhere;
}

.changes th {
  width: 9.5rem;
  font-weight: 500;
  color: var(--muted);
}

.changes .old {
  color: var(--danger);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--danger) 50%, transparent);
}

.changes .new {
  color: var(--ok);
}

.changes .arrow {
  color: var(--muted);
  padding: 0 0.25rem;
}

/* --- Empty state ---------------------------------------------------------- */
.empty {
  padding: 2.5rem 1.25rem;
  text-align: center;
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 0.75rem;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand);
}

.empty h2,
.empty h3 {
  font-size: var(--text-md);
}

.empty p {
  max-width: 30rem;
  margin: 0.4rem auto 1rem;
  color: var(--muted);
}

/* --- Pagination ----------------------------------------------------------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--line);
  font-size: var(--text-sm);
  color: var(--muted);
}

.pages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pages a,
.pages span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pages a:hover {
  background: var(--canvas);
}

.pages [aria-current="page"] {
  background: var(--brand);
  color: var(--on-brand);
}

.pages .gap {
  color: var(--muted);
  min-width: 1.5rem;
}

/* --- User menu ------------------------------------------------------------ */
.menu {
  position: relative;
  margin-left: auto;
}

.menu > summary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0 0.4rem;
  border-radius: var(--radius-sm);
  list-style: none;
  cursor: pointer;
  font-weight: 600;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

.menu > summary:hover {
  background: var(--canvas);
}

.menu-name {
  display: none;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 48rem) {
  .menu-name {
    display: inline;
  }
}

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 50;
  min-width: 15rem;
  padding: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
}

.menu-who {
  padding: 0.5rem 0.65rem 0.65rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.3rem;
}

.menu-panel a,
.menu-panel button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0 0.65rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-panel a:hover,
.menu-panel button:hover {
  background: var(--canvas);
}

/* --- Dialog --------------------------------------------------------------- */
.dialog {
  width: min(28rem, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-2);
}

.dialog::backdrop {
  background: rgb(8 14 20 / 55%);
}

.dialog-body {
  padding: 1.25rem 1.25rem 0.5rem;
}

.dialog-body h2 {
  margin-bottom: 0.5rem;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 0.75rem 1.25rem 1.25rem;
}

/* --- Auth pages ----------------------------------------------------------- */
.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
}

.auth-card {
  width: 100%;
  max-width: 25rem;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  font-size: var(--text-lg);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.auth-brand .brand-mark {
  width: 2.25rem;
  height: 2.25rem;
}

.auth-foot {
  margin-top: 1rem;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--muted);
}

/* --- Code / docs ---------------------------------------------------------- */
.code {
  display: block;
  margin: 0.5rem 0 1rem;
  padding: 0.85rem 1rem;
  background: var(--nav-bg);
  color: #dbe5ec;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  background: var(--canvas);
}

.code code {
  padding: 0;
  background: none;
  font-size: inherit;
}

.method {
  display: inline-block;
  min-width: 3.6rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  text-align: center;
  background: var(--info-tint);
  color: var(--info);
}

.method-post {
  background: var(--ok-tint);
  color: var(--ok);
}

.method-patch {
  background: var(--warn-tint);
  color: var(--warn);
}

.token-box {
  padding: 1rem;
  border: 2px solid var(--warn);
  border-radius: var(--radius);
  background: var(--warn-tint);
  margin-bottom: 1rem;
}

.token-value {
  display: block;
  margin: 0.6rem 0;
  padding: 0.7rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
  user-select: all;
}

.codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem 1rem;
  margin: 0.6rem 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
}

.qr {
  display: inline-block;
  padding: 0.6rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  line-height: 0;
}

.qr svg {
  width: 11.5rem;
  height: 11.5rem;
}

.prose h2 {
  margin: 1.5rem 0 0.5rem;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose ul,
.prose ol {
  margin: 0 0 0.75rem;
  padding-left: 1.25rem;
}

.prose li {
  margin-bottom: 0.25rem;
}

.compare {
  display: grid;
  gap: 1rem;
}

@media (min-width: 48rem) {
  .compare {
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
  }
}

.compare-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.subnav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.subnav a[aria-current="page"] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

.skeleton {
  display: block;
  height: 2.6rem;
  margin: 0.25rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--canvas) 25%, var(--line) 50%, var(--canvas) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 1rem; }
.text-right { text-align: right; }
.grow { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .sidebar,
  .topbar,
  .btn,
  .tabs,
  .pagination {
    display: none !important;
  }

  .shell-body {
    margin: 0;
  }
}

/* ==========================================================================
   Tabla - product-specific components
   ========================================================================== */

/* --- Shell additions ------------------------------------------------------ */
.main-wide {
  max-width: none;
}

.nav a > span:first-of-type {
  flex: 1;
  min-width: 0;
}

.nav-count {
  flex: none;
  min-width: 1.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #ffb84d;
  color: #2b1a00;
  font-size: var(--text-xs);
  font-weight: 700;
  text-align: center;
}

.nav-help {
  margin-top: 1.1rem;
}

.bell {
  position: relative;
  flex: none;
}

.bell.has-due {
  color: var(--danger);
}

.bell-count {
  position: absolute;
  top: 0.3rem;
  right: 0.2rem;
  min-width: 1.15rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
}

:root[data-theme="dark"] .bell-count {
  color: #2a0d0b;
}

/* --- Small controls -------------------------------------------------------- */
.btn-sm {
  min-height: 2.25rem;
  padding: 0 0.7rem;
  font-size: var(--text-sm);
}

/* Small buttons keep a 44px touch target on coarse pointers. */
@media (pointer: coarse) {
  .btn-sm {
    min-height: 2.75rem;
  }
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.select-sm {
  min-height: 2.25rem;
  width: auto;
  padding-top: 0;
  padding-bottom: 0;
  font-size: var(--text-sm);
}

.input-xs {
  width: 4.5rem;
  min-height: 2.25rem;
  text-align: center;
  font-family: var(--font-mono);
}

.input-code {
  max-width: 11rem;
  font-size: var(--text-lg);
  letter-spacing: 0.2em;
  text-align: center;
}

.num {
  font-variant-numeric: tabular-nums;
}

.form-medium {
  max-width: 46rem;
}

.form-wide {
  max-width: 62rem;
}

.field-end {
  display: flex;
  align-items: flex-end;
}

@media (min-width: 48rem) {
  .form-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form-grid-4 {
    grid-template-columns: 2fr 2fr 1fr auto;
  }
}

.time-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.time-range .input {
  flex: 1;
  min-width: 0;
}

.inline-edit {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.snooze {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.danger-zone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.danger-zone + .danger-zone {
  border-top: 1px solid var(--line);
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: 1rem;
  padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--canvas) 70%, transparent);
}

.card-note {
  margin: 0;
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-sm);
}

.item-compact {
  padding: 0.7rem 1.1rem;
  align-items: center;
}

.item-compact .item-body {
  display: flex;
  flex-direction: column;
}

a.item-title {
  color: var(--ink);
  text-decoration: none;
}

a.item-title:hover {
  color: var(--brand);
  text-decoration: underline;
}

.table-compact th,
.table-compact td {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.table tr.is-muted td {
  color: var(--muted);
}

.table tfoot th,
.table tfoot td {
  padding: 0.7rem 1.1rem;
  border-top: 2px solid var(--line-strong);
  text-align: left;
}

.table tfoot td.text-right {
  text-align: right;
}

.col-check {
  width: 2.75rem;
}

.col-check input,
.table input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--brand);
}

.tab-count-new {
  background: var(--danger);
  color: #fff;
}

:root[data-theme="dark"] .tab-count-new {
  color: #2a0d0b;
}

.kbd-inline {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

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

@media (min-width: 60rem) {
  .stats-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.steps {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 1.25rem;
}

/* --- Status vocabulary ------------------------------------------------------
   One mapping, used by the board cells, the summary pills, the "my open
   tasks" strip, the cell panel and the legend in the help page. */
.status-done {
  --st-bg: var(--ok-tint);
  --st-fg: var(--ok);
  --st-line: var(--ok-line);
}

.status-overdue {
  --st-bg: var(--danger-tint);
  --st-fg: var(--danger);
  --st-line: var(--danger-line);
}

.status-soon {
  --st-bg: var(--warn-tint);
  --st-fg: var(--warn);
  --st-line: var(--warn-line);
}

.status-progress {
  --st-bg: var(--info-tint);
  --st-fg: var(--info);
  --st-line: var(--info-line);
}

.status-pending {
  --st-bg: var(--surface);
  --st-fg: var(--muted);
  --st-line: var(--line-strong);
}

.status-badge {
  background: var(--st-bg);
  color: var(--st-fg);
  border-color: var(--st-line);
}

/* --- Board: header and summary -------------------------------------------- */
.board-head {
  align-items: center;
}

.period-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.period-label {
  min-width: 9.5rem;
  padding: 0 0.35rem;
  font-size: var(--text-md);
  text-align: center;
  text-transform: capitalize;
}

.status-pills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

@media (min-width: 40rem) {
  .status-pills {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.status-pill {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.55rem;
  align-items: center;
  min-height: 3.6rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--st-line);
  border-left: 5px solid var(--st-fg);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-1);
}

.status-pill .icon {
  grid-row: 1 / 3;
  width: 1.4rem;
  height: 1.4rem;
  color: var(--st-fg);
}

.status-pill:hover {
  background: var(--st-bg);
  color: var(--ink);
}

.status-pill.is-active {
  background: var(--st-bg);
  box-shadow: 0 0 0 2px var(--st-fg);
}

.status-count {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.status-label {
  font-size: var(--text-sm);
  color: var(--muted);
}

/* --- Board: layout ---------------------------------------------------------
   The matrix needs width. Three arrangements:
   - narrow:  dates (list), matrix, the other cards
   - medium:  dates as one horizontal strip above the matrix, the other cards below
   - very wide: dates and the other cards in a rail to the right of the matrix */
.board-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "dates"
    "main"
    "aside";
  gap: 1rem;
  align-items: start;
}

.board-layout > .card + .card,
.board-layout > * {
  margin-top: 0;
}

.board-dates {
  grid-area: dates;
  min-width: 0;
}

.board-main {
  grid-area: main;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.board-main > .card + .card {
  margin-top: 0;
}

.board-aside {
  grid-area: aside;
  min-width: 0;
  display: grid;
  gap: 1rem;
  align-items: start;
}

.board-aside > .card + .card {
  margin-top: 0;
}

.board-dates .card-head h2 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.board-dates .card-head .icon {
  color: var(--brand);
}

@media (min-width: 48rem) and (max-width: 99.99rem) {
  .board-layout .board-aside {
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  }
}

@media (min-width: 48rem) {

  /* Strip: the next dates side by side, scrolling sideways if they do not fit. */
  .board-dates .date-list {
    position: relative;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(15.5rem, 1fr);
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .board-dates .date-item {
    border-bottom: 0;
    border-right: 1px solid var(--line);
    padding: 0.55rem 0.75rem;
  }

  .board-dates .date-body > * {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .board-dates .date-body .muted {
    display: none;
  }

  .board-dates .date-body .date-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    white-space: normal;
  }

  .board-dates .date-partner {
    display: none;
  }

  .board-dates .card-head {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .board-dates .date-item:last-child {
    border-right: 0;
  }
}

@media (min-width: 100rem) {
  .board-layout.has-rail {
    grid-template-columns: minmax(0, 1fr) 21rem;
    grid-template-areas:
      "main dates"
      "main aside";
    grid-template-rows: auto 1fr;
  }

  .board-aside {
    grid-template-columns: minmax(0, 1fr);
  }

  .board-dates .date-list {
    display: block;
    overflow: visible;
  }

  .board-dates .date-item {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0.65rem 0.9rem;
  }

  .board-dates .date-body > * {
    white-space: normal;
  }

  .board-dates .date-body .muted {
    display: inline;
  }

  .board-dates .date-body .date-title {
    display: inline;
  }

  .board-dates .date-partner {
    display: block;
  }

  .board-dates .card-head {
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
  }

  .board-dates .date-item:last-child {
    border-bottom: 0;
  }
}

.board-aside .card-head h2 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.board-aside .card-head .icon {
  color: var(--brand);
}

.board-aside .card-foot {
  padding: 0.6rem 0.75rem 0.75rem;
  border-top: 1px solid var(--line);
}

.aside-empty {
  margin: 0;
  padding: 0.9rem 1.1rem 1.1rem;
  color: var(--muted);
  font-size: var(--text-sm);
}

.board-toolbar {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

@media (min-width: 48rem) {
  .toolbar.board-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.6rem;
  }

  .board-toolbar .field {
    flex: 1 1 8.5rem;
    min-width: 0;
    max-width: 15rem;
  }

  .toolbar.board-toolbar .toolbar-actions {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    border: 0;
  }
}

/* --- Board: my open tasks --------------------------------------------------- */
.my-open-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0.75rem;
  list-style: none;
}


.my-open-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 3.25rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--st-line);
  border-left: 4px solid var(--st-fg);
  border-radius: var(--radius-sm);
  background: var(--st-bg);
  color: var(--ink);
  text-decoration: none;
}

.my-open-item:hover {
  color: var(--ink);
  box-shadow: 0 0 0 2px var(--st-fg);
}

.my-open-item .icon {
  color: var(--st-fg);
}

.my-open-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.my-open-text strong,
.my-open-text .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-open-text .muted {
  font-size: var(--text-sm);
}

.my-open-due {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--st-fg);
  line-height: 1.2;
}

.my-open-due small {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--text-xs);
}

/* --- Board: the matrix ------------------------------------------------------ */
.matrix-wrap {
  position: relative;
  overflow: auto;
  max-height: calc(100dvh - 9rem);
  border-top: 1px solid var(--line);
}

.matrix {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.matrix th,
.matrix td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.matrix thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  min-width: 3.85rem;
  padding: 0.5rem 0.2rem;
  background: var(--surface-2);
  vertical-align: bottom;
  text-align: center;
  font-weight: 600;
}

.matrix-code {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--brand);
}

.matrix-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: var(--text-xs);
  line-height: 1.2;
  color: var(--muted);
  font-weight: 500;
}

.matrix .matrix-partner {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 11rem;
  min-width: 10rem;
  max-width: 15rem;
  padding: 0.45rem 0.75rem;
  background: var(--surface);
  text-align: left;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.matrix thead .matrix-partner {
  z-index: 4;
  background: var(--surface-2);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.matrix tbody tr:hover .matrix-partner {
  background: var(--brand-tint);
}

.matrix-partner a {
  color: var(--ink);
  text-decoration: none;
}

.matrix-partner a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.matrix-over {
  display: block;
  margin-top: 0.1rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--danger);
}

.cell {
  padding: 0.2rem;
  height: 3.25rem;
  text-align: center;
  background: var(--surface);
}

/* Unassigned: hatched, so "nobody does this" reads differently from "waiting". */
.cell-none {
  background: repeating-linear-gradient(135deg, var(--canvas) 0 6px, var(--surface-2) 6px 12px);
}

.cell-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  height: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--st-line);
  border-radius: var(--radius-sm);
  background: var(--st-bg);
  color: var(--st-fg);
  text-decoration: none;
  line-height: 1.1;
}

.cell-link:hover,
.cell-link:focus-visible {
  color: var(--st-fg);
  box-shadow: 0 0 0 2px var(--st-fg);
}

.cell-link.is-mine {
  border-width: 2px;
  border-color: var(--st-fg);
}

.cell-link .icon {
  width: 0.95rem;
  height: 0.95rem;
}

.cell-link.status-pending .icon {
  opacity: 0.5;
}

.cell-day {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
}

.cell-who {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

.matrix-legend {
  margin: 0;
  padding: 0.6rem 1.1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-sm);
}

/* Narrow screens: every partner becomes a card listing only its assigned
   tasks - a 13-column grid is unreadable at 360px. */
@media (max-width: 47.99rem) {
  .matrix-wrap {
    max-height: none;
    overflow: visible;
  }

  .matrix,
  .matrix tbody,
  .matrix tr,
  .matrix th,
  .matrix td {
    display: block;
    width: 100%;
  }

  .matrix thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .matrix th,
  .matrix td {
    border-right: 0;
  }

  .matrix tbody tr {
    padding: 0.5rem 0.75rem 0.75rem;
    border-bottom: 6px solid var(--canvas);
  }

  .matrix .matrix-partner {
    position: static;
    max-width: none;
    padding: 0.35rem 0 0.5rem;
    border-bottom: 0;
    font-size: var(--text-md);
    background: transparent;
  }

  .matrix tbody tr:hover .matrix-partner {
    background: transparent;
  }

  .cell-none {
    display: none !important;
  }

  .cell {
    height: auto;
    padding: 0.2rem 0;
    border-bottom: 0;
  }

  .cell-link {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.6rem;
    min-height: 2.9rem;
    padding: 0 0.75rem;
  }

  .cell-link::before {
    content: attr(title);
    order: 5;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: 500;
    text-align: left;
  }

  .cell-who {
    order: 9;
  }
}

/* --- Board: cell panel (dialog or page) ------------------------------------- */
.dialog-panel {
  width: min(44rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
}

.dialog-close {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  height: 0;
  padding: 0.4rem 0.4rem 0 0;
}

.dialog-panel [data-panel-body] {
  padding: 1.25rem;
}

.dialog-panel .panel-loading {
  display: grid;
  gap: 0.75rem;
  padding: 0.5rem 0 1rem;
}

.cell-panel {
  display: grid;
  gap: 1.1rem;
  max-width: 44rem;
}

.cell-panel-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-right: 2.5rem;
}

.cell-panel-title {
  font-size: var(--text-lg);
}

.cell-panel-sub {
  margin: 0.15rem 0 0;
  color: var(--muted);
}

.status-tile {
  flex: none;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 1px solid var(--st-line);
  border-radius: var(--radius);
  background: var(--st-bg);
  color: var(--st-fg);
}

.cell-facts {
  display: grid;
  gap: 0.5rem 1.5rem;
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

@media (min-width: 40rem) {
  .cell-facts {
    grid-template-columns: auto auto 1fr;
  }
}

.cell-facts dt {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.cell-facts dd {
  margin: 0.1rem 0 0;
  font-weight: 600;
}

.cell-panel h3 {
  margin-bottom: 0.5rem;
}

.cell-activities {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.cell-activities li {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

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

.cell-activity-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
}

.cell-activity-note {
  margin: 0.35rem 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.cell-form {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.cell-form-actions {
  margin-top: 1rem;
}

.remind-box {
  padding: 0.25rem 0.85rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.remind-box > summary {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--brand);
}

.remind-box[open] {
  padding-bottom: 0.85rem;
}

.remind-box[open] > summary {
  margin-bottom: 0.35rem;
}

/* --- Important dates -------------------------------------------------------- */
.date-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.date-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
}

.date-item:last-child {
  border-bottom: 0;
}

.date-list-full .date-item {
  padding: 0.8rem 1.1rem;
}

.date-item.is-today {
  background: var(--warn-tint);
}

.date-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  border: 1px solid var(--line-strong);
  border-top: 5px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--surface);
  line-height: 1;
}

.date-item.is-today .date-badge {
  border-top-color: var(--warn);
}

.date-day {
  font-family: var(--font-mono);
  font-size: var(--text-md);
  font-weight: 700;
}

.date-month {
  margin-top: -0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.date-body {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.date-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.date-meta,
.date-partner,
.date-note {
  display: block;
  font-size: var(--text-sm);
  color: var(--muted);
}

.date-when {
  font-weight: 600;
  color: var(--ink);
}

.date-partner a {
  color: var(--muted);
}

.date-actions {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.25rem;
}

.date-actions .badge::before {
  display: none;
}

.date-actions .badge .icon {
  width: 0.8rem;
  height: 0.8rem;
}

@media (max-width: 47.99rem) {
  .board-dates .date-item:nth-child(n + 4) {
    display: none;
  }
}

@media (max-width: 39.99rem) {
  .date-list-full .date-item {
    flex-wrap: wrap;
  }

  .date-list-full .date-actions {
    width: 100%;
    justify-content: flex-start;
    padding-left: 3.65rem;
  }
}

/* --- Mini lists (side panel) ------------------------------------------------ */
.mini-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mini-list li {
  border-bottom: 1px solid var(--line);
}

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

.mini-list a {
  display: block;
  padding: 0.6rem 0.9rem;
  color: var(--ink);
  text-decoration: none;
}

.mini-list a:hover {
  background: var(--surface-2);
}

.mini-list li.is-due a {
  box-shadow: inset 4px 0 0 var(--danger);
}

.mini-when,
.mini-meta {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted);
}

.mini-list li.is-due .mini-when {
  color: var(--danger);
  font-weight: 600;
}

.mini-text {
  display: block;
  overflow-wrap: anywhere;
}

/* --- Reminders, notes, posts ------------------------------------------------ */
.reminder.is-due {
  box-shadow: inset 4px 0 0 var(--danger);
}

.note-text {
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.note {
  scroll-margin-top: 5rem;
}

.note.is-important {
  border-left: 5px solid var(--danger);
}

.note.is-closed {
  background: var(--surface-2);
}

.note-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.5rem;
}

.note-replies {
  margin: 1rem 0 0;
  padding: 0 0 0 1rem;
  list-style: none;
  border-left: 3px solid var(--line);
}

.note-replies li {
  padding: 0.6rem 0;
}

.note-replies li + li {
  border-top: 1px solid var(--line);
}

.note-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.35rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.note-reply[open] {
  flex-basis: 100%;
}

.note-reply > summary,
.inline-details > summary {
  list-style: none;
  width: fit-content;
}

.note-reply > summary::-webkit-details-marker,
.inline-details > summary::-webkit-details-marker {
  display: none;
}

.note-reply form,
.inline-details form {
  margin-top: 0.75rem;
}

.inline-details {
  margin-top: 0.75rem;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

.attachments li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.post.is-pinned {
  box-shadow: inset 4px 0 0 var(--info);
}

.mail-item > summary {
  cursor: pointer;
  list-style-position: outside;
}

.mail-item > summary .item-title {
  display: block;
}

.mail-body {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

/* --- Assignments ------------------------------------------------------------ */
.assign-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.assign-chips li {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.assign-task {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--brand);
}

.assign-user {
  font-weight: 600;
}

.assign-due {
  font-family: var(--font-mono);
  color: var(--muted);
}

.bulk-bar {
  margin: 0;
  padding: 1rem 1.1rem;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.bulk-bar legend {
  float: left;
  width: 100%;
  margin-bottom: 0.6rem;
  padding: 0;
  font-weight: 650;
}

.bulk-bar .form-grid {
  clear: both;
}

/* --- Groups and permissions ------------------------------------------------- */
.perm-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 60rem) {
  .perm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.perm-grid > .card + .card {
  margin-top: 0;
}

.perm-section {
  min-width: 0;
  margin: 0;
  padding: 0.5rem 1.1rem 0.75rem;
}

.perm-legend {
  padding: 0 0.4rem;
  font-weight: 650;
  font-size: var(--text-md);
}

.perm-all {
  border-bottom: 1px dashed var(--line);
  margin-bottom: 0.2rem;
}

.rights {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 60rem) {
  .rights {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.check-list {
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: flex;
  gap: 0.45rem;
  padding: 0.2rem 0;
  font-size: var(--text-sm);
}

.check-list .icon {
  margin-top: 0.15rem;
  color: var(--ok);
}

/* --- Help legend ------------------------------------------------------------ */
.legend {
  padding: 0;
  list-style: none;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 0;
}

.legend-swatch {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--st-line);
  border-radius: var(--radius-sm);
  background: var(--st-bg);
  color: var(--st-fg);
}

/* --- Print (reports are printed / saved as PDF from the browser) ----------- */
.print-only {
  display: none;
}

.print-header {
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid #000;
  font-size: 0.95rem;
  line-height: 1.35;
}

@media print {
  .no-print,
  .subnav,
  .alert,
  .skip-link,
  .sidebar-backdrop {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  body,
  .card,
  .stat {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
  }

  .main {
    max-width: none;
    padding: 0;
  }

  .card {
    border: 0;
    break-inside: auto;
  }

  .table-stack thead {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
  }

  .table th,
  .table td {
    padding: 0.25rem 0.4rem;
    border-bottom: 1px solid #999;
  }

  .table tr {
    break-inside: avoid;
  }

  .stat {
    border: 1px solid #999;
  }

  a {
    color: #000 !important;
    text-decoration: none !important;
  }
}

/* --- Layout corrections for Tabla's markup --------------------------------- */
.grid > * {
  min-width: 0;
}

.grid > .card + .card {
  margin-top: 0;
}

.grid + .grid,
.card + .grid,
.grid + .card {
  margin-top: 1rem;
}

.entity {
  justify-content: flex-start;
  padding: 0.25rem 0 0;
}

.entity-body {
  flex: 1 1 20rem;
  min-width: 0;
}

.item-body {
  flex-direction: column;
  gap: 0.15rem;
}

.item-lines {
  margin-top: 0.25rem;
}

.table tbody th,
.table tfoot th {
  background: transparent;
  color: var(--ink);
  font-size: inherit;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.item-lines > span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-right: 0.9rem;
}

.board-aside,
.my-open-list {
  grid-template-columns: minmax(0, 1fr);
}

.board-aside > * {
  min-width: 0;
}

/* --- Installer -------------------------------------------------------------- */
.setup {
  align-items: start;
  padding-top: 2.5rem;
}

.setup-card {
  width: min(52rem, 100%);
  max-width: none;
}

.setup-card .card + .card,
.setup-card .card + .btn {
  margin-top: 1rem;
}

.setup-card .btn-block {
  min-height: 3.25rem;
  font-size: var(--text-md);
}

/* --- Import from the old Tabla ---------------------------------------------- */
.btn-row-end {
  justify-content: flex-end;
}

.progress {
  height: 0.75rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--canvas);
  border: 1px solid var(--line);
}

.progress-bar {
  display: block;
  height: 100%;
  background: var(--brand);
  transition: width 0.3s ease;
}

.load-state {
  border-top: 1px solid var(--line);
}

.report {
  border-top: 1px solid var(--line);
}

.report > summary {
  padding: 0.7rem 1.1rem;
  cursor: pointer;
}

.report-text {
  margin: 0;
  padding: 0.5rem 1.1rem 1.1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.45;
  white-space: pre;
}

.is-busy {
  opacity: 0.6;
  pointer-events: none;
}

details.advanced > summary {
  cursor: pointer;
  list-style: none;
}

details.advanced > summary::-webkit-details-marker {
  display: none;
}

details.advanced > summary h2::before {
  content: "▸ ";
  color: var(--muted);
}

details.advanced[open] > summary h2::before {
  content: "▾ ";
}

/* --- Client portal ---------------------------------------------------------
   The partner's own people: a top bar instead of the sidebar, the same
   tokens and components otherwise. */
.portal-body {
  min-height: 100dvh;
  background: var(--canvas);
}

.portal-top {
  background: var(--nav-bg);
  color: var(--nav-ink);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.portal-top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 0.75rem;
}

.portal-brand {
  flex: 1 1 auto;
  min-width: 0;
}

.portal-brand > span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.portal-partner {
  font-weight: 500;
  color: var(--nav-ink);
}

.portal-top .menu-name {
  color: var(--nav-ink-strong);
}

.portal-top .menu > summary {
  color: var(--nav-ink-strong);
}

.portal-nav {
  border-top: 1px solid var(--nav-hover);
  overflow-x: auto;
}

.portal-nav ul {
  display: flex;
  gap: 0.15rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.3rem 0.5rem;
  list-style: none;
}

.portal-nav a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--nav-ink);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.portal-nav a:hover {
  background: var(--nav-hover);
  color: var(--nav-ink-strong);
}

.portal-nav a[aria-current="page"] {
  background: var(--nav-active);
  color: var(--nav-ink-strong);
  box-shadow: inset 0 -3px 0 var(--nav-accent);
}

.portal-main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.25rem 0.75rem calc(3rem + env(safe-area-inset-bottom));
  padding-left: calc(0.75rem + env(safe-area-inset-left));
  padding-right: calc(0.75rem + env(safe-area-inset-right));
}

.portal-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.portal-strip-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--info-line);
  border-radius: 999px;
  background: var(--info-tint);
  color: var(--info);
  font-weight: 600;
  text-decoration: none;
}

/* --- Conversation ---------------------------------------------------------- */
.chat-card {
  display: flex;
  flex-direction: column;
}

.chat-scroll {
  max-height: min(60dvh, 34rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chat-day {
  align-self: center;
  margin: 0.4rem 0;
  font-size: var(--text-xs);
  color: var(--muted);
}

.chat-day span {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.chat-msg {
  display: flex;
  max-width: min(85%, 40rem);
}

.chat-mine {
  align-self: flex-end;
}

.chat-bubble {
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-lg);
  border-top-left-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.chat-mine .chat-bubble {
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-sm);
  background: var(--brand-tint);
  border-color: color-mix(in srgb, var(--brand) 25%, transparent);
}

.chat-meta {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 0.2rem;
  font-size: var(--text-xs);
  color: var(--muted);
}

.chat-text {
  white-space: pre-line;
}

.chat-file {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
  font-weight: 600;
}

.chat-compose {
  padding: 0.8rem 1.1rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.chat-compose textarea {
  resize: vertical;
}

.chat-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.chat-actions .help {
  flex: 1 1 8rem;
  margin: 0;
}

.chat-attach {
  cursor: pointer;
}

.chat-attach:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* --- Shared to-do list ----------------------------------------------------- */
.todo {
  margin: 0;
  padding: 0;
  list-style: none;
}

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--line);
}

.todo-item:first-child {
  border-top: 0;
}

.todo-overdue {
  background: color-mix(in srgb, var(--danger-tint) 55%, transparent);
}

.todo-check {
  flex: none;
  padding-top: 0.1rem;
}

.todo-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 2px solid var(--line-strong);
  border-radius: 0.4rem;
  background: var(--surface);
  color: var(--on-brand);
  cursor: pointer;
}

.todo-box:hover {
  border-color: var(--brand);
}

.todo-box.is-done {
  background: var(--ok);
  border-color: var(--ok);
}

.todo-box .icon {
  width: 1rem;
  height: 1rem;
}

.todo-body {
  flex: 1 1 auto;
  min-width: 0;
}

.todo-done .todo-title {
  text-decoration: line-through;
  color: var(--muted);
}

.card-section {
  border-top: 1px solid var(--line);
}

.card-section > summary {
  padding: 0.6rem 1.1rem;
  cursor: pointer;
}

.text-danger {
  color: var(--danger);
}

.row-unread td {
  font-weight: 600;
}

/* One-time secrets shown exactly once (portal passwords, invitation links). */
.secret-card {
  border-color: var(--warn-line);
  background: var(--warn-tint);
}

.secret {
  margin: 0.5rem 0;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px dashed var(--warn-line);
  font-family: var(--font-mono);
  font-size: var(--text-md);
  user-select: all;
}

.break {
  overflow-wrap: anywhere;
}

/* --- Conversation page: people on the left, thread on the right ----------- */
.chat-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 24rem;
}

@media (min-width: 60rem) {
  .chat-page {
    grid-template-columns: 18rem minmax(0, 1fr);
  }

  .chat-people {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }
}

.chat-people {
  border-bottom: 1px solid var(--line);
}

.chat-people ul {
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  max-height: 24rem;
  overflow-y: auto;
}

.chat-person {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}

.chat-person:hover {
  background: var(--surface-2);
}

.chat-person.is-active {
  background: var(--brand-tint);
}

.chat-person-new .icon {
  color: var(--brand);
}

.chat-person-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}

.chat-person-text > span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-pane .chat-scroll {
  flex: 1 1 auto;
  padding: 1rem;
}

.chat-pane-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
}

/* --- Floating chat widget (Messenger style) ------------------------------- */
.chatw {
  position: fixed;
  right: calc(1rem + env(safe-area-inset-right));
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

.chatw-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: var(--shadow-2);
  cursor: pointer;
}

.chatw-launcher .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.chatw-launcher:hover {
  background: var(--brand-strong);
}

.chatw-badge {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  min-width: 1.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  text-align: center;
  border: 2px solid var(--canvas);
}

.chatw-panel {
  display: flex;
  flex-direction: column;
  width: min(22rem, calc(100vw - 2rem));
  height: min(32rem, calc(100dvh - 7rem));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}

.chatw-head {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.5rem 0.4rem 0.75rem;
  background: var(--nav-bg);
  color: var(--nav-ink-strong);
}

.chatw-head .btn-ghost {
  color: var(--nav-ink-strong);
}

.chatw-title {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 650;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chatw-list {
  flex: 1 1 auto;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  overflow-y: auto;
}

.chatw-person {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.chatw-person:hover {
  background: var(--surface-2);
}

.chatw-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  list-style: none;
}

.chatw-thread {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.chatw-messages {
  flex: 1 1 auto;
  padding: 0.75rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chatw-messages .chat-msg {
  max-width: 88%;
}

.chatw-compose {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  padding: 0.5rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.chatw-compose textarea {
  flex: 1 1 auto;
  min-height: 2.5rem;
  max-height: 10rem;
  resize: none;
}

.chatw-note {
  margin: 0;
  padding: 0.4rem 0.75rem 0.6rem;
}

@media (max-width: 40rem) {
  .chatw.is-open {
    inset: 0;
    align-items: stretch;
    gap: 0;
  }

  .chatw.is-open .chatw-panel {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }

  .chatw.is-open .chatw-launcher {
    display: none;
  }
}

@media print {
  .chatw {
    display: none;
  }
}

.chat-people-wide {
  margin: 0;
  padding: 0.4rem;
  list-style: none;
}

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

.list-plain li {
  padding: 0.6rem 1.1rem;
  border-top: 1px solid var(--line);
}

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

/* --- Board, old look --------------------------------------------------------
   The table as the previous Tabla drew it, for colleagues who have used it for
   years: green header, "Rok:NN", grey = nobody assigned, green = done. Colours
   are tokens so the dark theme keeps the same meaning. */
:root {
  --old-head: #5cb52f;
  --old-head-ink: #ffffff;
  --old-line: #4f86c6;
  --old-cell: #ffffff;
  --old-cell-alt: #f2f5fb;
  --old-none: #d4d4d4;
  --old-done: #c8f0c3;
  --old-done-ink: #0d4d13;
  --old-ink: #1a2b45;
  --old-link: #1a4f9c;
}

:root[data-theme="dark"] {
  --old-head: #2f7a1c;
  --old-head-ink: #f0f7ec;
  --old-line: #3b5f8f;
  --old-cell: #16233a;
  --old-cell-alt: #1b2b45;
  --old-none: #2b3447;
  --old-done: #1f4a24;
  --old-done-ink: #bfe8b8;
  --old-ink: #e6ecf6;
  --old-link: #8db6f2;
}

.matrix-old {
  border-collapse: collapse;
  width: 100%;
  font-family: Verdana, Tahoma, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  color: var(--old-ink);
  background: var(--old-cell);
}

.matrix-old th,
.matrix-old td {
  border: 1px solid var(--old-line);
  padding: 0.25rem 0.35rem;
  vertical-align: top;
  text-align: center;
}

.matrix-old thead th {
  background: var(--old-head);
  color: var(--old-head-ink);
  font-weight: 700;
  font-size: 0.8rem;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2;
}

.matrix-old thead th.old-partner {
  text-align: left;
}

.old-caption {
  display: block;
  margin-bottom: 0.9rem;
}

.matrix-old .old-partner {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 11rem;
  max-width: 14rem;
  text-align: left;
  font-weight: 400;
  background: var(--old-cell);
}

.matrix-old tbody tr:nth-child(even) .old-partner,
.matrix-old tbody tr:nth-child(even) .old-open {
  background: var(--old-cell-alt);
}

.matrix-old .old-partner a {
  color: var(--old-link);
  text-decoration: none;
}

.matrix-old .old-partner a:hover {
  text-decoration: underline;
}

.old-owner {
  display: block;
  color: var(--old-link);
  font-size: 0.72rem;
}

.matrix-old .old-none {
  background: var(--old-none);
}

.matrix-old .old-open a,
.matrix-old .old-done a {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  color: var(--old-ink);
  text-decoration: none;
  white-space: nowrap;
}

.matrix-old .old-open a {
  flex-direction: row;
  gap: 0.3rem;
}

.matrix-old .old-open .icon {
  width: 0.95rem;
  height: 0.95rem;
  color: var(--old-link);
}

.matrix-old thead th.old-partner {
  background: var(--old-head);
  color: var(--old-head-ink);
  font-weight: 700;
  z-index: 3;
}

.matrix-old .old-done {
  background: var(--old-done);
}

.matrix-old .old-done a {
  color: var(--old-done-ink);
}

.matrix-old a:hover {
  text-decoration: underline;
}

.matrix-old a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

/* --- Task steps -------------------------------------------------------------
   A task may have up to five steps (payroll: sent / confirmed / prepared /
   filed). Each reached step has its own hue, the same on the board, in the old
   look and on the client portal; "done" stays green. */
:root {
  --step-1: #6d4bd6;
  --step-2: #1b57b5;
  --step-3: #0f7b8a;
  --step-4: #2a7f3f;
  --step-5: #7a5c00;
}

:root[data-theme="dark"] {
  --step-1: #b9a3ff;
  --step-2: #8db6f2;
  --step-3: #7fd3df;
  --step-4: #8fd19a;
  --step-5: #f0c36b;
}

.cell-link.has-step {
  --st-fg: var(--step-color);
  --st-line: color-mix(in srgb, var(--step-color) 45%, transparent);
  --st-bg: color-mix(in srgb, var(--step-color) 12%, var(--surface));
}

.step-1 { --step-color: var(--step-1); }
.step-2 { --step-color: var(--step-2); }
.step-3 { --step-color: var(--step-3); }
.step-4 { --step-color: var(--step-4); }
.step-5 { --step-color: var(--step-5); }

.cell-step {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
}

.old-step {
  display: block;
  margin-top: 0.1rem;
  padding: 0 0.3rem;
  border-radius: 3px;
  background: color-mix(in srgb, var(--step-color) 18%, var(--old-cell));
  color: var(--step-color);
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.step-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--step-color) 45%, transparent);
  background: color-mix(in srgb, var(--step-color) 12%, var(--surface));
  color: var(--step-color);
  font-size: var(--text-xs);
  font-weight: 700;
}

.old-step {
  flex-basis: 100%;
}

.step-track {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.step-track li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1rem 0.55rem 0.1rem 0.15rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.step-track li span {
  display: inline-grid;
  place-items: center;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: var(--surface-2);
  font-family: var(--font-mono);
}

.step-track li.is-reached {
  border-color: color-mix(in srgb, var(--step-color) 45%, transparent);
  background: color-mix(in srgb, var(--step-color) 12%, var(--surface));
  color: var(--step-color);
}

.step-track li.is-reached span {
  background: var(--step-color);
  color: var(--on-brand);
}

/* --- Billing and flat-fee reports -------------------------------------------- */
.price-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.input-sm {
  min-height: 2.1rem;
  padding: 0.2rem 0.5rem;
  width: 7rem;
}

.field-pair {
  display: inline-flex;
  gap: 0.35rem;
}

.field-pair .select {
  min-width: 0;
}

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

.column-order {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: col;
}

.column-order li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--line);
}

.column-order li::before {
  counter-increment: col;
  content: counter(col) ".";
  min-width: 1.6rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.column-order li:first-child {
  border-top: 0;
}

.column-order .grow {
  flex: 1 1 auto;
}

.arrow-down .icon {
  transform: rotate(180deg);
}

.stats-inset {
  margin: 0;
  padding: 1rem 1.1rem 0;
}

/* --- Look switch (top bar, left of the user) ------------------------------- */
.look-switch {
  display: flex;
  align-items: center;
  margin: 0;
}

.look-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0 0.6rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.look-switch-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.look-switch-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.look-switch-track {
  position: relative;
  width: 2.3rem;
  height: 1.3rem;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.15s;
}

.look-switch-knob {
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-1);
  transition: transform 0.15s;
}

.look-switch-btn[aria-checked="true"] .look-switch-track {
  background: var(--old-head);
}

.look-switch-btn[aria-checked="true"] .look-switch-knob {
  transform: translateX(1rem);
}

@media (max-width: 47.99rem) {
  .look-switch-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
}

/* --- Old-school look (whole application) -------------------------------------
   The previous Tabla's language: Verdana, square corners, blue hairlines, a
   green header and the dark-blue bar. Applied through the tokens, so every
   component follows without its own rules. Kept readable: contrast and
   spacing stay, only the dress changes. */
body.look-old {
  --font-ui: Verdana, Tahoma, "Segoe UI", Geneva, sans-serif;
  --text-base: 0.875rem;
  --radius-sm: 2px;
  --radius: 3px;
  --radius-lg: 3px;
  --canvas: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f3f6fb;
  --ink: #1a2b45;
  --muted: #4f6382;
  --line: #a9bfdc;
  --line-strong: #4f86c6;
  --brand: #3f8f1f;
  --brand-strong: #2f7a1c;
  --brand-tint: #e3f3da;
  --on-brand: #ffffff;
  --nav-bg: #1f3b6e;
  --nav-ink: #cfdbee;
  --nav-ink-strong: #ffffff;
  --nav-hover: #2a4d8a;
  --nav-active: #5cb52f;
  --nav-accent: #ffffff;
  --focus: #2f7a1c;
  --shadow-1: none;
  --shadow-2: 0 6px 18px rgb(16 32 58 / 25%);
  --ok: #2d7a1f; --ok-tint: #c8f0c3; --ok-line: #7cc46a;
  --info: #1f4f9c; --info-tint: #dce8f8; --info-line: #8fb3e3;
}

body.look-old .topbar {
  background: var(--old-head);
  border-bottom: 2px solid #3f8f1f;
  color: var(--old-head-ink);
}

body.look-old .topbar .search-box {
  background: #fff;
  border-color: #3f8f1f;
}

body.look-old .topbar .btn-ghost,
body.look-old .topbar .menu > summary,
body.look-old .topbar .menu-name,
body.look-old .topbar .look-switch-btn {
  color: var(--old-head-ink);
}

body.look-old .topbar .btn-ghost:hover,
body.look-old .topbar .look-switch-btn:hover {
  background: rgb(255 255 255 / 18%);
  color: #fff;
}

body.look-old .topbar .look-switch-track {
  background: rgb(255 255 255 / 45%);
}

body.look-old .topbar .look-switch-btn[aria-checked="true"] .look-switch-track {
  background: #1f3b6e;
}

body.look-old .card,
body.look-old .table-wrap,
body.look-old .alert,
body.look-old .input,
body.look-old .select,
body.look-old .textarea,
body.look-old .btn {
  border-radius: var(--radius-sm);
}

body.look-old .card-head {
  background: var(--old-head);
  color: var(--old-head-ink);
  border-bottom: 1px solid #3f8f1f;
}

body.look-old .card-head h2,
body.look-old .card-head .muted {
  color: inherit;
}

body.look-old .card-head .btn-ghost {
  color: #fff;
}

body.look-old .table thead th {
  background: var(--old-head);
  color: var(--old-head-ink);
  border-bottom: 0;
}

body.look-old .table th,
body.look-old .table td {
  border-color: var(--line);
}

body.look-old .matrix thead th {
  background: var(--old-head);
  color: var(--old-head-ink);
}

body.look-old .matrix .matrix-code {
  color: rgb(255 255 255 / 80%);
}

body.look-old .matrix thead th.matrix-partner {
  background: var(--old-head);
}

body.look-old .page-head h1 {
  font-size: 1.35rem;
}

body.look-old .lead {
  font-size: var(--text-sm);
}

body.look-old .sidebar-foot {
  background: #15294d;
}

body.look-old .brand-mark {
  background: var(--old-head);
}

body.look-old .status-pills li a,
body.look-old .badge,
body.look-old .chip,
body.look-old .nav-count,
body.look-old .tab-count {
  border-radius: 3px;
}

body.look-old .chatw-launcher {
  border-radius: 6px;
  background: var(--old-head);
}

body.look-old .chatw-head {
  background: #1f3b6e;
}

:root[data-theme="dark"] body.look-old {
  --canvas: #0e1726;
  --surface: #16233a;
  --surface-2: #1b2b45;
  --ink: #e6ecf6;
  --muted: #9fb0c8;
  --line: #34507a;
  --line-strong: #4f86c6;
  --brand: #5cb52f;
  --brand-strong: #7ccc4f;
  --brand-tint: #1e3a1a;
  --on-brand: #0b1a08;
  --nav-bg: #0a1424;
  --nav-hover: #152a4a;
  --ok: #8fd19a; --ok-tint: #173424; --ok-line: #2f6b43;
  --info: #8db6f2; --info-tint: #1a2f4e; --info-line: #2f5590;
}

:root[data-theme="dark"] body.look-old .topbar,
:root[data-theme="dark"] body.look-old .card-head,
:root[data-theme="dark"] body.look-old .table thead th,
:root[data-theme="dark"] body.look-old .matrix thead th,
:root[data-theme="dark"] body.look-old .matrix thead th.matrix-partner {
  background: var(--old-head);
  color: var(--old-head-ink);
}

/* --- Domov ------------------------------------------------------------------- */
.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "dates"
    "cards";
  gap: 1rem;
}

.home-grid {
  grid-area: cards;
  display: grid;
  gap: 1rem;
  align-items: start;
}

@media (min-width: 48rem) {
  .home-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 80rem) {
  .home-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.home-grid > .card {
  min-width: 0;
}

/* --- Board without sideways scrolling: the table shares the width -------- */
@media (min-width: 64rem) {
  /* One scrollbar only: the page scrolls, the table header stays under the top bar. */
  .matrix-wrap {
    overflow: visible;
    max-height: none;
  }

  .matrix thead th,
  .matrix-old thead th {
    top: var(--header-height);
  }

  .matrix .matrix-partner,
  .matrix-old .old-partner {
    position: static;
  }

  .matrix thead .matrix-partner,
  .matrix-old thead th.old-partner {
    position: sticky;
  }

  .matrix {
    table-layout: fixed;
  }

  .matrix thead th {
    min-width: 0;
    padding-inline: 0.15rem;
  }

  .matrix .matrix-partner {
    width: 18%;
    min-width: 9rem;
    max-width: none;
  }

  /* Column names stand upright so no word is broken, however many columns there are. */
  .matrix thead th:not(.matrix-partner) {
    height: 8.5rem;
    vertical-align: bottom;
  }

  .matrix-name {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    max-height: 6.5rem;
    margin: 0 auto 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    font-size: var(--text-sm);
  }

  .cell-link {
    min-height: 2.6rem;
  }

  .matrix-old {
    table-layout: fixed;
  }

  .matrix-old .old-partner {
    width: 18%;
    min-width: 9rem;
    max-width: none;
  }

  .matrix-old .old-open a,
  .matrix-old .old-done a {
    white-space: normal;
  }
}

/* --- Filters inside the column headers ------------------------------------- */
.matrix-head-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.matrix-head-link:hover {
  background: var(--brand-tint);
}

.matrix-head-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.matrix thead th.is-filtered {
  background: var(--brand-tint);
  box-shadow: inset 0 -3px 0 var(--brand);
}

.matrix-clear {
  font-size: var(--text-xs);
  color: var(--brand);
  font-weight: 700;
}

.old-head-link {
  color: inherit;
  text-decoration: none;
}

.old-head-link:hover {
  text-decoration: underline;
}

.matrix-old thead th.is-filtered {
  background: #3f8f1f;
  box-shadow: inset 0 -3px 0 #fff;
}

@media (min-width: 64rem) {
  .matrix-head-link .matrix-name {
    margin-bottom: 0.3rem;
  }
}

/* One task filtered: the table keeps a natural width instead of one giant column. */
@media (min-width: 64rem) {
  .matrix.matrix-narrow {
    width: auto;
    min-width: 36rem;
    table-layout: auto;
  }

  .matrix-narrow thead th:not(.matrix-partner) {
    height: auto;
    width: 10rem;
    min-width: 9rem;
  }

  .matrix-narrow .matrix-partner {
    width: 20rem;
  }

  .matrix-narrow td.cell {
    width: 10rem;
  }

  .matrix-narrow .matrix-name {
    writing-mode: horizontal-tb;
    transform: none;
    max-height: none;
    white-space: normal;
    text-align: center;
  }
}

/* --- Bulk closing of cells ----------------------------------------------------- */
.cell-bulk {
  position: relative;
}

.cell-pick {
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  z-index: 2;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.cell-bulk:has(.cell-pick:checked) .cell-link,
.cell-bulk:has(.cell-pick:checked) > a {
  box-shadow: 0 0 0 2px var(--brand);
}

.matrix-old .cell-pick {
  top: 0.15rem;
  left: 0.15rem;
}

.bulk-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  border-top: 2px solid var(--brand);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}

.bulk-bar-text {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.bulk-bar-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.bulk-bar-fields .input {
  width: auto;
}

.bulk-bar-fields #bulk-note {
  width: 14rem;
}

@media (max-width: 47.99rem) {
  .bulk-bar-fields #bulk-note {
    width: 100%;
  }
}

/* --- Assignments by person ------------------------------------------------- */
.pb-0 { padding-bottom: 0; }
.pt-0 { padding-top: 0; }

.task-ticks {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.15rem;
}

.task-ticks li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.3rem 0;
  border-top: 1px solid var(--line);
}

.task-ticks li:first-child {
  border-top: 0;
}

.task-ticks .check {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.task-ticks .input-xs {
  width: 3.4rem;
  text-align: center;
}

/* --- Colour schemes (per user, Moj profil → Izgled) ---------------------------
   Each scheme recolours the brand, the side bar and the focus ring; everything
   else keeps the neutral palette, so the status colours stay unambiguous. */
body.scheme-zelena { --brand: #2f7a1c; --brand-strong: #235f14; --brand-tint: #e3f3da; --nav-bg: #14301c; --nav-hover: #1e4328; --nav-active: #2f7a1c; --nav-accent: #cfe88a; --focus: #2f7a1c; }
body.scheme-vijolicna { --brand: #6a3fb5; --brand-strong: #52308e; --brand-tint: #ece4f8; --nav-bg: #251745; --nav-hover: #33215d; --nav-active: #6a3fb5; --nav-accent: #f2c14e; --focus: #6a3fb5; }
body.scheme-oranzna { --brand: #b85c0a; --brand-strong: #934807; --brand-tint: #fbe9d7; --nav-bg: #3a2410; --nav-hover: #4d301a; --nav-active: #b85c0a; --nav-accent: #ffd27a; --focus: #b85c0a; }
body.scheme-morska { --brand: #0f6e7a; --brand-strong: #0b5560; --brand-tint: #dbf1f3; --nav-bg: #0c2a2f; --nav-hover: #123b42; --nav-active: #0f6e7a; --nav-accent: #8fe3d2; --focus: #0f6e7a; }
body.scheme-rdeca { --brand: #a3252d; --brand-strong: #811c23; --brand-tint: #f9e2e3; --nav-bg: #3a1216; --nav-hover: #4e1a1f; --nav-active: #a3252d; --nav-accent: #ffc9a3; --focus: #a3252d; }
body.scheme-grafit { --brand: #3b4a63; --brand-strong: #2a3648; --brand-tint: #e6eaf1; --nav-bg: #1c2230; --nav-hover: #2a3243; --nav-active: #3b4a63; --nav-accent: #8fd16a; --focus: #3b4a63; }

:root[data-theme="dark"] body.scheme-zelena { --brand: #8fd19a; --brand-strong: #b3e3b9; --brand-tint: #173424; --on-brand: #06180a; --nav-bg: #0a1a0e; --nav-hover: #142a19; --nav-active: #1f4a24; --focus: #8fd19a; }
:root[data-theme="dark"] body.scheme-vijolicna { --brand: #c2a6ff; --brand-strong: #d8c6ff; --brand-tint: #2a1f45; --on-brand: #180d2e; --nav-bg: #130b25; --nav-hover: #20143a; --nav-active: #3b2866; --focus: #c2a6ff; }
:root[data-theme="dark"] body.scheme-oranzna { --brand: #f3b06b; --brand-strong: #f8c995; --brand-tint: #3e2a14; --on-brand: #2a1600; --nav-bg: #1f1309; --nav-hover: #302011; --nav-active: #5a3a16; --focus: #f3b06b; }
:root[data-theme="dark"] body.scheme-morska { --brand: #7fd3df; --brand-strong: #a6e3ec; --brand-tint: #11343a; --on-brand: #04191d; --nav-bg: #07181b; --nav-hover: #0f2a2f; --nav-active: #145a64; --focus: #7fd3df; }
:root[data-theme="dark"] body.scheme-rdeca { --brand: #f2a0a5; --brand-strong: #f7c0c3; --brand-tint: #3f1d20; --on-brand: #2a0a0d; --nav-bg: #1c0b0d; --nav-hover: #2d1316; --nav-active: #5a2228; --focus: #f2a0a5; }
:root[data-theme="dark"] body.scheme-grafit { --brand: #a9b8d1; --brand-strong: #c4cfe0; --brand-tint: #253044; --on-brand: #0e1420; --nav-bg: #0b0f16; --nav-hover: #161c27; --nav-active: #2a3648; --focus: #a9b8d1; }

/* The old look has its own green/blue dress; the scheme only tints its side bar. */
body.look-old.scheme-zelena, body.look-old.scheme-vijolicna, body.look-old.scheme-oranzna,
body.look-old.scheme-morska, body.look-old.scheme-rdeca, body.look-old.scheme-grafit { --brand: #3f8f1f; --brand-strong: #2f7a1c; --brand-tint: #e3f3da; --nav-active: #5cb52f; --nav-accent: #ffffff; }

.scheme-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scheme-option {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem 0.35rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.scheme-option:hover {
  border-color: var(--line-strong);
}

.scheme-option.is-active {
  border-color: var(--scheme);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--scheme) 35%, transparent);
}

.scheme-dot {
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: var(--scheme);
  flex: none;
}

.scheme-modra { --scheme: #1d4f91; }
.scheme-zelena { --scheme: #2f7a1c; }
.scheme-vijolicna { --scheme: #6a3fb5; }
.scheme-oranzna { --scheme: #b85c0a; }
.scheme-morska { --scheme: #0f6e7a; }
.scheme-rdeca { --scheme: #a3252d; }
.scheme-grafit { --scheme: #3b4a63; }

/* --- Poročilo o delu --------------------------------------------------------- */
@media (min-width: 48rem) {
  .work-toolbar {
    grid-template-columns: auto auto;
  }
}

.work-toolbar .field-pair .input {
  width: auto;
}

/* --- Poraba časa (partner card) ---------------------------------------------- */
.time-matrix th:first-child,
.time-matrix td:first-child {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
  min-width: 11rem;
}

.time-matrix .time-year th,
.time-matrix .time-year td {
  background: var(--surface-2);
  font-weight: 700;
}

.time-matrix .time-year.is-current-year th,
.time-matrix .time-year.is-current-year td {
  background: var(--brand-tint);
}

.time-matrix .time-user-name {
  padding-left: 1.6rem;
  color: var(--muted);
}

.time-matrix th.is-current {
  color: var(--brand);
}

.time-matrix tfoot th,
.time-matrix tfoot td {
  border-top: 2px solid var(--line-strong);
}

body.look-old .time-matrix .time-year th,
body.look-old .time-matrix .time-year td {
  background: #e3f3da;
}

/* --- Print layout (reports as documents, ?tisk=1) ---------------------------- */
@page {
  size: A4;
  margin: 12mm 12mm 14mm;
}

.print-body {
  background: #e9ecf1;
  color: #111;
  font-size: 11px;
  line-height: 1.35;
  margin: 0;
}

.print-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: var(--text-sm);
}

.print-doc {
  max-width: 210mm;
  margin: 1rem auto;
  padding: 12mm;
  background: #fff;
  box-shadow: 0 2px 12px rgb(0 0 0 / 0.12);
  color: #111;
}

.print-landscape .print-doc {
  max-width: 297mm;
}

.doc-head {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 0.6rem;
  margin-bottom: 0.9rem;
  border-bottom: 2px solid #111;
}

.doc-company {
  display: grid;
  gap: 0.1rem;
  font-size: 10.5px;
  color: #333;
}

.doc-company strong {
  font-size: 13px;
  color: #111;
}

.doc-title {
  text-align: right;
}

.doc-title h1 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.doc-subtitle {
  margin: 0.15rem 0 0;
  font-size: 12.5px;
  font-weight: 600;
}

.doc-filters {
  margin: 0.15rem 0 0;
  font-size: 10.5px;
  color: #555;
}

.doc-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 0.4rem;
  border-top: 1px solid #999;
  font-size: 9.5px;
  color: #555;
}

/* Everything inside the document is flat and compact. */
.print-doc .card,
.print-doc .grid > .card {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  margin: 0 0 0.9rem;
  break-inside: auto;
}

.print-doc .card-head {
  padding: 0 0 0.25rem;
  border-bottom: 1px solid #111;
  margin-bottom: 0.3rem;
  break-after: avoid;
}

.print-doc .card-head h2,
.print-doc .card-head h3,
.print-doc h2 {
  font-size: 12.5px;
  margin: 0;
}

.print-doc .card-body {
  padding: 0;
}

.print-doc .page-head,
.print-doc .subnav,
.print-doc .lead,
.print-doc .toolbar,
.print-doc .pagination,
.print-doc .no-print,
.print-doc .alert {
  display: none !important;
}

.print-doc .grid {
  display: block;
}

.print-doc .stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 0;
  margin: 0 0 0.9rem;
  border: 1px solid #999;
}

.print-doc .stats > li,
.print-doc .stats > .stat {
  margin: 0;
}

.print-doc .stat {
  border: 0;
  border-right: 1px solid #ccc;
  border-radius: 0;
  padding: 0.3rem 0.5rem;
  background: #fff;
  box-shadow: none;
}

.print-doc .stats > *:last-child .stat,
.print-doc .stats > .stat:last-child {
  border-right: 0;
}

.print-doc .stat-label {
  font-size: 9px;
  color: #555;
}

.print-doc .stat-value {
  font-size: 13px;
  color: #111;
}

.print-doc .stat-note {
  font-size: 8.5px;
  color: #777;
}

.print-doc .table-wrap {
  overflow: visible;
  border: 0;
}

.print-doc .table {
  width: 100%;
  font-size: 10px;
  border-collapse: collapse;
  color: #111;
}

.print-doc .table th,
.print-doc .table td {
  padding: 0.18rem 0.35rem;
  border-bottom: 1px solid #ccc;
  background: transparent;
  color: #111;
  vertical-align: top;
}

.print-doc .table thead th {
  background: #e6e6e6;
  border-bottom: 1px solid #111;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #222;
}

.print-doc .table tbody tr:nth-child(even) td,
.print-doc .table tbody tr:nth-child(even) th {
  background: #f6f6f6;
}

.print-doc .table tfoot th,
.print-doc .table tfoot td {
  border-top: 1px solid #111;
  border-bottom: 0;
  font-weight: 700;
}

.print-doc .table thead {
  display: table-header-group;
}

.print-doc .table tr {
  break-inside: avoid;
}

.print-doc .table-stack thead {
  position: static;
  width: auto;
  height: auto;
  clip: auto;
}

.print-doc .table-stack td::before {
  display: none;
}

.print-doc .table-stack tr,
.print-doc .table-stack td {
  display: table-row;
}

.print-doc .table-stack td {
  display: table-cell;
}

.print-doc .cell-sub {
  color: #555;
}

.print-doc .pill {
  border: 1px solid #999;
  background: transparent;
  color: #111;
}

.print-doc a {
  color: inherit;
  text-decoration: none;
}

.print-doc .group-row th,
.print-doc .group-row td {
  background: #ececec !important;
  font-weight: 700;
  border-top: 1px solid #999;
}

.print-doc .subtotal-row td,
.print-doc .subtotal-row th {
  font-weight: 700;
  background: #f6f6f6 !important;
}

@media print {
  .print-body {
    background: #fff;
    font-size: 10.5px;
  }

  .print-toolbar {
    display: none !important;
  }

  .print-doc {
    max-width: none;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }

  .doc-foot {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }
}

/* --- Screen: grouped detail rows and the report settings panel --------------- */
.group-row th,
.group-row td {
  background: var(--surface-2);
  font-weight: 700;
}

.subtotal-row td {
  font-weight: 600;
  color: var(--muted);
}

.report-settings summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.75rem 1.1rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.report-settings summary::-webkit-details-marker {
  display: none;
}

.report-settings summary::before {
  content: '▸';
  font-size: 0.8em;
  color: var(--muted);
}

.report-settings[open] summary::before {
  content: '▾';
}

.report-settings .card-body {
  border-top: 1px solid var(--line);
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.25rem 1rem;
}

.check-grid .check {
  margin: 0;
}

.report-detail .cell-note {
  color: var(--muted);
  font-size: var(--text-sm);
}

.print-doc .num,
.print-doc .table .num {
  color: #111;
}

.print-doc .report-detail .cell-note,
.print-doc .cell-note {
  font-size: 9.5px;
  color: #444;
}

.print-doc .report-detail th,
.print-doc .report-detail td {
  white-space: normal;
}

.print-doc .report-detail .pill {
  padding: 0 0.3rem;
  font-size: 8.5px;
  border-radius: 2px;
}

.print-doc .report-detail .pill-ok {
  border-color: #3f8f1f;
  color: #2f6e14;
}

.report-detail th:first-child,
.report-detail td:first-child {
  width: 1%;
  white-space: nowrap;
}

.print-doc .time-matrix th,
.print-doc .time-matrix td {
  color: #111;
  position: static;
}

fieldset.field,
.report-settings fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

fieldset.field legend,
.report-settings legend {
  padding: 0;
}

/* --- Domov (redesign) --------------------------------------------------------- */
.home-head .quick-menu > summary {
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
}

.home-head .quick-menu .menu-panel {
  min-width: 15rem;
}

.home-head .quick-menu .menu-panel a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.home-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

@media (min-width: 64rem) {
  .home-tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg, 14px);
  color: var(--ink);
  text-decoration: none;
  min-height: 6rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tile:hover {
  border-color: var(--brand);
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.06);
  text-decoration: none;
}

.tile-top {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.tile-num {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.tile-label {
  font-weight: 600;
  color: var(--ink);
}

.tile-note {
  font-size: var(--text-sm);
  color: var(--muted);
}

.tile-note.is-bad {
  color: var(--danger);
  font-weight: 600;
}

.home-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

@media (min-width: 64rem) {
  .home-cols {
    grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr);
  }
}

.home-main,
.home-side {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.home-main > .card,
.home-side > .card {
  margin: 0;
}

.home-kicker {
  margin: 0.9rem 0 0.4rem;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-kicker:first-child {
  margin-top: 0;
}

.home-none {
  margin: 0 0 0.4rem;
}

.home-date-list,
.home-rows,
.home-quick {
  margin: 0;
  padding: 0;
  list-style: none;
}

.home-date {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
}

.home-date:first-child {
  border-top: 0;
}

.home-date-body {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
}

.home-date-body strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-sq {
  flex: none;
  width: 2.4rem;
  height: 2.4rem;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand-tint);
  color: var(--brand-strong);
  font-size: var(--text-sm);
  font-weight: 700;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--brand);
  white-space: nowrap;
}

.link-arrow .icon {
  width: 0.9em;
  height: 0.9em;
}

.home-rows li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 1.1rem;
  border-top: 1px solid var(--line);
}

.home-counters li {
  padding-left: 0;
  padding-right: 0;
}

.home-rows li:first-child {
  border-top: 0;
}

.home-row-text {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.home-alert {
  display: grid;
  gap: 0.2rem;
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
}

.home-alert a {
  color: var(--danger);
  font-weight: 600;
}

.home-quick li a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0;
  font-weight: 600;
  color: var(--brand);
}

.home-post {
  margin: 0;
  display: grid;
  gap: 0.1rem;
}

.stack-sm > * + * {
  margin-top: 0.6rem;
}

.home-side .my-open-list {
  margin: 0;
}

body.look-old .tile {
  border-radius: 0;
}

body.look-old .avatar-sq {
  border-radius: 0;
}

.link-arrow,
.home-quick li a {
  text-decoration: none;
}

.link-arrow:hover,
.home-quick li a:hover {
  text-decoration: underline;
}

@media (max-width: 47.99rem) {
  .tile-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  .tile-num {
    font-size: 1.6rem;
  }

  .tile-label {
    font-size: var(--text-sm);
  }
}

/* --- Cell form: "done" switch top right ---------------------------------------- */
.cell-new-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.cell-new-head h3 {
  margin: 0;
}

.complete-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.8rem 0.45rem 0.5rem;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, background 0.15s;
}

.complete-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.complete-toggle-box {
  width: 1.6rem;
  height: 1.6rem;
  display: inline-grid;
  place-items: center;
  border: 2px solid var(--line-strong);
  border-radius: 6px;
  color: transparent;
  background: var(--surface);
}

.complete-toggle-box .icon {
  width: 1rem;
  height: 1rem;
}

.complete-toggle-text {
  display: grid;
  line-height: 1.2;
}

.complete-toggle-text small {
  color: var(--muted);
  font-size: var(--text-xs);
}

.complete-toggle:hover {
  border-color: var(--ok, #2f7a1c);
}

.complete-toggle:has(input:checked) {
  border-color: var(--ok, #2f7a1c);
  background: color-mix(in srgb, var(--ok, #2f7a1c) 12%, var(--surface));
}

.complete-toggle:has(input:checked) .complete-toggle-box {
  background: var(--ok, #2f7a1c);
  border-color: var(--ok, #2f7a1c);
  color: #fff;
}

.complete-toggle:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* --- Board: Akcije column and the closing row --------------------------------- */
.matrix .matrix-actions {
  width: 2.6rem;
  min-width: 2.6rem;
  padding: 0.2rem;
  text-align: center;
  vertical-align: middle;
}

.matrix thead .matrix-close-row th {
  position: static;
  height: auto !important;
  padding: 0.3rem 0.2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.matrix thead .matrix-close-row .matrix-close-label {
  text-align: right;
  font-weight: 500;
}

.matrix-close-btn {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.matrix-close-btn .icon {
  width: 0.95rem;
  height: 0.95rem;
}

.matrix-close-btn:hover,
.matrix-close-btn:focus-visible {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
  text-decoration: none;
}

.matrix tbody tr:hover .matrix-actions .matrix-close-btn {
  color: var(--ok);
  border-color: var(--ok);
}

@media (min-width: 64rem) {
  .matrix thead .matrix-close-row th {
    position: static;
  }

  .matrix thead .matrix-close-row .matrix-partner {
    position: static;
  }
}

@media (max-width: 63.99rem) {
  .matrix .matrix-actions {
    display: block;
    width: auto;
    text-align: left;
    padding: 0 0 0.4rem;
  }

  .matrix thead .matrix-close-row {
    display: none;
  }
}

body.look-old .matrix-close-btn {
  border-radius: 0;
}

/* Closing masks */
.close-pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.close-picks {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  max-height: 16rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.close-picks li {
  padding: 0.35rem 0.75rem;
  border-top: 1px solid var(--line);
}

.close-picks li:first-child {
  border-top: 0;
}

.close-picks .check {
  margin: 0;
}

.close-preview {
  margin: 0.25rem 0 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  background: var(--brand-tint);
  color: var(--brand-strong);
  font-weight: 600;
}

.close-preview:empty {
  display: none;
}

.matrix-old .old-actions {
  width: 2.2rem;
  text-align: center;
  vertical-align: middle;
  padding: 0.15rem;
}

.matrix-old thead .old-close-row th {
  position: static;
  height: auto;
  background: #f4f8ee;
  color: #335;
  font-weight: normal;
  font-size: 11px;
  padding: 0.25rem;
  text-align: center;
}

.matrix-old thead .old-close-row .old-close-label {
  text-align: right;
}

/* --- Meetings: attendees with colours, priorities, inline images ---------------- */
.attendee-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.8rem;
  margin: 0 0 1rem;
}

.attendee {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.65rem 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--person) 45%, var(--line));
  background: color-mix(in srgb, var(--person) 10%, var(--surface));
  font-size: var(--text-sm);
  font-weight: 600;
}

.attendee-dot {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--person, #8a93a3);
  vertical-align: middle;
}

.todo-item[style*="--person"] {
  border-left: 4px solid var(--person);
}

.todo-item.prio-1 .todo-box {
  border-color: var(--danger);
}

.minute-body .inline-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0.6rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.print-doc .minute-body .inline-image {
  max-height: 160mm;
  break-inside: avoid;
}

.print-doc .attendee {
  border-color: #999;
  background: transparent;
  color: #111;
}

/* --- Meeting editor ------------------------------------------------------------ */
.minute-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

@media (min-width: 64rem) {
  .minute-editor-grid {
    grid-template-columns: minmax(0, 1fr) 22rem;
  }
}

.minute-pane {
  margin: 0;
}

.minute-toolbar h2 label {
  cursor: text;
}

.minute-editor-body {
  padding: 0.75rem 1.1rem 1rem;
}

.minute-textarea {
  width: 100%;
  min-height: 60vh;
  resize: vertical;
  font-size: var(--text-md);
  line-height: 1.6;
  padding: 1rem 1.1rem;
}

.minute-paste-status {
  margin: 0.5rem 0 0;
}

.minute-side {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.minute-side > .card {
  margin: 0;
}

.people-picker {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.25rem;
  max-height: 22rem;
  overflow: auto;
  padding-right: 0.2rem;
}

.people-picker li[hidden] {
  display: none;
}

.person-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.6rem 0.35rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, border-color 0.12s;
}

.person-chip:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.person-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.person-avatar {
  flex: none;
  width: 1.7rem;
  height: 1.7rem;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
}

.person-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.person-check {
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
  color: transparent;
}

.person-chip:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.person-chip:has(input:checked) .person-avatar {
  background: var(--brand);
  color: var(--on-brand, #fff);
}

.person-chip:has(input:checked) .person-check {
  color: var(--brand);
}

.person-chip:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.minute-danger {
  margin-top: 1rem;
}

body.look-old .person-chip,
body.look-old .person-avatar {
  border-radius: 0;
}

.minute-editor .page-head {
  align-items: flex-start;
}

.minute-editor .page-head .btn-row {
  margin-left: auto;
}

.minute-side .input-sm[type="search"] {
  width: 100%;
}

/* --- Tasks written in the minutes ---------------------------------------------- */
.inline-task {
  display: inline-grid;
  place-items: center;
  width: 1.15em;
  height: 1.15em;
  margin-right: 0.3em;
  vertical-align: -0.15em;
  border: 2px solid var(--person, var(--line-strong));
  border-radius: 4px;
  color: #fff;
  background: transparent;
  text-decoration: none;
}

.inline-task.is-done {
  background: var(--person, var(--ok));
}

.inline-task.is-gone {
  border-color: var(--line);
  color: var(--muted);
  font-size: 0.9em;
}

.inline-task .icon {
  width: 0.8em;
  height: 0.8em;
}

.side-tasks {
  margin: 0;
  padding: 0.25rem 1.1rem;
  list-style: none;
  display: grid;
  gap: 0.3rem;
  font-size: var(--text-sm);
}

.side-tasks li {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.side-tasks li.is-done {
  color: var(--muted);
  text-decoration: line-through;
}

.side-task-box {
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.1rem;
  display: inline-grid;
  place-items: center;
  border: 2px solid var(--line-strong);
  border-radius: 4px;
  color: #fff;
}

.side-tasks li.is-done .side-task-box {
  background: var(--ok);
  border-color: var(--ok);
}

.minute-paste-status code {
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 0 0.3em;
  border-radius: 3px;
}

.input-time {
  width: 6.2rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

/* --- Searchable select ---------------------------------------------------------- */
.pick {
  position: relative;
}

.pick-native {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.pick-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pick-button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.pick.is-placeholder .pick-label {
  color: var(--muted);
}

.pick-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pick-caret {
  color: var(--muted);
  flex: none;
}

.pick-pop {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  min-width: 16rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.16);
}

.pick-search {
  width: 100%;
  margin-bottom: 0.4rem;
}

.pick-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 16rem;
  overflow: auto;
}

.pick-item {
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pick-group {
  padding: 0.5rem 0.6rem 0.2rem;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: default;
}

.pick-group[hidden] {
  display: none;
}

.pick-item[hidden] {
  display: none;
}

.pick-item.is-active,
.pick-item:hover {
  background: var(--surface-2);
}

.pick-item.is-selected {
  font-weight: 600;
  color: var(--brand);
}

.pick-item.is-disabled {
  color: var(--muted);
  cursor: default;
}

.pick-empty {
  margin: 0.2rem 0.6rem 0.4rem;
  color: var(--muted);
  font-size: var(--text-sm);
}

.pick-item[data-value=""] {
  color: var(--muted);
}

body.look-old .pick-button,
body.look-old .pick-pop,
body.look-old .pick-item {
  border-radius: 0;
}

/* --- Partner → Dodelitve: one person at a time, every task as a small tile -----
   The lead picks a person in the card head (searchable); the tiles show every
   active task in as many columns as fit. The border tells the state: green =
   the person has it, black = they do not. A click saves at once (app.js); the
   due day is edited on the tile.
   A sticky summary on the right lists what the person has. */
.assign-head {
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
}

.assign-pick {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  min-width: 16rem;
}

.assign-pick .select,
.assign-pick .pick {
  min-width: 16rem;
}

.assign-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: 1.25rem;
  align-items: start;
}

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

.assign-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.25rem;
  margin: 0 0 0.6rem;
  font-size: var(--text-xs);
  color: var(--muted);
}

.assign-legend li {
  padding: 0.1rem 0;
  gap: 0.4rem;
}

.assign-swatch {
  flex: none;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 4px;
  border: 2px solid var(--ink);
  background: var(--surface);
}

.assign-swatch.is-on,
.assign-tile.is-on {
  border-color: var(--ok);
  background: var(--ok-tint);
}

.assign-swatch.is-off,
.assign-tile.is-off {
  border-color: var(--ink);
  background: var(--surface);
}

.assign-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.4rem;
}

.assign-tile {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.assign-tile.is-busy {
  opacity: 0.6;
}

.assign-tile-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  flex: 1 1 auto;
  width: 100%;
  min-height: 2.9rem;
  padding: 0.3rem 0.45rem 0.15rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  border-radius: 0;
}

button.assign-tile-main {
  cursor: pointer;
}

button.assign-tile-main:hover {
  box-shadow: inset 0 0 0 999px rgb(0 0 0 / 5%);
}

button.assign-tile-main:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -3px;
}

.assign-tile-code {
  font-size: 0.65rem;
  line-height: 1;
  color: var(--muted);
}

.assign-tile-name {
  font-weight: 600;
  font-size: var(--text-xs);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.assign-tile.is-on .assign-tile-name {
  color: var(--ok);
}

.assign-tile-due {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0 0.45rem 0.3rem;
  font-size: 0.65rem;
  color: var(--muted);
}

.assign-tile-due .input-xs {
  width: 2.3rem;
  min-height: 1.5rem;
  padding: 0 0.2rem;
  font-size: var(--text-xs);
  text-align: center;
}

.assign-tile-due .input-xs:disabled {
  opacity: 0.4;
}

.assign-msg {
  min-height: 1.2em;
  margin: 0.6rem 0 0;
  font-size: var(--text-sm);
  color: var(--danger);
}

.assign-msg:empty {
  margin: 0;
}

.assign-summary {
  position: sticky;
  top: calc(var(--header-height) + 1rem);
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--canvas);
  font-size: var(--text-sm);
}

.assign-summary-title {
  margin: 0;
  font-size: var(--text-md);
}

.assign-summary-count {
  margin: 0.1rem 0 0.6rem;
}

.assign-summary-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 60dvh;
  overflow: auto;
}

.assign-summary-list li {
  padding: 0.25rem 0;
  border-top: 1px solid var(--line);
  line-height: 1.3;
}

.assign-summary-list li:first-child {
  border-top: 0;
}

.assign-summary-due {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted);
}

/* The old look: its own green for "has it". */
body.look-old .assign-tile.is-on,
body.look-old .assign-swatch.is-on {
  border-color: #3f8f1f;
  background: var(--old-done);
}

body.look-old .assign-tile.is-on .assign-tile-name {
  color: var(--old-done-ink);
}

@media (max-width: 63.99rem) {
  .assign-body {
    grid-template-columns: 1fr;
  }

  .assign-summary {
    position: static;
  }
}

@media (max-width: 47.99rem) {
  .assign-pick {
    margin-left: 0;
    width: 100%;
    min-width: 0;
  }

  .assign-pick .select,
  .assign-pick .pick {
    flex: 1 1 auto;
    min-width: 0;
  }

  .assign-tiles {
    grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  }
}
