/* Theme tokens — dark default */
:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --bg0: #0f1419;
  --bg1: #161d25;
  --bg2: #1e2833;
  --bg-rail: rgba(10, 14, 18, 0.72);
  --bg-topbar: rgba(12, 17, 23, 0.92);
  --bg-panel: rgba(22, 29, 37, 0.88);
  --bg-elev: rgba(255, 255, 255, 0.03);
  --bg-input: rgba(255, 255, 255, 0.04);
  --bg-code: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.08);
  --text: #e8eef4;
  --muted: #8b9aab;
  --accent: #2dd4bf;
  --accent-2: #38bdf8;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --accent-ring: rgba(45, 212, 191, 0.15);
  --warn: #fbbf24;
  --danger: #fb7185;
  --ok: #34d399;
  --btn-primary-fg: #042f2e;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  --grad-a: rgba(45, 212, 191, 0.16);
  --grad-b: rgba(56, 189, 248, 0.12);
  --grad-base-top: #0c1117;
  --grad-base-bot: #121820;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Syne", "DM Sans", sans-serif;
  --radius: 14px;
  --rail-w: 220px;
  --topbar-h: 3.25rem;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg0: #f4f7fa;
  --bg1: #ffffff;
  --bg2: #e8eef4;
  --bg-rail: rgba(255, 255, 255, 0.92);
  --bg-topbar: rgba(255, 255, 255, 0.96);
  --bg-panel: rgba(255, 255, 255, 0.96);
  --bg-elev: rgba(15, 20, 25, 0.03);
  --bg-input: rgba(15, 20, 25, 0.04);
  --bg-code: rgba(15, 20, 25, 0.06);
  --line: rgba(15, 30, 45, 0.12);
  --text: #15202b;
  --muted: #5a6b7c;
  --accent: #0d9488;
  --accent-2: #0284c7;
  --accent-soft: rgba(13, 148, 136, 0.12);
  --accent-ring: rgba(13, 148, 136, 0.18);
  --warn: #b45309;
  --danger: #e11d48;
  --ok: #059669;
  --btn-primary-fg: #ffffff;
  --shadow: 0 20px 50px rgba(15, 30, 45, 0.12);
  --grad-a: rgba(13, 148, 136, 0.1);
  --grad-b: rgba(2, 132, 199, 0.08);
  --grad-base-top: #eef3f7;
  --grad-base-bot: #f4f7fa;
}

* { box-sizing: border-box; }
html {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  max-width: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--grad-a), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, var(--grad-b), transparent 50%),
    linear-gradient(180deg, var(--grad-base-top) 0%, var(--bg0) 40%, var(--grad-base-bot) 100%);
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-size: 0.92em;
  background: var(--bg-code);
  padding: 0.1em 0.35em;
  border-radius: 6px;
}

/* ——— Theme switch ——— */
.theme-switch {
  display: inline-flex;
  gap: 0.15rem;
  padding: 0.15rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-input);
  flex-shrink: 0;
}
.theme-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
}
.theme-switch button:hover { color: var(--text); background: var(--accent-soft); }
.theme-switch button.is-active {
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.35);
}
html[data-theme="light"] .theme-switch button.is-active {
  box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.4);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  margin-right: 0.35rem;
  flex-shrink: 0;
}
.lang-switch-label {
  display: inline-flex;
  margin: 0;
}
.lang-switch-select {
  appearance: none;
  -webkit-appearance: none;
  height: 2.05rem;
  min-width: 3.4rem;
  max-width: 5.5rem;
  padding: 0 1.35rem 0 0.45rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: var(--bg-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
  background-size: 0.65rem;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}
.lang-switch-select:hover,
.lang-switch-select:focus {
  border-color: var(--accent, #2dd4bf);
  outline: none;
}
.lang-switch-go {
  margin-left: 0.25rem;
  font-size: 0.72rem;
}
.rail-foot-switches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.lang-switch-rail {
  margin-right: 0;
}
.lang-switch-rail .lang-switch-select {
  min-width: 100%;
  max-width: none;
  width: 100%;
}

.auth-theme-bar {
  position: fixed;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ——— App shell ——— */
.app-shell {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  grid-template-rows: 1fr;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  display: none;
  align-items: center;
  gap: 0.55rem;
  height: var(--topbar-h);
  padding: 0 0.75rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-topbar);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.topbar::-webkit-scrollbar { display: none; }
.topbar-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.05rem;
  min-width: 0;
  text-decoration: none;
  line-height: 1.1;
}
.topbar-brand .brand-company {
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  max-width: 100%;
}
.topbar-brand .brand-by {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.topbar-brand .brand-platform {
  font-family: var(--display);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.topbar-brand .brand-logo {
  display: block;
  height: 1.55rem;
  width: auto;
  max-width: 7.5rem;
  object-fit: contain;
  object-position: left center;
}
.topbar-spacer { flex: 1; min-width: 0.25rem; }
.topbar-extra {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 0.35rem;
  flex-shrink: 0;
}
.rail-extra {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  margin-bottom: 0.35rem;
}
/* Module interrupting gate via EventBus core.layout.gate (blocked=true) */
body.is-layout-gate .topbar-menu {
  visibility: hidden;
}
/* No rail in DOM — collapse the reserved rail column so gate content is centered */
body.app-shell.is-layout-gate {
  grid-template-columns: 1fr;
}
.workspace-gate {
  margin-left: 0 !important;
  grid-column: 1 / -1;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.workspace-gate .main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: none;
}
.topbar-user {
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-logout-form,
.rail-logout-form { display: inline; margin: 0; }
button.topbar-logout,
button.rail-logout {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  color: inherit;
}
.topbar-logout {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}
.topbar-menu {
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topbar-menu-icon,
.topbar-menu-icon::before,
.topbar-menu-icon::after {
  display: block;
  width: 1rem;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  position: relative;
}
.topbar-menu-icon::before,
.topbar-menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
}
.topbar-menu-icon::before { top: -5px; }
.topbar-menu-icon::after { top: 5px; }

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 35;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
}
body.nav-open .nav-backdrop {
  display: block;
}

.rail {
  padding: 1.25rem 1rem 1rem;
  border-right: 1px solid var(--line);
  background: var(--bg-rail);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  z-index: 40;
}
.rail-brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
  text-decoration: none;
  line-height: 1.1;
}
.rail-brand .brand-company {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  max-width: 100%;
}
.rail-brand .brand-by {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.rail-brand .brand-platform {
  font-family: var(--display);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.rail-brand .brand-logo {
  display: block;
  height: 2rem;
  width: auto;
  max-width: 10.5rem;
  object-fit: contain;
  object-position: left center;
}
.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.5rem;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.rail-nav a {
  color: var(--muted);
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  text-decoration: none;
  display: block;
}
.rail-nav a:hover,
.rail-nav a.is-active {
  background: var(--accent-soft);
  color: var(--text);
}
.rail-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.rail-user {
  font-size: 0.9rem;
  line-height: 1.3;
  word-break: break-word;
}
.rail-logout { color: var(--muted); font-size: 0.85rem; }
.theme-switch-rail { align-self: flex-start; margin-bottom: 0.25rem; }

.rail-group { margin-bottom: 0.35rem; border-radius: 10px; }
.rail-group.is-open {
  background: var(--bg-input);
  border: 1px solid var(--line);
  padding: 0.15rem 0.15rem 0.25rem;
}
.rail-group-bar {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}
.rail-group-home {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 0.4rem 0.55rem 0.3rem;
  margin: 0;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
}
.rail-group-home:hover,
.rail-group-home.is-active {
  color: var(--text);
  background: var(--accent-soft);
}
.rail-group.is-open .rail-group-home {
  color: var(--text);
}
.rail-group-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0 0.15rem 0 0;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
  border-radius: 8px;
}
.rail-group-toggle.rail-group-toggle-full {
  flex: 1;
  width: auto;
  height: auto;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.4rem 0.55rem 0.3rem;
  margin: 0;
  text-align: left;
}
.rail-group-toggle:hover {
  color: var(--text);
  background: var(--accent-soft);
}
.rail-group.is-open .rail-group-toggle {
  color: var(--text);
}
.rail-group-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  line-height: 1.3;
}
.rail-group-chevron {
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.7;
  transition: transform 0.15s ease;
}
.rail-group.is-open .rail-group-chevron {
  transform: rotate(45deg);
}
.rail-group:not(.is-open) .rail-group-body {
  display: none;
}
.rail-group-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0 0.1rem 0.15rem;
}
.rail-group-body a {
  border-radius: 8px;
}
.rail-group-body a:hover,
.rail-group-body a.is-active {
  background: var(--accent-soft);
  color: var(--text);
}

.rail-expand-all {
  flex-shrink: 0;
  width: 100%;
  margin: 0.15rem 0 0;
  padding: 0.55rem 0.7rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-align: center;
}
.rail-expand-all:hover {
  color: var(--text);
  background: var(--accent-soft);
  border-style: solid;
}

.rail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem;
}
.rail-toggle,
.rail-expand,
.rail-close {
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}
.rail-close { display: none; font-size: 1.25rem; }
.rail-expand {
  position: fixed;
  left: 0.6rem;
  top: 0.75rem;
  z-index: 40;
}

/* Full-screen menu: all sections open, rail covers the viewport */
body.rail-mega {
  overflow: hidden;
}
body.rail-mega .rail {
  position: fixed;
  inset: 0;
  width: 100% !important;
  max-width: none;
  max-height: none;
  min-height: 100%;
  z-index: 70;
  border-right: 0;
  padding: 1.25rem 1.5rem 1.5rem;
  box-shadow: var(--shadow);
  transform: none !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  overflow: auto;
}
body.rail-mega .rail-nav {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr));
  gap: 0.75rem 1.25rem;
  align-content: start;
}
body.rail-mega .rail-group {
  margin-bottom: 0;
  background: var(--bg-input);
  border: 1px solid var(--line);
  padding: 0.15rem 0.15rem 0.35rem;
  border-radius: 10px;
}
body.rail-mega .rail-group .rail-group-body {
  display: flex;
}
body.rail-mega .rail-group-toggle:not(.rail-group-toggle-full) {
  display: none;
}
body.rail-mega .rail-group-toggle-full {
  pointer-events: none;
  cursor: default;
}
body.rail-mega .rail-group-chevron {
  display: none;
}
body.rail-mega .rail-group-home {
  pointer-events: auto;
}
body.rail-mega .rail-expand-all {
  display: none;
}
body.rail-mega .rail-toggle {
  display: none !important;
}
body.rail-mega .rail-close {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}
body.rail-mega .rail-foot {
  max-width: 28rem;
}

body.rail-collapsed {
  grid-template-columns: 0 1fr;
}
body.rail-collapsed .rail {
  width: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
body.rail-collapsed .workspace .main {
  padding-left: 3rem;
}

.main {
  padding: 1.75rem 2rem 3rem;
  max-width: 1400px;
  min-width: 0;
  flex: 1;
}
.main.main-flush {
  max-width: none;
  width: 100%;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}
body.rail-collapsed .workspace .main.main-flush {
  padding-left: 2.75rem;
}

/* ——— Content ——— */
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent);
  margin: 0 0 0.5rem;
  font-weight: 700;
}
.hero {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  animation: rise 0.55s ease both;
  position: relative;
  z-index: 5;
}
.hero-brand, .auth-brand, .page-head h1 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 0.95;
  margin: 0;
}
.auth-brand {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.auth-brand .brand-company {
  font: inherit;
  letter-spacing: inherit;
}
.auth-brand .brand-by {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  line-height: 1.2;
}
.auth-brand .brand-platform {
  font-family: var(--display);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.auth-brand .brand-logo {
  display: block;
  height: auto;
  width: auto;
  max-width: min(16rem, 100%);
  max-height: 4.5rem;
  object-fit: contain;
  object-position: left center;
}
.hero-instance, .auth-instance { color: var(--muted); margin: 0.35rem 0 0; }
.lede { color: var(--muted); max-width: 42rem; line-height: 1.5; }

.command { position: relative; max-width: 34rem; z-index: 30; }
.command input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font: inherit;
  outline: none;
}
.command input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.command-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0.35rem;
  position: absolute;
  left: 0; right: 0;
  top: 100%;
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: 12px;
  z-index: 40;
  box-shadow: var(--shadow);
  max-height: min(60vh, 22rem);
  overflow-y: auto;
}
.command-list[hidden] { display: none !important; }
.command-list li { margin: 0; }
.command-list li button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
  display: block;
}
.command-list li button:hover { background: var(--accent-soft); }

.widgets {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
  animation: rise 0.7s ease both;
  position: relative;
  z-index: 1;
}
.widgets-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: -0.25rem;
}
.widgets-customize {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.widgets-customize-icon {
  flex-shrink: 0;
  opacity: 0.85;
}
.widgets-empty {
  margin: 0;
}
/* Compact status cards share a row; never stretched beside tall feeds. */
.widgets-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 0.9rem;
  align-items: start;
}
/* Feed lists sit side-by-side when width allows, stack when narrow. */
.widgets-feeds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 0.9rem;
  align-items: start;
}
.widget {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  min-width: 0;
}
.widget-command {
  padding: 0.85rem 1rem;
  background: transparent;
  border-style: dashed;
}
.widget-command .command {
  max-width: none;
  z-index: 40;
}
.widget-command .widget-body { margin: 0; }
.widgets > .widget-lg { width: 100%; }
.widgets-cards .widget-md,
.widgets-feeds .widget-md,
.widgets-feeds .widget-lg,
.widgets-feeds .widget-feed {
  grid-column: auto;
}
.widget h2 { margin: 0 0 0.4rem; font-size: 1rem; }
.widget p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.widget-meta { margin: 0 0 0.55rem; font-size: 0.85rem; }
.widget-body { margin: 0; }
.widget-link { display: inline-block; margin-top: 0.75rem; font-weight: 600; }
.widget-link-narrow { display: none; }
@media (max-width: 768px) {
  .widget-link-wide { display: none; }
  .widget-link-narrow { display: inline-block; }
}
.widget-event.is-ongoing .widget-event-live {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.orders-quick-actions {
  display: grid;
  gap: 0.5rem;
}
.orders-quick-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  text-decoration: none;
  box-sizing: border-box;
}
.orders-quick-count {
  font-variant-numeric: tabular-nums;
}
.tone-ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.tone-warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); }

.widget-event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.widget-event a {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr) auto;
  gap: 0.5rem 0.75rem;
  align-items: baseline;
  padding: 0.35rem 0.45rem;
  border-radius: calc(var(--radius) - 2px);
  text-decoration: none;
  color: inherit;
}
.widget-event a:hover { background: var(--accent-soft); }
.widget-event-when { font-variant-numeric: tabular-nums; font-size: 0.9rem; color: var(--muted); }
.widget-event-label { font-weight: 560; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-event-op { font-size: 0.88rem; }
.widget-event.is-block .widget-event-label { font-weight: 500; }
@media (max-width: 640px) {
  .widget-event a {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

.dashboard-layout-list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
}
.dashboard-hint {
  margin: -0.35rem 0 0.75rem;
  font-size: 0.9rem;
}
.dashboard-rail-peek {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  cursor: pointer;
}
.dashboard-rail-peek input {
  margin-top: 0.2rem;
}
.dashboard-layout-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
  transition: box-shadow 0.15s ease, background 0.15s ease;
}
.dashboard-layout-item:last-child { border-bottom: 0; }
.dashboard-layout-item.is-dragging {
  opacity: 0.55;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--text) 12%, transparent);
}
.dashboard-layout-item.is-drag-over {
  background: var(--accent-soft);
}
.dashboard-drag-handle {
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.4;
  user-select: none;
  cursor: grab;
}
.dashboard-drag-handle:active { cursor: grabbing; }
.dashboard-layout-main {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
  flex: 1;
}
.dashboard-layout-check {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.dashboard-layout-title { font-weight: 600; }
.dashboard-layout-mod { font-size: 0.85rem; }
.dashboard-layout-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  padding-left: 1.55rem;
}
.dashboard-setting {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.dashboard-setting input[type="number"] {
  width: 4.5rem;
  padding: 0.3rem 0.45rem;
}

.widget-likes-head {
  display: flex;
  justify-content: flex-end;
  margin: -0.15rem 0 0.65rem;
}
.widget-likes-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.widget-likes-item {
  font-size: 0.95rem;
  line-height: 1.45;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
}
.widget-likes-item:last-child { border-bottom: 0; }
.widget-likes-item .user-badge {
  display: inline-block;
  margin: 0 0.15rem 0.1rem 0;
  padding: 0.05rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  vertical-align: baseline;
}
.widget-likes-status { margin: 0.65rem 0 0; }
.widget-likes.is-done .widget-likes-list,
.widget-likes.is-done .widget-likes-head { display: none; }

.widget-feed-head {
  display: flex;
  justify-content: flex-end;
  margin: -0.15rem 0 0.55rem;
}
.widget-feed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.85rem;
}
.widget .feed-list.compact { gap: 0.4rem; }
.widget .feed-item { padding: 0.55rem 0.65rem; }
.widget .feed-title { font-size: 0.92rem; }


.page-head { margin-bottom: 1.25rem; animation: rise 0.45s ease both; }
.page-head h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
.subhead { margin-top: 1.5rem; font-size: 1.05rem; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
.data { width: 100%; border-collapse: collapse; }
.data th, .data td {
  text-align: left;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 0.875rem;
  line-height: 1.3;
}
.data th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.data--compact th,
.data--compact td {
  padding: 0.22rem 0.35rem;
  font-size: 0.82rem;
  line-height: 1.3;
}
.data--compact th { font-size: 0.75rem; }
.data th.th-sort a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}
.data th.th-sort a:hover { color: var(--text); }
.data th.th-sort.is-active a { color: var(--text); }

.pager {
  width: 100%;
  box-sizing: border-box;
  margin: 0.75rem 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
.pager-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  width: 100%;
}
.pager-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.pager-nav-empty { display: none; }
.pager-aside {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-left: auto;
}
.pager-meta {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}
.pager-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0.3rem 0.6rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text) !important;
  text-decoration: none !important;
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}
a.pager-chip:hover {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}
.pager-chip.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--btn-primary-fg) !important;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
.pager-chip.is-disabled {
  opacity: 0.35;
  cursor: default;
}
.pager-chip.pager-arrow {
  font-size: 1.05rem;
  min-width: 2.4rem;
}
.pager-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.05em;
  user-select: none;
}
.pager-size {
  display: inline-flex;
  align-items: center;
  margin: 0;
}
.pager-size-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.pager-size-select {
  min-width: 5.5rem;
  max-width: 9rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
}
@media (max-width: 700px) {
  .pager { padding: 0.5rem 0.6rem; }
  .pager-aside { width: 100%; justify-content: space-between; margin-left: 0; }
  .pager-nav { width: 100%; }
}
.pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.pill.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill.off { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.muted { color: var(--muted); font-size: 0.85rem; }

/* Signed money (accrual + / write-off −) — oper show_account_moves parity */
.money-signed { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money-signed.money-in { color: var(--ok, #1a7a1a); }
.money-signed.money-out { color: var(--danger, #c0392b); }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1rem 0; }
.btn-primary, .btn-secondary {
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.15rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
}
.btn-primary { background: var(--accent); color: var(--btn-primary-fg); }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-primary:hover { filter: brightness(1.05); }

.status-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat {
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  background: var(--bg-elev);
}
.stat.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }

.flash { padding: 0.75rem 0.9rem; border-radius: 12px; margin: 0.75rem 0; }
.flash-ok {
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
}
.flash-warn {
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
  color: var(--text);
}

.report { list-style: none; padding: 0; margin: 0; }
.report li { padding: 0.35rem 0; color: var(--muted); border-bottom: 1px solid var(--line); }
.report li.ok { color: var(--ok); }
.report li.error { color: var(--danger); }
.report li.skip { color: var(--muted); }
.report li.pending { color: var(--warn); }

.modules-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  background: var(--panel, transparent);
}
.modules-filters label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.88rem;
}
.modules-filters input[type="search"],
.modules-filters select {
  min-width: 9rem;
}
.modules-filter-q {
  flex: 1 1 12rem;
}
.modules-filters-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.modules-count { margin: 0 0 0.85rem; }
.modules-catalog-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0 0.85rem;
}
.modules-catalog-hint { margin: 0 0 0.85rem; }
.modules-section--installable .modules-section-title { color: var(--accent, #0b6); }
.modules-section-lede { margin: -0.35rem 0 0.75rem; font-size: 0.92rem; }
.modules-card--installable {
  border-style: dashed;
  background: color-mix(in srgb, var(--bg, #fff) 92%, var(--accent, #0b6));
}
.modules-card .pill.avail {
  background: color-mix(in srgb, var(--accent, #0b6) 18%, transparent);
}
.modules-sections-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  margin: 0 0 1.25rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.modules-sections-nav a {
  text-decoration: none;
  white-space: nowrap;
}
.modules-sections-nav a:hover { text-decoration: underline; }
.modules-section {
  margin: 0 0 2rem;
  scroll-margin-top: 1rem;
}
.modules-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}
.modules-section-title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
}
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 1rem;
}
.modules-card {
  border: 1px solid var(--line);
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 100%;
}
.modules-card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}
.modules-card-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  align-items: flex-start;
}
.pill.maturity-alpha {
  background: color-mix(in srgb, var(--danger, #c0392b) 16%, transparent);
  color: var(--danger, #c0392b);
}
.pill.maturity-beta {
  background: color-mix(in srgb, var(--warn, #b78103) 18%, transparent);
  color: var(--warn, #b78103);
}
.pill.maturity-release {
  background: color-mix(in srgb, var(--ok, #1a7a1a) 16%, transparent);
  color: var(--ok, #1a7a1a);
}
.modules-risk-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}
.modules-risk {
  margin: 0.35rem 0 0;
  padding: 0.85rem 1rem;
  max-width: 36rem;
  font-size: 1rem;
  line-height: 1.45;
}
.modules-risk-static {
  margin: 0.75rem 0;
  max-width: 40rem;
}
.modules-risk-title {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
}
.modules-risk-body,
.modules-risk-agent {
  margin: 0.35rem 0 0;
}
.modules-risk-agent {
  font-size: 0.95rem;
  opacity: 0.95;
}
.modules-risk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
}
.modules-card-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
}
.modules-card-title a { text-decoration: none; }
.modules-card-title a:hover { text-decoration: underline; }
.modules-card-desc {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.4;
  flex: 1 1 auto;
}
.modules-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.modules-card .modules-actions {
  margin-top: auto;
}
.modules-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.modules-detail-head h1 { margin: 0 0 0.25rem; }
.modules-detail-actions { margin: 0.75rem 0; }
.modules-section { margin: 1.35rem 0; }
.modules-section h2 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.modules-section h3 { margin: 0.85rem 0 0.35rem; font-size: 0.95rem; }
.modules-summary p { white-space: pre-wrap; line-height: 1.45; }
.modules-provides {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.25rem;
}
.modules-shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.85rem;
}
.modules-shot {
  margin: 0;
  border: 1px solid var(--line);
  padding: 0.4rem;
}
.modules-shot img {
  display: block;
  width: 100%;
  height: auto;
}
.modules-shot figcaption {
  margin-top: 0.35rem;
  font-size: 0.85rem;
}
.modules-table .modules-actions {
  white-space: nowrap;
  min-width: 9rem;
}
.modules-actions .inline-form {
  display: inline-block;
  margin: 0.15rem 0.15rem 0.15rem 0;
}
.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  border-radius: 999px;
}
.btn-sm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.dep-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.25rem;
}
.dep-list li { font-size: 0.88rem; line-height: 1.35; }
.dep-ok { color: var(--ok); }
.dep-bad { color: var(--danger); }
.dep-constraint {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--muted);
}
.dep-summary { margin-top: 0.35rem; }
.ok-text { color: var(--ok); }
.bad-text { color: var(--danger); }
.modules-hint {
  margin-top: 0.45rem;
  font-size: 0.88rem;
  line-height: 1.35;
}
.btn-danger.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-stage { width: min(440px, 100%); animation: rise 0.5s ease both; }
.auth-panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.6rem 1.5rem 1.4rem;
  box-shadow: var(--shadow);
}
.auth-form { display: grid; gap: 0.85rem; margin-top: 1.1rem; }
.auth-form label { display: grid; gap: 0.35rem; color: var(--muted); font-size: 0.9rem; }
.auth-form input[type="text"],
.auth-form input[type="password"] {
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  font: inherit;
}
.auth-form .auth-remember {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  grid-template-columns: none;
}
.auth-form .auth-remember input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--accent, #2f6fed);
  cursor: pointer;
}
.auth-form .auth-remember span {
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}
.auth-pass {
  position: relative;
  display: block;
}
.auth-pass input {
  width: 100%;
  padding-right: 2.75rem;
  box-sizing: border-box;
}
.auth-pass-toggle {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  width: 2.1rem;
  height: 2.1rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}
.auth-pass-toggle:hover,
.auth-pass-toggle:focus-visible {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  outline: none;
}
.auth-pass-icon {
  width: 1.15rem;
  height: 1.15rem;
  background: currentColor;
  /* Feather Icons (MIT) — eye / eye-off — https://feathericons.com */
  /* eye */
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
}
.auth-pass-toggle[aria-pressed="true"] .auth-pass-icon {
  /* eye-off */
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94'/%3E%3Cpath d='M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19'/%3E%3Cpath d='M14.12 14.12a3 3 0 1 1-4.24-4.24'/%3E%3Cline x1='1' y1='1' x2='23' y2='23'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94'/%3E%3Cpath d='M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19'/%3E%3Cpath d='M14.12 14.12a3 3 0 1 1-4.24-4.24'/%3E%3Cline x1='1' y1='1' x2='23' y2='23'/%3E%3C/svg%3E") center / contain no-repeat;
}

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

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

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0 0 1rem;
}
.filters input, .filters select, .form-grid input {
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  font: inherit;
}
.filters select option { background: var(--bg1); color: var(--text); }
.filters input[type="search"] { min-width: 220px; flex: 1; }

.swatch {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 0.9rem;
}
.detail-grid > .widget {
  min-width: 0;
  overflow: hidden;
}
.user-menu-preview {
  margin-top: 0.9rem;
}
.user-menu-preview-group + .user-menu-preview-group {
  margin-top: 0.85rem;
}
.user-menu-preview-group-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
}
.user-menu-preview-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.user-menu-preview-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.55rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border, #ddd) 70%, transparent);
}
.user-menu-preview-item:last-child {
  border-bottom: 0;
}
.user-menu-preview-perms {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.user-menu-preview-perm {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: 0.25rem;
  background: color-mix(in srgb, var(--muted, #888) 14%, transparent);
  color: var(--muted, #666);
  font-size: 0.82em;
  white-space: nowrap;
}
.kv {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 0.35rem 0.75rem;
  margin: 0;
}
.kv dt { color: var(--muted); }
.kv dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.kv dd a {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.kv dd img.user-site-photo {
  display: block;
  max-width: 120px;
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: cover;
  border-radius: 6px;
}

.form-grid {
  display: grid;
  gap: 0.85rem;
  max-width: 32rem;
}
.form-grid label { display: grid; gap: 0.35rem; color: var(--muted); font-size: 0.9rem; }

.home-feed { margin-top: 1.75rem; animation: rise 0.75s ease both; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.section-head h2 { margin: 0; font-size: 1.15rem; }

.feed-list { display: grid; gap: 0.55rem; }
.feed-item {
  display: block;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  color: inherit;
  text-decoration: none;
}
.feed-item:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-decoration: none;
}
.feed-meta { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; margin-bottom: 0.3rem; }
.feed-title {
  display: inline-block;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.feed-title:hover { color: var(--accent-2); text-decoration: underline; }
.feed-short { font-size: 0.9rem; margin-top: 0.2rem; }
.feed-checklist {
  margin-top: 0.4rem;
  display: grid;
  gap: 0.15rem;
  width: 100%;
}
.feed-checklist .checklist-progress { height: 0.35rem; width: 100%; }
.feed-list.compact .feed-checklist { margin-top: 0.3rem; }
.feed-list.compact .feed-checklist .checklist-progress { height: 0.28rem; }
.feed-list.compact .feed-checklist .checklist-progress-label { font-size: 0.78rem; }
.checklist-add-empty {
  margin: 0.75rem 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.checklist-add-empty > summary.checklist-add-toggle {
  display: inline;
  font-size: 0.95rem;
}
.pill.tone-type {
  background: color-mix(in srgb, var(--accent-2) 16%, transparent);
  color: var(--accent-2);
}
.pill.status-pill {
  flex: 0 0 auto;
  width: auto;
  max-width: 8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.72rem;
  padding: 0.12rem 0.45rem;
  line-height: 1.2;
}
.prose .body-html { line-height: 1.55; color: var(--text); }

.page-head-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
}
.page-head-row > :first-child {
  flex: 1 1 12rem;
  min-width: 0;
}
.page-head-row > .page-actions {
  margin-left: auto;
  /* Grow/shrink so long action rows wrap instead of clipping past overflow-x:clip */
  flex: 1 1 16rem;
  min-width: 0;
  max-width: 100%;
  justify-content: flex-end;
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.page-actions > .to-top { margin-left: auto; }
.page-actions > .inline-form {
  display: inline-flex;
  max-width: 100%;
  margin: 0;
}
.page-actions > .btn,
.page-actions > .btn-primary,
.page-actions > .btn-secondary,
.page-actions > .btn-danger,
.page-actions > .btn-ghost,
.page-actions > .inline-form > .btn,
.page-actions > .inline-form > .btn-primary,
.page-actions > .inline-form > .btn-secondary,
.page-actions > .inline-form > .btn-danger,
.page-actions > .inline-form > .btn-ghost {
  max-width: 100%;
  white-space: normal;
  text-align: center;
  box-sizing: border-box;
}
.btn-danger {
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.form-wide { max-width: 44rem; }
.field-block { display: grid; gap: 0.35rem; }
.field-label { color: var(--muted); font-size: 0.9rem; }
.rte {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-input);
  overflow: hidden;
}
.rte-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.45rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}
.rte-btn, .rte-mode {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 0.28rem 0.5rem;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.2;
  cursor: pointer;
}
.rte-btn:hover, .rte-mode:hover { background: var(--accent-soft); }
.rte-btn:focus-visible, .rte-mode:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
}
.rte-sep {
  width: 1px;
  height: 1.1rem;
  background: var(--line);
  margin: 0 0.15rem;
}
.rte-spacer { flex: 1; min-width: 0.5rem; }
.rte-modes {
  display: inline-flex;
  gap: 0.15rem;
  padding: 0.1rem;
  border-radius: 9px;
  background: var(--bg-code);
}
.rte-mode { color: var(--muted); font-weight: 600; }
.rte-mode.is-active {
  color: var(--text);
  background: var(--bg1);
  border-color: var(--line);
}
.rte-visual {
  min-height: 14rem;
  max-height: 32rem;
  overflow: auto;
  padding: 0.85rem 1rem;
  color: var(--text);
  line-height: 1.5;
  outline: none;
}
.rte-visual:empty::before {
  content: 'Текст…';
  color: var(--muted);
}
.rte-visual:focus { box-shadow: inset 0 0 0 2px var(--accent-ring); }
.rte-visual p { margin: 0 0 0.65em; }
.rte-visual h2 { margin: 0.4em 0 0.5em; font-size: 1.2rem; }
.rte-visual blockquote {
  margin: 0.5em 0;
  padding: 0.35em 0.75em;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.rte-visual ul, .rte-visual ol { margin: 0.4em 0 0.6em 1.25em; }
.rte-visual a { color: var(--accent-2); }
.rte-source {
  display: block;
  width: 100%;
  min-height: 14rem;
  max-height: 32rem;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--bg-code) !important;
  color: var(--text);
  padding: 0.85rem 1rem !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.45;
  resize: vertical;
  outline: none;
}
.rte.is-source .rte-visual { display: none; }
.rte.is-source .rte-source { display: block !important; }
.rte:not(.is-source) .rte-source { display: none !important; }
.rte.is-source .rte-btn { opacity: 0.35; pointer-events: none; }
.form-grid textarea, .comment-form textarea, .comment-form select {
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  font: inherit;
  width: 100%;
}
.comment-form select option { background: var(--bg1); color: var(--text); }
.comment-form { display: grid; gap: 0.75rem; }
.comment-form label { display: grid; gap: 0.35rem; color: var(--muted); font-size: 0.9rem; }
.comment-list { display: grid; gap: 0.65rem; }
.comment {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  background: var(--bg-elev);
}
.comment.is-status { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.comment-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.35rem; }
.status-summary {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
}
.comment-body { line-height: 1.45; }
.danger-zone { margin-top: 1.5rem; }
.check {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem;
  color: var(--text) !important;
}

/* ——— Mobile: top bar + drawer ——— */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .topbar {
    display: flex;
    grid-column: 1;
    grid-row: 1;
    gap: 0.35rem;
    padding: 0 0.55rem;
  }
  .topbar-brand .brand-company { max-width: 6.5rem; }
  .topbar-brand .brand-logo { max-width: 5.5rem; height: 1.35rem; }
  .topbar-logout { font-size: 0.72rem; }

  /* Lock page scroll while the drawer is open so touch gestures
     go to the rail (Android Chrome otherwise scrolls the body). */
  body.nav-open {
    overflow: hidden;
    touch-action: none;
  }

  .rail {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(18rem, 86vw);
    /* Prefer dvh: 100vh on mobile Chrome includes the URL bar and
       clips the foot so nested .rail-nav never becomes scrollable. */
    height: 100%;
    height: 100dvh;
    max-height: 100%;
    max-height: 100dvh;
    min-height: 0;
    /* Scroll the transformed drawer itself — nested overflow-y on
       .rail-nav inside transform:translateX is flaky on Android Chrome. */
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: none;
    border-right: 1px solid var(--line);
    z-index: 40;
  }
  body.nav-open .rail {
    transform: translateX(0);
    box-shadow: var(--shadow);
  }
  .rail-nav {
    flex: 0 0 auto;
    overflow: visible;
    min-height: 0;
  }

  .rail-toggle,
  .rail-expand {
    display: none !important;
  }
  .rail-close { display: inline-flex; align-items: center; justify-content: center; }

  /* Lang/theme live in the sandwich drawer footer, not the top bar. */
  .topbar .lang-switch,
  .topbar .theme-switch { display: none !important; }

  .workspace {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
  }

  .main {
    padding: 1.1rem 1rem 2.5rem;
    max-width: none;
  }

  body.rail-collapsed {
    grid-template-columns: 1fr;
  }
  body.rail-collapsed .rail {
    /* collapse only applies on desktop; mobile uses drawer */
    width: min(18rem, 86vw);
    padding: 1.25rem 1rem 1rem;
    opacity: 1;
    pointer-events: auto;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    transform: translateX(-105%);
  }
  body.rail-collapsed.nav-open .rail {
    transform: translateX(0);
  }
  body.rail-collapsed .workspace .main {
    padding-left: 1rem;
  }

  .hero-brand, .auth-brand, .page-head h1 {
    font-size: clamp(1.85rem, 8vw, 2.6rem);
  }
  .filters input[type="search"] { min-width: 0; width: 100%; }
}

@media (min-width: 901px) {
  .topbar { display: none !important; }
  .nav-backdrop { display: none !important; }
  .rail-close { display: none !important; }
  body.rail-mega .rail-close {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
  body.nav-open .nav-backdrop { display: none !important; }
}

/* ——— User badges (colored acronyms) ——— */
.user-badge {
  display: inline-block;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
  text-decoration: none !important;
  line-height: 1.3;
  white-space: nowrap;
  vertical-align: middle;
}
.user-badge:hover { filter: brightness(1.08); text-decoration: none !important; }
.user-fullname-full { margin-left: 0.35rem; }
.badge-row { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.rail-user { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* ——— Type tabs (horizontal swipe) ——— */
.type-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  margin: 0 0 1rem;
  padding: 0.15rem 0 0.45rem;
  border-bottom: 1px solid var(--line);
}
.type-tab {
  flex: 0 0 auto;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none !important;
  white-space: nowrap;
}
.type-tab:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.type-tab.is-active {
  background: var(--accent-soft);
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}
.type-tab-count {
  margin-left: 0.3rem;
  font-size: 0.78rem;
  opacity: 0.75;
}

.breadcrumbs-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin: 0 0 1rem;
}
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin: 0;
  font-size: 0.95rem;
  flex: 1 1 auto;
  min-width: 0;
}
.bc-sep { color: var(--muted); }
.breadcrumbs .bc-current,
.breadcrumbs span[aria-current="page"] {
  font-weight: 700;
  color: var(--text);
}
.bc-return {
  flex: 0 0 auto;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.bc-return:hover {
  color: var(--accent);
  text-decoration: underline;
}

.folder-list {
  display: grid;
  gap: 0.4rem;
  margin: 0 0 1rem;
}
.folder-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.55rem 0.55rem 0.9rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  color: inherit;
}
.folder-row:hover { border-color: var(--accent); }
.folder-row.is-archive {
  border-style: dotted;
  opacity: 0.9;
}
.folder-row.is-hidden {
  opacity: 0.55;
  border-style: dotted;
  background: transparent;
}
.folder-row.is-hidden:hover {
  opacity: 0.75;
  border-color: var(--muted);
}
.folder-row.is-hidden .folder-name,
.folder-row.is-hidden .folder-icon {
  color: var(--muted);
  font-weight: 500;
}
.folder-open {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none !important;
}
.folder-edit {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  padding: 0.15rem 0.35rem;
  font-size: 0.95rem;
  line-height: 1.2;
  color: var(--muted);
  text-decoration: none !important;
  border-radius: 6px;
}
.folder-edit:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.folder-icon { color: var(--accent); font-weight: 700; }
.folder-name { font-weight: 600; flex: 1; min-width: 0; }
.folder-archive-badge {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: lowercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 2.5rem;
  height: 1.4rem;
  flex: 0 0 auto;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--line);
  transition: background 0.15s ease;
}
.switch-slider::before {
  content: '';
  position: absolute;
  width: 1.05rem;
  height: 1.05rem;
  left: 0.18rem;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 0.15s ease;
}
.switch input:checked + .switch-slider {
  background: var(--accent);
}
.switch input:checked + .switch-slider::before {
  transform: translate(1.05rem, -50%);
}
.switch input:focus-visible + .switch-slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
table.data tr.is-disabled td {
  opacity: 0.55;
}
table.data tr.is-disabled td a {
  color: var(--muted);
}

.section-title {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 1.25rem 0 0.65rem;
}

.feed-resp { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; }
.feed-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  align-items: center;
  margin-top: 0.4rem;
  font-size: 0.82rem;
}
.feed-foot-item {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}
.feed-foot-label {
  font-weight: 560;
  white-space: nowrap;
}
.feed-meta-inline { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }

.ticket-panel { margin-bottom: 1rem; }
.ticket-panel h2 { margin: 0 0 0.65rem; font-size: 1rem; }
.ticket-controls {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}
.ticket-lock-note { margin: 0; }
.ticket-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: end;
}
.ticket-field {
  display: grid;
  gap: 0.2rem;
  margin: 0;
  min-width: 0;
  flex: 0 1 auto;
}
.ticket-field-label {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.2;
}
.ticket-select,
.ticket-field select,
.ticket-field input[type="date"] {
  width: auto;
  max-width: 14rem;
  min-width: 8rem;
  font-size: 0.9rem;
  padding: 0.35rem 0.5rem;
}
.ticket-field input[type="date"] {
  max-width: 11rem;
  min-width: 9rem;
}
.ticket-resp-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
}
.ticket-resp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  min-height: 1.5rem;
}
.ticket-resp-chip { display: inline-flex; }
.ticket-resp-empty { font-size: 0.9rem; }
.ticket-resp-dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  max-width: min(28rem, calc(100vw - 2rem));
  width: 100%;
  background: var(--bg-elev, #fff);
  color: inherit;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.ticket-resp-dialog::backdrop {
  background: rgba(0, 0, 0, 0.28);
}
.ticket-resp-dialog-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--line);
}
.ticket-resp-checks {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem 0.85rem 1rem;
  max-height: min(50vh, 22rem);
  overflow: auto;
}
.ticket-resp-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.2rem 0;
}
.offer-fields-wrap {
  margin: 0.5rem 0 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}
.offer-fields-toggle {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
  user-select: none;
}
.offer-fields-toggle::-webkit-details-marker { display: none; }
.offer-fields-toggle::before {
  content: '▸';
  font-size: 0.75rem;
  line-height: 1;
}
.offer-fields-wrap[open] > .offer-fields-toggle::before {
  content: '▾';
}
.offer-fields-wrap[open] > .offer-fields-toggle {
  color: inherit;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.offer-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  gap: 0.65rem;
  margin: 0;
  max-width: 28rem;
}
.offer-fields label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}
.offer-fields input {
  font-size: 0.9rem;
  padding: 0.35rem 0.5rem;
}

.contract-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--line);
  width: 100%;
  flex-basis: 100%;
}
.comment-meta .contract-status,
.comment-meta .contract-curator {
  font-size: 0.86rem;
}
.contract-curator {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}
.contract-status {
  font-weight: 700;
  max-width: none;
}
.contract-status.is-ok {
  background: color-mix(in srgb, var(--ok, #1a7a1a) 18%, transparent);
  color: var(--ok, #1a7a1a);
}
.contract-status.is-warn {
  background: color-mix(in srgb, var(--warn, #b78103) 18%, transparent);
  color: var(--warn, #b78103);
}
.contract-extend-link {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--link, #2563eb);
  text-decoration: underline;
  cursor: pointer;
}
.contract-status.is-bad {
  background: color-mix(in srgb, var(--danger, #c0392b) 16%, transparent);
  color: var(--danger, #c0392b);
}
.contract-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.contract-actions .btn-primary,
.contract-actions .btn-secondary,
.contract-actions .btn-danger {
  padding: 0.35rem 0.75rem;
  font-size: 0.86rem;
  font-weight: 600;
}
.contract-warn { color: var(--danger); font-size: 0.85rem; }
.contract-list { display: grid; gap: 0.65rem; }
.contract-row-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.25rem;
}
.contract-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.9rem;
}

.comment {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  background: var(--bg-elev);
  margin-left: calc(var(--depth, 0) * 1.1rem);
}
.comment.is-status { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.comment.is-hidden {
  opacity: 0.38;
  filter: grayscale(0.35);
  border-style: dashed;
  background: transparent;
}
.comment.is-hidden .comment-body,
.comment.is-hidden .comment-meta {
  color: var(--muted);
}
.comment-children { display: grid; gap: 0.55rem; margin-top: 0.55rem; }
.comment-list { display: grid; gap: 0.65rem; }
.comment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  align-items: center;
  margin-top: 0.45rem;
}
.comment-actions .btn-ghost {
  min-width: 1.7rem;
  padding: 0.15rem 0.35rem;
  line-height: 1.2;
  font-size: 0.95rem;
}
.comment-body.tone-green { color: var(--ok); font-weight: 600; }
.comment-body.tone-red { color: var(--danger); font-weight: 600; }
.comment-edit-dialog {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  max-width: min(640px, 96vw);
  width: 100%;
  background: var(--bg1);
  color: var(--text);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}
.comment-edit-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}
.comment-edit-dialog-form {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 1.1rem 1.1rem;
}
.comment-edit-dialog-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.comment-edit-dialog textarea {
  width: 100%;
  min-height: 12rem;
  resize: vertical;
  font: inherit;
  line-height: 1.45;
}
.comment-edit-extra .offer-fields {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 560px) {
  .comment-edit-extra .offer-fields { grid-template-columns: 1fr; }
}
.news-checklist { display: grid; gap: 0.65rem; }
.checklist-progress {
  height: 0.45rem;
  background: color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 999px;
  overflow: hidden;
}
.checklist-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.2s ease;
}
.checklist-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.checklist-item.is-done span { text-decoration: line-through; color: var(--muted); }
.checklist-progress-label {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.checklist-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin: 0.15rem 0 0.25rem;
}
.checklist-add-wrap {
  margin-top: 0.5rem;
}
.checklist-add-toggle {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: var(--muted);
  user-select: none;
}
.checklist-add-toggle::-webkit-details-marker { display: none; }
.checklist-add-toggle::before {
  content: '▸';
  font-size: 0.75rem;
}
.checklist-add-wrap[open] > .checklist-add-toggle::before { content: '▾'; }
.checklist-add-wrap[open] > .checklist-add-toggle {
  color: inherit;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.checklist-add {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.35rem;
}
.checklist-add textarea {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  font: inherit;
}
.checklist-add-hint {
  margin: 0;
  font-size: 0.85rem;
}
.inline-form { display: inline; margin: 0; }
.news-versions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.news-versions-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  font-size: 0.92rem;
}
.news-versions-list li.is-current strong { color: var(--text); }
.news-version-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}
.news-version-restore { margin-left: 0.25rem; }
.btn-ghost {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
}
.btn-ghost:hover { color: var(--text); background: var(--accent-soft); }
.body-html { line-height: 1.55; overflow-wrap: anywhere; }
.body-html img { max-width: 100%; height: auto; }

.resp-pick {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  margin: 0;
  background: var(--bg-elev);
}
.resp-pick legend {
  padding: 0 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.resp-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 0.35rem 0.75rem;
  max-height: 14rem;
  overflow: auto;
}
.resp-checks .check {
  margin: 0;
  font-size: 0.88rem;
}
.viewers { margin-top: 1rem; }
.viewers h2 { margin: 0 0 0.55rem; font-size: 1rem; }
.comment-body a { color: var(--accent-2); }
.comment-body b, .comment-body strong { font-weight: 700; }

/* Notices bar (legacy notices chips) */
.notices-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  padding: 0.55rem 2rem 0.15rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg1) 80%, transparent);
}
.notice-chip {
  font-weight: 700;
  font-size: 0.82rem;
  text-decoration: none !important;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  white-space: nowrap;
}
.notice-chip.tone-info { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 12%, transparent); }
.notice-chip.tone-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.notice-chip.tone-danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.notice-chip:hover { filter: brightness(1.08); }

.app-footer {
  margin-top: auto;
  padding: 0.75rem 2rem 1.25rem;
  border-top: 1px solid var(--line);
}
.perm-setup-warn {
  max-width: 1100px;
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  border-radius: 6px;
}
.perm-setup-warn a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.schema-setup-gate {
  width: 100%;
  max-width: 36rem;
  margin: 0 auto;
  padding: 1rem;
}
.schema-setup-gate .eyebrow {
  margin-bottom: 0.35rem;
}
.schema-setup-banner-inner {
  max-width: 1100px;
  margin: 0 auto 0.85rem;
  padding: 1rem 1.15rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  background: color-mix(in srgb, var(--warn) 10%, var(--bg-panel));
  box-shadow: 0 8px 28px color-mix(in srgb, var(--warn) 12%, transparent);
}
.schema-setup-banner-title {
  display: block;
  font-family: var(--display);
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  font-weight: 800;
  color: var(--warn);
  letter-spacing: -0.02em;
  margin: 0 0 0.45rem;
}
.schema-setup-banner-text {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--text);
}
.schema-setup-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
}
.schema-setup-banner-cli {
  margin: 0;
  font-size: 0.85rem;
}
@media (max-width: 900px) {
  .schema-setup-gate { padding: 0.5rem; }
  .schema-setup-banner-inner { padding: 0.85rem 0.9rem; }
}
.timing-panel {
  font-size: 0.82rem;
  color: var(--muted);
  max-width: 1100px;
}
.timing-panel summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.timing-panel summary::-webkit-details-marker { display: none; }
.timing-panel summary::before {
  content: "▸ ";
  color: var(--accent);
}
.timing-panel[open] summary::before { content: "▾ "; }
.timing-stages { margin-top: 0.55rem; }
.timing-stages ul { margin: 0.35rem 0; padding-left: 1.1rem; }
.timing-stages li { margin: 0.1rem 0; }
.timing-sum { margin-top: 0.35rem; }

/* Home multi-column feeds (desktop) */
.home-news-board {
  margin-top: 1.5rem;
}
.home-news-tabs {
  display: none;
  gap: 0.35rem;
  overflow-x: auto;
  margin-bottom: 0.75rem;
}
.home-news-tab {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}
.home-news-tab.is-active {
  background: var(--accent-soft);
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.home-news-cols {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
}
.home-news-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
  padding: 0.85rem 0.9rem 1rem;
  min-width: 0;
}
.home-news-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}
.home-news-card-head h2 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.home-news-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.85rem;
}
.home-news-card .feed-list { gap: 0.4rem; }
.home-news-card .feed-item { padding: 0.55rem 0.65rem; }
.home-news-card .feed-title { font-size: 0.92rem; }

@media (max-width: 1100px) and (min-width: 901px) {
  .home-news-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .notices-bar { padding: 0.5rem 1rem 0.1rem; }
  .app-footer { padding: 0.65rem 1rem 1rem; }
  .home-news-tabs { display: flex; }
  .home-news-cols {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 0.75rem;
  }
  .home-news-card {
    flex: 0 0 min(88vw, 22rem);
    scroll-snap-align: start;
  }
}

.hero-compact { margin-bottom: 1.1rem; }
.hero-compact .command { max-width: 40rem; }

.deadline-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  color: var(--ok);
  white-space: nowrap;
}
.deadline-chip.is-soon {
  background: color-mix(in srgb, var(--warn) 18%, transparent);
  color: var(--warn);
}
.deadline-chip.is-overdue {
  background: color-mix(in srgb, var(--danger) 18%, transparent);
  color: var(--danger);
}

.access-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  background: var(--bg-code);
  color: var(--muted);
  margin: 0.1rem 0.15rem 0.1rem 0;
}
.access-chip.is-group { color: var(--accent-2); }
.access-chip.is-group2 { color: var(--accent); }
.feed-access { margin-top: 0.35rem; font-size: 0.82rem; }
.feed-foot .access-chip,
.feed-foot .user-badge { font-size: 0.82rem; }
.access-line { margin: 0.5rem 0 0.85rem; font-size: 0.9rem; }

.news-meta-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.85rem;
  margin: 0.45rem 0 0.85rem;
  font-size: 0.86rem;
  font-weight: 400;
  line-height: 1.45;
}
.news-meta-item {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.35rem;
  min-width: 0;
}
.news-meta-label {
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.news-meta-label::after { content: ':'; }
.news-meta-strip .user-badge,
.news-meta-strip .access-chip,
.news-meta-strip .pill,
.news-meta-strip .status-pill {
  font-size: 0.78rem;
  vertical-align: middle;
  max-width: none;
}
.viewers-inline {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.6;
}
.viewers-inline .user-badge { margin: 0 0.15rem; }

#comment-form, #comments, #top {
  scroll-margin-top: 4.5rem;
}


.url-short {
  word-break: break-all;
  overflow-wrap: anywhere;
  font-size: 0.92em;
}
.body-html, .comment-body {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.body-html a, .comment-body a { overflow-wrap: anywhere; }

.jump-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.5rem 0;
}

/* User edit */
.user-edit-form { max-width: 48rem; }
.form-section-title {
  margin: 1.25rem 0 0.15rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  font-size: 1.05rem;
}
.user-edit-form .form-section-title:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}
.form-hint {
  margin: -0.35rem 0 0.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}
.input-row, .color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.input-row input { flex: 1; min-width: 10rem; }
.color-row input[type="color"] {
  width: 2.75rem;
  height: 2.5rem;
  padding: 0.15rem;
  border-radius: 10px;
  cursor: pointer;
}
.color-row input[type="text"],
.color-row input:not([type="color"]) {
  flex: 1;
  min-width: 8rem;
}
.check-fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 1rem 1rem;
  margin: 0;
  background: var(--bg-elev);
}
.check-fieldset legend {
  padding: 0 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}
details.check-fieldset {
  padding-top: 0.55rem;
}
details.check-fieldset > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
  user-select: none;
}
details.check-fieldset > summary::-webkit-details-marker { display: none; }
.perm-group-summary .perm-group-name {
  color: var(--text);
  font-weight: 600;
}
.perm-group-summary .perm-group-count {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}
.perm-role-pack {
  margin: 0.5rem 0 0.75rem;
}
label.check.perm-diff {
  outline: 1px dashed color-mix(in srgb, var(--accent, #2563eb) 55%, transparent);
  outline-offset: 2px;
  border-radius: 4px;
}
.perm-group-summary .perm-group-count.is-on {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  background: var(--accent-soft);
}
.perm-groups {
  display: grid;
  gap: 0.55rem;
}
.check-grid {
  display: grid;
  gap: 0.35rem 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(min(14rem, 100%), 1fr));
  margin-top: 0.35rem;
}
.check-grid-tall {
  max-height: 22rem;
  overflow: auto;
  padding-right: 0.25rem;
}
.perm-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
/* Sticky Save/Cancel on long admin forms (document scroll). */
form.form-grid .page-actions,
form.form-grid .form-actions,
form.form .form-actions,
.page-actions-sticky {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin-top: 1rem;
  padding: 0.75rem 0 max(0.35rem, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent 0%, var(--bg0) 28%);
  border-top: 1px solid var(--line);
}
dialog form .page-actions,
dialog form .form-actions,
.page-actions-static {
  position: static;
  z-index: auto;
  margin-top: 0;
  padding: 0;
  background: none;
  border-top: 0;
}
.form-grid select {
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  font: inherit;
}
.form-grid input[type="date"],
.form-grid input[type="datetime-local"],
.form-grid input[type="number"],
.form-grid input[type="url"] {
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  font: inherit;
}

/* Date / datetime quick tools (− УД + / УТ) */
.date-tools {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
}
.date-tools > input[type="date"],
.date-tools > input[type="datetime-local"] {
  flex: 1 1 auto;
  min-width: 0;
}
.date-tools-btns {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  flex: 0 0 auto;
}
.date-tools-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.85rem;
  height: 1.85rem;
  padding: 0 0.4rem;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}
.date-tools-btn:hover {
  background: var(--bg-input);
  border-color: var(--text-muted, var(--muted));
}
.date-tools-btn:focus-visible {
  outline: 2px solid var(--accent, #5b8def);
  outline-offset: 1px;
}
.filters .date-tools,
.form-grid label .date-tools {
  width: 100%;
}

/* Bulk selection / group actions */
.bulk-form { margin: 0; }
.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin: 0.5rem 0 0.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
}
.bulk-bar select {
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  font: inherit;
  min-width: 12rem;
}
.bulk-field-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.bulk-field-label select,
.bulk-field-label input {
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  font: inherit;
}
.bulk-check-col {
  width: 2.75rem;
  padding: 0.55rem 0.4rem !important;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
}
.bulk-check-hit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
}
.bulk-check-col input {
  margin: 0;
  cursor: pointer;
}
table.data tr.is-bulk-selected td {
  background: var(--accent-soft);
}
table.data tr.is-bulk-selected.is-disabled td {
  background: var(--accent-soft);
  opacity: 0.85;
}
.bulk-skip-list {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
}

.form-fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 1rem 1rem;
  margin: 0.5rem 0 1rem;
}
.form-fieldset legend {
  padding: 0 0.35rem;
  font-weight: 600;
}
.logo-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--bg-input);
  margin: 0.25rem 0 0.5rem;
}
.logo-preview img {
  display: block;
  max-width: 14rem;
  max-height: 4rem;
  width: auto;
  height: auto;
  object-fit: contain;
}
.logo-remove {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.logo-remove input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.form-grid input[type="file"] {
  padding: 0.45rem 0;
  border: 0;
  background: transparent;
}
.form-row-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* In-app navigation progress (MPA wait feedback) */
.nav-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
}
.nav-progress.is-active {
  /* Immediate opacity — CSS transition would not paint once navigation freezes the page */
  opacity: 1;
}
.nav-progress.is-done {
  opacity: 0;
  transition: opacity 0.25s ease 0.08s;
}
.nav-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.25s ease-out;
}
.nav-progress.is-done .nav-progress-bar {
  transition: width 0.12s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .nav-progress.is-done,
  .nav-progress-bar {
    transition: none;
  }
}

/* Database hub (/db) */
.db-table-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.35rem 1rem;
  margin: 0.75rem 0 1rem;
  max-height: 18rem;
  overflow: auto;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border, #ccc);
  border-radius: 4px;
}
.db-table-picker {
  margin: 0.75rem 0;
}
.db-table-picker > summary {
  cursor: pointer;
  font-weight: 600;
}
.db-fold > summary.subhead {
  cursor: pointer;
  list-style: none;
  display: list-item;
}
.db-fold > summary.subhead::-webkit-details-marker { display: none; }
.db-fold > summary.subhead::before {
  content: "▸ ";
  font-weight: 400;
  color: var(--muted, #666);
}
.db-fold[open] > summary.subhead::before { content: "▾ "; }
.db-fold-meta {
  margin-left: 0.5rem;
  font-weight: 400;
  font-size: 0.9em;
}
.db-help {
  display: inline;
  position: relative;
  margin-left: 0.35rem;
  font-weight: 400;
  vertical-align: middle;
}
.db-help > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 1px solid var(--border, #ccc);
  cursor: pointer;
  list-style: none;
  color: var(--muted, #666);
  font-size: 0.75rem;
  line-height: 1;
  vertical-align: middle;
}
.db-help > summary::-webkit-details-marker { display: none; }
.db-help-body {
  margin: 0.5rem 0 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border, #ccc);
  border-radius: 4px;
  background: var(--surface-2, #f7f7f7);
  font-weight: 400;
  font-size: 0.9rem;
}
.db-help-body p { margin: 0 0 0.4rem; }
.db-help-body p:last-child { margin-bottom: 0; }
h2.subhead .db-help,
.subhead .db-help { font-size: 1rem; }
.db-table-need {
  background: color-mix(in srgb, var(--warn, #c90) 12%, transparent);
  border-radius: 3px;
  padding: 0.1rem 0.25rem;
}
.db-diag-tag,
.db-diag-reason {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.85em;
  color: var(--warn, #a60);
}
.db-select-bar {
  margin: 0.5rem 0;
}
.db-diag-list {
  margin-bottom: 1rem;
}
.db-job-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}
.db-job-overlay[hidden] {
  display: none !important;
}
.db-job-panel {
  width: min(40rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 1.25rem 1.5rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #ccc);
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.db-job-msg {
  min-height: 2.5em;
  margin: 0.5rem 0 0.75rem;
  white-space: pre-wrap;
}
.db-job-log-wrap {
  margin: 0 0 1rem;
}
.db-job-log-label {
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}
.db-job-log {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.35;
  max-height: 14rem;
  overflow: auto;
  padding: 0.55rem 0.65rem;
  background: var(--bg-muted, #f6f7f8);
  border: 1px solid var(--border, #ddd);
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}
.db-job-log-line + .db-job-log-line {
  margin-top: 0.15rem;
}
.db-job-metric {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0.85rem 0 1rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
}
.db-job-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.db-job-bar-block {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.db-job-bar-label {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
}
.db-job-bar {
  height: 0.55rem;
  background: var(--border, #ddd);
  border-radius: 999px;
  overflow: hidden;
}
.db-job-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent, #2a6), var(--accent-2, #4a8));
  transition: width 0.25s linear;
}
.db-job-fill-table {
  background: linear-gradient(90deg, #3a7bd5, #5fa8ff);
}
.db-job-actions {
  margin-top: 0.25rem;
  justify-content: flex-end;
}
.db-job-actions [hidden] {
  display: none !important;
}
.db-fetch-form {
  margin: 0.75rem 0 1.25rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border, #ddd);
  border-bottom: 1px solid var(--border, #ddd);
}
.db-fetch-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.db-fetch-form input[type="url"] {
  width: 100%;
  max-width: 40rem;
}
body.db-job-busy {
  overflow: hidden;
}

.chip-gcal {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
  border: 1px solid var(--border, #ccc);
  border-radius: 0.25rem;
  color: var(--muted, #666);
  vertical-align: middle;
  white-space: nowrap;
}

.form-grid.form-wide {
  max-width: 40rem;
}
.gcal-redirect-code {
  display: block;
  margin-top: 0.25rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  word-break: break-all;
  background: var(--bg, #f6f6f6);
  border-radius: 0.35rem;
}
.gcal-queue,
.gcal-staff {
  margin-top: 1.5rem;
  max-width: 48rem;
}
.gcal-queue h2,
.gcal-staff h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}
.gcal-staff-list {
  display: grid;
  gap: 0.75rem;
}
.gcal-staff-card {
  padding: 0.85rem 1rem;
  border: 1px solid var(--line, #ddd);
  border-radius: 12px;
  background: var(--bg-elev, #fff);
}
.gcal-staff-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}
.gcal-staff-head strong {
  display: block;
}
.gcal-staff-cals {
  display: grid;
  gap: 0.65rem;
}
@media (min-width: 640px) {
  .gcal-staff-cals {
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
  }
}
.gcal-staff-cals label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.gcal-staff-cals select {
  width: 100%;
  min-width: 0;
}


