:root {
  --radius: 14px;
  --font: "DM Sans", sans-serif;
  --display: "Instrument Serif", Georgia, serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1412;
  --bg-elevated: #171e1b;
  --panel: #f4f6f3;
  --ink: #13201a;
  --ink-muted: #5a6b62;
  --accent: #1f6b4a;
  --accent-hover: #18553b;
  --accent-soft: #d7ebe1;
  --danger: #8f2f2f;
  --danger-bg: #f8e8e8;
  --line: #d5ddd7;
  --shadow: 0 24px 60px rgba(8, 16, 12, 0.35);

  --t-text: #e8f2ec;
  --t-muted: rgba(232, 242, 236, 0.68);
  --t-faint: rgba(232, 242, 236, 0.55);
  --t-page-bg:
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(31, 107, 74, 0.18), transparent 55%),
    linear-gradient(180deg, #121916 0%, #0f1412 40%, #0c1210 100%);
  --t-topbar-border: rgba(232, 242, 236, 0.1);
  --t-topbar-bg: linear-gradient(180deg, #1a2e24 0%, #15241c 100%);
  --t-topbar-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  --t-nav-bg: rgba(0, 0, 0, 0.28);
  --t-nav-border: rgba(232, 242, 236, 0.1);
  --t-nav-text: rgba(232, 242, 236, 0.72);
  --t-nav-hover-bg: rgba(232, 242, 236, 0.08);
  --t-nav-hover-text: #f3faf6;
  --t-nav-active-bg: #b7e0cb;
  --t-nav-active-text: #0f1412;
  --t-chip-border: transparent;
  --t-chip-hover-border: rgba(232, 242, 236, 0.18);
  --t-chip-hover-bg: rgba(232, 242, 236, 0.06);
  --t-surface: rgba(20, 28, 24, 0.75);
  --t-surface-solid: #161e1a;
  --t-border: rgba(232, 242, 236, 0.1);
  --t-border-soft: rgba(232, 242, 236, 0.08);
  --t-th: rgba(232, 242, 236, 0.55);
  --t-td-border: rgba(232, 242, 236, 0.08);
  --t-row-bg: #161e1a;
  --t-row-hover: #1c2b23;
  --t-input-bg: rgba(12, 18, 16, 0.55);
  --t-input-border: rgba(232, 242, 236, 0.14);
  --t-input-text: #e8f2ec;
  --t-input-placeholder: rgba(232, 242, 236, 0.35);
  --t-input-focus: rgba(183, 224, 203, 0.55);
  --t-btn-secondary-bg: rgba(232, 242, 236, 0.08);
  --t-btn-secondary-border: rgba(232, 242, 236, 0.14);
  --t-btn-secondary-hover: rgba(232, 242, 236, 0.14);
  --t-icon-bg: rgba(232, 242, 236, 0.06);
  --t-icon-border: rgba(232, 242, 236, 0.14);
  --t-expand-bg: rgba(232, 242, 236, 0.08);
  --t-expand-border: rgba(232, 242, 236, 0.22);
  --t-status-bg: rgba(183, 224, 203, 0.16);
  --t-status-text: #b7e0cb;
  --t-tabs-bg: rgba(0, 0, 0, 0.28);
  --t-empty: rgba(232, 242, 236, 0.55);
  --t-modal-bg: #161e1a;
  --t-modal-overlay: rgba(8, 12, 10, 0.72);
  --t-link: #9fd4b8;
  --t-link-hover: #c6edd8;
  --t-sidebar-bg:
    linear-gradient(180deg, #1a2a22 0%, #141c18 48%, #101814 100%);
  --t-sidebar-border: rgba(183, 224, 203, 0.18);
  --t-sidebar-shadow: 6px 0 24px rgba(0, 0, 0, 0.28);
  --sticky-bg: #161e1a;
  --sticky-bg-head: #121916;
  --sticky-bg-filter: #1a2a22;
  --sticky-bg-hover: #1c2b23;
  --sticky-bg-form: #1a3d2e;
  --sticky-bg-related: #121816;
  --t-row-form-bg: #1a3d2e;
  --t-row-form-border: #4ecf8e;
  --t-row-form-shadow:
    0 14px 40px rgba(46, 200, 120, 0.42),
    0 6px 18px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(78, 207, 142, 0.35);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3f0;
  --bg-elevated: #ffffff;
  --panel: #ffffff;
  --ink: #15241c;
  --ink-muted: #5a6d63;
  --accent: #1a6b48;
  --accent-hover: #145539;
  --accent-soft: #d8eee3;
  --danger: #a33a3a;
  --danger-bg: #fdecec;
  --line: #d0dbd4;
  --shadow: 0 18px 40px rgba(20, 40, 30, 0.12);

  --t-text: #15241c;
  --t-muted: rgba(21, 36, 28, 0.68);
  --t-faint: rgba(21, 36, 28, 0.55);
  --t-page-bg:
    radial-gradient(ellipse 55% 40% at 100% 0%, rgba(31, 107, 74, 0.12), transparent 55%),
    linear-gradient(180deg, #f5f8f6 0%, #eef3f0 45%, #e8efea 100%);
  --t-topbar-border: rgba(31, 107, 74, 0.22);
  --t-topbar-bg: linear-gradient(180deg, #e3f2ea 0%, #d5ebe0 100%);
  --t-topbar-shadow: 0 1px 0 rgba(31, 107, 74, 0.1);
  --t-nav-bg: rgba(255, 255, 255, 0.72);
  --t-nav-border: rgba(21, 36, 28, 0.1);
  --t-nav-text: rgba(21, 36, 28, 0.7);
  --t-nav-hover-bg: rgba(21, 36, 28, 0.06);
  --t-nav-hover-text: #15241c;
  --t-nav-active-bg: #1f6b4a;
  --t-nav-active-text: #f4fbf7;
  --t-chip-border: transparent;
  --t-chip-hover-border: rgba(21, 36, 28, 0.16);
  --t-chip-hover-bg: rgba(255, 255, 255, 0.7);
  --t-surface: rgba(255, 255, 255, 0.82);
  --t-surface-solid: #ffffff;
  --t-border: rgba(21, 36, 28, 0.12);
  --t-border-soft: rgba(21, 36, 28, 0.08);
  --t-th: rgba(21, 36, 28, 0.55);
  --t-td-border: rgba(21, 36, 28, 0.08);
  --t-row-bg: #ffffff;
  --t-row-hover: #eef6f1;
  --t-input-bg: #ffffff;
  --t-input-border: rgba(21, 36, 28, 0.16);
  --t-input-text: #15241c;
  --t-input-placeholder: rgba(21, 36, 28, 0.38);
  --t-input-focus: rgba(31, 107, 74, 0.45);
  --t-btn-secondary-bg: rgba(255, 255, 255, 0.85);
  --t-btn-secondary-border: rgba(21, 36, 28, 0.14);
  --t-btn-secondary-hover: rgba(31, 107, 74, 0.08);
  --t-icon-bg: rgba(255, 255, 255, 0.9);
  --t-icon-border: rgba(21, 36, 28, 0.14);
  --t-expand-bg: #ffffff;
  --t-expand-border: rgba(21, 36, 28, 0.18);
  --t-status-bg: rgba(31, 107, 74, 0.12);
  --t-status-text: #145539;
  --t-tabs-bg: rgba(255, 255, 255, 0.7);
  --t-empty: rgba(21, 36, 28, 0.5);
  --t-modal-bg: #ffffff;
  --t-modal-overlay: rgba(18, 30, 24, 0.45);
  --t-link: #145539;
  --t-link-hover: #0f3f2a;
  --t-sidebar-bg:
    linear-gradient(180deg, #d9ebe2 0%, #cfe4da 42%, #c5ddd2 100%);
  --t-sidebar-border: rgba(31, 107, 74, 0.28);
  --t-sidebar-shadow: 6px 0 20px rgba(20, 40, 30, 0.08);
  --sticky-bg: #ffffff;
  --sticky-bg-head: #f2f6f3;
  --sticky-bg-filter: #e7f1eb;
  --sticky-bg-hover: #eef6f1;
  --sticky-bg-form: #c8ecd9;
  --sticky-bg-related: #f3f7f5;
  --t-row-form-bg: #c8ecd9;
  --t-row-form-border: #1a6b48;
  --t-row-form-shadow:
    0 14px 36px rgba(26, 107, 72, 0.38),
    0 6px 16px rgba(20, 40, 30, 0.16),
    0 0 0 1px rgba(26, 107, 72, 0.28);
}

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

html, body {
  margin: 0;
  min-height: 100%;
}

html:has(body.app-page-fill) {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

h1 {
  margin: 0 0 0.4rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 2.75rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.lead {
  margin: 0 0 1.5rem;
  color: var(--ink-muted);
  font-size: 1.02rem;
  line-height: 1.55;
  max-width: 36rem;
}

.auth-page {
  min-height: 100vh;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}

.auth-visual {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(47, 140, 98, 0.35), transparent 55%),
    radial-gradient(ellipse 70% 50% at 80% 80%, rgba(20, 70, 50, 0.45), transparent 50%),
    linear-gradient(160deg, #0c1612 0%, #163528 45%, #0a1210 100%);
}

.auth-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
  pointer-events: none;
}

.auth-visual-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 3.5rem;
  color: #e8f2ec;
}

.brand-mark {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3rem, 6vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.brand-tag {
  margin: 0.85rem 0 0;
  color: rgba(232, 242, 236, 0.72);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem clamp(1.5rem, 4vw, 3.5rem);
  background: var(--panel);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 24rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.field .field-hint {
  font-weight: 400;
  font-size: 0.8rem;
  line-height: 1.35;
}

.field input {
  appearance: none;
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  padding: 0.85rem 1.1rem;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  margin-top: 0.35rem;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
  padding: 0.45rem 0.75rem;
}

.btn-ghost:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.05);
}

.alert {
  max-width: 24rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  line-height: 1.4;
}

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

.alert-success {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.app-page {
  min-height: 100vh;
  background: var(--t-page-bg);
  color: var(--t-text);
  display: flex;
  flex-direction: column;
}

.app-page-fill {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.app-page-fill .topbar {
  flex-shrink: 0;
}

.app-shell {
  display: flex;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

.app-page:not(.app-page-fill) .app-shell {
  flex: 1 0 auto;
  min-height: calc(100vh - 4.5rem);
}

.app-sidebar {
  --sidebar-w: 15.25rem;
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  box-sizing: border-box;
  border-right: 1px solid var(--t-sidebar-border);
  background: var(--t-sidebar-bg);
  box-shadow: var(--t-sidebar-shadow);
  z-index: 4;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  transition:
    width 0.28s ease,
    flex-basis 0.28s ease,
    padding 0.28s ease,
    opacity 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

html.sidebar-collapsed .app-sidebar {
  width: 0;
  flex-basis: 0;
  padding: 0;
  opacity: 0;
  border-right-width: 0;
  border-right-color: transparent;
  box-shadow: none;
  pointer-events: none;
  overflow: hidden;
}

.sidebar-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--t-icon-border);
  background: var(--t-icon-bg);
  color: var(--t-text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.sidebar-toggle:hover {
  background: var(--t-btn-secondary-hover);
  transform: translateY(-1px);
}

.sidebar-toggle:active {
  transform: translateY(0);
}

.sidebar-toggle-box {
  position: relative;
  display: block;
  width: 1.05rem;
  height: 0.8rem;
}

.sidebar-toggle-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.28s ease, opacity 0.2s ease, top 0.28s ease;
}

.sidebar-toggle-line:nth-child(1) {
  top: 0;
}

.sidebar-toggle-line:nth-child(2) {
  top: 50%;
  transform: translateY(-50%);
}

.sidebar-toggle-line:nth-child(3) {
  top: calc(100% - 2px);
}

/* Open sidebar → крестик (стан з html.sidebar-collapsed) */
html:not(.sidebar-collapsed) .sidebar-toggle .sidebar-toggle-line:nth-child(1) {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

html:not(.sidebar-collapsed) .sidebar-toggle .sidebar-toggle-line:nth-child(2) {
  opacity: 0;
  transform: translateY(-50%) scaleX(0);
}

html:not(.sidebar-collapsed) .sidebar-toggle .sidebar-toggle-line:nth-child(3) {
  top: 50%;
  transform: translateY(-50%) rotate(-45deg);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.85rem 0.75rem 1rem;
}

.sidebar-footer {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
  border-top: 1px solid var(--t-sidebar-border);
  background: transparent;
}

.sidebar-footer-link {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--t-nav-text);
  font-size: 0.86rem;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-footer-link:hover {
  color: var(--t-nav-hover-text);
  background: var(--t-nav-hover-bg);
}

.sidebar-footer-link.is-active {
  color: var(--t-nav-active-text);
  background: var(--t-nav-active-bg);
}

.sidebar-footer-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer-meta {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--t-faint);
}

.sidebar-footer-link.is-active .sidebar-footer-meta {
  color: inherit;
  opacity: 0.8;
}

.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-group + .sidebar-group {
  margin-top: 0.15rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--t-border);
}

.sidebar-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--t-text);
  padding: 0.4rem 0.55rem;
  cursor: default;
  user-select: none;
}

.sidebar-sub {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-left: 0.35rem;
}

.sidebar-link {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--t-nav-text);
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.sidebar-link-row .sidebar-link {
  flex: 1 1 auto;
  min-width: 0;
}

.sidebar-add {
  appearance: none;
  box-sizing: border-box;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 1px solid var(--t-nav-border, transparent);
  border-radius: 8px;
  background: var(--t-nav-hover-bg);
  color: var(--t-nav-text);
  font-size: 1.15rem;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-add:hover {
  background: var(--t-nav-active-bg);
  color: var(--t-nav-active-text);
}

.sidebar-link:hover {
  color: var(--t-nav-hover-text);
  background: var(--t-nav-hover-bg);
}

.sidebar-link.is-active {
  color: var(--t-nav-active-text);
  background: var(--t-nav-active-bg);
}

.sidebar-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-actions {
  display: none;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.1rem 0 0.25rem;
  padding: 0 0 0 0.65rem;
}

.sidebar-item.is-open .sidebar-actions {
  display: flex;
}

.btn-sidebar {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  font-size: 0.78rem;
  padding: 0.4rem 0.5rem;
  text-align: center;
}

.sidebar-actions .import-form {
  display: block;
  width: 100%;
}

.sidebar-actions .import-btn {
  width: 100%;
  justify-content: center;
  box-sizing: border-box;
}

.app-shell > .app-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.app-main-fill {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  animation: none;
}

.page-head-compact {
  margin: 0;
  padding: 0.65rem 1rem 0.5rem;
  flex-shrink: 0;
}

.page-head-compact h1 {
  font-size: clamp(1.55rem, 2.6vw, 2rem);
  margin: 0;
}

.app-main-fill .alert {
  flex-shrink: 0;
  margin: 0.65rem 1rem 0;
}

.app-main-fill .stats-panel-fill {
  padding: 0.75rem 1rem 1rem;
  gap: 0.75rem;
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    flex: 0 0 auto;
    border-right: none;
    border-bottom: 1px solid var(--t-topbar-border);
    max-height: 42vh;
  }

  .app-page-fill .app-sidebar {
    max-height: 32vh;
  }

  .sidebar-nav {
    padding: 0.65rem 0.75rem 0.5rem;
  }

  .sidebar-footer {
    padding: 0.55rem 0.75rem 0.65rem;
  }

  html.sidebar-collapsed .app-sidebar {
    width: 100%;
    flex-basis: auto;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-color: transparent;
  }
}

.stats-panel-fill {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.stats-panel-fill.is-stats-expanded .stats-kpis {
  display: none;
}

.stats-workspace {
  position: relative;
  flex: 0 0 auto;
  min-height: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow: visible;
}

.stats-workspace-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.55rem 0.85rem;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--t-page-bg, var(--bg));
  padding: 0.35rem 0 0.45rem;
  margin: 0;
  box-shadow: 0 1px 0 var(--t-border);
}

.stats-workspace-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 1rem;
  min-width: 0;
  flex: 1 1 auto;
}

.stats-view-switch {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.stats-control-label {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--t-faint);
}

.stats-workspace-bar .section-tabs {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
}

.stats-workspace-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--t-text);
}

.stats-workspace-bar .btn-stats-expand {
  margin-left: auto;
  align-self: center;
}

.stats-block[hidden] {
  display: none !important;
}

.btn-stats-expand {
  appearance: none;
  border: 1px solid var(--t-border);
  background: var(--t-surface);
  color: var(--t-muted);
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 0.3rem;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-stats-expand:hover {
  color: var(--t-text);
  background: var(--t-btn-secondary-hover);
}

.duplicates-panel-fill:not([hidden]) {
  flex: 0 1 38%;
  min-height: 0;
  max-height: 38%;
  overflow: auto;
  margin-top: 0.75rem;
}

.table-stage-fill {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 15px;
  box-sizing: border-box;
}

.table-stage-fill > .table-wrap.table-wrap-fill {
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: 0;
}

.duplicates-panel-overlay {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 15px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: min(48%, 24rem);
  margin: 0;
  padding: 0.85rem 1rem 1rem;
  border: 1px solid var(--t-border);
  border-radius: var(--radius);
  background: var(--t-modal-bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.duplicates-panel-overlay[hidden] {
  display: none !important;
}

.duplicates-modal {
  position: absolute;
  top: 0.65rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: min(28rem, calc(100% - 1.5rem));
  max-height: min(52%, 22rem);
  margin: 0;
  padding: 0.7rem 0.85rem 0.8rem;
  border: 1px solid var(--t-border);
  border-radius: var(--radius);
  background: var(--t-modal-bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.duplicates-modal.developer-suggest-wide {
  top: 0.4rem;
  left: 0.4rem;
  right: 0.4rem;
  bottom: clamp(5.25rem, 13vh, 8.5rem);
  transform: none;
  width: auto;
  max-width: none;
  max-height: none;
  height: auto;
  padding: 0.85rem 1rem 1rem;
  gap: 0.65rem;
}

.form-suggest-panel {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  z-index: 5;
  width: 100%;
  max-width: 100%;
  max-height: min(70vh, 36rem);
  margin: 0 0 1rem;
  grid-column: 1 / -1;
}

.form-suggest-panel.developer-suggest-wide {
  max-height: min(75vh, 40rem);
}

.form-grid .form-suggest-panel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.7rem 0.85rem 0.8rem;
  border: 1px solid var(--t-border, var(--line));
  border-radius: var(--radius, 10px);
  background: var(--t-modal-bg, var(--t-surface, #fff));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.form-suggest-panel[hidden] {
  display: none !important;
}

.dev-suggest-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.developer-suggest-devs-only .dev-suggest-columns {
  grid-template-columns: 1fr;
}

.duplicates-modal.developer-suggest-devs-only {
  width: min(28rem, calc(100% - 1.5rem));
  max-height: min(52%, 22rem);
}

.dev-suggest-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.dev-suggest-col-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--t-muted, rgba(232, 242, 236, 0.7));
}

.dev-suggest-plan-filters {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}

.dev-suggest-col .dup-list {
  flex: 1 1 auto;
}

.dup-item.is-disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

@media (max-width: 720px) {
  .duplicates-modal.developer-suggest-wide {
    left: 0.35rem;
    right: 0.35rem;
    bottom: clamp(5.5rem, 18vh, 10rem);
  }
  .dev-suggest-columns {
    grid-template-columns: 1fr;
  }
}

.duplicates-modal[hidden] {
  display: none !important;
}

.dup-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
}

.duplicates-modal .dup-title {
  margin: 0;
  font-size: 1.15rem;
}

.dup-overlay-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
}

.dup-lead {
  margin: 0;
  font-size: 0.9rem;
}

.dup-search-row {
  flex-shrink: 0;
}

.dup-search-field {
  display: grid;
  gap: 0.3rem;
  margin: 0;
}

.dup-search-field > span {
  font-size: 0.82rem;
  color: var(--t-muted, rgba(232, 242, 236, 0.7));
}

.dup-search-field .cell-input {
  width: 100%;
}

.duplicates-panel-overlay .dup-actions,
.duplicates-modal .dup-actions {
  margin: 0;
  flex-shrink: 0;
  gap: 0.55rem 0.85rem;
}

.dup-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin: 0;
}

.dup-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.dup-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--t-border);
  border-radius: 6px;
  background: var(--t-surface-solid, var(--t-surface));
  color: var(--t-text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.dup-item:hover {
  border-color: color-mix(in srgb, var(--t-text) 28%, var(--t-border));
}

.dup-item[selected] {
  background: color-mix(in srgb, var(--accent) 22%, var(--t-surface-solid, var(--t-surface)));
  border-color: color-mix(in srgb, var(--accent) 55%, var(--t-border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.dup-item-main {
  min-width: 0;
  flex: 1 1 auto;
}

.dup-item-meta,
.dup-item-title,
.dup-item-sub {
  margin: 0;
}

.dup-item-meta {
  font-size: 0.78rem;
  color: var(--t-muted);
}

.dup-item-title {
  margin-top: 0.15rem;
  font-size: 0.9rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.dup-item-sub {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--t-muted);
}

.dup-item-action {
  flex: 0 0 auto;
  align-self: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--t-muted);
  white-space: nowrap;
}

.dup-item[selected] .dup-item-action {
  color: var(--t-text);
}

.dup-empty {
  margin: 0;
  color: var(--t-muted);
  font-size: 0.9rem;
}

.duplicates-modal .dup-title,
.app-page h2.dup-title,
.dup-title {
  color: var(--t-text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1.25rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--t-topbar-border);
  background: var(--t-topbar-bg);
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
  box-shadow: var(--t-topbar-shadow);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  min-width: 0;
}

.brand-link {
  font-family: var(--display);
  font-size: 1.65rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.topbar-crumbs {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.topbar-crumb {
  font-family: var(--display);
  font-size: clamp(1.25rem, 2.4vw, 1.65rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--t-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(42rem, 58vw);
}

.nav-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem;
  border-radius: 12px;
  background: var(--t-nav-bg);
  border: 1px solid var(--t-nav-border);
}

.nav-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--t-nav-text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: 9px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-btn:hover {
  color: var(--t-nav-hover-text);
  background: var(--t-nav-hover-bg);
}

.nav-btn.is-active {
  color: var(--t-nav-active-text);
  background: var(--t-nav-active-bg);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-chip {
  font-size: 0.9rem;
  color: var(--t-nav-text);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--t-chip-border);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

a.user-chip:hover {
  color: var(--t-text);
  border-color: var(--t-chip-hover-border);
  background: var(--t-chip-hover-bg);
}

a.user-chip.is-active {
  color: var(--t-text);
  border-color: rgba(31, 107, 74, 0.45);
  background: rgba(31, 107, 74, 0.12);
}

.account-form {
  max-width: 22rem;
}

.account-form .field input {
  background: var(--t-input-bg);
  border: 1px solid var(--t-input-border);
  color: var(--t-input-text);
}

.account-form .field span {
  color: var(--t-faint);
}

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

.app-main {
  padding: clamp(1.5rem, 4vw, 2.75rem) clamp(1.25rem, 4vw, 2.5rem) 3rem;
  animation: rise 0.45s ease both;
}

.app-main.app-main-fill {
  padding: 0;
  animation: none;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 0;
}

.row-filter-chips[hidden],
.row-filter-chips:not(.has-filters) {
  /* toggled via JS hidden attribute */
}

table.has-filters tr.row-filter-chips,
tr.row-filter-chips {
  /* visible when not hidden */
}

.data-table thead tr.row-filter th,
.data-table thead tr.row-filter td {
  padding: 0.15rem 0.12rem;
  vertical-align: middle;
  background: rgba(31, 107, 74, 0.12);
  border-bottom: 1px solid rgba(183, 224, 203, 0.16);
  font-weight: 400;
}

.data-table thead tr.row-filter-chips th {
  padding: 0.35rem 0.55rem;
  background: rgba(20, 28, 24, 0.9);
  border-bottom: 1px solid rgba(232, 242, 236, 0.08);
  font-weight: 400;
}

.data-table thead tr.row-filter-chips[hidden] {
  display: none;
}

.data-table thead tr.row-filter .cell-input {
  width: 100%;
  min-width: 0;
  border-color: transparent;
  background: rgba(0, 0, 0, 0.12);
  box-shadow: none;
}

.data-table thead tr.row-filter select.cell-input {
  appearance: auto;
  cursor: pointer;
  padding-right: 0.25rem;
}

.data-table thead tr.row-filter .cell-input:hover {
  border-color: rgba(183, 224, 203, 0.22);
}

.data-table thead tr.row-filter .cell-input:focus {
  border-color: var(--t-input-focus);
  box-shadow: 0 0 0 2px rgba(31, 107, 74, 0.22);
}

.data-table thead tr.row-filter .actions {
  white-space: nowrap;
  text-align: center;
}

.filter-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem 0.28rem 0.65rem;
  border: 1px solid rgba(183, 224, 203, 0.28);
  border-radius: 999px;
  background: rgba(31, 107, 74, 0.28);
  color: #d7ebe1;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.filter-chip:hover {
  background: rgba(31, 107, 74, 0.42);
}

.filter-chip-label {
  color: rgba(232, 242, 236, 0.55);
}

.filter-chip-value {
  font-weight: 600;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-chip-x {
  margin-left: 0.1rem;
  opacity: 0.7;
  font-size: 1rem;
  line-height: 1;
}

.app-main.narrow {
  max-width: 52rem;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.app-page h1 {
  color: var(--t-text);
}

.app-page h2.dup-title,
.dup-title {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  color: var(--t-text);
}

.duplicates-panel {
  margin-top: 1.75rem;
  padding-top: 0.25rem;
}

.duplicates-panel[hidden] {
  display: none !important;
}

.dup-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.25rem;
  margin: 0 0 1rem;
}

.dup-choice {
  margin: 0;
  color: var(--t-muted);
  font-size: 0.95rem;
}

.dup-actions .btn[selected],
.duplicates-panel .btn[selected],
.duplicates-modal .btn[selected] {
  outline: none;
  background: color-mix(in srgb, var(--accent) 28%, var(--t-surface-solid, var(--t-surface)));
  border-color: color-mix(in srgb, var(--accent) 55%, var(--t-border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--t-text);
}

.duplicates-modal .btn-primary[selected] {
  background: var(--accent-hover);
  color: #fff;
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.duplicates-modal .btn-primary:not([selected]) {
  background: transparent;
  color: var(--t-text);
  border: 1px solid var(--t-border);
  box-shadow: none;
}

.dup-link-hint {
  white-space: nowrap;
  color: var(--t-muted);
  font-size: 0.85rem;
}

.badge-root {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  margin-left: 0.35rem;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1;
  color: #1a2420;
  background: rgba(232, 242, 236, 0.85);
  border-radius: 50%;
}

.row-current td {
  background: rgba(232, 242, 236, 0.06);
}

.col-expand {
  width: 2.25rem;
  min-width: 2.25rem;
  max-width: 2.5rem;
  text-align: center;
  padding-left: 0.35rem !important;
  padding-right: 0.35rem !important;
}

.btn-expand {
  appearance: none;
  border: 1px solid var(--t-expand-border);
  background: var(--t-expand-bg);
  color: var(--t-text);
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 0.3rem;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
}

.btn-expand:hover {
  background: var(--t-btn-secondary-hover);
}

.data-row.is-expanded {
  background: rgba(232, 242, 236, 0.05);
}

/* Per-row colored frame — all four sides, including between adjacent highlighted rows. */
tr.is-related-hl > td {
  border-top: 2px solid var(--related-border, #e67a2e) !important;
  border-bottom: 2px solid var(--related-border, #e67a2e) !important;
  border-left: none !important;
  border-right: none !important;
  box-shadow: none !important;
}

tr.is-related-hl > td:first-child {
  border-left: 2px solid var(--related-border, #e67a2e) !important;
}

tr.is-related-hl > td:last-child {
  border-right: 2px solid var(--related-border, #e67a2e) !important;
}

/* Nested related rows: same frame, but skip the expand/badges cell. */
tr.row-related-child.is-related-hl > td:first-child {
  border-top: none !important;
  border-bottom: none !important;
  border-left: none !important;
  border-right: none !important;
}

tr.row-related-child.is-related-hl > td:nth-child(2) {
  border-left: 2px solid var(--related-border, #e67a2e) !important;
}

tr.is-related-hl.is-related-current > td,
tr.is-related-hl.related-row-current > td {
}

.row-related-child > td {
  background: var(--sticky-bg-related);
}

.row-related-child.row-related-enter > td {
  animation: relatedRowIn 180ms ease-out;
}

.row-related-child.row-related-leave > td {
  animation: relatedRowOut 180ms ease-in forwards;
}

html[data-theme="light"] .row-related-child > td {
  background: var(--sticky-bg-related);
}

.row-related-child.is-related-hl > td {
}

.row-related-child.is-related-hl.is-related-current > td,
.row-related-child.is-related-hl.related-row-current > td {
}

@keyframes relatedRowIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes relatedRowOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.col-badges {
  vertical-align: middle;
}

.col-badges .badge-root,
.col-badges .badge-current {
  display: inline-flex;
  margin: 0.12rem auto;
  margin-left: auto;
}

.badge-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  margin-left: 0.35rem;
  padding: 0;
  font-size: 0.8rem;
  line-height: 1;
  color: #2a1608;
  background: #e67a2e;
  border-radius: 50%;
}

.app-page .lead {
  color: var(--t-muted);
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.page-head h1 {
  margin: 0;
}

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 1.25rem;
}

.section-toolbar .head-actions {
  margin-left: 0;
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.import-form {
  margin: 0;
  display: inline;
}

.import-btn {
  cursor: pointer;
  margin: 0;
  position: relative;
  overflow: hidden;
}

.import-btn .import-file {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.crumb {
  margin: 0 0 0.85rem;
  color: var(--t-faint);
  font-size: 0.9rem;
}

.form-page-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.form-page-titles {
  min-width: 0;
  flex: 1 1 auto;
}

.form-page-titles .crumb {
  margin: 0 0 0.35rem;
}

.form-page-titles h1 {
  margin: 0;
}

.btn-back {
  flex: 0 0 auto;
  margin-top: 0.15rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.crumb a {
  color: var(--t-muted);
}

.crumb a:hover {
  color: var(--t-text);
}

.btn-secondary {
  background: var(--t-btn-secondary-bg);
  color: var(--t-text);
  border: 1px solid var(--t-btn-secondary-border);
}

.btn-secondary:hover {
  background: var(--t-btn-secondary-hover);
}

.btn-danger {
  background: rgba(143, 47, 47, 0.85);
  color: #fff;
}

.btn-danger:hover {
  background: #8f2f2f;
}

.link-danger {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: #e08a8a;
  cursor: pointer;
}

.link-danger:hover {
  color: #ffb4b4;
}

.status {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--t-status-bg);
  color: var(--t-status-text);
  font-size: 0.85rem;
  font-weight: 600;
}

.status-approved {
  background: rgba(31, 107, 74, 0.18);
  color: #8fd4b0;
}

.status-progress {
  background: rgba(196, 140, 32, 0.2);
  color: #e8c46a;
}

.status-rejected {
  background: rgba(168, 55, 55, 0.22);
  color: #f0a0a0;
}

.status-skipped {
  background: rgba(120, 130, 140, 0.2);
  color: #b8c0c8;
}

.status-other {
  background: rgba(78, 140, 200, 0.18);
  color: #9ec4e8;
}

html[data-theme="light"] .status-approved {
  background: rgba(31, 107, 74, 0.14);
  color: #145539;
}

html[data-theme="light"] .status-progress {
  background: rgba(180, 120, 20, 0.16);
  color: #8a5a08;
}

html[data-theme="light"] .status-rejected {
  background: rgba(168, 55, 55, 0.14);
  color: #a33a3a;
}

html[data-theme="light"] .status-skipped {
  background: rgba(80, 90, 100, 0.12);
  color: #4a5560;
}

html[data-theme="light"] .status-other {
  background: rgba(40, 100, 160, 0.12);
  color: #1f5f8f;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--t-border);
  border-radius: var(--radius);
  background: var(--t-surface);
}

.table-wrap.table-wrap-fill {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  overflow-x: auto;
  overflow-y: auto;
  border: none;
  border-radius: 0;
  background: transparent;
  padding-bottom: 15px;
  box-sizing: border-box;
}

.table-wrap-sticky {
  overflow: auto;
  overflow-anchor: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  min-height: 0;
  --sticky-head-h: 4.75rem;
  --sticky-head-group-h: 0px;
  --sticky-head-leaf-h: 4.75rem;
  --sticky-filter-h: 2.6rem;
  --sticky-expand-w: 2.25rem;
  --sticky-status-w: 8.5rem;
}

.table-wrap-sticky > table {
  /* Keep table pinned to the start of the scrollport so sticky thead
     stays fixed while older rows are prepended above. */
  flex: 0 0 auto;
  margin-right: auto;
  margin-top: 0;
}

.table-wrap-sticky:not(.table-wrap-fill) {
  max-height: calc(100vh - 10.5rem);
}

#submissions-table,
#tracking-table {
  border-collapse: separate;
  border-spacing: 0;
}

#submissions-table thead th,
#tracking-table thead th {
  position: sticky;
  z-index: 5;
  background: var(--sticky-bg-head);
  /* Avoid subpixel jitter while tbody grows during lazy load. */
  backface-visibility: hidden;
}

#submissions-table thead tr:first-child th,
#tracking-table thead tr.head-group th {
  top: 0;
  z-index: 7;
}

#tracking-table thead tr.head-group th[rowspan] {
  z-index: 8;
  vertical-align: middle;
}

#tracking-table thead tr.head-labels th {
  top: var(--sticky-head-group-h);
  z-index: 6;
}

#submissions-table thead tr.row-filter th,
#tracking-table thead tr.row-filter th {
  top: var(--sticky-head-h);
  background: var(--sticky-bg-filter);
  z-index: 5;
}

#submissions-table thead tr.row-filter-chips th,
#tracking-table thead tr.row-filter-chips th {
  top: calc(var(--sticky-head-h) + var(--sticky-filter-h));
  background: var(--sticky-bg-head);
  z-index: 5;
}

#submissions-table thead tr.row-filter .col-expand,
#submissions-table thead tr.row-filter .col-status,
#submissions-table thead tr.row-filter-chips .col-expand,
#submissions-table thead tr.row-filter-chips .col-status {
  z-index: 8;
}

#submissions-table .col-expand,
#submissions-table .col-status {
  position: sticky;
  z-index: 3;
  background: var(--t-row-bg);
}

#submissions-table thead .col-expand,
#submissions-table thead .col-status {
  z-index: 7;
}

#submissions-table .col-expand {
  left: 0;
  width: var(--sticky-expand-w);
  min-width: var(--sticky-expand-w);
  max-width: var(--sticky-expand-w);
}

#submissions-table .col-status {
  left: var(--sticky-expand-w);
  min-width: var(--sticky-status-w);
  width: var(--sticky-status-w);
  max-width: 12rem;
  box-shadow: 6px 0 10px -6px rgba(0, 0, 0, 0.55);
}

#submissions-table tbody tr:hover > .col-expand,
#submissions-table tbody tr:hover > .col-status {
  background: var(--t-row-hover);
}

#submissions-table tbody tr.row-form > .col-expand,
#submissions-table tbody tr.row-form > .col-status {
  background: var(--t-row-form-bg);
}

#submissions-table tbody tr.row-related-child > .col-expand,
#submissions-table tbody tr.row-related-child > .col-status {
  background: var(--sticky-bg-related);
}

#submissions-table tbody tr.row-related-child:hover > .col-expand,
#submissions-table tbody tr.row-related-child:hover > .col-status {
  background: var(--sticky-bg-related);
}

#submissions-table tbody tr.is-related-hl > .col-expand,
#submissions-table tbody tr.is-related-hl > .col-status {
}

#submissions-table tbody tr.is-related-current > .col-expand,
#submissions-table tbody tr.is-related-current > .col-status,
#submissions-table tbody tr.related-row-current > .col-expand,
#submissions-table tbody tr.related-row-current > .col-status {
}

#submissions-table tbody tr.row-lazy-sentinel td {
  text-align: center;
  color: rgba(232, 242, 236, 0.55);
  font-size: 0.88rem;
  padding: 0.65rem 1rem;
  background: rgba(18, 25, 22, 0.9);
}


.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.data-table-wide {
  min-width: 3200px;
}

.data-table.data-table-layout {
  table-layout: fixed;
}

/* Sticky expand/status keep fixed widths via --sticky-*-w (do not zero them out). */

#submissions-table.data-table-layout .col-expand {
  left: 0;
  width: var(--sticky-expand-w);
  min-width: var(--sticky-expand-w);
  max-width: var(--sticky-expand-w);
}

#submissions-table.data-table-layout .col-status {
  left: var(--sticky-expand-w);
  width: var(--sticky-status-w);
  min-width: var(--sticky-status-w);
  max-width: var(--sticky-status-w);
  box-shadow: 6px 0 10px -6px rgba(0, 0, 0, 0.55);
}

#submissions-table.data-table-layout thead .col-expand,
#submissions-table.data-table-layout thead .col-status {
  position: sticky;
  z-index: 9;
  background: var(--sticky-bg-head);
}

#submissions-table.data-table-layout tbody .col-expand,
#submissions-table.data-table-layout tbody .col-status {
  position: sticky;
  z-index: 3;
  background: var(--t-row-bg);
}

.data-table-layout th,
.data-table-layout td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
}

.data-table-layout thead th.col-resizable {
  overflow: visible;
  vertical-align: bottom;
}

.data-table-layout thead th {
  height: auto;
  max-height: none;
}

.data-table-layout.has-head-height thead tr.head-labels > th {
  height: var(--table-head-h);
  max-height: var(--table-head-h);
  overflow: hidden;
  vertical-align: bottom;
  box-sizing: border-box;
}

.data-table-layout.has-head-group-height thead tr.head-group > th:not([rowspan]) {
  height: var(--table-head-group-h);
  max-height: var(--table-head-group-h);
  overflow: hidden; /* clip text; resizers sit on the edge */
  vertical-align: bottom;
  box-sizing: border-box;
}

/* Rowspan (merged) cells: lock total height so text cannot fight the drag handle. */
.data-table-layout.has-head-height.has-head-group-height thead tr.head-group > th[rowspan] {
  height: var(--table-head-span-h, calc(var(--table-head-group-h) + var(--table-head-h)));
  max-height: var(--table-head-span-h, calc(var(--table-head-group-h) + var(--table-head-h)));
  overflow: hidden;
  vertical-align: bottom;
  box-sizing: border-box;
}

.data-table-layout.has-head-height.has-head-group-height tr.head-group > th[rowspan] > .cell-clip-head {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--table-head-span-clamp, 3);
  line-clamp: var(--table-head-span-clamp, 3);
  overflow: hidden;
  text-overflow: ellipsis;
  height: 100%;
  max-height: 100%;
  box-sizing: border-box;
}

/* Absolute resizers use the sticky/relative cell as containing block.
   Never override position:sticky from #…-table thead th rules. */

/* Header text clip — independent from body .cell-clip / --table-line-clamp. */
.cell-clip-head {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  display: block;
  max-height: none;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}

/* Only after user sets header height — leaf label row only, not group rowspan cells. */
.data-table-layout.has-head-height tr.head-labels > th > .cell-clip-head {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--table-head-clamp, 2);
  line-clamp: var(--table-head-clamp, 2);
  overflow: hidden;
  text-overflow: ellipsis;
  height: 100%;
  max-height: 100%;
  box-sizing: border-box;
}

.data-table-layout.has-head-group-height tr.head-group > th:not([rowspan]) > .cell-clip-head {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--table-head-group-clamp, 2);
  line-clamp: var(--table-head-group-clamp, 2);
  overflow: hidden;
  text-overflow: ellipsis;
  height: 100%;
  max-height: 100%;
  box-sizing: border-box;
}

/* Body cells only — header height is --table-head-h. */
.data-table-layout tbody td {
  height: var(--table-row-max-h, 72px);
  max-height: var(--table-row-max-h, 72px);
  overflow: hidden;
  vertical-align: top;
}

.data-table-wide th {
  max-width: none;
  white-space: normal;
  line-height: 1.3;
  vertical-align: bottom;
  position: relative;
}

.data-table-wide td {
  max-width: none;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.data-table-layout tbody tr.row-form td,
.data-table-layout tbody tr.row-form-label td,
.data-table-layout tbody tr.row-empty td,
.data-table-layout tbody tr.row-lazy-sentinel td {
  height: auto;
  max-height: none;
  overflow: visible;
}

.data-table-layout tbody tr.row-form td:not(.actions) {
  overflow-x: hidden;
  max-width: 0; /* allow inputs to shrink to column width */
}

.cell-clip {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--table-line-clamp, 3);
  line-clamp: var(--table-line-clamp, 3);
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  max-height: 100%;
}

.data-table td.cell-title {
  max-width: none;
  white-space: normal;
}

.tracking-table {
  min-width: 4200px;
}

.tracking-table thead tr.head-group > th {
  text-align: center;
  line-height: 1.2;
  font-size: 0.8rem;
  white-space: normal;
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}

.tracking-table thead tr.head-labels > th {
  text-align: center;
  font-weight: 600;
  font-size: 0.78rem;
  line-height: 1.15;
  white-space: nowrap;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

.form-section {
  margin: 0.35rem 0 0;
  padding-top: 0.45rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-hover);
}

.data-table th,
.data-table td {
  padding: 0.9rem 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--t-td-border);
  color: var(--t-text);
}

.data-table tbody td {
  background: var(--t-row-bg);
}

.data-table th {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--t-th);
  background: var(--sticky-bg-head);
}

.data-table tbody tr:hover > td {
  background: var(--t-row-hover);
}

.data-table tbody tr.row-related-child:hover > td {
  background: var(--sticky-bg-related);
}

.col-resizable {
  position: relative;
  border-right: 1px solid var(--t-td-border);
}

.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 12;
  touch-action: none;
}

.tracking-table thead tr.head-group > th[rowspan].col-resizable {
  overflow: visible;
}

.col-resizer::after {
  content: "";
  position: absolute;
  top: 12%;
  bottom: 12%;
  left: 4px;
  width: 2px;
  border-radius: 1px;
  background: rgba(31, 107, 74, 0.28);
  transition: background 0.12s ease, width 0.12s ease;
}

.col-resizable:hover .col-resizer::after,
.col-resizer:hover::after,
body.is-col-resizing .col-resizer::after {
  background: rgba(31, 107, 74, 0.85);
  width: 3px;
}

body.is-col-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}

body.is-col-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

tbody.is-row-resize-cursor,
tbody.is-row-resize-cursor * {
  cursor: row-resize !important;
}

.data-table-layout tbody tr.is-row-resize-hover > td {
  box-shadow: inset 0 -2px 0 rgba(31, 107, 74, 0.65);
}

thead.is-head-resize-cursor,
thead.is-head-resize-cursor * {
  cursor: row-resize !important;
}

.head-resizer {
  position: absolute;
  left: 0;
  right: 6px;
  bottom: 0;
  height: 8px;
  cursor: row-resize;
  user-select: none;
  z-index: 14;
  touch-action: none;
}

.head-resizer::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 3px;
  height: 2px;
  border-radius: 1px;
  background: transparent;
  transition: background 0.12s ease;
}

thead tr.head-labels > th:hover .head-resizer::after,
thead tr.head-group > th:hover .head-resizer::after,
.head-resizer:hover::after,
body.is-head-resizing .head-resizer::after,
.data-table-layout thead tr.head-labels.is-head-resize-hover > th .head-resizer-leaf::after,
.data-table-layout thead tr.head-group.is-head-resize-hover > th .head-resizer-group::after,
.data-table-layout thead tr.head-group.is-head-resize-hover > th[rowspan] .head-resizer-span::after {
  background: rgba(31, 107, 74, 0.85);
}

.data-table-layout thead tr.head-labels.is-head-resize-hover > th,
.data-table-layout thead tr.head-group.is-head-resize-hover > th:not([rowspan]),
.data-table-layout thead tr.head-group.is-head-resize-hover > th[rowspan] {
  box-shadow: none;
  border-bottom-color: rgba(31, 107, 74, 0.85);
}

body.is-head-resizing {
  cursor: row-resize !important;
  user-select: none !important;
}

body.is-head-resizing * {
  cursor: row-resize !important;
  user-select: none !important;
}

body.is-row-resizing {
  cursor: row-resize !important;
  user-select: none !important;
}

body.is-row-resizing * {
  cursor: row-resize !important;
  user-select: none !important;
}

.data-table tbody tr.row-empty:hover {
  background: transparent;
}

.data-table tbody tr.row-empty td {
  color: var(--t-empty, rgba(232, 242, 236, 0.55));
  font-size: 0.92rem;
  text-align: center;
  padding: 0;
  border-bottom: none;
  vertical-align: middle;
}

.data-table tbody tr.row-empty[data-filter-empty] td,
.data-table tbody tr.row-empty[data-filter-nomatch] td {
  height: clamp(14rem, 46vh, 32rem);
}

.table-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.45rem;
  min-height: inherit;
  padding: 2rem 1.5rem 2rem 1.25rem;
  box-sizing: border-box;
  text-align: left;
}

.table-empty-compact {
  padding: 1.5rem 1rem;
}

.table-empty-title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  font-weight: 400;
  color: var(--t-text);
  line-height: 1.2;
}

.table-empty-hint {
  margin: 0;
  max-width: 28rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--t-muted);
}

.data-table tbody tr.row-form,
#submissions-table tbody tr.row-form,
#tracking-table tbody tr.row-form {
  position: relative;
  z-index: 2;
  background: var(--t-row-form-bg);
  box-shadow: var(--t-row-form-shadow);
}

.data-table tbody tr.row-form:hover,
#submissions-table tbody tr.row-form:hover,
#tracking-table tbody tr.row-form:hover {
  background: var(--t-row-form-bg);
}

.data-table tbody tr.row-form-label,
#submissions-table tbody tr.row-form-label,
#tracking-table tbody tr.row-form-label {
  position: relative;
  z-index: 2;
  background: var(--t-row-form-bg);
}

.data-table tbody tr.row-form-label td,
#submissions-table tbody tr.row-form-label td,
#tracking-table tbody tr.row-form-label td {
  padding: 0.55rem 50px 0.35rem 0.75rem;
  border-bottom: none;
  border-top: 1px solid var(--t-row-form-border);
  background: var(--t-row-form-bg) !important;
  vertical-align: middle;
  color: var(--t-text);
}

.data-table tbody tr.row-form-label td:first-child,
#submissions-table tbody tr.row-form-label td:first-child,
#tracking-table tbody tr.row-form-label td:first-child {
  border-left: 1px solid var(--t-row-form-border);
  border-top-left-radius: 10px;
}

.data-table tbody tr.row-form-label td:last-child,
#submissions-table tbody tr.row-form-label td:last-child,
#tracking-table tbody tr.row-form-label td:last-child {
  border-right: 1px solid var(--t-row-form-border);
  border-top-right-radius: 10px;
}

.row-form-label-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--t-text);
  margin-right: 0.55rem;
}

.row-form-label-hint {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--t-faint);
}

.row-form-label-action {
  appearance: none;
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 700;
  color: var(--t-link, var(--accent));
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.row-form-label-action:hover {
  color: var(--t-link-hover, var(--accent-hover));
}

.data-table tbody tr.row-form td,
#submissions-table tbody tr.row-form td,
#tracking-table tbody tr.row-form td {
  vertical-align: top;
  border-top: none !important;
  border-bottom: 1px solid var(--t-row-form-border) !important;
  background: var(--t-row-form-bg) !important;
  padding: 0.35rem 0.2rem 0.45rem;
  color: var(--t-text);
}

.data-table tbody tr.row-form td:first-child,
#submissions-table tbody tr.row-form td:first-child,
#tracking-table tbody tr.row-form td:first-child {
  border-left: 1px solid var(--t-row-form-border) !important;
  border-bottom-left-radius: 10px;
  padding-left: 0.35rem;
}

.data-table tbody tr.row-form td:last-child,
#submissions-table tbody tr.row-form td:last-child,
#tracking-table tbody tr.row-form td:last-child {
  border-right: 1px solid var(--t-row-form-border) !important;
  border-bottom-right-radius: 10px;
  padding-right: 50px !important;
}

.row-form .actions .btn-row {
  min-height: 2rem;
  height: auto;
  align-self: flex-start;
  margin-top: 0;
}

.cell-input {
  appearance: none;
  display: block;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.28rem 0.35rem;
  border: 1px solid var(--t-input-border);
  border-radius: 5px;
  background: var(--t-input-bg);
  color: var(--t-input-text);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.35;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.cell-input[hidden] {
  display: none !important;
}

textarea.cell-input,
textarea.cell-input-wrap {
  resize: none;
  overflow: hidden;
  min-height: 2rem;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  field-sizing: content;
}

/* Same control size for text / date / number / select in every registry form. */
.row-form input.cell-input,
.row-form select.cell-input,
.row-form textarea.cell-input,
.row-form textarea.cell-input-wrap {
  box-sizing: border-box;
  max-width: 100%;
  min-height: 2rem;
  height: auto;
  padding: 0.28rem 0.35rem;
  font-size: 0.85rem;
  line-height: 1.35;
  background: var(--t-input-bg);
  border-color: var(--t-input-border);
  color: var(--t-input-text);
}

.row-form input.cell-input:not([type="hidden"]),
.row-form select.cell-input {
  height: 2rem;
}

.row-form textarea.cell-input,
.row-form textarea.cell-input-wrap {
  max-height: 5.5rem;
  field-sizing: fixed;
  align-self: stretch;
  overflow-y: auto;
}

#tracking-table .row-form textarea[name="title"],
#tracking-table .row-form textarea#new-track-title,
#tracking-table .row-form textarea[data-track-title] {
  max-height: 5.5rem;
  overflow-y: auto;
  resize: none;
}

.cell-input::placeholder {
  color: var(--t-input-placeholder);
}

.cell-input:focus {
  outline: none;
  border-color: var(--t-input-focus);
  box-shadow: 0 0 0 2px rgba(31, 107, 74, 0.22);
  background: var(--t-input-bg);
}

.cell-input[type="date"] {
  color-scheme: inherit;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  font-size: 0.85rem;
}

.form-grid input[type="date"] {
  color-scheme: light;
  min-width: 8.2rem;
}

.row-form .actions {
  white-space: nowrap;
  padding-left: 0.4rem !important;
  padding-right: 50px !important;
  overflow: visible;
  max-width: none;
  width: 1%;
  min-width: 8.75rem;
  background: var(--t-row-form-bg) !important;
}

.btn-row {
  padding: 0.28rem 0.65rem;
  font-size: 0.82rem;
  white-space: nowrap;
}

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

.row-link {
  color: var(--t-link);
  font-weight: 600;
}

.row-link:hover {
  color: var(--t-link-hover);
}

.actions a {
  color: var(--t-faint);
  font-size: 0.9rem;
}

.actions a:hover {
  color: #fff;
}

.data-table th.actions,
.data-table td.actions {
  width: 1%;
  min-width: 8.75rem;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
  padding-left: 0.4rem !important;
  padding-right: 0.4rem !important;
  overflow: visible;
}

.data-table-layout tbody td.actions {
  overflow: visible;
  max-width: none;
}

/* Collapse trailing action cells — toolbar floats on hover. */
.data-table thead th.actions {
  min-width: 6rem;
}

.data-table tbody tr.data-row > td.actions,
.data-table tbody tr.plan-row > td.actions {
  width: 1%;
  min-width: 0;
  padding: 0 !important;
  overflow: hidden;
  pointer-events: none;
  vertical-align: middle;
}

.data-table tbody tr.data-row > td.actions .row-actions,
.data-table tbody tr.plan-row > td.actions .row-actions,
.row-actions-placeholder {
  display: none;
}

.row-actions {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: center;
  min-width: max-content;
}

.row-actions-float {
  position: fixed;
  z-index: 90;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0.28rem 0.35rem;
  border: 1px solid var(--t-border);
  border-radius: 999px;
  background: var(--t-surface-solid, var(--t-row-bg, #1a2420));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
}

.row-actions-float[hidden] {
  display: none !important;
}

.row-actions-float .row-actions {
  display: inline-flex;
}

html[data-theme="light"] .row-actions-float {
  background: var(--t-surface-solid, #fff);
  box-shadow: 0 8px 22px rgba(20, 40, 30, 0.14);
}

tr.data-row.has-row-actions-open,
tr.plan-row.has-row-actions-open {
  position: relative;
}

.btn-icon {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  margin: 0;
  border: 1px solid var(--t-icon-border);
  border-radius: 50%;
  background: var(--t-icon-bg);
  color: var(--t-text);
  font-size: 0.95rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease, border-color 0.15s ease;
}

.th-find-replace {
  position: relative;
}

.th-find-replace > .cell-clip-head {
  padding-right: 1.55rem;
}

.btn-find-replace {
  position: absolute;
  top: 0.15rem;
  right: 0.55rem;
  z-index: 15;
  flex: 0 0 auto;
  width: 1.45rem;
  height: 1.45rem;
  margin: 0;
  border-radius: 4px;
  opacity: 0.72;
}

.btn-find-replace:hover {
  opacity: 1;
  transform: none;
  border-color: rgba(31, 107, 74, 0.45);
  background: rgba(31, 107, 74, 0.12);
  color: var(--t-status-text, var(--accent));
}

.btn-icon:hover {
  transform: translateY(-1px);
}

.btn-icon:active {
  transform: translateY(0);
}

.btn-icon-edit:hover {
  background: rgba(183, 224, 203, 0.28);
  border-color: rgba(183, 224, 203, 0.45);
}

.btn-icon-copy:hover,
.btn-icon-copy.is-copied {
  background: rgba(183, 224, 203, 0.28);
  border-color: rgba(183, 224, 203, 0.45);
}

.col-plan-link {
  width: 4.5rem;
  text-align: center;
  white-space: nowrap;
}

.plan-link-ok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  color: #2f9e6a;
  text-decoration: none;
}

.plan-link-ok:hover {
  color: #238a58;
  text-decoration: none;
}

html[data-theme="light"] .plan-link-ok {
  color: #1f8a52;
}

html[data-theme="light"] .plan-link-ok:hover {
  color: #176b40;
}

.btn-icon-delete {
  background: rgba(143, 47, 47, 0.22);
  border-color: rgba(224, 138, 138, 0.28);
}

.btn-icon-delete:hover {
  background: rgba(143, 47, 47, 0.4);
  border-color: rgba(224, 138, 138, 0.5);
}

.row-actions .inline {
  display: inline-flex;
  margin: 0;
}

.empty {
  padding: 2.5rem;
  border: 1px dashed var(--t-border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--t-muted);
}

.empty.compact {
  padding: 1.5rem;
}

.empty .btn {
  margin-top: 1rem;
}

.detail-block {
  margin-top: 1.75rem;
  padding: 1.35rem 1.4rem;
  border-radius: var(--radius);
  background: var(--t-surface);
  border: 1px solid var(--t-border);
}

.detail-block h2 {
  margin: 0 0 1rem;
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 400;
  color: var(--t-text);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2 {
  margin: 0;
}

.section-head a {
  color: var(--t-link);
  font-size: 0.95rem;
}

.kv {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.25rem;
}

.kv > div {
  min-width: 0;
}

.kv .full {
  grid-column: 1 / -1;
}

.kv dt {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--t-faint);
  line-height: 1.35;
}

.kv dd {
  margin: 0;
  color: var(--t-text);
  line-height: 1.45;
  word-break: break-word;
}

.kv a {
  color: var(--t-link);
}

.submission-card {
  padding: 1.1rem 0;
  border-top: 1px solid var(--t-border);
}

.submission-card:first-of-type {
  border-top: none;
  padding-top: 0;
}

.submission-card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}

.submission-card-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--t-text);
}

.submission-card-head a {
  color: var(--t-muted);
  font-size: 0.9rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.55rem;
  margin-top: 1rem;
  padding: 0.85rem;
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-grid .field {
  gap: 0.2rem;
}

.form-grid .field span {
  color: var(--ink-muted);
  font-size: 0.78rem;
}

.form-grid .field input,
.form-grid .field select,
.form-grid textarea {
  appearance: none;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
}

.form-grid .field select {
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%),
    linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% - 2px), calc(100% - 9px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 1.6rem;
}

.form-grid textarea {
  resize: vertical;
  min-height: 3.25rem;
}

.form-grid .field input:focus,
.form-grid .field select:focus,
.form-grid textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

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

.app-page .alert {
  max-width: none;
}

.app-page .alert-error {
  background: rgba(143, 47, 47, 0.25);
  color: #f0c4c4;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    min-height: 28vh;
  }

  .auth-visual-inner {
    justify-content: flex-end;
    padding: 1.75rem;
  }

  .brand-mark {
    font-size: 2.6rem;
  }

  .kv,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.users-panel {
  background: var(--t-surface);
  color: var(--t-text);
  border: 1px solid var(--t-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
}

.users-create-panel {
  padding: 0.95rem 1.15rem 1.05rem;
}

.users-create-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.users-create-head .section-title {
  margin: 0;
  font-size: 1.02rem;
}

.users-create-note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--t-faint);
  max-width: 28rem;
  line-height: 1.35;
}

.users-create-compact {
  margin: 0;
}

.users-create-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.55rem 0.65rem;
  align-items: end;
}

.users-create-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--t-faint);
  min-width: 0;
}

.users-create-fields .cell-input {
  min-height: 2.15rem;
  padding: 0.4rem 0.55rem;
  font-size: 0.9rem;
}

.users-create-submit {
  display: flex;
  align-items: end;
  min-height: 100%;
}

.users-create-submit .btn {
  width: 100%;
  white-space: nowrap;
}

.users-danger {
  border-color: rgba(143, 47, 47, 0.45);
}

.users-danger-compact {
  padding: 0.9rem 1.15rem;
}

.users-danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

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

.users-danger-row .section-title {
  margin: 0 0 0.25rem;
  font-size: 1.02rem;
}

.users-danger-row .form-hint {
  margin: 0;
  font-size: 0.82rem;
}

.users-danger .form-hint {
  margin-bottom: 1rem;
}

.users-danger-compact .form-hint {
  margin-bottom: 0;
}

.users-panel .table-wrap {
  border: 1px solid var(--t-border-soft);
  background: transparent;
}

.section-title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--t-text);
}

.users-create-grid,
.users-perm-row {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.users-create-grid {
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.users-perm-row {
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  align-items: end;
}

.users-perm-row.compact {
  margin-bottom: 0;
}

.users-create label,
.users-perm-row label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--t-faint);
}

.form-hint {
  margin: 0 0 1rem;
  color: var(--t-faint);
  font-size: 0.9rem;
}

.stats-hint {
  margin: 0;
  color: var(--t-muted);
  font-size: 0.88rem;
  line-height: 1.45;
  max-width: 48rem;
}

.stats-details {
  flex-shrink: 0;
  font-size: 0.82rem;
  color: var(--t-muted);
}

.stats-details summary {
  cursor: pointer;
  color: var(--t-faint);
  font-weight: 600;
  user-select: none;
}

.stats-details summary:hover {
  color: var(--t-text);
}

.stats-details p {
  margin: 0.4rem 0 0;
  line-height: 1.45;
  max-width: 48rem;
}

.stats-yes {
  color: #3dba7a;
  font-weight: 650;
}

.stats-no {
  color: var(--t-faint);
}

html[data-theme="light"] .stats-yes {
  color: #1a6b48;
}

.users-table {
  min-width: 0;
}

.users-table .cell-input {
  min-width: 9.5rem;
}

.users-table td {
  color: var(--t-text);
  vertical-align: middle;
}

.users-table td.muted,
.users-table .muted {
  color: var(--t-faint);
}

.inline-form {
  margin: 0;
}

.muted {
  color: var(--t-faint);
  font-weight: 400;
}

.app-page .users-panel .alert {
  margin-bottom: 1rem;
}


.section-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem;
  margin: 0;
  border-radius: 12px;
  background: var(--t-tabs-bg);
  border: 1px solid var(--t-nav-border);
}

.section-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--t-nav-text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.5rem 1.05rem;
  border-radius: 9px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.section-tab:hover {
  color: var(--t-nav-hover-text);
  background: var(--t-nav-hover-bg);
}

.section-tab.is-active {
  color: var(--t-nav-active-text);
  background: var(--t-nav-active-bg);
}

.stats-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stats-toolbar.stats-filters {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--t-border);
  background: var(--t-surface);
  flex-shrink: 0;
}

.stats-toolbar-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 0.65rem 0.85rem;
  align-items: end;
}

.stats-toolbar-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--t-faint);
}

.stats-toolbar-grow {
  min-width: 12rem;
}

.stats-toolbar-actions {
  display: flex;
  align-items: end;
  justify-content: flex-start;
  min-height: 2.15rem;
}

.stats-kpis {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.75rem 1.1rem;
  flex-shrink: 0;
}

.stats-kpi-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.stats-kpi {
  min-width: 7.5rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--t-border);
  background: var(--t-surface);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stats-kpi-accepted {
  border-color: rgba(46, 160, 100, 0.55);
  background: rgba(46, 160, 100, 0.16);
}

.stats-kpi-value {
  font-family: var(--display);
  font-size: 1.55rem;
  line-height: 1.1;
  color: var(--t-text);
  font-weight: 650;
}

.stats-kpi-label {
  font-size: 0.78rem;
  color: var(--t-muted);
  line-height: 1.3;
}

.stats-kpi-statuses {
  flex: 1 1 16rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  justify-content: center;
}

.stats-kpi-statuses-label {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--t-faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stats-status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.stats-status-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--t-border);
  background: var(--t-surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.stats-status-pill:hover {
  border-color: rgba(31, 107, 74, 0.45);
  background: rgba(31, 107, 74, 0.1);
}

.stats-status-pill:focus-visible {
  outline: 2px solid rgba(31, 107, 74, 0.55);
  outline-offset: 2px;
}

.stats-status-pill-count {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--t-text);
}

.stats-status-pill-name {
  font-size: 0.8rem;
  color: var(--t-muted);
}

.stats-block {
  flex: 0 0 auto;
  min-height: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  overflow: visible;
}

.stats-activity-range {
  margin: 0;
  color: var(--t-muted);
  font-size: 0.86rem;
}

.stats-activity {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}

.stats-activity-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
}

.stats-activity-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--t-muted);
}

.stats-activity-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  flex: 0 0 auto;
}

.stats-activity-canvas-wrap {
  width: 100%;
  border: 1px solid var(--t-border);
  border-radius: 12px;
  background: var(--t-panel, transparent);
  padding: 0.5rem 0.35rem 0.25rem;
  box-sizing: border-box;
}

.stats-activity-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 320px;
}

.stats-panel-fill.is-stats-expanded .stats-activity-canvas-wrap canvas {
  height: min(52vh, 520px);
}

.stats-block-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--t-text);
}

.stats-table-wrap-compact {
  width: max-content;
  max-width: 100%;
}

.stats-table-wrap {
  max-width: 100%;
}

.stats-table-wrap-sticky {
  flex: 0 0 auto;
  min-height: auto;
  max-height: none;
  overflow: visible;
  border: 1px solid var(--t-border);
  border-radius: var(--radius);
  background: var(--t-surface-solid, var(--t-surface));
}

.stats-empty {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stats-table {
  min-width: 480px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.stats-table.stats-table-compact {
  width: max-content;
  min-width: 0;
  max-width: 100%;
}

.stats-table th,
.stats-table td {
  white-space: nowrap;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--t-td-border);
}

.stats-table tbody td {
  background: var(--t-row-bg);
}

.stats-table tbody tr:hover > td {
  background: var(--t-row-hover);
}

.stats-table .stats-num {
  text-align: center;
}

.stats-table a.stats-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted rgba(31, 107, 74, 0.45);
}

.stats-table a.stats-link:hover {
  color: var(--t-status-text);
  border-bottom-color: currentColor;
}

.stats-table a.stats-link:focus-visible {
  outline: 2px solid rgba(31, 107, 74, 0.55);
  outline-offset: 2px;
  border-radius: 2px;
}

.stats-table tfoot td {
  border-top: 1px solid var(--t-border);
  border-bottom: none;
  font-size: 0.92rem;
  color: var(--t-muted);
  background: var(--sticky-bg-head);
}

.stats-table thead th {
  position: sticky;
  top: var(--stats-sticky-head-top, 3.25rem);
  z-index: 3;
  background: var(--sticky-bg-head);
  color: var(--t-th);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 0 var(--t-border);
}

/* Audit / other modals: no page-toolbar offset for sticky head. */
.modal .stats-table thead th {
  top: 0;
}

.stats-table .stats-sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--t-row-bg);
  box-shadow: 2px 0 0 var(--t-border);
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-table thead th.stats-sticky-col {
  z-index: 4;
  background: var(--sticky-bg-head);
}

.stats-table tbody tr:hover > .stats-sticky-col {
  background: var(--t-row-hover);
}

.btn-icon-info {
  font-family: var(--font);
  font-weight: 700;
  font-style: italic;
  font-size: 1rem;
  color: var(--t-status-text);
}

.btn-icon-info:hover {
  background: var(--t-status-bg);
  border-color: rgba(31, 107, 74, 0.35);
}

body.modal-open {
  overflow: hidden;
}

.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--t-modal-overlay);
  backdrop-filter: blur(2px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(40rem, 100%);
  max-height: min(80vh, 40rem);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--t-border);
  background: var(--t-modal-bg);
  box-shadow: var(--shadow);
  color: var(--t-text);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--t-border);
}

.modal-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 400;
}

.modal-body {
  padding: 1rem 1.15rem 1.25rem;
  overflow: auto;
}

.modal-status {
  margin: 0.25rem 0;
  color: rgba(232, 242, 236, 0.65);
}

.modal-dialog-sm {
  width: min(28rem, 100%);
  max-height: none;
}

.modal-dialog-incoming {
  width: min(36rem, 100%);
  max-height: min(90vh, 44rem);
}

.modal-dialog-incoming .modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cell-edit-dup-panel.form-suggest-panel {
  margin: 0;
  max-height: min(50vh, 22rem);
  flex: 0 1 auto;
  min-height: 0;
}

.modal-dialog-plan {
  width: min(42rem, 100%);
  max-height: min(90vh, 44rem);
}

.plan-link-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.65rem 0.85rem;
  margin: 0 0 0.85rem;
}

.plan-link-filters .field {
  display: grid;
  gap: 0.3rem;
  margin: 0;
}

.plan-link-filters .field > span {
  font-size: 0.85rem;
  color: var(--t-muted, rgba(232, 242, 236, 0.7));
}

.plan-link-list {
  max-height: min(50vh, 22rem);
  overflow: auto;
  margin: 0 0 0.85rem;
  padding: 0;
  list-style: none;
}

.plan-link-cell {
  cursor: pointer;
}

.plan-link-btn {
  appearance: none;
  display: block;
  width: 100%;
  min-width: 7.5rem;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--t-input-text, #e8f2ec);
  background: rgba(8, 14, 12, 0.72);
  border: 1px solid rgba(78, 207, 142, 0.55);
  border-radius: 5px;
  padding: 0.28rem 0.35rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.plan-link-btn.is-empty {
  border-style: dashed;
  color: rgba(183, 224, 203, 0.88);
  font-style: italic;
}

.plan-link-btn:hover,
.plan-link-btn:focus {
  outline: none;
  border-style: solid;
  border-color: #4ecf8e;
  background: rgba(8, 14, 12, 0.92);
  box-shadow: 0 0 0 2px rgba(78, 207, 142, 0.28);
}

.row-form .plan-link-btn {
  box-sizing: border-box;
  min-height: 2rem;
  height: 2rem;
  max-width: 100%;
}

html[data-theme="light"] .plan-link-btn {
  background: #ffffff;
  border-color: rgba(26, 107, 72, 0.45);
  color: var(--t-input-text, #15241c);
}

html[data-theme="light"] .plan-link-btn.is-empty {
  color: rgba(26, 107, 72, 0.72);
}

html[data-theme="light"] .plan-link-btn:hover,
html[data-theme="light"] .plan-link-btn:focus {
  border-color: #1a6b48;
  background: #ffffff;
}

.form-grid .plan-link-btn {
  min-height: 2.4rem;
  height: auto;
  white-space: normal;
}

.cell-edit-form .cell-edit-field {
  display: grid;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.cell-edit-form .cell-edit-field > span {
  font-size: 0.9rem;
  color: var(--t-muted, rgba(232, 242, 236, 0.7));
}

.cell-edit-form .cell-input {
  width: 100%;
}

.cell-edit-form textarea.cell-edit-text,
.cell-edit-form textarea[data-cell-edit-text] {
  min-height: 4.5rem;
  max-height: 14rem;
  height: auto;
  resize: vertical;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.4;
  field-sizing: content;
}

.cell-edit-actions {
  justify-content: flex-end;
  margin-top: 0;
}

.modal-error {
  margin: 0 0 0.85rem;
  color: #e8a0a0;
  font-size: 0.92rem;
}

html[data-theme="light"] .modal-error {
  color: #9b2c2c;
}

table.data-table[data-can-edit="1"]:not([data-deleted-view="1"]) tbody tr.data-row td:not(.actions):not(.col-expand),
table.data-table[data-can-edit="1"]:not([data-deleted-view="1"]) tbody tr.row-related-child td:not(.actions):not(.col-expand) {
  cursor: pointer;
}

table.data-table[data-can-edit="1"]:not([data-deleted-view="1"]) tbody tr.data-row td:not(.actions):not(.col-expand):hover,
table.data-table[data-can-edit="1"]:not([data-deleted-view="1"]) tbody tr.row-related-child td:not(.actions):not(.col-expand):hover {
  background: color-mix(in srgb, #b7e0cb 14%, var(--t-row-bg));
}

html[data-theme="light"] table.data-table[data-can-edit="1"]:not([data-deleted-view="1"]) tbody tr.data-row td:not(.actions):not(.col-expand):hover,
html[data-theme="light"] table.data-table[data-can-edit="1"]:not([data-deleted-view="1"]) tbody tr.row-related-child td:not(.actions):not(.col-expand):hover {
  background: color-mix(in srgb, #1f6b4a 8%, var(--t-row-bg));
}


/* theme-toggle */
.theme-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--t-icon-border);
  background: var(--t-icon-bg);
  color: var(--t-text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.theme-toggle:hover {
  background: var(--t-btn-secondary-hover);
  transform: translateY(-1px);
}

.theme-toggle:active {
  transform: translateY(0);
}

.theme-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}

html[data-theme="dark"] .theme-toggle .icon-moon,
html[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

html[data-theme="light"] .data-table thead tr.row-filter th,
html[data-theme="light"] .data-table thead tr.row-filter td {
  background: rgba(31, 107, 74, 0.08);
  border-bottom-color: rgba(21, 36, 28, 0.1);
}

html[data-theme="light"] .data-table thead tr.row-filter .cell-input {
  background: rgba(255, 255, 255, 0.72);
}

html[data-theme="light"] .data-table thead tr.row-filter .cell-input:hover {
  border-color: rgba(21, 36, 28, 0.16);
}

html[data-theme="light"] .data-table thead tr.row-filter-chips th {
  background: rgba(255, 255, 255, 0.9);
  border-bottom-color: rgba(21, 36, 28, 0.08);
}

html[data-theme="light"] .data-table tbody tr.row-empty td,
html[data-theme="light"] .users-create-note,
html[data-theme="light"] .users-create-fields label,
html[data-theme="light"] .users-create label,
html[data-theme="light"] .users-perm-row label,
html[data-theme="light"] .muted,
html[data-theme="light"] .users-table td.muted,
html[data-theme="light"] .users-table .muted {
  color: var(--t-faint);
}

html[data-theme="light"] .filter-chip {
  background: rgba(31, 107, 74, 0.1);
  border-color: rgba(31, 107, 74, 0.22);
  color: var(--t-text);
}

html[data-theme="light"] .account-form .field input {
  background: var(--t-input-bg);
  border-color: var(--t-input-border);
  color: var(--t-input-text);
}

html[data-theme="light"] .account-form .field span {
  color: var(--t-faint);
}

html[data-theme="light"] .users-panel .table-wrap {
  border-color: var(--t-border-soft);
}

html[data-theme="light"] #submissions-table tbody tr.row-lazy-sentinel td {
  color: var(--t-faint);
  background: var(--sticky-bg-head);
}
