:root {
  color-scheme: light;
  --canvas: #f3f6f5;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --surface-strong: #edf2f0;
  --ink: #17252d;
  --ink-soft: #52636c;
  --muted: #75838a;
  --line: #dbe4e1;
  --line-strong: #c4d0cd;
  --brand: #176d62;
  --brand-strong: #0f584f;
  --brand-soft: #e3f1ee;
  --brand-pale: #f0f8f6;
  --sidebar: #142c36;
  --sidebar-deep: #0e222b;
  --sidebar-text: #f4f8f7;
  --sidebar-muted: #a8bbc0;
  --danger: #b33b3b;
  --danger-soft: #faeaea;
  --warning: #9a6115;
  --warning-soft: #fff3db;
  --success: #1a734e;
  --success-soft: #e5f4ec;
  --info: #326c96;
  --info-soft: #e8f2f9;
  --focus: #3c8fd5;
  --shadow-sm: 0 1px 2px rgb(24 43 51 / 6%), 0 4px 14px rgb(24 43 51 / 5%);
  --shadow-md: 0 16px 50px rgb(15 38 45 / 16%);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --sidebar-width: 264px;
  --topbar-height: 68px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.has-open-sidebar {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
summary,
label[for] {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: .58;
}

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

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 74%, transparent);
  outline-offset: 2px;
}

::selection {
  color: var(--ink);
  background: #bfe2db;
}

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

.skip-link {
  position: fixed;
  z-index: 2000;
  top: 10px;
  left: 12px;
  padding: 9px 13px;
  color: #fff;
  background: var(--brand-strong);
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
  transition: transform .15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-root {
  min-height: 100vh;
}

.boot-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--ink-soft);
}

.boot-screen > div:nth-child(2) {
  display: grid;
  gap: 1px;
}

.boot-screen strong {
  color: var(--ink);
  font-size: 18px;
}

.boot-screen span:not(.spinner) {
  font-size: 13px;
}

.startup-unavailable {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.startup-unavailable .state-card {
  width: min(520px, 100%);
}

.startup-retry-note {
  font-size: 13px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: var(--brand);
  border-radius: 12px;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -.04em;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 14%);
}

.spinner {
  width: 20px;
  height: 20px;
  display: inline-block;
  flex: 0 0 auto;
  border: 2px solid var(--line-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(420px, 1fr);
  background: var(--surface);
}

.login-panel {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: clamp(32px, 7vw, 88px);
}

.login-card {
  width: 100%;
  max-width: 390px;
  margin: auto;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 54px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 720;
}

.login-card h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1.14;
  letter-spacing: -.035em;
}

.login-intro {
  margin: 0 0 32px;
  color: var(--ink-soft);
  font-size: 15px;
}

.login-form {
  display: grid;
  gap: 18px;
}

.login-form .button {
  width: 100%;
  min-height: 46px;
  margin-top: 5px;
}

.login-note {
  display: flex;
  gap: 9px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.login-note .mini-icon {
  color: var(--success);
}

.login-art {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: clamp(40px, 6vw, 82px);
  color: #eaf4f2;
  background:
    radial-gradient(circle at 78% 18%, rgb(63 151 138 / 24%) 0, transparent 28%),
    radial-gradient(circle at 15% 83%, rgb(56 118 128 / 22%) 0, transparent 34%),
    linear-gradient(145deg, #173844 0%, #102832 58%, #0c222a 100%);
}

.login-art::before,
.login-art::after {
  content: "";
  position: absolute;
  border: 1px solid rgb(177 226 215 / 12%);
  border-radius: 50%;
}

.login-art::before {
  width: min(56vw, 730px);
  height: min(56vw, 730px);
  top: -24%;
  right: -21%;
}

.login-art::after {
  width: min(34vw, 450px);
  height: min(34vw, 450px);
  top: 7%;
  right: -1%;
}

.login-art-content {
  position: relative;
  z-index: 1;
  max-width: 650px;
}

.login-art-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 19px;
  color: #9ed2c8;
  font-size: 12px;
  font-weight: 730;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.login-art h2 {
  max-width: 580px;
  margin: 0 0 18px;
  color: #fff;
  font-size: clamp(30px, 4.4vw, 58px);
  line-height: 1.07;
  letter-spacing: -.045em;
}

.login-art p {
  max-width: 520px;
  margin: 0;
  color: #b8cace;
  font-size: clamp(15px, 1.6vw, 18px);
}

/* Shell */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  transition: grid-template-columns .2s ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar {
  position: fixed;
  z-index: 700;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--sidebar-text);
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-deep) 100%);
  transition: transform .2s ease;
}

.app-shell.sidebar-collapsed .sidebar {
  transform: translateX(-102%);
}

.sidebar-header {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
  padding: 0 62px 0 20px;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
}

.sidebar-header .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 18px;
  background: #238277;
}

.sidebar-brand-text {
  display: grid;
  line-height: 1.18;
}

.sidebar-brand-text strong {
  font-size: 15px;
}

.sidebar-brand-text span {
  color: var(--sidebar-muted);
  font-size: 10px;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.sidebar-scroll {
  min-height: 0;
  overflow-y: auto;
  padding: 18px 12px 26px;
  scrollbar-width: thin;
  scrollbar-color: rgb(255 255 255 / 18%) transparent;
}

.nav-group + .nav-group {
  margin-top: 22px;
}

.nav-label {
  margin: 0 10px 7px;
  color: #789098;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 11px;
  color: var(--sidebar-muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  text-align: left;
  text-decoration: none;
  transition: color .14s ease, background .14s ease;
}

.nav-link:hover {
  color: #fff;
  background: rgb(255 255 255 / 6%);
}

.nav-link[aria-current="page"] {
  color: #fff;
  background: rgb(46 142 128 / 28%);
  box-shadow: inset 3px 0 0 #5bb6a8;
}

.nav-icon {
  width: 19px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: currentColor;
  font-size: 16px;
  line-height: 1;
}

.shell-content {
  min-width: 0;
  grid-column: 2;
}

.topbar {
  position: sticky;
  z-index: 500;
  top: 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  background: rgb(255 255 255 / 94%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(13px);
}

.app-shell > .icon-button.menu-toggle {
  position: fixed;
  z-index: 760;
  top: calc((var(--topbar-height) - 38px) / 2);
  left: calc(var(--sidebar-width) - 52px);
  display: inline-flex;
  color: var(--sidebar-text);
  background: rgb(255 255 255 / 8%);
  border-color: rgb(255 255 255 / 16%);
  transition: left .2s ease, background .14s ease, border-color .14s ease, color .14s ease, transform .08s ease;
}

.app-shell > .icon-button.menu-toggle:hover:not(:disabled) {
  background: rgb(255 255 255 / 14%);
  border-color: rgb(255 255 255 / 25%);
}

.app-shell.sidebar-collapsed > .icon-button.menu-toggle {
  left: 16px;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}

.app-shell.sidebar-collapsed > .icon-button.menu-toggle:hover:not(:disabled) {
  background: var(--surface-strong);
  border-color: #aebdba;
}

.app-shell.sidebar-collapsed .topbar {
  padding-left: 72px;
}

.sidebar-toggle-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.sidebar-toggle-icon [data-icon-expand] {
  display: none;
}

.menu-toggle[aria-expanded="false"] .sidebar-toggle-icon [data-icon-collapse] {
  display: none;
}

.menu-toggle[aria-expanded="false"] .sidebar-toggle-icon [data-icon-expand] {
  display: block;
}

.topbar-heading {
  min-width: 0;
  display: grid;
  margin-right: auto;
  line-height: 1.25;
}

.topbar-heading span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 690;
  letter-spacing: .07em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar-heading strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.connection-state::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
}

.connection-state.is-offline::before {
  background: var(--danger);
}

.user-menu {
  position: relative;
}

.user-menu > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 7px 4px 5px;
  border-radius: 10px;
  list-style: none;
}

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

.user-menu > summary:hover {
  background: var(--surface-strong);
}

.avatar {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--brand-strong);
  background: var(--brand-soft);
  border: 1px solid #cbe2dd;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.user-summary-text {
  max-width: 160px;
  display: grid;
  line-height: 1.2;
}

.user-summary-text strong,
.user-summary-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-summary-text strong {
  font-size: 13px;
}

.user-summary-text span {
  color: var(--muted);
  font-size: 11px;
}

.dropdown-panel {
  position: absolute;
  z-index: 850;
  top: calc(100% + 7px);
  right: 0;
  width: 230px;
  padding: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.dropdown-user {
  padding: 9px 10px 11px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 5px;
}

.dropdown-user strong,
.dropdown-user span {
  display: block;
  overflow-wrap: anywhere;
}

.dropdown-user span {
  color: var(--muted);
  font-size: 12px;
}

.dropdown-action {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
}

.dropdown-action:hover {
  background: var(--surface-strong);
}

.dropdown-action.is-danger {
  color: var(--danger);
}

.page-main {
  min-height: calc(100vh - var(--topbar-height));
  padding: 26px 28px 38px;
}

.page-container {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
}

.page-heading {
  min-height: 50px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(22px, 2.5vw, 30px);
  line-height: 1.2;
  letter-spacing: -.03em;
}

.page-heading p {
  max-width: 700px;
  margin: 5px 0 0;
  color: var(--ink-soft);
}

.page-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.embedded-grid-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: 18px 0 12px;
}

.embedded-grid-heading h3,
.embedded-grid-heading p {
  margin: 0;
}

.embedded-grid-heading h3 {
  font-size: 19px;
}

.embedded-grid-heading p {
  margin-top: 4px;
  color: var(--ink-soft);
}

.context-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 2px 12px;
  color: var(--muted);
  font-size: 12px;
}

.context-breadcrumbs a {
  color: var(--brand-strong);
  text-decoration: none;
}

.context-breadcrumbs a:hover {
  text-decoration: underline;
}

.sidebar-scrim {
  position: fixed;
  z-index: 650;
  inset: 0;
  display: none;
  background: rgb(8 23 29 / 52%);
  backdrop-filter: blur(2px);
}

/* Buttons and forms */
.button,
.icon-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 1px 1px rgb(19 42 51 / 3%);
  transition: background .14s ease, border-color .14s ease, color .14s ease, transform .08s ease;
}

.button {
  padding: 0 13px;
}

.icon-button {
  width: 38px;
  padding: 0;
  flex: 0 0 auto;
  font-size: 16px;
}

.button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  background: var(--surface-strong);
  border-color: #aebdba;
}

.button:active:not(:disabled),
.icon-button:active:not(:disabled) {
  transform: translateY(1px);
}

.button.is-primary {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.button.is-primary:hover:not(:disabled) {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

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

.button.is-danger-outline {
  color: var(--danger);
  background: var(--surface);
  border-color: color-mix(in srgb, var(--danger) 48%, var(--line));
}

.button.is-danger-outline:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.button.is-danger-quiet,
.icon-button.is-danger-quiet {
  color: var(--danger);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.button.is-quiet,
.icon-button.is-quiet {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.button.is-small,
.icon-button.is-small {
  min-height: 32px;
}

.button.is-small {
  padding-inline: 10px;
  font-size: 12px;
}

.icon-button.is-small {
  width: 32px;
  font-size: 14px;
}

.button-icon {
  width: 15px;
  display: inline-grid;
  place-items: center;
  font-size: 15px;
}

.field {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.field-label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 680;
}

.required-mark {
  color: var(--danger);
}

.input,
.select,
.textarea {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  box-shadow: inset 0 1px 1px rgb(21 43 50 / 2%);
  transition: border-color .14s ease, box-shadow .14s ease;
}

.input,
.select {
  min-height: 40px;
  padding: 7px 10px;
}

.textarea {
  min-height: 88px;
  padding: 9px 10px;
  resize: vertical;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: #aebdba;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--focus);
  outline: 0;
  box-shadow: 0 0 0 3px rgb(60 143 213 / 14%);
}

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

.field-hint {
  color: var(--muted);
  font-size: 11px;
}

.field-error,
.form-error {
  color: var(--danger);
  font-size: 12px;
}

.form-error {
  padding: 10px 12px;
  background: var(--danger-soft);
  border: 1px solid #efc9c9;
  border-radius: 9px;
}

.password-input {
  position: relative;
}

.password-input .input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 40px;
  height: 36px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.checkbox,
.switch-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.checkbox input,
.switch-row input {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  accent-color: var(--brand);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

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

/* Dashboard */
.dashboard-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 18px;
  padding: clamp(22px, 3vw, 32px);
  color: #e8f3f1;
  background: linear-gradient(125deg, #173b45 0%, #155a55 100%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.dashboard-hero::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  top: -136px;
  right: -54px;
  border: 44px solid rgb(255 255 255 / 5%);
  border-radius: 50%;
}

.dashboard-hero-content {
  position: relative;
  z-index: 1;
}

.dashboard-hero h2 {
  margin: 0 0 6px;
  color: #fff;
  font-size: clamp(21px, 3vw, 29px);
  letter-spacing: -.03em;
}

.dashboard-hero p {
  max-width: 650px;
  margin: 0;
  color: #bcd1cf;
}

.dashboard-date {
  position: relative;
  z-index: 1;
  min-width: 150px;
  padding: 11px 14px;
  color: #d8e8e5;
  background: rgb(255 255 255 / 9%);
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 11px;
  text-align: center;
  white-space: nowrap;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.metric-card {
  min-height: 128px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  padding: 18px;
}

.metric-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.metric-icon {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 9px;
  font-size: 15px;
}

.metric-value {
  font-size: clamp(22px, 3vw, 31px);
  font-weight: 740;
  line-height: 1.15;
  letter-spacing: -.035em;
}

.metric-trend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.metric-trend.is-positive { color: var(--success); }
.metric-trend.is-negative { color: var(--danger); }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel-header {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 17px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 15px;
}

.panel-body {
  padding: 17px;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.quick-link {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
}

.quick-link:hover {
  color: var(--brand-strong);
  background: var(--brand-pale);
  border-color: #c7ded9;
}

.quick-link .nav-icon {
  width: 32px;
  height: 32px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 8px;
}

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

.simple-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

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

.simple-list-main {
  min-width: 0;
  display: grid;
}

.simple-list-main span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Grid */
.data-panel {
  overflow: visible;
}

.data-panel.is-embedded {
  box-shadow: none;
}

.grid-context {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  margin-bottom: 12px;
  padding: 11px 13px;
  color: var(--ink-soft);
  background: var(--brand-pale);
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line));
  border-radius: 11px;
}

.grid-context-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  color: var(--brand-strong);
  background: var(--surface);
  border-radius: 50%;
}

.grid-context-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.grid-context-copy span {
  color: var(--muted);
  font-size: 12px;
}

.grid-context-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.grid-toolbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
}

.search-box {
  position: relative;
  width: min(350px, 100%);
  margin-right: auto;
}

.search-box .input {
  padding-left: 37px;
  padding-right: 36px;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 32px;
  height: 32px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
}

.toolbar-separator {
  width: 1px;
  height: 27px;
  background: var(--line);
}

.grid-toolbar-select-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.grid-toolbar-select-filter .select {
  width: auto;
  min-width: 160px;
  max-width: 240px;
}

.filter-count {
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  color: #fff;
  background: var(--brand);
  border-radius: 10px;
  font-size: 10px;
}

.column-picker {
  position: relative;
}

.column-picker > summary {
  list-style: none;
}

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

.column-picker-panel {
  position: absolute;
  z-index: 200;
  top: calc(100% + 7px);
  right: 0;
  width: 270px;
  max-height: min(460px, 70vh);
  overflow: auto;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.column-picker-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 7px 9px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.column-option {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 7px;
  border-radius: 7px;
  justify-content: space-between;
}

.column-option:hover {
  background: var(--surface-strong);
}

.column-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.column-option > label,
.column-order-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.column-option > label {
  min-width: 0;
  flex: 1 1 auto;
}

.column-option > label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-picker-hint {
  margin: 5px 7px;
}

.active-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 9px 13px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.filter-chip {
  min-height: 29px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  font-size: 11px;
}

.filter-chip button {
  width: 19px;
  height: 19px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.filter-chip.is-locked {
  color: var(--brand-strong);
  background: var(--brand-pale);
  border-color: color-mix(in srgb, var(--brand) 25%, var(--line));
  font-weight: 650;
}

.locked-filter-value {
  color: var(--brand-strong);
  font-size: 11px;
  font-weight: 650;
}

.table-wrap {
  position: relative;
  width: 100%;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  min-width: 120px;
  max-width: 380px;
  padding: 11px 12px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  text-align: left;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  z-index: 3;
  top: 0;
  color: var(--ink-soft);
  background: #f8faf9;
  font-size: 11px;
  font-weight: 730;
  letter-spacing: .015em;
}

.data-table th[data-column-header] {
  padding-left: 27px;
}

.data-table th[data-column-resize-auto] {
  padding-left: 12px;
}

.column-resize-handle {
  position: absolute;
  z-index: 6;
  top: 0;
  right: -5px;
  width: 11px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}

.column-resize-handle::after {
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 5px;
  width: 1px;
  background: transparent;
  content: "";
  transition: background .12s ease;
}

.column-resize-handle:hover::after,
.column-resize-handle:focus-visible::after,
.data-table th.is-column-resizing .column-resize-handle::after {
  width: 2px;
  background: var(--brand);
}

.column-resize-handle:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.data-table th.is-column-resizing {
  overflow: visible;
  box-shadow: inset -2px 0 0 var(--brand);
}

.column-drag-handle {
  position: absolute;
  left: 7px;
  top: 50%;
  display: inline-grid;
  width: 16px;
  height: 24px;
  place-items: center;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
  transform: translateY(-50%);
  user-select: none;
}

.column-drag-handle:active {
  cursor: grabbing;
}

.column-drag-handle:focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.data-table th.is-column-dragging {
  opacity: .55;
}

.data-table th.is-column-drag-target {
  box-shadow: inset 3px 0 0 var(--brand);
}

.data-table tbody tr {
  background: var(--surface);
  transition: background .1s ease;
}

.data-table tbody tr:hover {
  background: #f8fbfa;
}

.data-table tbody tr.row-state-success {
  background: #edf8f1;
  box-shadow: inset 4px 0 0 var(--success);
}

.data-table tbody tr.row-state-warning {
  background: #fff8e6;
  box-shadow: inset 4px 0 0 var(--warning);
}

.data-table tbody tr.row-state-danger {
  background: #fff0f0;
  box-shadow: inset 4px 0 0 var(--danger);
}

.data-table tbody tr.row-state-neutral {
  background: #f5f7f7;
  box-shadow: inset 4px 0 0 var(--muted);
}

.data-table tbody tr.row-state-success:hover { background: #e4f4ea; }
.data-table tbody tr.row-state-warning:hover { background: #fff1cc; }
.data-table tbody tr.row-state-danger:hover { background: #ffe5e5; }
.data-table tbody tr.row-state-neutral:hover { background: #edf0f0; }

.data-table tbody tr.is-editing,
.data-table tbody tr.is-creating {
  background: var(--brand-pale);
}

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

.data-table .cell-actions,
.data-table .actions-header {
  position: sticky;
  z-index: 4;
  right: 0;
  min-width: 152px;
  width: 152px;
  max-width: 152px;
  padding-inline: 7px;
  overflow: visible;
  background: inherit;
  background-clip: padding-box;
  box-shadow: -1px 0 0 var(--line), -7px 0 10px rgb(31 52 60 / 5%);
  isolation: isolate;
}

.data-table .selection-cell,
.data-table .selection-header {
  position: sticky;
  z-index: 4;
  left: 0;
  min-width: 46px;
  width: 46px;
  max-width: 46px;
  padding-inline: 13px;
  background: inherit;
  box-shadow: 7px 0 10px rgb(31 52 60 / 4%);
}

.data-table .selection-header {
  z-index: 5;
  background: #f8faf9;
}

.selection-cell input,
.selection-header input {
  width: 17px;
  height: 17px;
  accent-color: var(--brand);
}

.bulk-grid-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.data-table .actions-header {
  z-index: 5;
  background: #f8faf9;
}

.data-table .cell-actions.has-text-actions,
.data-table .actions-header.has-text-actions {
  min-width: 250px;
  width: 250px;
  max-width: 300px;
}

.row-actions {
  width: max-content;
  min-width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 2px;
}

.icon-button.is-document-available {
  position: relative;
  color: var(--success);
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 42%, var(--line));
}

.icon-button.is-document-warning {
  color: var(--warning-strong, #7a4d00);
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 48%, var(--line));
}

.icon-button.is-document-available.has-document-warning {
  border-color: var(--warning);
  box-shadow: inset 0 -3px 0 var(--warning);
}

.document-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  padding-inline: 3px;
  color: #fff;
  background: var(--brand-strong);
  border: 2px solid var(--surface);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.row-actions.has-text-actions {
  gap: 5px;
}

.row-text-action {
  white-space: nowrap;
}

.cell-primary-link {
  color: var(--brand-strong);
  font-weight: 650;
  text-decoration: none;
}

.cell-primary-link:hover {
  text-decoration: underline;
}

.cell-primary-link:focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.cell-value.is-locked {
  color: var(--brand-strong);
  font-weight: 650;
}

.data-table tr.is-navigable {
  cursor: pointer;
}

.data-table tr.is-navigable:focus-visible {
  position: relative;
  z-index: 2;
  outline: 3px solid color-mix(in srgb, var(--focus) 72%, transparent);
  outline-offset: -3px;
}

.status-stack {
  display: grid;
  gap: 2px;
  white-space: normal;
}

.status-stack small {
  color: var(--muted);
  font-size: 10px;
}

.sort-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  text-align: left;
}

.sort-indicator {
  color: var(--brand);
  font-size: 11px;
}

.filters-row th {
  top: 39px;
  z-index: 2;
  padding-block: 7px;
  background: #f3f7f5;
}

.filters-row .input,
.filters-row .select {
  min-height: 32px;
  padding: 4px 7px;
  font-size: 11px;
}

.range-filter {
  display: flex;
  gap: 4px;
}

.range-filter .input {
  min-width: 112px;
}

.cell-input {
  min-width: 116px;
  min-height: 34px;
  padding: 5px 7px;
  font-size: 12px;
}

.lookup-input-state {
  min-width: 150px;
  display: grid;
  gap: 5px;
}

.cell-input.has-lookup-error {
  border-color: var(--warning);
  background: var(--warning-soft);
}

.lookup-inline-state {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  max-width: 300px;
  color: var(--warning);
  font-size: 11px;
  line-height: 1.35;
}

.lookup-inline-state[hidden] {
  display: none;
}

.lookup-inline-state .button {
  min-height: 25px;
  flex: 0 0 auto;
  padding-inline: 6px;
  font-size: 11px;
}

.cell-value.is-muted {
  color: var(--muted);
}

.cell-value.is-number {
  display: block;
  text-align: right;
}

.cell-value.is-identifier {
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: .035em;
}

.cell-error-row td {
  padding: 8px 12px;
  color: var(--danger);
  background: var(--danger-soft);
  border-bottom-color: #ecc5c5;
  font-size: 12px;
  white-space: normal;
}

.badge {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  color: var(--ink-soft);
  background: var(--surface-strong);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 640;
}

.badge.is-success { color: var(--success); background: var(--success-soft); }
.badge.is-danger { color: var(--danger); background: var(--danger-soft); }
.badge.is-warning { color: var(--warning); background: var(--warning-soft); }
.badge.is-info { color: var(--info); background: var(--info-soft); }

.grid-footer {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 13px;
  border-top: 1px solid var(--line);
}

.grid-summary {
  color: var(--muted);
  font-size: 12px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-number {
  min-width: 94px;
  color: var(--ink-soft);
  text-align: center;
  white-space: nowrap;
}

.page-size {
  min-height: 34px;
  width: auto;
  padding: 4px 28px 4px 8px;
  font-size: 12px;
}

.data-panel.density-compact .data-table th,
.data-panel.density-compact .data-table td {
  padding-block: 7px;
}

.data-panel.density-comfortable .data-table th,
.data-panel.density-comfortable .data-table td {
  padding-block: 15px;
}

.table-loading {
  min-height: 260px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.loading-stack {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.skeleton-row td {
  height: 48px;
}

.skeleton-line {
  width: min(150px, 82%);
  height: 10px;
  display: block;
  background: linear-gradient(90deg, #edf1f0 20%, #f8faf9 42%, #edf1f0 66%);
  background-size: 220% 100%;
  border-radius: 8px;
  animation: shimmer 1.25s linear infinite;
}

@keyframes shimmer {
  to { background-position-x: -220%; }
}

/* States */
.state-card {
  min-height: 310px;
  display: grid;
  place-items: center;
  padding: 32px;
  text-align: center;
}

.state-content {
  max-width: 450px;
  display: grid;
  justify-items: center;
  gap: 10px;
}

.state-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 15px;
  font-size: 23px;
}

.state-content h2,
.state-content h3,
.state-content p {
  margin: 0;
}

.state-content h2,
.state-content h3 {
  font-size: 18px;
}

.state-content p {
  color: var(--ink-soft);
}

.state-content.is-error .state-icon {
  color: var(--danger);
  background: var(--danger-soft);
}

/* Dialogs and drawers */
dialog {
  color: var(--ink);
}

.modal {
  width: min(520px, calc(100vw - 28px));
  max-height: calc(100vh - 36px);
  overflow: hidden;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.modal[open] > form {
  max-height: inherit;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.modal::backdrop,
.drawer-dialog::backdrop {
  background: rgb(8 23 29 / 54%);
  backdrop-filter: blur(2px);
}

.modal-header,
.drawer-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 17px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2,
.drawer-header h2 {
  margin: 0;
  font-size: 18px;
}

.modal-body,
.drawer-body {
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.modal-body p:first-child {
  margin-top: 0;
}

.modal-footer,
.drawer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 13px 17px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.documents-modal {
  width: min(780px, calc(100vw - 28px));
}

.documents-modal[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.documents-header > div,
.document-copy {
  min-width: 0;
}

.documents-header .field-hint {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.documents-body {
  display: grid;
  align-content: start;
  gap: 18px;
}

.document-upload {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.document-upload .form-error {
  flex: 0 0 100%;
}

.document-file-field {
  position: relative;
  min-width: 0;
  flex: 1 1 360px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  cursor: pointer;
}

.document-file-field:hover {
  border-color: var(--brand);
}

.document-file-field:focus-within {
  outline: 3px solid rgb(60 143 213 / 24%);
  outline-offset: 1px;
}

.document-file-field input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.document-file-icon,
.document-kind {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 9px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.document-file-copy,
.document-copy {
  display: grid;
  gap: 3px;
}

.document-file-copy small,
.document-copy small {
  color: var(--ink-soft);
  font-size: 12px;
}

.documents-list {
  min-width: 0;
}

.documents-list-heading,
.documents-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.documents-list-heading {
  padding: 0 2px 9px;
}

.document-items {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.document-item {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.document-item:hover {
  background: var(--surface-soft);
}

.document-item.is-document-missing {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 38%, var(--line));
}

.document-item.is-document-missing .document-kind {
  color: var(--danger);
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--danger) 38%, var(--line));
}

.document-missing-message {
  color: var(--danger) !important;
  font-weight: 650;
}

.document-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.document-legacy-warning {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  margin-bottom: 10px;
  padding: 12px;
  color: var(--ink);
  background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 38%, var(--line));
  border-radius: 11px;
}

.document-legacy-warning p {
  margin: 3px 0 5px;
  color: var(--ink-soft);
  font-size: 13px;
}

.document-legacy-warning small {
  color: var(--ink-soft);
}

.document-legacy-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--warning-strong, #7a4d00);
  background: rgb(255 255 255 / 65%);
  border-radius: 50%;
  font-weight: 800;
}

.document-item.skeleton-row .document-copy {
  gap: 8px;
}

.documents-pagination {
  justify-content: flex-end;
  padding-top: 12px;
}

.drawer-dialog {
  width: min(570px, 100vw);
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0 0 0 auto;
  overflow: hidden;
  padding: 0;
  background: var(--surface);
  border: 0;
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}

.drawer-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.drawer-dialog[open] > form {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.drawer-section + .drawer-section {
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.drawer-section h3 {
  margin: 0 0 13px;
  font-size: 14px;
}

.role-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.role-option {
  min-height: 52px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.role-option input {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  margin-top: 1px;
  accent-color: var(--brand);
}

.role-option span {
  display: grid;
}

.role-option small {
  color: var(--muted);
}

/* Administration and audit */
.admin-toolbar,
.audit-filters {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 13px;
  border-bottom: 1px solid var(--line);
}

.admin-toolbar .search-box {
  margin-right: auto;
}

.audit-filters .field {
  min-width: 150px;
  flex: 1 1 160px;
}

.audit-filters .field:first-child {
  flex-basis: 210px;
}

.role-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.audit-event {
  white-space: normal;
}

.audit-event summary {
  color: var(--brand);
  font-size: 12px;
}

.audit-json {
  max-width: min(700px, 75vw);
  max-height: 260px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  color: #dce9e7;
  background: #182a32;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
}

/* Daily workflows */
.workflow-control {
  margin-bottom: 18px;
}

.workflow-search {
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 16px;
}

.workflow-search .field {
  width: min(560px, 100%);
  flex: 1 1 320px;
}

.workflow-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.workflow-summary h2,
.workflow-summary p {
  margin: 0;
}

.workflow-summary h2 {
  margin-block: 2px;
  font-size: 20px;
}

.workflow-summary p {
  color: var(--ink-soft);
}

.workflow-metrics {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.contract-workspace-summary {
  align-items: flex-start;
}

.contract-workspace-summary.is-compact {
  margin-bottom: 10px;
  padding: 12px 14px;
}

.contract-workspace-summary.is-compact h2 {
  font-size: 18px;
}

.contract-workspace-main {
  min-width: 0;
  flex: 1 1 auto;
}

.contract-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  margin: 14px 0 0;
}

.contract-facts.is-compact {
  grid-template-columns: minmax(90px, .6fr) minmax(130px, .9fr) minmax(160px, 1.1fr) minmax(250px, 1.5fr);
  gap: 6px;
  margin-top: 9px;
}

.contract-facts.is-compact div {
  padding: 7px 9px;
}

.contract-facts .contract-period dd {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.contract-facts div {
  min-width: 0;
  padding: 9px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.contract-facts dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
}

.contract-facts dd {
  overflow: hidden;
  margin: 3px 0 0;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  margin-bottom: 14px;
  padding: 4px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 11px;
  scrollbar-width: thin;
}

.workspace-tab {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 0 auto;
  padding: 8px 15px;
  color: var(--ink-soft);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 680;
  text-decoration: none;
  white-space: nowrap;
}

.workspace-tab:hover {
  color: var(--ink);
  background: rgb(255 255 255 / 58%);
}

.workspace-tab.is-active {
  color: var(--brand-strong);
  background: var(--surface);
  box-shadow: 0 1px 4px rgb(23 47 55 / 10%);
}

.workspace-tab-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.workspace-color-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.workspace-color-legend .field-hint {
  margin-left: 3px;
}

.totals-comparison {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 620px), 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric-slice {
  min-width: 0;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric-slice > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}

.metric-slice > header h3 {
  margin: 0;
  font-size: 16px;
}

.metric-slice > header span {
  color: var(--muted);
  font-size: 11px;
}

.metric-slice .metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 8px;
  margin: 0;
}

.metric-slice .metric-card {
  min-width: 0;
  min-height: 104px;
  padding: 12px;
  box-shadow: none;
}

.metric-slice .metric-label > span:first-child,
.act-control-card dt {
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  text-wrap: balance;
}

.metric-slice .metric-label > span:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.metric-slice .metric-icon {
  flex: 0 0 30px;
}

.metric-slice .metric-value {
  font-size: clamp(16px, 1.8vw, 21px);
  white-space: nowrap;
}

.act-control-card dl {
  display: grid;
  gap: 4px;
  margin: 8px 0 0;
}

.act-control-card dl div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: baseline;
  gap: 8px;
}

.act-control-card dt {
  color: var(--ink-soft);
  font-size: 11px;
}

.act-control-card dd {
  margin: 0;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.act-control-card .is-danger dt,
.act-control-card .is-danger dd {
  color: var(--danger);
}

.act-control-card .is-warning dt,
.act-control-card .is-warning dd {
  color: var(--warning);
}

.act-control-card .is-success dd {
  color: var(--success);
}

.bank-payment-summary {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px;
}

.bank-payment-summary > header,
.bank-payment-summary.is-warning {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.bank-payment-summary.is-warning {
  border-color: color-mix(in srgb, var(--warning) 42%, var(--line));
  background: var(--warning-soft);
}

.bank-payment-summary h3 {
  margin: 2px 0 3px;
  font-size: 17px;
}

.bank-payment-summary p {
  margin: 0;
  color: var(--ink-soft);
}

.bank-payment-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
}

.bank-payment-metrics > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.bank-payment-metrics span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
}

.bank-payment-metrics strong {
  overflow: hidden;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-payment-statuses {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bank-payment-summary .bank-payment-note {
  color: var(--muted);
  font-size: 11px;
}

.bank-payment-badge {
  width: fit-content;
  white-space: normal;
}

.reconciliation-panel {
  overflow: visible;
}

.reconciliation-panel .audit-filters {
  gap: 8px;
  padding: 9px 11px;
}

.reconciliation-panel .audit-filters .field {
  gap: 3px;
}

.reconciliation-panel .audit-filters .field-label {
  font-size: 11px;
}

.reconciliation-panel .audit-filters .input,
.reconciliation-panel .audit-filters .select,
.reconciliation-panel .audit-filters .button {
  min-height: 34px;
}

.reconciliation-table-wrap {
  max-height: min(64vh, 760px);
  border-block: 1px solid var(--line);
  scrollbar-gutter: stable;
}

.reconciliation-ledger {
  min-width: 1025px;
  table-layout: fixed;
}

.reconciliation-ledger th,
.reconciliation-ledger td {
  height: 38px;
  padding: 6px 9px;
  border-right: 1px solid var(--line);
  line-height: 1.25;
}

.reconciliation-ledger tr > :last-child {
  border-right: 0;
}

.reconciliation-ledger .reconciliation-col-date {
  min-width: 120px;
  width: 120px;
  max-width: 120px;
  white-space: nowrap;
}

.reconciliation-ledger .reconciliation-col-document {
  min-width: 210px;
  width: 210px;
  max-width: 210px;
}

.reconciliation-ledger .reconciliation-col-money {
  min-width: 145px;
  width: 145px;
  max-width: 145px;
  text-align: right;
  white-space: nowrap;
}

.reconciliation-ledger .reconciliation-col-status {
  min-width: 260px;
  width: 260px;
  max-width: 260px;
}

.reconciliation-ledger tbody tr.row-state-success {
  background: #f3f8f4;
}

.reconciliation-ledger tbody tr.row-state-warning {
  background: #fff9e9;
}

.reconciliation-ledger tbody tr.row-state-danger {
  background: #fff3f3;
}

.reconciliation-ledger tbody tr:hover,
.reconciliation-ledger tbody tr.row-state-success:hover,
.reconciliation-ledger tbody tr.row-state-warning:hover,
.reconciliation-ledger tbody tr.row-state-danger:hover {
  background: #eaf3f0;
}

.reconciliation-ledger .status-stack {
  display: grid;
  align-items: start;
  justify-items: start;
  gap: 2px;
}

.reconciliation-ledger .status-stack small {
  width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reconciliation-ledger .reconciliation-status-badge {
  min-height: 20px;
  padding: 2px 7px;
  font-size: 10px;
}

.reconciliation-totals-row th,
.reconciliation-totals-row td {
  position: sticky;
  z-index: 2;
  bottom: 0;
  background: #f1f6f4;
  border-top: 2px solid var(--line-strong);
  border-bottom: 0;
  font-weight: 760;
}

.reconciliation-totals-row th {
  color: var(--ink);
}

.bank-operations-panel {
  overflow: visible;
}

.bank-data-panel {
  overflow: visible;
  padding: 14px;
}

.bank-data-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.bank-data-filters .field {
  min-width: 0;
}

.bank-data-filters .field.is-wide {
  grid-column: span 2;
}

.bank-data-filter-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.bank-data-table {
  min-width: 1120px;
}

.bank-data-table .bank-purpose {
  min-width: 260px;
  max-width: 440px;
}

.bank-relink-dialog {
  width: min(760px, calc(100vw - 28px));
}

.bank-contract-resolution-state {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.bank-contract-resolution-state .spinner {
  width: 18px;
  height: 18px;
}

.bank-import-dialog.is-wide {
  width: min(1520px, calc(100vw - 16px));
  max-height: calc(100dvh - 12px);
}

.bank-import-dialog.is-compact {
  width: min(560px, calc(100vw - 28px));
}

.bank-import-dialog.bank-create-contract-dialog {
  width: min(980px, calc(100vw - 20px));
}

.bank-import-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.bank-import-dialog > form {
  height: 100%;
  min-height: 0;
}

#bank-import-upload-dialog .modal-header {
  min-height: 48px;
  padding: 7px 12px;
}

#bank-import-upload-dialog .modal-header h2 {
  font-size: 16px;
}

#bank-import-upload-dialog .modal-body {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 7px;
  overflow: hidden;
  padding: 9px 11px;
}

#bank-import-upload-dialog .modal-footer {
  min-height: 48px;
  padding: 7px 12px;
}

#bank-import-upload-dialog [data-bank-import-preview] {
  min-height: 0;
  overflow: hidden;
}

.bank-import-actions {
  justify-content: flex-end;
}

.bank-import-upload-fields,
.bank-period-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  align-items: end;
}

.bank-import-upload-fields .field.is-wide,
.bank-period-fields .field.is-wide {
  grid-column: span 2;
}

.bank-import-upload-fields {
  grid-template-columns: minmax(310px, 1.65fr) minmax(190px, .75fr) minmax(220px, .85fr);
  gap: 7px;
}

.bank-import-upload-fields .field.is-wide {
  grid-column: auto;
}

.bank-import-upload-fields .field-hint {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-import-preview-panel,
.bank-history-section,
.bank-period-impact {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.bank-import-preview-panel {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 7px;
  margin-top: 0;
  overflow: hidden;
}

.bank-import-preview-footer {
  min-height: 30px;
  padding: 3px 2px 0;
}

.bank-import-preview-head {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(430px, .9fr) minmax(660px, 1.35fr);
  gap: 7px;
}

.bank-history-section + .bank-history-section {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.bank-history-footer .pagination {
  align-items: center;
}

.bank-history-page-size {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.bank-history-page-size .select {
  width: auto;
  min-width: 64px;
  min-height: 30px;
  padding-block: 3px;
}

.bank-history-section h3,
.bank-period-impact h3 {
  margin: 0;
  font-size: 17px;
}

.bank-import-metadata {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.bank-import-metadata > div {
  min-width: 0;
  display: grid;
  gap: 1px;
  padding: 5px 7px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.bank-import-metadata span,
.bank-import-summary-card span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.bank-import-metadata strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-import-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 5px;
}

.bank-import-preview-head .bank-import-summary {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.bank-import-summary-card {
  display: grid;
  gap: 1px;
  padding: 5px 7px;
  background: var(--brand-pale);
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
  border-radius: 9px;
}

.bank-import-summary-card strong {
  font-size: 14px;
}

.bank-import-preview-toolbar {
  display: grid;
  grid-template-columns: minmax(170px, .42fr) minmax(300px, 1.58fr) auto;
  gap: 7px;
  align-items: end;
}

.bank-import-preview-toolbar > .button {
  min-height: 34px;
  white-space: nowrap;
}

.bank-import-preview-table {
  min-height: 0;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
}

.bank-import-preview-table table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 12px;
}

.bank-import-preview-table .data-table th,
.bank-import-preview-table .data-table td {
  min-width: 0;
  max-width: none;
  padding: 5px 6px;
}

.bank-import-preview-table .data-table th {
  position: sticky;
  font-size: 10px;
}

.bank-import-preview-table .column-resize-handle {
  right: -4px;
}

.bank-import-preview-table .data-table .cell-actions,
.bank-import-preview-table .data-table .actions-header {
  width: 104px;
  min-width: 104px;
  max-width: 104px;
  padding-inline: 4px;
}

.bank-import-preview-table .cell-actions {
  gap: 3px;
}

.bank-import-preview-table .bank-purpose,
.bank-import-preview-table .bank-contract-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-import-preview-table .cell-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-import-preview-table tbody tr.is-invalid {
  background: var(--danger-soft);
}

.bank-import-preview-table tbody tr.is-duplicate {
  background: var(--surface-soft);
  color: var(--ink-soft);
}

.bank-import-preview-table tbody tr.is-review,
.bank-import-preview-table tbody tr.is-unlinked {
  background: var(--warning-soft);
}

.bank-import-preview-table tbody tr.is-auto {
  background: var(--success-soft);
}

.bank-import-preview-table tbody tr.is-excluded {
  color: var(--muted);
  background: var(--surface-soft);
  opacity: .72;
}

.bank-import-preview-table tbody tr.is-excluded td {
  text-decoration-color: color-mix(in srgb, var(--muted) 55%, transparent);
}

.bank-partner-picker,
.bank-client-contract-picker,
.bank-create-section {
  display: grid;
  gap: 9px;
}

.bank-partner-picker .callout,
.bank-client-contract-picker .callout {
  display: grid;
  gap: 2px;
  margin-bottom: 0;
}

.bank-client-contract-search {
  margin: 0;
}

.bank-client-contract-search .input {
  min-height: 34px;
}

.bank-create-existing-contract-action {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 10px;
  padding-top: 2px;
}

.bank-client-contract-list {
  max-height: min(390px, 48dvh);
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  overflow: auto;
  border: 0;
}

.bank-client-contract-option {
  min-width: 0;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 3px 8px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}

.bank-client-contract-option:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.bank-client-contract-option:has(input:focus-visible) {
  outline: 3px solid color-mix(in srgb, var(--brand) 24%, transparent);
  outline-offset: 1px;
}

.bank-client-contract-option:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-pale);
}

.bank-client-contract-option.is-active {
  border-inline-start: 4px solid var(--success);
  padding-inline-start: 7px;
}

.bank-client-contract-option > input {
  grid-row: 1 / span 3;
  align-self: center;
  margin: 0;
}

.bank-client-contract-main {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
}

.bank-client-contract-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-client-contract-detail {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-create-section + .bank-create-section {
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.bank-create-section h3 {
  margin: 0;
  font-size: 15px;
}

.bank-create-section-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.bank-same-inn-rows {
  min-height: 54px;
}

.bank-same-inn-table {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.bank-same-inn-table .data-table {
  min-width: 720px;
  font-size: 11px;
}

.bank-same-inn-table .data-table th,
.bank-same-inn-table .data-table td {
  min-width: 0;
  padding: 6px 7px;
}

.bank-same-inn-table .data-table th:first-child,
.bank-same-inn-table .data-table td:first-child {
  width: 38px;
}

.bank-same-inn-table tr.is-disabled {
  color: var(--muted);
  background: var(--surface-soft);
}

.cell-subtitle {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.callout {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.callout.is-warning {
  color: color-mix(in srgb, var(--warning) 72%, var(--ink));
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 42%, var(--line));
}

.callout.is-danger {
  color: color-mix(in srgb, var(--danger) 78%, var(--ink));
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 42%, var(--line));
}

@media (max-width: 780px) {
  .bank-import-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .bank-import-upload-fields .field.is-wide,
  .bank-period-fields .field.is-wide {
    grid-column: auto;
  }

  .bank-import-preview-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1120px) {
  #bank-import-upload-dialog .modal-body {
    overflow: auto;
  }

  #bank-import-upload-dialog [data-bank-import-preview],
  .bank-import-preview-panel {
    overflow: visible;
  }

  .bank-import-upload-fields,
  .bank-import-preview-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .bank-import-preview-table {
    max-height: 58vh;
  }
}

#quick-add-dialog {
  width: min(900px, calc(100vw - 28px));
}

.batch-preview {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.batch-preview-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.batch-preview-summary > div {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  background: var(--brand-pale);
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
  border-radius: 9px;
}

.batch-preview-summary strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-preview-table {
  max-height: 290px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.batch-preview-table .data-table {
  min-width: 520px;
}

.batch-preview-empty {
  padding: 18px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  text-align: center;
}

.batch-preview-more {
  margin: 0;
}

.workflow-form {
  display: grid;
  gap: 15px;
}

.workflow-section {
  overflow: visible;
}

.workflow-section .panel-header h2 {
  display: flex;
  align-items: center;
  gap: 9px;
}

.step-number {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  color: var(--brand-strong);
  background: var(--brand-soft);
  border-radius: 8px;
  font-size: 12px;
}

.segmented {
  width: fit-content;
  display: inline-flex;
  gap: 3px;
  margin-bottom: 17px;
  padding: 3px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  color: var(--ink-soft);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 650;
}

.segmented input:checked + span {
  color: var(--brand-strong);
  background: var(--surface);
  box-shadow: 0 1px 4px rgb(23 47 55 / 10%);
}

.segmented input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--focus) 74%, transparent);
  outline-offset: 2px;
}

.document-schedules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.schedule-card {
  min-width: 0;
  margin: 0;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.schedule-card legend {
  padding: 0 4px;
  font-weight: 700;
}

.schedule-card .form-grid {
  padding-top: 7px;
}

.schedule-card .is-disabled {
  opacity: .55;
}

.workflow-submit {
  position: sticky;
  z-index: 20;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding: 12px 14px;
  background: rgb(255 255 255 / 95%);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
}

.workflow-submit .field-hint {
  max-width: 680px;
  margin-right: auto;
}

.workflow-result {
  margin-top: 18px;
  scroll-margin-top: calc(var(--topbar-height) + 18px);
}

.result-steps {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.result-steps li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  background: var(--surface-soft);
  border-radius: 9px;
}

.result-steps li > span:first-child {
  width: 23px;
  height: 23px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 760;
}

.result-steps .is-ok > span:first-child {
  color: var(--success);
  background: var(--success-soft);
}

.result-steps .is-error > span:first-child {
  color: var(--danger);
  background: var(--danger-soft);
}

.bank-target {
  display: flex;
  align-items: end;
  gap: 14px;
  padding: 13px 15px;
  background: var(--brand-pale);
  border-bottom: 1px solid #cfe2de;
}

.bank-target .field {
  width: min(520px, 100%);
}

.inline-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  color: var(--info);
  background: var(--info-soft);
  border-bottom: 1px solid #c8deed;
  font-size: 12px;
}

.inline-banner > span:first-child {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  background: #d3e6f2;
  border-radius: 6px;
  font-weight: 750;
}

.inline-banner.is-success {
  color: var(--success);
  background: var(--success-soft);
  border-bottom-color: #c8e3d4;
}

/* Toasts */
.toast-region {
  position: fixed;
  z-index: 1800;
  right: 18px;
  bottom: 18px;
  width: min(390px, calc(100vw - 28px));
  display: grid;
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 12px 12px 12px 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--info);
  border-radius: 11px;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: toast-in .2s ease-out both;
}

.toast.is-success { border-left-color: var(--success); }
.toast.is-error { border-left-color: var(--danger); }
.toast.is-warning { border-left-color: var(--warning); }

.toast-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--info);
  background: var(--info-soft);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 750;
}

.toast.is-success .toast-icon { color: var(--success); background: var(--success-soft); }
.toast.is-error .toast-icon { color: var(--danger); background: var(--danger-soft); }
.toast.is-warning .toast-icon { color: var(--warning); background: var(--warning-soft); }

.toast-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.toast-copy strong {
  font-size: 12px;
}

.toast-copy span {
  color: var(--ink-soft);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.toast-close {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

/* Management reporting */
.reporting-loading,
.reporting-empty,
.reporting-detail-loading {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--ink-soft);
}

.reporting-loading {
  min-height: 260px;
}

.reporting-loading > div {
  display: grid;
  gap: 2px;
}

.reporting-loading span:not(.spinner),
.reporting-panel-toolbar span {
  color: var(--muted);
  font-size: 11px;
}

.reporting-controls {
  display: grid;
  gap: 13px;
  margin-bottom: 14px;
  padding: 14px;
}

.reporting-filter-grid {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(110px, 160px) minmax(360px, auto);
  align-items: end;
  gap: 10px;
}

.reporting-presets,
.reporting-tree-actions,
.reporting-detail-footer > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.reporting-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.reporting-meta div {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  background: var(--surface-soft);
  border-radius: 8px;
}

.reporting-meta dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 680;
  text-transform: uppercase;
}

.reporting-meta dd {
  overflow: hidden;
  margin: 0;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reporting-warnings {
  display: grid;
  grid-template-columns: minmax(180px, .7fr) minmax(280px, 1.8fr);
  gap: 16px;
  margin-bottom: 14px;
  padding: 14px 16px;
  background: #fffbf2;
  border-color: color-mix(in srgb, var(--warning) 30%, var(--line));
}

.reporting-warnings h2,
.reporting-warnings p,
.reporting-warnings ul {
  margin: 0;
}

.reporting-warnings h2 {
  font-size: 15px;
}

.reporting-warnings p,
.reporting-warnings small {
  color: var(--muted);
  font-size: 11px;
}

.reporting-warnings ul {
  display: grid;
  gap: 6px;
  padding: 0;
  list-style: none;
}

.reporting-warnings li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.reporting-warnings li > span {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  color: var(--warning);
  background: var(--warning-soft);
  border-radius: 7px;
  font-weight: 800;
}

.reporting-warnings li > div {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.reporting-panel {
  position: relative;
  overflow: hidden;
}

.reporting-panel-toolbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.reporting-panel-toolbar > div:first-child {
  display: grid;
  gap: 2px;
}

.reporting-progress {
  position: absolute;
  z-index: 20;
  top: 68px;
  right: 14px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  color: var(--ink-soft);
  background: rgb(255 255 255 / 94%);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
  font-size: 11px;
}

.reporting-progress .spinner {
  width: 15px;
  height: 15px;
}

.reporting-table-scroll {
  max-height: calc(100vh - 255px);
  min-height: 330px;
}

.reporting-table {
  min-width: 1990px;
  width: max-content;
}

.reporting-table th,
.reporting-table td {
  min-width: 128px;
  width: 128px;
  max-width: 180px;
  padding: 9px 10px;
  text-align: right;
}

.reporting-table thead th {
  height: 78px;
  padding: 8px 11px;
  text-align: center;
  vertical-align: top;
  white-space: normal;
}

.reporting-table thead th > span {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 11px;
}

.reporting-table .reporting-line-column {
  position: sticky;
  z-index: 5;
  left: 0;
  min-width: 260px;
  width: 260px;
  max-width: 380px;
  text-align: left;
  background: inherit;
  box-shadow: 1px 0 0 var(--line), 7px 0 10px rgb(31 52 60 / 4%);
}

.reporting-table thead .reporting-line-column {
  z-index: 8;
  background: #f8faf9;
}

.reporting-table .reporting-annual-column {
  position: sticky;
  z-index: 5;
  right: 0;
  min-width: 150px;
  width: 150px;
  max-width: 210px;
  background: inherit;
  box-shadow: -1px 0 0 var(--line), -7px 0 10px rgb(31 52 60 / 5%);
}

.reporting-table thead .reporting-annual-column {
  z-index: 8;
  background: #edf3f1;
}

.reporting-table thead .reporting-annual-column small {
  color: var(--brand-strong);
}

.reporting-mode-select {
  width: 100%;
  min-height: 28px;
  padding: 3px 6px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  font-size: 10px;
  font-weight: 700;
}

.reporting-mode-select.is-fact {
  color: var(--success);
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 35%, var(--line));
}

.reporting-mode-select.is-plan {
  color: var(--info);
  background: var(--info-soft);
  border-color: color-mix(in srgb, var(--info) 30%, var(--line));
}

.reporting-month-status {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
}

.reporting-month-status.is-partial { color: var(--warning); }
.reporting-month-status.is-missing { color: var(--danger); }

.reporting-kpi-row {
  background: #eef4f2;
}

.reporting-kpi-row.is-profit {
  background: #e6f2ee;
}

.reporting-kpi-row.is-accumulated {
  background: #e9f0f5;
}

.reporting-kpi-row th,
.reporting-kpi-row td {
  border-bottom-color: var(--line-strong);
  font-weight: 750;
}

.reporting-kpi-row th {
  display: table-cell;
}

.reporting-kpi-row th strong,
.reporting-kpi-row th small {
  display: block;
}

.reporting-kpi-row th small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  white-space: normal;
}

.reporting-line-row.is-group {
  font-weight: 740;
}

.reporting-line-row.is-group.is-income {
  background: #e8f4ea;
}

.reporting-line-row.is-group.is-expense {
  background: #fff1df;
}

.reporting-line-row.is-detail.is-income:hover {
  background: #f3faf5;
}

.reporting-line-row.is-detail.is-expense:hover {
  background: #fff9f1;
}

.reporting-line-label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.reporting-line-label.level-1 { padding-left: 15px; }
.reporting-line-label.level-2 { padding-left: 31px; }
.reporting-line-label.level-3 { padding-left: 47px; }
.reporting-line-label.level-4 { padding-left: 63px; }
.reporting-line-label.level-5 { padding-left: 79px; }

.reporting-line-label > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reporting-tree-toggle,
.reporting-tree-spacer {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.reporting-tree-toggle {
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: var(--brand-strong);
  background: rgb(255 255 255 / 64%);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-weight: 800;
  line-height: 1;
}

.reporting-value-button,
.reporting-value-static {
  position: relative;
  min-width: 0;
  display: grid;
  justify-items: end;
  gap: 1px;
}

.reporting-value-button {
  width: 100%;
  padding: 3px 4px;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: right;
}

.reporting-value-button:hover {
  color: var(--brand-strong);
  background: rgb(23 109 98 / 8%);
}

.reporting-cell-value {
  max-width: 100%;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reporting-value-button small,
.reporting-value-static small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.reporting-cell-value.is-negative,
.reporting-detail-table .numeric.is-negative {
  color: var(--danger);
}

.reporting-completeness {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 14px;
  height: 14px;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface-strong);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
}

.reporting-completeness.is-partial { color: var(--warning); background: var(--warning-soft); }
.reporting-completeness.is-missing { color: var(--danger); background: var(--danger-soft); }

.reporting-detail-dialog {
  width: min(1180px, calc(100vw - 28px));
  max-height: min(820px, calc(100vh - 28px));
}

.reporting-detail-dialog .modal-header > div {
  min-width: 0;
}

.reporting-detail-dialog .modal-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.reporting-detail-body {
  min-height: 260px;
  overflow: auto;
}

.reporting-detail-table {
  min-width: 960px;
}

.reporting-detail-table td small {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

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

.reporting-detail-footer {
  justify-content: space-between;
}

/* Dense reporting workspace */
.reporting-view {
  display: grid;
  gap: 9px;
}

.reporting-upper-region {
  display: grid;
  gap: 8px;
}

.reporting-heading {
  min-height: 0;
  align-items: center;
  margin: 0 3px;
}

.reporting-heading h1 {
  font-size: clamp(21px, 2vw, 27px);
}

.reporting-heading p {
  margin-top: 2px;
  font-size: 12px;
}

.reporting-heading .button,
.reporting-controls .button {
  min-height: 32px;
}

.reporting-controls {
  gap: 7px;
  margin-bottom: 0;
  padding: 9px 11px;
}

.reporting-controls.is-dirty {
  border-color: color-mix(in srgb, var(--brand) 42%, var(--line));
}

.reporting-controls .field {
  gap: 3px;
}

.reporting-controls .field-label {
  font-size: 10px;
}

.reporting-controls .select {
  min-height: 34px;
  padding-block: 5px;
}

.reporting-filter-grid {
  grid-template-columns: minmax(210px, 1fr) minmax(100px, 150px) minmax(330px, auto);
  gap: 8px;
}

.reporting-meta {
  gap: 5px;
  padding-top: 7px;
}

.reporting-meta div {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 5px;
  padding: 5px 8px;
}

.reporting-meta dt {
  font-size: 8px;
}

.reporting-meta dd {
  font-size: 11px;
  text-align: right;
}

.reporting-dirty-status {
  width: fit-content;
  color: var(--muted);
  font-size: 10px;
}

.reporting-dirty-status.is-dirty {
  color: var(--warning);
  font-weight: 700;
}

.reporting-warnings {
  grid-template-columns: minmax(155px, .55fr) minmax(260px, 2fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  padding: 8px 11px;
}

.reporting-warnings h2 {
  font-size: 13px;
}

.reporting-warnings p,
.reporting-warnings small {
  font-size: 10px;
}

.reporting-warnings li {
  grid-template-columns: 19px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.reporting-warnings li > span {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  font-size: 10px;
}

.reporting-compact-summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 9px;
}

.reporting-compact-summary-copy,
.reporting-compact-summary-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.reporting-compact-summary-copy > span:not(.reporting-dirty-status) {
  max-width: 260px;
  overflow: hidden;
  padding-left: 7px;
  color: var(--ink-soft);
  border-left: 1px solid var(--line);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reporting-warning-count.has-warnings {
  color: var(--warning) !important;
  font-weight: 700;
}

.reporting-panel-toolbar {
  min-height: 46px;
  padding: 6px 9px;
}

.reporting-panel-toolbar > div:first-child {
  line-height: 1.2;
}

.reporting-panel-toolbar .button {
  min-height: 30px;
}

.reporting-apply-button.is-dirty {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 22%, transparent);
}

.reporting-progress {
  top: 52px;
  right: 9px;
}

.reporting-table-scroll-compact {
  min-height: 360px;
  max-height: calc(100vh - 205px);
  scrollbar-gutter: stable;
}

.reporting-view:not(.is-upper-collapsed) .reporting-table-scroll-compact {
  max-height: calc(100vh - 330px);
}

.reporting-table.is-compact {
  min-width: 1455px;
}

.reporting-table.is-compact th,
.reporting-table.is-compact td {
  min-width: 92px;
  width: 92px;
  max-width: 118px;
  height: 27px;
  padding: 3px 5px;
  border-right: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.1;
}

.reporting-table.is-compact tr > :last-child {
  border-right: 0;
}

.reporting-table.is-compact thead th {
  height: 51px;
  padding: 4px 5px;
  vertical-align: top;
}

.reporting-table.is-compact thead th > span {
  margin-bottom: 2px;
  font-size: 10px;
}

.reporting-table.is-compact .reporting-line-column {
  min-width: 230px;
  width: 230px;
  max-width: 300px;
}

.reporting-table.is-compact .reporting-annual-column {
  min-width: 120px;
  width: 120px;
  max-width: 145px;
}

.reporting-table.is-compact .reporting-mode-select {
  min-height: 22px;
  padding: 1px 4px;
  border-radius: 5px;
  font-size: 9px;
}

.reporting-mode-select.is-dirty {
  outline: 2px solid color-mix(in srgb, var(--warning) 35%, transparent);
  outline-offset: 1px;
}

.reporting-table.is-compact .reporting-month-status {
  margin-top: 1px;
  font-size: 8px;
}

.reporting-table.is-compact .reporting-value-button,
.reporting-table.is-compact .reporting-value-static {
  min-height: 20px;
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 4px;
}

.reporting-table.is-compact .reporting-value-button {
  padding: 1px 2px;
}

.reporting-table.is-compact .reporting-cell-value {
  font-size: 11px;
}

.reporting-table.is-compact .reporting-value-button small,
.reporting-table.is-compact .reporting-value-static small {
  flex: 0 0 auto;
  font-size: 8px;
}

.reporting-table.is-compact .reporting-kpi-row th strong,
.reporting-table.is-compact .reporting-kpi-row th small {
  display: inline;
}

.reporting-table.is-compact .reporting-kpi-row th small {
  margin: 0 0 0 5px;
  font-size: 8px;
  white-space: nowrap;
}

.reporting-table.is-compact .reporting-line-label {
  gap: 3px;
}

.reporting-table.is-compact .reporting-line-label.level-1 { padding-left: 9px; }
.reporting-table.is-compact .reporting-line-label.level-2 { padding-left: 18px; }
.reporting-table.is-compact .reporting-line-label.level-3 { padding-left: 27px; }
.reporting-table.is-compact .reporting-line-label.level-4 { padding-left: 36px; }
.reporting-table.is-compact .reporting-line-label.level-5 { padding-left: 45px; }

.reporting-table.is-compact .reporting-tree-toggle,
.reporting-table.is-compact .reporting-tree-spacer {
  width: 16px;
  height: 16px;
  flex-basis: 16px;
  border-radius: 4px;
  font-size: 10px;
}

.reporting-detail-dialog {
  position: relative;
  width: min(1500px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
}

.reporting-detail-overlay {
  position: absolute;
  z-index: 20;
  inset: 52px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink-soft);
  background: rgb(255 255 255 / 80%);
  backdrop-filter: blur(1px);
}

.reporting-detail-overlay .spinner {
  width: 18px;
  height: 18px;
}

.reporting-detail-dialog[open] > .reporting-detail-shell {
  height: min(860px, calc(100vh - 24px));
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.reporting-detail-sticky-header {
  min-height: 52px;
  padding: 8px 12px;
}

.reporting-detail-filterbar {
  max-height: min(190px, 28vh);
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  align-items: end;
  gap: 6px;
  padding: 7px 11px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.reporting-detail-filterbar .field {
  gap: 2px;
}

.reporting-detail-filterbar .field-label {
  font-size: 9px;
}

.reporting-detail-filterbar .input {
  min-height: 31px;
  padding: 4px 7px;
  font-size: 11px;
}

.reporting-detail-search {
  grid-column: span 2;
}

.reporting-detail-filter-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.reporting-detail-filter-actions .button {
  min-height: 31px;
}

.reporting-detail-body {
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.reporting-detail-table-wrap {
  height: 100%;
  overflow: auto;
  scrollbar-gutter: stable;
}

.reporting-detail-table {
  min-width: 1080px;
}

.reporting-detail-table th,
.reporting-detail-table td {
  height: 38px;
  padding: 6px 8px;
  border-right: 1px solid var(--line);
  font-size: 11px;
}

.reporting-detail-table tr > :last-child {
  border-right: 0;
}

.reporting-detail-sort {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: inherit;
  text-align: left;
}

.reporting-detail-table th.numeric .reporting-detail-sort {
  justify-content: flex-end;
}

.reporting-detail-footer {
  max-height: min(126px, 24vh);
  overflow: auto;
  min-height: 50px;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 11px;
}

.reporting-detail-totals,
.reporting-detail-pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.reporting-detail-totals {
  color: var(--ink-soft);
  font-size: 11px;
}

.reporting-detail-page-size {
  display: flex;
  align-items: center;
  gap: 4px;
}

.reporting-detail-page-size .select {
  width: 68px;
  min-height: 29px;
  padding: 2px 23px 2px 6px;
  font-size: 11px;
}

.reporting-detail-pagination > .button {
  min-width: 29px;
  min-height: 29px;
  padding-inline: 7px;
}

.reporting-pagination-gap {
  color: var(--muted);
}

.reconciliation-current-total-row th,
.reconciliation-current-total-row td {
  background: #e9f0ee;
  border-top: 2px solid var(--line-strong);
  border-bottom: 2px solid var(--line-strong);
  font-weight: 760;
}

.payroll-statements-view {
  display: grid;
  gap: 16px;
}

.payroll-statements-heading {
  margin-bottom: 0;
}

.payroll-statements-controls {
  display: grid;
  grid-template-columns: minmax(260px, 520px) minmax(190px, 1fr) auto;
  align-items: end;
  gap: 14px;
  padding: 16px;
}

.payroll-statements-picker {
  margin: 0;
}

.payroll-statements-selection {
  min-height: 42px;
  display: flex;
  align-items: center;
}

.payroll-statement-panel {
  overflow: hidden;
}

.payroll-statement-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.payroll-statement-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.payroll-statement-table-wrap {
  border-top: 1px solid var(--line);
}

.payroll-statement-table {
  min-width: 760px;
}

.payroll-statement-table th,
.payroll-statement-table td {
  padding-block: 10px;
}

.payroll-statement-table tbody th {
  color: var(--ink);
  font-weight: 650;
  text-align: left;
}

.payroll-statement-table .payroll-employee-id {
  width: 140px;
}

.payroll-statement-table .numeric {
  min-width: 150px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.payroll-statement-table tfoot th,
.payroll-statement-table tfoot td {
  background: var(--surface-strong);
  border-top: 2px solid var(--line-strong);
  font-weight: 760;
}

.payroll-statement-table .payroll-delta.is-negative {
  color: var(--danger);
}

.payroll-statement-table .payroll-delta.is-positive {
  color: var(--warning);
}

.payroll-statement-dialog {
  width: min(520px, calc(100vw - 24px));
}

.payroll-statement-import-dialog {
  width: min(1180px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
}

.payroll-statement-import-dialog[open],
.payroll-statement-import-dialog > form {
  min-height: 0;
}

.payroll-statement-import-dialog > form {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.payroll-statement-import-dialog .modal-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.payroll-import-fields {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(380px, 1.4fr);
  gap: 12px;
  align-items: end;
}

.payroll-import-atomic {
  display: grid;
  gap: 2px;
  margin: 12px 0 0;
}

.payroll-import-preview {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.payroll-import-preview-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.payroll-import-preview-heading h3,
.payroll-import-section h4 {
  margin: 0;
}

.payroll-import-preview-heading h3 {
  font-size: 18px;
}

.payroll-import-preview-heading p,
.payroll-import-commit-note {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.payroll-import-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(105px, 1fr));
  gap: 6px;
}

.payroll-import-summary > div {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 8px 9px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.payroll-import-summary span {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .035em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.payroll-import-summary strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.payroll-import-preview .callout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 12px;
}

.payroll-import-preview .callout ul {
  grid-column: 2;
  margin: 0;
  padding-inline-start: 18px;
}

.payroll-import-section {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.payroll-import-section h4 {
  font-size: 14px;
}

.payroll-import-table-wrap {
  max-height: 230px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.payroll-import-table-wrap.is-employees {
  max-height: 300px;
}

.payroll-import-table-wrap .data-table {
  min-width: 840px;
  font-size: 11px;
}

.payroll-import-table-wrap .data-table th,
.payroll-import-table-wrap .data-table td {
  min-width: 0;
  padding: 6px 8px;
}

.payroll-import-table-wrap .numeric {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.payroll-import-table-wrap .is-warning-text {
  color: var(--warning-strong, #8a5d00);
}

.payroll-import-result {
  min-height: 250px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.payroll-import-result-files {
  width: min(100%, 680px);
  display: grid;
  gap: 5px;
  margin-top: 8px;
  text-align: left;
}

.payroll-import-result-files ul {
  max-height: 132px;
  margin: 0;
  padding-inline-start: 20px;
  overflow: auto;
}

.payroll-import-result-files li {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(190px, 1fr));
  }

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

  .reporting-filter-grid {
    grid-template-columns: minmax(220px, 1fr) minmax(110px, 160px);
  }

  .reporting-presets {
    grid-column: 1 / -1;
  }

  .payroll-import-summary {
    grid-template-columns: repeat(3, minmax(105px, 1fr));
  }
}

@media (max-width: 960px) {
  .payroll-statements-controls {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .payroll-statements-selection {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: auto;
  }

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

  .login-panel {
    min-height: 100vh;
  }

  .login-art {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    transform: translateX(-102%);
    transition: transform .2s ease;
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app-shell.sidebar-open .sidebar-scrim {
    display: block;
  }

  .app-shell > .icon-button.menu-toggle {
    display: inline-flex;
    left: 12px;
    color: var(--ink);
    background: var(--surface);
    border-color: var(--line-strong);
  }

  .app-shell.sidebar-open > .icon-button.menu-toggle {
    left: calc(var(--sidebar-width) - 52px);
    color: var(--sidebar-text);
    background: rgb(255 255 255 / 8%);
    border-color: rgb(255 255 255 / 16%);
  }

  .shell-content {
    width: 100%;
  }

  .topbar {
    padding: 0 16px 0 66px;
  }

  .page-main {
    padding: 22px 18px 34px;
  }

  .connection-state {
    display: none;
  }

  .reporting-meta {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

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

@media (max-width: 680px) {
  :root {
    --topbar-height: 60px;
  }

  .payroll-statements-controls {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .payroll-statements-selection {
    grid-column: auto;
    grid-row: auto;
  }

  .payroll-statements-controls > .button {
    width: 100%;
  }

  .payroll-statement-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .payroll-import-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .payroll-import-summary {
    grid-template-columns: repeat(2, minmax(105px, 1fr));
  }

  .login-panel {
    align-items: flex-start;
    padding: 32px 22px;
  }

  .login-brand {
    margin-bottom: 46px;
  }

  .topbar {
    gap: 9px;
    padding: 0 10px 0 60px;
  }

  .topbar-heading span,
  .user-summary-text {
    display: none;
  }

  .user-menu > summary {
    padding-right: 3px;
  }

  .page-main {
    padding: 18px 10px 28px;
  }

  .page-heading {
    min-height: 0;
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    margin: 0 4px 16px;
  }

  .page-actions .button {
    flex: 1 1 auto;
  }

  .reporting-filter-grid,
  .reporting-meta,
  .reporting-warnings {
    grid-template-columns: minmax(0, 1fr);
  }

  .reporting-presets {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .reporting-presets .button {
    width: 100%;
  }

  .reporting-panel-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .reporting-tree-actions .button {
    flex: 1 1 auto;
  }

  .reporting-table-scroll {
    max-height: calc(100vh - 185px);
  }

  .reporting-compact-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .reporting-compact-summary-actions .button {
    flex: 1 1 auto;
  }

  .reporting-detail-dialog[open] > .reporting-detail-shell {
    height: calc(100vh - 16px);
  }

  .reporting-detail-filterbar {
    max-height: min(170px, 30vh);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 6px 8px;
  }

  .reporting-detail-search {
    grid-column: 1 / -1;
  }

  .reporting-detail-filter-actions {
    grid-column: 1 / -1;
  }

  .reporting-detail-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .reporting-detail-pagination {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .embedded-grid-heading,
  .grid-context {
    align-items: stretch;
    grid-template-columns: minmax(0, 1fr);
    flex-direction: column;
  }

  .embedded-grid-heading .button {
    width: 100%;
  }

  .grid-context-icon {
    display: none;
  }

  .grid-context-actions {
    justify-content: stretch;
  }

  .grid-context-actions .button {
    flex: 1 1 auto;
  }

  .dashboard-hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .dashboard-date {
    min-width: 0;
  }

  .metric-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .metric-card {
    min-height: 108px;
  }

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

  .grid-toolbar {
    gap: 7px;
  }

  .search-box {
    width: 100%;
    flex-basis: 100%;
  }

  .toolbar-separator {
    display: none;
  }

  .grid-toolbar > .button .button-label,
  .grid-toolbar > .column-picker > summary .button-label {
    display: none;
  }

  .grid-toolbar > .button,
  .grid-toolbar > .column-picker > summary {
    width: 38px;
    padding: 0;
  }

  .grid-toolbar > .button.is-primary {
    width: auto;
    padding-inline: 12px;
  }

  .grid-toolbar > .button.is-primary .button-label {
    display: inline;
  }

  .grid-toolbar-select-label {
    display: none;
  }

  .grid-toolbar-select-filter {
    flex: 1 1 170px;
  }

  .grid-toolbar-select-filter .select {
    width: 100%;
    min-width: 0;
  }

  .column-picker-panel {
    position: fixed;
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: 65vh;
  }

  .grid-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
  }

  .pagination {
    justify-content: space-between;
  }

  .page-size-label {
    margin-right: auto;
  }

  .form-grid,
  .role-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .contract-facts,
  .batch-preview-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .contract-facts dd {
    white-space: normal;
  }

  .workspace-tabs {
    justify-content: flex-start;
  }

  .workspace-tab {
    flex-grow: 0;
  }

  .metric-slice {
    padding: 10px;
  }

  .metric-slice > header {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

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

  .data-table .cell-actions.has-text-actions,
  .data-table .actions-header.has-text-actions {
    min-width: 210px;
    width: 210px;
  }

  .row-actions.has-text-actions {
    flex-wrap: wrap;
  }

  .row-actions.has-text-actions .row-text-action {
    flex: 1 0 100%;
  }

  .drawer-dialog {
    width: 100vw;
  }

  .drawer-body {
    padding: 17px 14px;
  }

  .modal-footer,
  .drawer-footer {
    padding-bottom: max(13px, env(safe-area-inset-bottom));
  }

  .documents-modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .documents-body {
    padding: 14px 12px;
  }

  .document-upload {
    align-items: stretch;
    flex-direction: column;
    padding: 11px;
  }

  .document-file-field {
    flex-basis: auto;
  }

  .document-upload > .button {
    min-height: 42px;
  }

  .document-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .document-kind {
    grid-row: 1 / span 2;
  }

  .document-actions {
    grid-column: 2;
  }

  .audit-filters {
    align-items: stretch;
    flex-direction: column;
  }

  .audit-filters .field {
    width: 100%;
  }

  .toast-region {
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 1100px) {
  .workflow-metrics {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .contract-facts {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .contract-facts.is-compact {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 680px) {
  .workflow-search,
  .workflow-summary,
  .bank-target,
  .workflow-submit {
    align-items: stretch;
    flex-direction: column;
  }

  .bank-data-filters .field.is-wide {
    grid-column: auto;
  }

  .bank-data-filter-actions,
  .bank-data-filter-actions .button {
    width: 100%;
  }

  .bank-data-filter-actions .button {
    flex: 1 1 0;
  }

  .workflow-search .button,
  .workflow-submit .button {
    min-height: 43px;
  }

  .workflow-metrics,
  .document-schedules {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .contract-facts.is-compact {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace-tab-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-tab-toolbar > .button {
    width: 100%;
  }

  .segmented {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .segmented span {
    justify-content: center;
  }

  .workflow-submit {
    bottom: max(6px, env(safe-area-inset-bottom));
  }

}

.help-layout {
  display: grid;
  grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.help-index {
  position: sticky;
  top: 16px;
  padding: 20px;
}

.help-index ul {
  margin: 12px 0 0;
  padding-left: 20px;
}

.help-index a[aria-current="page"] {
  font-weight: 700;
}

.help-document {
  padding: clamp(20px, 4vw, 40px);
  overflow-wrap: anywhere;
}

.help-document pre {
  overflow-x: auto;
}

.help-readonly {
  float: right;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--surface-muted);
  font-size: .75rem;
}

@media (max-width: 760px) {
  .help-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .help-index {
    position: static;
  }
}

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

@media print {
  .sidebar,
  .topbar,
  .page-heading,
  .grid-toolbar,
  .active-filters,
  .grid-footer,
  .toast-region,
  .cell-actions,
  .actions-header {
    display: none !important;
  }

  .app-shell,
  .shell-content {
    display: block;
  }

  .page-main {
    padding: 0;
  }

  .panel,
  .metric-card {
    border-color: #bbb;
    box-shadow: none;
  }

  .table-wrap {
    overflow: visible;
  }

  .data-table {
    min-width: 0;
    font-size: 9px;
  }
}
