@import url("https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&display=swap");

:root {
  --color-primary: #c1654a;
  --color-primary-hover: #a8513a;
  --color-primary-soft: #e8c4b8;
  --color-primary-muted: rgba(193, 101, 74, 0.09);
  --color-bg: #faf6f2;
  --color-surface: #ffffff;
  --color-border: #e4d8cf;
  --color-text: #2e2622;
  --color-text-muted: #6b5e55;
  --color-success: #4a7a52;
  --color-success-soft: #edf4ee;
  --color-warning: #c08a2e;
  --color-warning-soft: #fdf5e0;
  --color-danger: #b0463c;
  --color-danger-soft: #fdecea;
  --shadow: 0 18px 42px rgba(93, 66, 49, 0.09);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Source Serif 4", Georgia, serif;
}

.nav__attention {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 14px;
  margin-left: auto;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: #D99016;
  color: #FFF;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.shell.is-sidebar-collapsed .nav__attention {
  position: absolute;
  top: 3px;
  right: 2px;
  margin: 0;
}

* {
  box-sizing: border-box;
}

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

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

body {
  margin: 0;
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.5;
  background:
    radial-gradient(circle at top left, rgba(232, 196, 184, 0.55), transparent 28%),
    radial-gradient(circle at top right, rgba(193, 101, 74, 0.08), transparent 22%),
    var(--color-bg);
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -0.012em;
}

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

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

.shell {
  min-height: 100vh;
  align-items: start;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  max-height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
  transition: padding 180ms ease, width 180ms ease;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 18px 18px 16px;
  margin-bottom: 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  box-shadow: var(--shadow);
}

.brand__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 112px;
}

.brand__mark {
  width: min(100%, 182px);
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  border: 1px solid var(--color-border);
  background: var(--color-primary-muted);
  overflow: hidden;
  flex: 0 0 auto;
  padding: 10px 14px;
}

.brand__mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0;
}

.brand__fallback {
  color: var(--color-primary);
  font-weight: 800;
  letter-spacing: 0.05em;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav__group {
  display: grid;
  gap: 8px;
}

.nav__group + .nav__group {
  margin-top: 8px;
}

.nav__group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 4px 14px 0;
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.nav__group-toggle:hover {
  color: var(--color-text);
}

.nav__group-caret {
  font-size: 0.9rem;
  transition: transform 160ms ease;
}

.nav__group.is-collapsed .nav__group-caret {
  transform: rotate(-90deg);
}

.nav__group-items {
  display: grid;
  gap: 8px;
}

.nav__group.is-collapsed .nav__group-items {
  display: none;
}

.nav a {
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--color-text-muted);
  border: 1px solid transparent;
  transition: 160ms ease;
  font-size: 0.98rem;
}

.nav a:hover,
.nav a.is-active {
  color: var(--color-text);
  background: var(--color-primary-muted);
  border-color: rgba(193, 101, 74, 0.16);
}

.sidebar__footer {
  margin-top: 24px;
  padding: 16px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.92rem;
  display: grid;
  gap: 10px;
}

.sidebar__logout {
  margin: 0;
}

.sidebar__logout-button {
  width: 100%;
}

.sidebar__account-button {
  width: 100%;
}

.sidebar__logout-icon {
  display: none;
}

.sidebar__logout-icon svg {
  display: block;
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.content {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.page-title {
  margin: 0;
  font-size: clamp(1.45rem, 1.85vw, 2rem);
  line-height: 1.05;
}

.page-subtitle {
  margin: 10px 0 0;
  color: var(--color-text-muted);
  max-width: 62ch;
  font-size: 0.98rem;
}

.panel-grid {
  display: grid;
  gap: 18px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

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

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

.card {
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow);
}

.card--soft {
  background: linear-gradient(180deg, #fffdfb, #fff8f5);
}

.card__label {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.card__value {
  margin-top: 12px;
  font-size: 1.75rem;
  font-weight: 800;
}

.card__value.is-numeric,
.card__value.is-money {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.card__meta {
  margin-top: 8px;
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  min-width: 0;
}

.header-actions__back {
  flex: 0 0 auto;
}

.topbar,
.page-hd {
  position: relative;
}

.topbar > .toolbar,
.page-hd-right,
.page-hd-right > .toolbar {
  position: relative;
}

.topbar > .toolbar,
.page-hd-right > .toolbar,
.page-hd-right > .header-actions {
  min-height: 36px;
  padding-right: 100px;
}

.topbar > .toolbar > .header-actions,
.page-hd-right > .toolbar > .header-actions,
.page-hd-right > .header-actions {
  display: flex;
  align-items: center;
}

.topbar > .toolbar > .header-actions .user-menu,
.page-hd-right > .toolbar > .header-actions .user-menu,
.page-hd-right > .header-actions .user-menu {
  position: absolute;
  top: 0;
  right: 0;
}

.ai-header-button {
  width: 40px;
  min-width: 40px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
}

.ai-header-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.user-menu {
  position: relative;
  flex: 0 0 auto;
}

.user-menu__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 40px;
  min-width: 40px;
  min-height: 34px;
  padding: 0 6px 0 5px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  box-shadow: none;
  transition: background 140ms ease, color 140ms ease;
}

.user-menu__toggle:hover {
  background: rgba(193, 101, 74, 0.08);
}

.user-menu__toggle:focus-visible,
.user-menu__item:focus-visible {
  outline: 2px solid rgba(193, 101, 74, 0.45);
  outline-offset: 2px;
}

.user-menu.is-open .user-menu__toggle {
  background: rgba(193, 101, 74, 0.1);
}

.user-menu__avatar {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(193, 101, 74, 0.16), rgba(193, 101, 74, 0.3));
  color: var(--color-primary-hover);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.user-menu__chevron {
  color: var(--color-text-muted);
  font-size: 0.68rem;
  line-height: 1;
  transition: transform 140ms ease;
}

.user-menu.is-open .user-menu__chevron {
  transform: rotate(180deg);
}

.user-menu__panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: min(320px, calc(100vw - 32px));
  padding: 10px;
  border: 1px solid rgba(228, 216, 207, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 42px rgba(93, 66, 49, 0.16);
}

.ai-layout {
  align-items: start;
}

.ai-conversation-list {
  display: grid;
  gap: 10px;
}

.ai-conversation-link {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
}

.ai-conversation-link.is-active {
  border-color: var(--blue-mid);
  background: var(--blue-pale);
}

.ai-thread {
  display: grid;
  gap: 12px;
}

.ai-bubble {
  max-width: 860px;
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--surface2);
}

.ai-bubble--user {
  margin-left: auto;
  background: var(--blue-pale);
  border-color: rgba(27, 120, 200, 0.22);
}

.ai-bubble--assistant {
  margin-right: auto;
  background: var(--surface);
}

.ai-drawer-shell {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}

.ai-drawer-shell.is-open {
  pointer-events: auto;
}

.ai-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(46, 38, 34, 0.18);
  opacity: 0;
  transition: opacity 160ms ease;
}

.ai-drawer-shell.is-open .ai-drawer-backdrop {
  opacity: 1;
}

.ai-drawer {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(420px, 100vw);
  height: 100vh;
  border-left: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: -18px 0 42px rgba(93, 66, 49, 0.13);
  transform: translateX(100%);
  transition: transform 180ms ease;
}

.ai-drawer-shell.is-open .ai-drawer {
  transform: translateX(0);
}

.ai-drawer__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.ai-drawer__header h2,
.ai-drawer__header p {
  margin: 0;
}

.ai-drawer__header h2 {
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0;
}

.ai-drawer__header p {
  margin-top: 4px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.ai-drawer__close {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 1.15rem;
}

.ai-drawer__thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 18px 20px;
  overflow-y: auto;
  background: var(--color-bg);
}

.ai-drawer__empty {
  margin: auto;
  max-width: 260px;
  color: var(--color-text-muted);
  text-align: center;
  font-size: 0.92rem;
}

.ai-drawer__bubble {
  display: grid;
  gap: 6px;
  max-width: 88%;
  padding: 12px 13px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
}

.ai-drawer__bubble--user {
  align-self: end;
  background: rgba(232, 196, 184, 0.42);
  border-color: rgba(193, 101, 74, 0.2);
}

.ai-drawer__bubble--assistant {
  align-self: start;
}

.ai-drawer__bubble-content {
  white-space: pre-line;
  color: var(--color-text);
  font-size: 0.94rem;
  line-height: 1.45;
}

.ai-drawer__form {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.ai-drawer__form textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 11px 12px;
  background: var(--color-surface);
  color: var(--color-text);
}

.ai-drawer__form textarea:focus {
  outline: 2px solid rgba(193, 101, 74, 0.32);
  outline-offset: 2px;
}

.ai-drawer__form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-drawer__status {
  margin: 0;
  min-height: 20px;
  color: var(--color-text-muted);
  font-size: 0.84rem;
}

.ai-drawer__submit:disabled {
  cursor: wait;
  opacity: 0.72;
}

@media (max-width: 640px) {
  .ai-drawer {
    width: 100vw;
  }

  .ai-drawer__header {
    padding: 16px;
  }

  .ai-drawer__thread {
    padding: 16px;
  }

  .ai-drawer__bubble {
    max-width: 94%;
  }
}

.ai-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.user-menu__summary {
  display: grid;
  gap: 4px;
  padding: 6px 8px 8px;
}

.user-menu__summary-name,
.user-menu__summary-roles {
  margin: 0;
}

.user-menu__summary-name {
  font-weight: 700;
  color: var(--color-text);
}

.user-menu__summary-meta {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.user-menu__summary-roles {
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

.user-menu__divider {
  height: 1px;
  margin: 6px 0;
  background: rgba(228, 216, 207, 0.95);
}

.user-menu__item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--color-text);
  text-align: left;
  font-weight: 600;
  cursor: pointer;
}

.user-menu__item:hover {
  background: rgba(193, 101, 74, 0.09);
}

.user-menu__logout-form {
  margin: 0;
}

.user-menu__item--danger {
  color: var(--color-danger);
}

.user-menu__item--danger:hover {
  background: rgba(176, 70, 60, 0.08);
}

.button,
button.button,
input[type="submit"].button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  box-shadow: 0 12px 28px rgba(193, 101, 74, 0.2);
  cursor: pointer;
  font-weight: 600;
}

.button:hover,
button.button:hover,
input[type="submit"].button:hover {
  background: linear-gradient(135deg, var(--color-primary-hover), #8f402f);
}

.button--ghost {
  color: var(--color-text);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: none;
}

.button--danger {
  background: linear-gradient(135deg, var(--color-danger), #8f3028);
}

.button--icon {
  min-width: 42px;
  padding: 0;
}

.panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, #fffdfb, #fffaf6);
}

.panel__body {
  padding: 18px 20px;
}

.section-gap {
  margin-top: 18px;
}

.mt-12 {
  margin-top: 12px;
}

.mt-14 {
  margin-top: 14px;
}

.mt-18 {
  margin-top: 18px;
}

.mt-20 {
  margin-top: 20px;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-6 {
  margin-bottom: 6px;
}

.table-wrap {
  overflow-x: auto;
}

table.app-table {
  width: 100%;
  border-collapse: collapse;
}

.app-table th,
.app-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
  font-size: 0.95rem;
}

.app-table thead th {
  color: var(--color-text-muted);
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.app-table th.is-numeric,
.app-table th.is-money,
.app-table td.is-numeric,
.app-table td.is-money {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.app-table tbody tr:hover {
  background: rgba(193, 101, 74, 0.05);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  background: var(--color-surface);
}

.badge--success {
  border-color: rgba(74, 122, 82, 0.24);
  background: var(--color-success-soft);
}

.badge--danger {
  border-color: rgba(176, 70, 60, 0.24);
  background: var(--color-danger-soft);
}

.badge--warning {
  border-color: rgba(192, 138, 46, 0.24);
  background: var(--color-warning-soft);
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(24, 65, 120, 0.18);
  background: rgba(24, 65, 120, 0.07);
  color: var(--color-primary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: var(--color-text-muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.7);
}

.field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%),
    linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.field input[type="file"] {
  padding: 8px 12px;
  background: #fffaf7;
}

.field input[type="checkbox"] {
  width: auto;
  min-height: auto;
  accent-color: var(--color-primary);
}

.field input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 8px 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
}

.field textarea {
  min-height: 120px;
}

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

.help {
  color: var(--color-text-muted);
  font-size: 0.86rem;
}

.message {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.message.is-success {
  border-color: rgba(74, 122, 82, 0.22);
  background: var(--color-success-soft);
}

.message.is-error {
  border-color: rgba(176, 70, 60, 0.22);
  background: var(--color-danger-soft);
}

.toast-region {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 90;
  display: grid;
  gap: 10px;
  width: min(390px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 13px 14px 13px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.14);
  font-size: 13px;
  line-height: 1.4;
  pointer-events: auto;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-closing {
  opacity: 0;
  transform: translateX(12px);
}

.toast--success {
  border-color: rgba(21, 128, 61, 0.22);
  background: var(--pos-bg);
}

.toast--info {
  border-color: rgba(27, 120, 200, 0.24);
  background: var(--blue-pale);
}

.toast--warning {
  border-color: rgba(180, 83, 9, 0.24);
  background: var(--warning-soft, #FEF3C7);
}

.toast--error {
  border-color: rgba(185, 28, 28, 0.22);
  background: var(--neg-bg);
}

.toast__content {
  min-width: 0;
}

.toast__close {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-mid);
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
}

.toast__close:hover,
.toast__close:focus-visible {
  background: rgba(17, 24, 39, 0.08);
  color: var(--text);
}

.progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #f0e4dc;
}

.progress__bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-hover));
  width: var(--progress, 0%);
}

.processing-hero {
  margin: 24px auto;
  width: min(860px, 100%);
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 36px;
  border: 1px solid rgba(24, 65, 120, 0.18);
  border-radius: 12px;
  background: linear-gradient(135deg, #ffffff 0%, #f3f8ff 100%);
  box-shadow: 0 18px 42px rgba(24, 65, 120, 0.14);
}

.processing-hero--completed {
  border-color: rgba(74, 122, 82, 0.25);
  background: var(--color-success-soft);
}

.processing-hero--failed {
  border-color: rgba(176, 70, 60, 0.25);
  background: var(--color-danger-soft);
}

.processing-hero--warning {
  border-color: rgba(192, 138, 46, 0.28);
  background: var(--color-warning-soft);
}

.processing-hero__spinner {
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
}

.processing-hero--consolidating .processing-hero__spinner {
  animation: processing-spin 0.9s linear infinite;
}

.processing-hero__spinner-track {
  stroke: #d9e5f5;
}

.processing-hero__spinner-progress {
  stroke: var(--color-primary);
  stroke-dasharray: 226.2;
  stroke-dashoffset: calc(226.2 - (226.2 * var(--spinner-progress, 0) / 100));
  transform: rotate(-90deg);
  transform-origin: 48px 48px;
  transition: stroke-dashoffset 180ms ease;
}

.processing-hero__spinner-head {
  stroke: var(--color-primary);
}

.processing-hero--ingesting .processing-hero__spinner-progress {
  animation: processing-pulse 1.5s ease-in-out infinite;
}

.processing-hero--ingesting .processing-hero__spinner-head {
  opacity: 0;
}

.processing-hero--consolidating .processing-hero__spinner-progress {
  opacity: 0;
}

.processing-hero__body {
  flex: 1 1 auto;
  min-width: 0;
}

.processing-hero__title {
  margin-top: 8px;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 800;
  color: var(--color-text);
}

.processing-hero__body p {
  margin: 12px 0 22px;
  color: var(--color-text-muted);
}

.processing-hero__bar {
  height: 22px;
  overflow: hidden;
  border-radius: 999px;
  background: #d9e5f5;
}

.processing-hero__bar-fill {
  position: relative;
  height: 100%;
  width: var(--progress, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-primary), #2f80d5);
  transition: width 180ms ease;
}

.processing-hero--ingesting .processing-hero__bar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.32) 42%, transparent 100%);
  transform: translateX(-100%);
  animation: processing-scan 1.35s ease-in-out infinite;
}

.processing-hero__meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  color: var(--color-text-muted);
}

.processing-hero__meta strong {
  color: var(--color-primary);
}

.processing-hero__actions {
  margin-top: 16px;
}

.import-detail-page {
  display: grid;
  gap: 18px;
}

.import-detail-topbar {
  align-items: end;
  gap: 24px;
  margin-bottom: 0;
}

.import-detail-heading {
  min-width: 0;
}

.import-detail-heading .page-title {
  line-height: 1.04;
}

.import-detail-filename {
  max-width: min(72ch, 100%);
  margin: 9px 0 0;
  overflow: hidden;
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-detail-heading .page-subtitle {
  margin-top: 5px;
}

.import-detail-toolbar {
  align-items: stretch;
  justify-content: flex-end;
  gap: 12px;
}

.import-detail-toolbar .button {
  min-width: 0;
}

.import-detail-metrics {
  display: grid;
  grid-template-columns: 0.7fr 1fr 1fr 1fr 1.35fr;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  box-shadow: var(--shadow);
}

.import-detail-metric {
  min-width: 0;
  min-height: 126px;
  padding: 20px 22px 18px;
  display: grid;
  align-content: center;
  gap: 6px;
  border-left: 1px solid var(--color-border);
}

.import-detail-metric:first-child {
  border-left: 0;
}

.import-detail-metric__label {
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.import-detail-metric__value {
  overflow-wrap: normal;
  color: var(--color-primary);
  font-size: clamp(1.65rem, 2vw, 2.15rem);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.import-detail-metric__meta {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  line-height: 1.3;
}

.import-detail-metric--money {
  background: rgba(24, 65, 120, 0.04);
}

.import-detail-metric--money .import-detail-metric__value {
  font-size: clamp(1.55rem, 1.85vw, 2.05rem);
}

.import-detail-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px;
  border: 1px solid var(--color-border);
  border-left-width: 4px;
  border-radius: 8px;
  background: var(--color-surface);
}

.import-detail-status--completed {
  border-left-color: var(--color-success);
  background: var(--color-success-soft);
}

.import-detail-status--failed {
  border-left-color: var(--color-danger);
  background: var(--color-danger-soft);
}

.import-detail-status--warning {
  border-left-color: var(--color-warning);
  background: var(--color-warning-soft);
}

.import-detail-status__title {
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 800;
}

.import-detail-status__body p {
  margin: 3px 0 0;
  color: var(--color-text-muted);
  font-size: 0.88rem;
}

.global-processing-indicator {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
}

.global-processing-indicator[hidden] {
  display: none;
}

.global-processing-indicator__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 28, 52, 0.34);
  backdrop-filter: blur(3px);
}

.global-processing-indicator__dialog {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  min-width: min(92vw, 360px);
  padding: 28px 32px;
  border: 1px solid rgba(24, 65, 120, 0.24);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 247, 253, 0.98));
  box-shadow: 0 24px 64px rgba(12, 28, 52, 0.22);
  text-align: center;
}

.global-processing-indicator__spinner {
  width: 112px;
  height: 112px;
  animation: processing-spin 0.9s linear infinite;
}

.global-processing-indicator__spinner-track {
  stroke: rgba(24, 65, 120, 0.16);
}

.global-processing-indicator__spinner-head {
  stroke: var(--color-primary);
}

.global-processing-indicator__title {
  font-size: 1.5rem;
  line-height: 1.1;
  color: var(--color-text);
}

.global-processing-indicator__text {
  margin: 0;
  font-size: 1rem;
  color: var(--color-text-muted);
}

body.is-global-processing-active {
  overflow: hidden;
}

.panel__header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel__subtitle {
  margin: 6px 0 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.reconciliation-source,
.reconciliation-checks {
  display: flex;
  align-items: center;
  gap: 12px 22px;
  flex-wrap: wrap;
}

.reconciliation-source {
  margin-bottom: 16px;
  color: var(--color-text-muted);
}

.reconciliation-table-wrap {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow-x: auto;
}

.reconciliation-table__result td {
  border-top: 2px solid var(--color-border);
  background: rgba(24, 65, 120, 0.05);
  font-weight: 800;
}

.reconciliation-audit-note,
.reconciliation-checks,
.homologation-summary,
.homologation-form {
  margin-top: 16px;
}

.reconciliation-error-report {
  margin-top: 16px;
}

.reconciliation-error-report h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.reconciliation-error-table code {
  color: var(--color-danger);
  font-weight: 800;
}

.homologation-summary {
  padding: 14px 16px;
  border-left: 4px solid var(--color-success);
  background: var(--color-success-soft);
}

.homologation-blocked {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(176, 70, 60, 0.24);
  border-left: 4px solid var(--color-danger);
  border-radius: var(--radius-md);
  background: var(--color-danger-soft);
}

.homologation-blocked strong {
  color: var(--color-danger);
}

.homologation-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(192, 138, 46, 0.28);
  border-radius: 12px;
  background: var(--color-warning-soft);
}

.homologation-form .button {
  min-width: 220px;
}

.homologation-confirmation {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.4;
}

.homologation-confirmation input {
  margin-top: 3px;
}

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

@keyframes processing-pulse {
  0%,
  100% {
    stroke-opacity: 0.92;
  }
  50% {
    stroke-opacity: 0.45;
  }
}

@keyframes processing-scan {
  100% {
    transform: translateX(220%);
  }
}

@media (max-width: 720px) {
  .toast-region {
    top: 12px;
    right: 16px;
    width: calc(100vw - 32px);
  }

  .panel__header-row,
  .homologation-form {
    align-items: stretch;
    flex-direction: column;
  }

  .processing-hero {
    flex-direction: column;
    align-items: stretch;
    padding: 24px;
  }

  .processing-hero__spinner {
    width: 72px;
    height: 72px;
    align-self: center;
  }

  .processing-hero__title {
    font-size: 26px;
  }

  .processing-hero__meta {
    flex-direction: column;
    gap: 6px;
  }

  .import-detail-toolbar .button,
  .import-detail-status .button,
  .homologation-form .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
  }
}

.segment-detail {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.segment-detail summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--color-text);
}

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

.stack {
  display: grid;
  gap: 12px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.small {
  font-size: 0.9rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.modal {
  width: min(680px, calc(100vw - 32px));
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: 0;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(65, 40, 30, 0.28);
  backdrop-filter: blur(6px);
}

.modal__body {
  padding: 24px;
}

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

.login-card {
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid var(--color-border);
  border-radius: 28px;
  background: var(--color-surface);
  box-shadow: var(--shadow);
}

.login-card--wide {
  width: min(720px, 100%);
}

.login-card h1 {
  margin: 0 0 12px;
}

.login-card .help {
  margin-bottom: 20px;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 18px;
}

.auth-links a {
  color: var(--color-primary);
  font-weight: 600;
}

.logo-preview {
  width: fit-content;
  padding: 10px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: #fffaf7;
  margin-bottom: 12px;
}

.logo-preview img {
  display: block;
  max-width: 180px;
  max-height: 72px;
  object-fit: contain;
}

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

.shell.is-sidebar-collapsed .sidebar {
  padding: 18px 12px;
}

.shell.is-sidebar-collapsed .brand__eyebrow,
.shell.is-sidebar-collapsed .sidebar__footer {
  display: none;
}

.shell.is-sidebar-collapsed .brand {
  align-items: center;
}

.shell.is-sidebar-collapsed .brand__topline {
  width: 100%;
  min-height: auto;
}

.shell.is-sidebar-collapsed .brand__mark {
  display: none;
}

.shell.is-sidebar-collapsed .nav {
  gap: 6px;
}

.shell.is-sidebar-collapsed .nav a {
  display: grid;
  place-items: center;
  padding-inline: 0;
  min-height: 48px;
}

.shell.is-sidebar-collapsed .nav__label {
  display: none;
}

.shell.is-sidebar-collapsed .nav__group-toggle {
  display: none;
}

.shell.is-sidebar-collapsed .nav__group-items {
  display: grid !important;
}

.shell.is-sidebar-collapsed .nav__group {
  gap: 6px;
}

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

  .sidebar {
    position: relative;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
    overflow: visible;
  }

  .cards,
  .form-grid,
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .import-detail-topbar {
    align-items: stretch;
  }

  .import-detail-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .import-detail-metric:nth-child(odd) {
    border-left: 0;
  }

  .import-detail-metric:nth-child(n + 3) {
    border-top: 1px solid var(--color-border);
  }

  .import-detail-metric--money {
    grid-column: 1 / -1;
    border-top: 1px solid var(--color-border);
    border-left: 0;
  }
}

@media (max-width: 860px) {
  .topbar,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .content {
    padding: 18px;
  }

  .sidebar {
    padding: 18px;
  }

  .sidebar__footer {
    gap: 8px;
  }

  .button,
  button.button,
  input[type="submit"].button {
    width: 100%;
  }

  .shell.is-sidebar-collapsed {
    grid-template-columns: 1fr;
  }
}

/* Segunda passada visual das landings: pesos distintos para análise, atalho e pendência. */
.landing-summary {
  gap: 12px;
  margin-top: 12px;
}

.landing-summary__item {
  min-height: 70px;
  padding: 11px 14px;
  border-radius: 9px;
  box-shadow: 0 3px 10px rgba(17, 24, 39, 0.025);
}

.landing-summary__item strong {
  font-size: 23px;
}

.operation-sections--landing {
  gap: 20px;
  margin-top: 14px;
}

.operation-sections--landing .operation-section__header {
  margin-bottom: 8px;
}

.operation-sections--landing .operation-card-grid {
  gap: 12px;
}

.operation-sections--landing .operation-card {
  min-height: 132px;
  border-radius: 10px;
  box-shadow: 0 3px 12px rgba(17, 24, 39, 0.035);
}

.operation-sections--landing .operation-card__link {
  padding: 16px 18px 14px;
}

.operation-sections--landing .operation-card__icon {
  width: 30px;
  height: 30px;
  margin-bottom: 10px;
}

.operation-sections--landing .operation-card h3 {
  font-size: 15px;
  line-height: 1.25;
}

.operation-sections--landing .operation-card p {
  font-size: 12.5px;
  line-height: 1.38;
}

.operation-sections--landing .operation-card__action {
  padding-top: 10px;
  font-size: 12.5px;
}

.operation-sections--landing .operation-card--compact {
  min-height: 112px;
}

.operation-sections--landing .operation-card--compact .operation-card__link {
  padding-right: 64px;
}

.operation-sections--landing .operation-card--compact .operation-card__icon {
  top: 15px;
  right: 15px;
}

.operation-sections--landing .operation-card--attention,
.operation-sections--finance .operation-card--attention {
  min-height: 108px;
}

.operation-sections--landing .operation-card--attention .operation-card__link {
  padding-right: 136px;
}

.operation-sections--reports .operation-card {
  min-height: 128px;
}

.operation-sections--works .operation-card-grid--2 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.finance-summary-strip--dashboard {
  gap: 10px;
  margin-top: 14px;
}

.finance-summary-strip--dashboard .finance-summary-card {
  min-height: 76px;
  padding: 12px 14px;
  border-radius: 9px;
  box-shadow: 0 3px 12px rgba(17, 24, 39, 0.035);
}

.finance-summary-strip--dashboard .finance-summary-card span {
  margin-bottom: 5px;
}

.finance-summary-strip--dashboard .finance-summary-card strong {
  font-size: 20px;
}

.operation-sections--finance {
  gap: 18px;
  margin-top: 16px;
}

.operation-sections--finance .operation-card {
  min-height: 112px;
}

.operation-sections--finance .operation-card__link {
  padding: 15px 17px 13px;
}

.operation-sections--finance .operation-card__icon {
  width: 30px;
  height: 30px;
  margin-bottom: 10px;
}

.operation-sections--finance .operation-card h3 {
  margin-bottom: 4px;
  font-size: 15px;
}

.operation-sections--finance .operation-card p {
  font-size: 12.5px;
  line-height: 1.38;
}

.operation-sections--finance .operation-card__action {
  padding-top: 10px;
  font-size: 12.5px;
}

.operation-sections--finance .operation-section[aria-labelledby="finance-operation"] .operation-card,
.operation-sections--finance .operation-section[aria-labelledby="finance-registers"] .operation-card {
  min-height: 102px;
}

.operation-sections--finance .operation-card--attention .operation-card__link {
  padding-right: 136px;
}

@media (max-width: 860px) {
  .operation-sections--works .operation-card-grid--2 {
    grid-template-columns: 1fr;
  }

  .operation-sections--landing .operation-card--attention .operation-card__link,
  .operation-sections--finance .operation-card--attention .operation-card__link {
    padding-right: 18px;
  }
}

/* Página pública de login: identidade visual é sempre carregada da configuração. */
.login-shell {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  overflow: hidden;
  padding: 48px 24px;
  background: #f5f0e9;
}

.login-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0) 58%);
}

.login-card {
  position: relative;
  width: min(648px, 100%);
  padding: 52px 72px 44px;
  border: 1px solid rgba(24, 65, 120, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 42px rgba(33, 43, 54, 0.1);
}

.login-brand {
  display: grid;
  place-items: center;
  margin-bottom: 38px;
}

.login-brand__mark {
  display: grid;
  place-items: center;
  width: min(100%, 430px);
  height: 96px;
}

.login-brand__mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-card .brand__eyebrow {
  margin-bottom: 12px;
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 0 0 12px;
  color: var(--navy);
  font-size: clamp(28px, 3vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.login-card .help {
  max-width: 470px;
  margin: 0 0 28px;
  color: var(--text-mid);
  font-size: 16px;
  line-height: 1.55;
}

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

.login-card .field {
  gap: 7px;
}

.login-card .field label {
  color: var(--text-mid);
  font-size: 13px;
  font-weight: 700;
}

.login-field-control {
  position: relative;
}

.login-field-control__icon,
.login-password-toggle svg,
.auth-links svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.login-field-control__icon {
  position: absolute;
  top: 50%;
  left: 16px;
  z-index: 1;
  width: 20px;
  height: 20px;
  color: #5473a7;
  pointer-events: none;
  transform: translateY(-50%);
}

.login-field-control input {
  min-height: 54px;
  padding: 12px 52px;
  border-color: #cbd5e1;
  border-radius: 9px;
  font-size: 16px;
}

.login-field-control input:hover {
  border-color: #94a3b8;
}

.login-field-control input:focus {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(27, 120, 200, 0.12);
}

.login-password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #7183a0;
  cursor: pointer;
  transform: translateY(-50%);
}

.login-password-toggle:hover,
.login-password-toggle:focus-visible {
  background: #eef3fb;
  color: var(--navy);
  outline: none;
}

.login-password-toggle svg {
  width: 21px;
  height: 21px;
}

.login-card .message.is-error {
  margin: 0;
  border: 1px solid rgba(185, 28, 28, 0.18);
  border-radius: 9px;
  font-size: 14px;
}

.login-card .button {
  width: 100%;
  min-height: 54px;
  margin-top: 6px;
  border-radius: 9px;
  background: var(--navy);
  box-shadow: 0 8px 18px rgba(19, 59, 115, 0.18);
  font-size: 16px;
  font-weight: 700;
}

.login-card .button:hover,
.login-card .button:focus-visible {
  background: #174d93;
}

.login-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin: 28px 0 16px;
  color: var(--text-dim);
  font-size: 13px;
}

.login-divider::before,
.login-divider::after {
  height: 1px;
  content: "";
  background: var(--border);
}

.auth-links {
  display: grid;
  gap: 0;
  margin: 0;
}

.auth-links a {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 2px;
  border-bottom: 1px solid var(--border);
  color: var(--navy);
  font-size: 15px;
  font-weight: 700;
}

.auth-links a::after {
  content: "›";
  color: var(--blue-mid);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}

.auth-links a:hover,
.auth-links a:focus-visible {
  color: #174d93;
  outline: none;
}

.auth-links svg {
  width: 21px;
  height: 21px;
  color: #1554a0;
}

@media (max-width: 640px) {
  .login-shell {
    display: block;
    padding: 20px 16px;
  }

  .login-card {
    padding: 34px 24px 28px;
    border-radius: 16px;
  }

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

  .login-brand__mark {
    height: 72px;
  }

  .login-card .help {
    font-size: 15px;
  }
}

/* =========================================================
   Dashboard Foco — Design System v2
   Overrides aligned to the attached Editora Foco mockups.
   ========================================================= */

:root {
  --navy: #1A3C6B;
  --blue: #0071BC;
  --blue-mid: #1B78C8;
  --blue-pale: #E8F1FB;
  --bg: #EFEBE4;
  --surface: #FFFFFF;
  --surface2: #FAFAF8;
  --text: #111827;
  --text-mid: #4B5563;
  --text-dim: #9CA3AF;
  --border: #E0DBD3;
  --border-light: #EDE9E3;
  --pos: #15803D;
  --pos-bg: #DCFCE7;
  --neg: #B91C1C;
  --neg-bg: #FEE2E2;
  --year-hl: #FFFBEB;
  --year-hl-border: #FDE68A;
  --year-hl-text: #B45309;
  --color-primary: var(--navy);
  --color-primary-hover: #1E4A82;
  --color-primary-soft: var(--blue-pale);
  --color-primary-muted: rgba(27, 120, 200, 0.1);
  --color-bg: var(--bg);
  --color-surface: var(--surface);
  --color-border: var(--border);
  --color-text: var(--text);
  --color-text-muted: var(--text-mid);
  --color-success: var(--pos);
  --color-success-soft: var(--pos-bg);
  --color-warning: #B45309;
  --color-warning-soft: #FEF3C7;
  --color-danger: var(--neg);
  --color-danger-soft: var(--neg-bg);
  --shadow: 0 10px 24px rgba(17, 24, 39, 0.06);
  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-serif: "DM Sans", system-ui, sans-serif;
  --sidebar-w: 224px;
  --type-page-title: clamp(20px, 1.45vw, 24px);
  --type-title-lg: 20px;
  --type-title-md: 16px;
  --type-body-lg: 14px;
  --type-body-md: 13px;
  --type-body-sm: 12px;
  --type-caption: 11px;
  --type-caption-strong: 11.5px;
  --type-micro: 10.5px;
  --type-table-head: 12px;
  --type-table-body: 12px;
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-body: 1.45;
  --tracking-label: 0.09em;
}

html,
body {
  height: 100%;
  width: 100%;
}

.auth-page,
.login-shell {
  width: 100%;
  min-width: 100%;
  max-width: none;
}

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

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.45;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.shell {
  height: 100vh;
  width: 100%;
  max-width: none;
  overflow: hidden;
  align-items: stretch;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  backdrop-filter: none;
  box-shadow: none;
  overflow: hidden;
}

.brand {
  flex-shrink: 0;
  padding: 22px 18px 18px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--border-light);
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}

.brand__topline {
  min-height: auto;
  align-items: center;
  gap: 10px;
}

.brand__mark {
  width: 100%;
  height: 84px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--surface2);
  border-color: var(--border-light);
}

.nav {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  gap: 0;
  padding: 8px 0 12px;
}

.nav__group {
  gap: 0;
}

.nav__group + .nav__group {
  margin-top: 10px;
}

.nav__group-toggle {
  padding: 14px 18px 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.nav__group-toggle:hover {
  color: var(--text-mid);
}

.nav__group-toggle:focus {
  outline: none;
}

.nav__group-toggle:focus-visible {
  outline: 2px solid var(--blue-mid);
  outline-offset: -2px;
}

.nav__group-caret {
  font-size: 0.8rem;
}

.nav__group-items {
  display: grid;
  gap: 1px;
  padding-bottom: 8px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 1px 8px;
  padding: 8px 10px 8px 18px;
  border-radius: 7px;
  border: 0;
  color: var(--text-mid);
  font-size: 13.5px;
  font-weight: 400;
}

.nav a:hover {
  background: #F3F4F6;
  color: var(--text);
}

.nav a.is-active {
  background: var(--blue-pale);
  color: var(--blue-mid);
  font-weight: 600;
}

.nav a.is-active::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--blue-mid);
  flex-shrink: 0;
}

.nav a[data-short]::after {
  display: none;
}

.sidebar__footer {
  flex-shrink: 0;
  margin-top: 0;
  padding: 16px 18px 18px;
  gap: 10px;
  border-top: 1px solid var(--border-light);
  color: var(--text-mid);
  font-size: 13px;
}

.sidebar__footer-label,
.sidebar__footer-value {
  display: block;
}

.sidebar__footer-label {
  color: var(--text-dim);
  font-size: var(--type-micro);
  letter-spacing: var(--tracking-label);
}

.sidebar__footer-value {
  color: var(--text-mid);
  font-variant-numeric: tabular-nums;
}

.sidebar__logout-button {
  width: 100%;
}

.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow-y: auto;
  background: var(--bg);
}

.content::-webkit-scrollbar {
  width: 8px;
}

.content::-webkit-scrollbar-track {
  background: transparent;
}

.content::-webkit-scrollbar-thumb {
  background: #D4CEC4;
  border-radius: 999px;
}

.topbar,
.page-hd {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px 18px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.content > .topbar + .panel--fill,
.content > .topbar + .list-filter + .panel--fill,
.content > .topbar + .finance-bulk-panel + .panel--fill {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 32px;
  display: flex;
  flex-direction: column;
}

.content > .topbar + .panel--fill > .table-wrap,
.content > .topbar + .list-filter + .panel--fill > .table-wrap,
.content > .topbar + .finance-bulk-panel + .panel--fill > .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.content > .panel:not(.panel--fill),
.content > .cards,
.content > .grid-2,
.content > .grid-3,
.content > .panel-grid {
  flex-shrink: 0;
}

.content > .channel-report-shell {
  flex: 0 0 auto;
}

.page-title {
  margin: 0;
  font-size: 21px;
  line-height: 1.15;
  font-weight: 700;
  color: var(--text);
}

.page-subtitle,
.page-sub {
  margin: 4px 0 0;
  max-width: 72ch;
  color: var(--text-mid);
  font-size: 13px;
}

.page-crumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 4px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
}

.page-crumb a,
.page-crumb span {
  color: var(--text-mid);
}

.page-crumb a {
  text-decoration: none;
}

.page-crumb a:hover {
  color: var(--blue-mid);
}

.page-crumb span[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

.page-crumb__separator {
  color: var(--text-dim);
}

.list-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 16px;
  padding: 14px 32px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.list-filter__fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) minmax(132px, 0.55fr);
  gap: 12px;
}

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

.list-filter__field input,
.list-filter__field select {
  min-height: 40px;
  border-radius: 8px;
  background-color: var(--surface);
}

.list-filter__actions {
  align-self: end;
  flex-shrink: 0;
}

.list-filter__chips {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 600;
}

.toolbar {
  gap: 10px;
}

.button,
button.button,
input[type="submit"].button,
.btn,
.period-badge,
.dp-btn-cancel,
.dp-btn-apply {
  font-family: var(--font-sans);
}

.button,
button.button,
input[type="submit"].button {
  min-height: 40px;
  border-radius: 7px;
  background: var(--navy);
  box-shadow: none;
  color: white;
  font-weight: 600;
}

.button:hover,
button.button:hover,
input[type="submit"].button:hover {
  background: #1E4A82;
}

.button--ghost {
  background: var(--surface);
  color: var(--text-mid);
  border: 1px solid var(--border);
}

.button--ghost:hover {
  background: var(--blue-pale);
  border-color: var(--blue-mid);
  color: var(--blue-mid);
}

.button--danger {
  background: var(--neg);
}

.button--danger:hover {
  background: #991B1B;
}

.button__icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.button__icon svg,
.delete-import-modal svg,
.delete-confirmation-modal svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button--table-action {
  min-height: 32px;
  padding: 0 10px;
  gap: 6px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.table-actions {
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  min-width: 148px;
}

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

.import-actions-cell {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.button--icon {
  min-width: 40px;
  padding: 0;
}

.card,
.panel,
.login-card,
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.delete-import-modal,
.delete-confirmation-modal,
.finance-suggestion-confirmation-modal {
  width: min(520px, calc(100vw - 32px));
  overflow: hidden;
}

.delete-import-modal::backdrop,
.delete-confirmation-modal::backdrop,
.finance-suggestion-confirmation-modal::backdrop {
  background: rgba(17, 24, 39, 0.42);
  backdrop-filter: blur(4px);
}

.delete-import-modal__body,
.delete-confirmation-modal__body {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  padding: 24px 24px 20px;
}

.delete-import-modal__mark,
.delete-confirmation-modal__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(185, 28, 28, 0.16);
  border-radius: 12px;
  background: var(--neg-bg);
  color: var(--neg);
}

.delete-import-modal__mark svg,
.delete-confirmation-modal__mark svg {
  width: 22px;
  height: 22px;
}

.delete-import-modal__eyebrow,
.delete-confirmation-modal__eyebrow {
  margin: 0 0 6px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.delete-import-modal__title,
.delete-confirmation-modal__title {
  margin: 0;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.25;
}

.delete-import-modal__copy,
.delete-confirmation-modal__copy {
  margin: 10px 0 0;
  color: var(--text-mid);
  font-size: 14px;
  line-height: 1.55;
}

.delete-import-modal__file,
.delete-confirmation-modal__target {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.delete-confirmation-modal__field {
  margin-top: 14px;
}

.delete-confirmation-modal__field input {
  text-transform: uppercase;
}

.delete-confirmation-modal__actions,
.delete-import-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--surface2);
}

.finance-suggestion-confirmation-modal__body {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  padding: 24px 24px 20px;
}

.finance-suggestion-confirmation-modal__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(27, 120, 200, 0.2);
  border-radius: 12px;
  background: var(--blue-pale);
  color: var(--blue-mid);
}

.finance-suggestion-confirmation-modal__mark svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.finance-suggestion-confirmation-modal__eyebrow {
  margin: 0 0 6px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.finance-suggestion-confirmation-modal__title {
  margin: 0;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
}

.finance-suggestion-confirmation-modal__copy {
  margin: 10px 0 0;
  color: var(--text-mid);
  font-size: 14px;
  line-height: 1.55;
}

.finance-suggestion-confirmation-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--surface2);
}

.card--soft {
  background: linear-gradient(180deg, #FFFDFB, #FFF9F4);
}

.card__label,
.table-card-hd-title,
.nav__group-toggle,
.kpi-lbl {
  color: var(--text-dim);
}

.card__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.card__value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}

.panel__header,
.table-card-hd,
.panel__body,
.message,
.field input,
.field select,
.field textarea {
  border-color: var(--border);
}

.field label {
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  min-height: 42px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(27, 120, 200, 0.14);
  outline-offset: 0;
  border-color: var(--blue-mid);
}

.badge,
.status-pill,
.chip-row {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text-mid);
}

.message.is-success,
.badge--success {
  background: var(--pos-bg);
  border-color: rgba(21, 128, 61, 0.18);
}

.message.is-error,
.badge--danger {
  background: var(--neg-bg);
  border-color: rgba(185, 28, 28, 0.18);
}

.message.is-warning,
.badge--warning {
  background: var(--warning-soft, #FEF3C7);
  border-color: rgba(180, 83, 9, 0.18);
}

.progress {
  background: #EAE5DC;
}

.progress__bar {
  background: var(--navy);
}

.modal::backdrop {
  background: rgba(17, 24, 39, 0.34);
}

.login-card h1 {
  font-size: 21px;
  font-weight: 700;
}

.table-wrap {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-gutter: stable;
}

.panel__body.table-wrap {
  padding-top: 0;
}

table.app-table,
.report-table {
  border-collapse: separate;
  border-spacing: 0;
}

.app-table th,
.app-table td {
  border-bottom-color: var(--border-light);
}

.app-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.09em;
}

.app-table tbody tr:hover {
  background: rgba(27, 120, 200, 0.04);
}

.app-table--cfop-rules,
.app-table--return-rules {
  table-layout: fixed;
}

.app-table--cfop-rules {
  min-width: 980px;
}

.app-table--return-rules {
  min-width: 900px;
}

.app-table--ignored-quantity {
  min-width: 980px;
  table-layout: fixed;
}

.app-table--ignored-quantity th:nth-child(1),
.app-table--ignored-quantity td:nth-child(1) {
  width: 7%;
}

.app-table--ignored-quantity th:nth-child(2),
.app-table--ignored-quantity td:nth-child(2) {
  width: 36%;
}

.app-table--ignored-quantity th:nth-child(3),
.app-table--ignored-quantity td:nth-child(3) {
  width: 22%;
}

.app-table--ignored-quantity th:nth-child(4),
.app-table--ignored-quantity td:nth-child(4) {
  width: 13%;
}

.app-table--ignored-quantity th:nth-child(5),
.app-table--ignored-quantity td:nth-child(5) {
  width: 22%;
}

.app-table__actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: nowrap;
}

.app-table__actions form {
  margin: 0;
}

.app-table__actions .button {
  white-space: nowrap;
}

.app-table--cfop-rules th:nth-child(1),
.app-table--cfop-rules td:nth-child(1) {
  width: 8%;
}

.app-table--cfop-rules th:nth-child(2),
.app-table--cfop-rules td:nth-child(2) {
  width: 43%;
}

.app-table--cfop-rules th:nth-child(3),
.app-table--cfop-rules td:nth-child(3) {
  width: 18%;
  padding-right: 30px;
}

.app-table--cfop-rules th:nth-child(4),
.app-table--cfop-rules td:nth-child(4) {
  width: 15%;
  padding-left: 18px;
}

.app-table--cfop-rules th:nth-child(5),
.app-table--cfop-rules td:nth-child(5) {
  width: 10%;
}

.app-table--cfop-rules th:nth-child(6),
.app-table--cfop-rules td:nth-child(6) {
  width: 6%;
}

.app-table--return-rules th:nth-child(1),
.app-table--return-rules td:nth-child(1) {
  width: 30%;
}

.app-table--return-rules th:nth-child(2),
.app-table--return-rules td:nth-child(2) {
  width: 14%;
  padding-right: 26px;
}

.app-table--return-rules th:nth-child(3),
.app-table--return-rules td:nth-child(3) {
  width: 18%;
  padding-right: 30px;
}

.app-table--return-rules th:nth-child(4),
.app-table--return-rules td:nth-child(4) {
  width: 18%;
  padding-left: 26px;
}

.app-table--return-rules th:nth-child(5),
.app-table--return-rules td:nth-child(5) {
  width: 24%;
}

.page-hd + .kpi-strip {
  border-bottom: 1px solid var(--border);
}

.kpi-strip {
  display: flex;
  gap: 12px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.kpi-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.kpi-card.highlight {
  background: var(--year-hl);
  border-color: var(--year-hl-border);
}

.kpi-lbl {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kpi-val {
  color: var(--text);
  font-size: 26px;
  line-height: 1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.kpi-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.kpi-dv {
  color: var(--text-dim);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.delta-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.delta-pill.pos {
  background: var(--pos-bg);
  color: var(--pos);
}

.delta-pill.neg {
  background: var(--neg-bg);
  color: var(--neg);
}

.delta-pill.neu {
  background: #F3F4F6;
  color: var(--text-dim);
}

.table-card {
  margin: 24px 32px 40px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.table-card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 20px 11px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface2);
}

.table-card-hd-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

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

.table-card-actions .button,
.table-card-actions .btn,
.table-card-actions .button--ghost {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 12.5px;
}

.report-table {
  width: 100%;
  font-variant-numeric: tabular-nums;
}

.report-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 10px 16px 9px;
  background: var(--surface2);
  border-bottom: 2px solid var(--border);
  color: var(--text-mid);
  text-align: right;
  vertical-align: bottom;
  white-space: nowrap;
}

.report-table thead th:first-child {
  text-align: left;
  min-width: 192px;
}

.report-table thead th.cur {
  background: var(--year-hl);
  border-bottom-color: var(--year-hl-border);
}

.th-yr {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.th-yr.cur {
  color: var(--year-hl-text);
}

.th-range {
  display: block;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 400;
}

.cur-badge {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--year-hl-text);
  color: white;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.report-table tbody tr {
  border-bottom: 1px solid var(--border-light);
}

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

.report-table td {
  padding: 0;
  border-right: 1px solid #F0ECE8;
  vertical-align: top;
}

.report-table td:last-child {
  border-right: 0;
}

.report-table .td-in {
  padding: 11px 16px;
}

.td-name-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 16px;
}

.td-name {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}

.td-name.total {
  font-size: 14px;
  font-weight: 700;
}

.td-name.sub {
  padding-left: 22px;
  color: var(--text-mid);
  font-size: 13px;
  font-weight: 400;
}

.sparkline-wrap {
  flex-shrink: 0;
  opacity: 0.7;
}

.xbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.1s, color 0.1s, transform 0.2s;
}

.xbtn:hover {
  background: var(--blue-pale);
  color: var(--blue-mid);
}

.xbtn.open {
  transform: rotate(90deg);
}

.td-val {
  text-align: right;
}

.td-val.cur {
  background: var(--year-hl);
}

.v-main {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.v-main.dim {
  color: var(--text-dim);
  font-weight: 400;
}

.v-dv {
  display: block;
  margin-top: 1px;
  color: var(--text-dim);
  font-size: 11.5px;
}

.v-delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
  padding: 1.5px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.v-delta.pos {
  background: var(--pos-bg);
  color: var(--pos);
}

.v-delta.neg {
  background: var(--neg-bg);
  color: var(--neg);
}

.v-delta.na {
  background: #F3F4F6;
  color: var(--text-dim);
  font-weight: 400;
}

.tr-total td {
  background: #F2F7FD;
}

.tr-total:hover td {
  background: #EBF3FC !important;
}

.tr-sub td {
  background: var(--surface2);
}

.tr-hidden {
  display: none;
}

.period-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-mid);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: none;
  cursor: pointer;
}

.period-badge:hover,
.period-badge.is-open {
  border-color: var(--blue-mid);
  background: var(--blue-pale);
  color: var(--blue-mid);
}

.period-badge__icon,
.dp-chevron {
  color: var(--text-dim);
  flex-shrink: 0;
}

.period-badge:hover .period-badge__icon,
.period-badge:hover .dp-chevron,
.period-badge.is-open .period-badge__icon,
.period-badge.is-open .dp-chevron {
  color: var(--blue-mid);
}

.dp-wrap {
  position: relative;
}

.dp-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  z-index: 200;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.13);
}

.dp-section-label {
  padding: 11px 14px 7px;
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.dp-presets {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 6px 6px;
}

.dp-preset {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-mid);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
}

.dp-preset:hover {
  background: #F3F4F6;
  color: var(--text);
}

.dp-preset.active {
  background: var(--blue-pale);
  color: var(--blue-mid);
  font-weight: 600;
}

.dp-preset-range {
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 400;
}

.dp-preset.active .dp-preset-range {
  color: var(--blue-mid);
  opacity: 0.7;
}

.dp-divider {
  height: 1px;
  margin: 4px 0;
  background: var(--border-light);
}

.dp-custom {
  padding: 6px 14px 10px;
}

.dp-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.dp-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dp-field label {
  color: var(--text-mid);
  font-size: 11.5px;
  font-weight: 500;
}

.dp-field input[type="date"] {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12.5px;
  cursor: pointer;
}

.dp-field input[type="date"]:focus {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(27, 120, 200, 0.12);
  outline: none;
}

.dp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-light);
}

.dp-applied-label {
  color: var(--text-dim);
  font-size: 11.5px;
}

.dp-btns {
  display: flex;
  gap: 8px;
}

.dp-btn-cancel {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-mid);
}

.dp-btn-cancel:hover {
  background: #F3F4F6;
}

.dp-btn-apply {
  border: 0;
  background: var(--navy);
  color: white;
  font-weight: 600;
}

.dp-btn-apply:hover {
  background: #1E4A82;
}

.is-hidden {
  display: none;
}

.table-card .button--ghost,
.table-card .btn-ghost {
  background: var(--surface);
  color: var(--text-mid);
  border: 1px solid var(--border);
}

.table-card .button--ghost:hover,
.table-card .btn-ghost:hover {
  background: var(--blue-pale);
  border-color: var(--blue-mid);
  color: var(--blue-mid);
}

.channel-date-form {
  display: flex;
  align-items: end;
  gap: 8px;
}

.channel-date-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.channel-date-field label {
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.channel-date-field input[type="date"] {
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12.5px;
}

.channel-report-shell {
  margin: 0 32px 40px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.channel-report-shell--empty {
  padding: 18px;
}

.channel-alert {
  padding: 14px 16px;
  border: 1px solid var(--neg-bg);
  border-radius: 8px;
  background: #FFF7F7;
  color: var(--neg);
  font-weight: 700;
}

.channel-report-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFAF8 100%);
}

.channel-kicker {
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.channel-period-title {
  margin-top: 3px;
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
}

.channel-note {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--text-mid);
  font-size: 12.5px;
}

.channel-summary-line {
  display: grid;
  grid-template-columns: repeat(4, minmax(104px, auto));
  align-items: stretch;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.channel-summary-line > div {
  padding: 10px 12px;
  border-right: 1px solid var(--border-light);
  text-align: right;
}

.channel-summary-line > div:last-child {
  border-right: 0;
}

.channel-summary-line span {
  display: block;
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.channel-summary-line strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.segment-summary-line small {
  display: block;
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.segment-summary-line small.pos {
  color: var(--pos);
}

.segment-summary-line small.neg {
  color: var(--neg);
}

.segment-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding: 8px 14px 8px 18px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface2);
}

.segment-history {
  border-bottom: 0;
}

.segment-history-table .td-name-wrap {
  padding: 0;
}

.segment-history-table .td-name-wrap strong {
  display: inline-block;
}

.segment-history-table .xbtn {
  margin-right: 2px;
}

.segment-history-table .sparkline-wrap {
  margin-left: 2px;
}

.channel-summary-line strong.pos,
.channel-detail-table .pos,
.channel-reconciliation .pos {
  color: var(--pos);
}

.channel-summary-line strong.neg,
.channel-detail-table .neg,
.channel-reconciliation .neg,
.neg-text {
  color: var(--neg);
}

.channel-history {
  overflow-x: auto;
  border-bottom: 1px solid var(--border-light);
}

.channel-report-shell[data-table-workspace="flow"] .channel-history,
.channel-report-shell[data-table-workspace="flow"] .table-wrap {
  max-height: calc(100vh - 300px);
  overflow: auto;
  overscroll-behavior: contain;
}

.channel-report-shell[data-table-workspace="flow"] .channel-history-table tbody td:first-child {
  z-index: 3;
}

.channel-report-shell[data-table-workspace="flow"] :is(.channel-history-table, .channel-detail-table) :is(thead th, thead th *, tbody td, tbody td *, tfoot th, tfoot th *) {
  font-size: var(--type-table-body);
  line-height: var(--leading-snug);
}

.channel-report-shell[data-table-workspace="flow"] :is(.channel-history-table, .channel-detail-table) :is(.v-main, tbody td strong) {
  font-weight: 600;
  overflow-wrap: normal;
  white-space: nowrap;
}

.channel-report-shell[data-table-workspace="flow"] :is(.channel-history-table .channel-child-label, .channel-detail-table .channel-child-strong) {
  font-weight: 400;
}

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

.channel-history-table th,
.channel-history-table td {
  padding: 9px 12px;
  border-right: 1px solid #EEEAE4;
  border-bottom: 1px dashed #D9D2C8;
  text-align: right;
  vertical-align: top;
}

.channel-history-table th:first-child,
.channel-history-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 4;
  min-width: 190px;
  background: var(--surface);
  text-align: left;
}

.channel-history-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface2);
}

.channel-history-table th.cur,
.channel-history-table td.cur {
  background: var(--year-hl);
}

.channel-history-table td strong {
  display: block;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 800;
}

.channel-history-table td span {
  display: block;
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 11px;
}

.channel-history-table .dim {
  color: var(--text-dim);
  font-weight: 500;
}

.channel-total-row td {
  background: #F2F7FD;
}

.channel-group-row td {
  background: #F8F6F1;
}

.channel-group-row td:first-child {
  background: #F8F6F1;
}

.channel-child-row td:first-child {
  background: var(--surface);
}

.channel-child-label,
.channel-child-strong {
  display: inline-block;
  padding-left: 18px;
}

.channel-history-table td .channel-child-label {
  color: var(--text-mid);
  font-size: 14px;
  font-weight: 400;
}

.channel-group-row--clients td {
  padding-top: 0;
  background: #FBFAF7;
}

.channel-mini-delta.neg {
  color: var(--neg);
}

.channel-mini-delta.pos {
  color: var(--pos);
}

.channel-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px 12px;
}

.channel-detail-head h2 {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
}

.channel-reconciliation {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-mid);
  font-size: 12px;
}

.channel-reconciliation strong {
  color: var(--text);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.channel-detail-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.channel-report-shell .table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.channel-detail-table th,
.channel-detail-table td {
  overflow-wrap: anywhere;
}

.channel-detail-table th:first-child,
.channel-detail-table td:first-child {
  width: 22%;
}

.channel-detail-table th:not(:first-child),
.channel-detail-table td:not(:first-child) {
  width: 9.75%;
}

.channel-detail-table tfoot th {
  padding: 12px 16px;
  border-top: 2px solid var(--border);
  background: #F2F7FD;
  color: var(--text);
  font-size: 13px;
}

.channel-name-cell {
  min-width: 0;
  padding: 12px 16px;
}

.channel-name-cell > strong {
  display: block;
  color: var(--text);
  font-size: 13.5px;
}

.channel-detail-table .channel-name-cell > .channel-child-strong {
  color: var(--text-mid);
  font-size: 15px;
  font-weight: 400;
}

.channel-clients {
  margin-top: 5px;
}

.channel-clients summary {
  width: fit-content;
  color: var(--blue-mid);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.channel-clients ul {
  display: grid;
  gap: 3px;
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
}

.channel-clients li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  color: var(--text-mid);
  font-size: 11.5px;
}

.channel-clients li span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.channel-clients li strong {
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.report-ranking-drawer-open {
  overflow: hidden;
}

.report-ranking-drawer {
  position: fixed;
  inset: 0;
  z-index: 70;
}

.report-ranking-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.28);
  backdrop-filter: blur(2px);
}

.report-ranking-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(1120px, calc(100vw - 56px));
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 32px rgba(17, 24, 39, 0.12);
}

.report-ranking-drawer__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
}

.report-ranking-drawer__eyebrow {
  margin: 0 0 6px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.report-ranking-drawer__title {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.report-ranking-drawer__subtitle {
  margin: 10px 0 0;
  color: var(--text-mid);
  font-size: 13px;
  line-height: 1.5;
}

.report-ranking-drawer__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface2);
}

.report-ranking-drawer__limit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.report-ranking-drawer__limit input {
  width: 88px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.report-ranking-drawer__quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.report-ranking-drawer__quick-button {
  min-width: 42px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.report-ranking-drawer__quick-button.is-active {
  border-color: var(--blue-mid);
  background: var(--blue-pale);
  color: var(--blue-mid);
}

.report-ranking-drawer__table-wrap {
  overflow: auto;
  background: var(--surface);
}

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

.report-ranking-table th,
.report-ranking-table td {
  padding: 12px 14px;
  border-right: 1px solid #EEEAE4;
  border-bottom: 1px dashed #D9D2C8;
  vertical-align: top;
}

.report-ranking-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface2);
  text-align: left;
}

.report-ranking-table th.cur,
.report-ranking-table td.cur {
  background: var(--year-hl);
}

.report-ranking-table th:first-child,
.report-ranking-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 74px;
  min-width: 74px;
  background: var(--surface);
}

.report-ranking-table thead th:first-child {
  z-index: 4;
  background: var(--surface2);
}

.report-ranking-table__position {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.report-ranking-table__position--other {
  color: var(--text);
  text-transform: uppercase;
}

.report-ranking-table__cell strong {
  display: block;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.report-ranking-table__cell span {
  display: block;
  margin-top: 4px;
  color: var(--text-mid);
  font-size: 12px;
  line-height: 1.4;
}

.report-ranking-table__row--other td {
  background: #F8F6F1;
}

.report-ranking-table__row--other td:first-child {
  background: #F8F6F1;
}

.report-ranking-table__empty {
  color: var(--text-mid);
  text-align: center;
}

.report-ranking-drawer__footer {
  padding: 18px 24px 22px;
  border-top: 1px solid var(--border-light);
  background: var(--surface2);
}

.report-ranking-drawer__summary strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.report-ranking-drawer__summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.report-ranking-drawer__summary-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.report-ranking-drawer__summary-item strong {
  margin: 0;
  font-size: 13px;
}

.report-ranking-drawer__summary-item span {
  color: var(--text-mid);
  font-size: 12px;
  line-height: 1.4;
}

.segment-contextual-ranking-trigger {
  display: inline-flex;
  align-items: center;
  margin: -5px -7px;
  padding: 5px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: inherit;
}

.segment-contextual-ranking-trigger:hover,
.segment-contextual-ranking-trigger:focus-visible {
  background: var(--blue-pale);
  color: var(--blue-mid);
  outline: none;
}

.segment-contextual-ranking-drawer .report-ranking-drawer__panel {
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(620px, calc(100vw - 56px));
}

.segment-contextual-ranking-drawer__years {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface2);
}

.segment-contextual-ranking-drawer__total {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.segment-contextual-ranking-year {
  min-width: 48px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-mid);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.segment-contextual-ranking-year:hover,
.segment-contextual-ranking-year:focus-visible,
.segment-contextual-ranking-year.is-active {
  border-color: var(--blue-mid);
  background: var(--blue-pale);
  color: var(--blue-mid);
  outline: none;
}

.segment-contextual-ranking-drawer__content {
  overflow: auto;
  background: var(--surface);
}

.segment-contextual-ranking-state {
  margin: 0;
  padding: 32px 24px;
  color: var(--text-mid);
  font-size: 13px;
  text-align: center;
}

.segment-contextual-ranking-state--error {
  color: var(--neg);
}

.segment-contextual-ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.segment-contextual-ranking-table th,
.segment-contextual-ranking-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-light);
}

.segment-contextual-ranking-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--text-dim);
  background: var(--surface2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.segment-contextual-ranking-table th:nth-child(3),
.segment-contextual-ranking-table th:nth-child(4),
.segment-contextual-ranking-table td:nth-child(3),
.segment-contextual-ranking-table td:nth-child(4) {
  text-align: right;
}

.segment-contextual-ranking-table td:first-child {
  width: 30px;
  color: var(--text-dim);
  font-weight: 700;
}

.segment-contextual-ranking-table td:nth-child(2) {
  max-width: 260px;
}

.segment-contextual-ranking-table td:nth-child(2) strong {
  display: block;
  overflow-wrap: anywhere;
}

.segment-contextual-ranking-table__other td {
  background: #F8F6F1;
}

.segment-contextual-ranking-table__other span {
  display: block;
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 11px;
}

.segment-contextual-ranking-table__total td {
  border-top: 1px solid var(--border);
  border-bottom: 0;
  background: var(--surface2);
  font-weight: 700;
}

.segment-contextual-ranking-table .is-top-three td:first-child {
  color: var(--blue-mid);
}

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

  .sidebar {
    position: relative;
    width: 100%;
    min-width: 0;
    height: auto;
    max-height: none;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .content {
    overflow: visible;
  }

  .page-hd,
  .topbar,
  .kpi-strip {
    padding-left: 18px;
    padding-right: 18px;
  }

  .table-card {
    margin-left: 18px;
    margin-right: 18px;
  }

  .channel-report-shell {
    margin-left: 18px;
    margin-right: 18px;
  }

  .channel-report-top {
    grid-template-columns: 1fr;
  }

  .channel-summary-line {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .list-filter {
    grid-template-columns: 1fr;
  }

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

  .list-filter__actions {
    justify-content: flex-start;
  }

  .report-ranking-drawer__panel {
    width: 100vw;
  }

  .segment-contextual-ranking-drawer .report-ranking-drawer__panel {
    width: min(620px, 100vw);
  }

  .report-ranking-table {
    min-width: 760px;
  }
}

@media (max-width: 860px) {
  .sidebar {
    padding: 0;
  }

  .page-hd,
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .list-filter {
    padding-left: 18px;
    padding-right: 18px;
  }

  .list-filter__fields {
    grid-template-columns: 1fr;
  }

  .kpi-strip {
    flex-direction: column;
  }

  .table-card-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .channel-date-form,
  .channel-detail-head,
  .channel-reconciliation {
    align-items: stretch;
    flex-direction: column;
  }

  .channel-date-form .button {
    width: 100%;
  }

  .channel-summary-line {
    grid-template-columns: 1fr;
  }

  .channel-summary-line > div {
    border-right: 0;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
  }

  .channel-summary-line > div:last-child {
    border-bottom: 0;
  }

  .report-ranking-drawer__controls {
    align-items: flex-start;
    flex-direction: column;
  }

  .dp-wrap {
    width: 100%;
  }

  .dp-popover {
    left: 0;
    right: 0;
    width: auto;
  }

  .button,
  button.button,
  input[type="submit"].button {
    width: 100%;
  }
}

/* =========================================================
   Dashboard Foco — Interface polish
   Visual-only refinements for the operational shell.
   ========================================================= */

:root {
  --sidebar-w: 236px;
  --sidebar-collapsed-w: 76px;
  --bg: #F1EEE8;
  --surface2: #FBFAF8;
  --shadow: 0 8px 22px rgba(17, 24, 39, 0.055);
}

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

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

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: linear-gradient(180deg, #FFFFFF 0%, #FBFAF8 100%);
}

.shell.is-sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-w);
  min-width: var(--sidebar-collapsed-w);
  padding: 0;
}

.brand {
  padding: 18px 16px 16px;
}

.brand__mark {
  flex: 1 1 auto;
  min-width: 0;
  height: 76px;
  background: #FFFFFF;
  box-shadow: inset 0 0 0 1px rgba(26, 60, 107, 0.04);
}

.brand__topline .button--icon {
  flex: 0 0 40px;
}

.button--icon {
  border-radius: 9px;
}

.shell.is-sidebar-collapsed .brand {
  padding: 12px 10px;
}

.shell.is-sidebar-collapsed .brand__topline {
  justify-content: center;
}

.shell.is-sidebar-collapsed .button--icon {
  width: 44px;
  min-width: 44px;
}

.nav {
  padding: 10px 0 14px;
}

.nav__group-toggle {
  padding: 15px 20px 7px;
}

.nav a {
  position: relative;
  min-height: 38px;
  margin: 1px 10px;
  padding: 9px 12px 9px 16px;
  border-radius: 9px;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.nav__icon {
  display: none;
}

.nav__icon svg {
  display: block;
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav a:hover {
  transform: translateX(1px);
}

.nav a.is-active {
  background: linear-gradient(90deg, rgba(27, 120, 200, 0.13), rgba(27, 120, 200, 0.07));
  color: var(--navy);
}

.nav a.is-active::before {
  width: 3px;
  height: 22px;
  border-radius: 999px;
  background: var(--blue-mid);
}

.shell.is-sidebar-collapsed .brand__mark,
.shell.is-sidebar-collapsed .nav__label,
.shell.is-sidebar-collapsed .nav__group-toggle {
  display: none;
}

.shell.is-sidebar-collapsed .nav {
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.shell.is-sidebar-collapsed .nav__group,
.shell.is-sidebar-collapsed .nav__group-items {
  width: 100%;
}

.shell.is-sidebar-collapsed .nav__group-items {
  display: grid !important;
  gap: 8px;
  padding-bottom: 0;
}

.shell.is-sidebar-collapsed .nav a {
  width: 48px;
  min-height: 44px;
  margin: 0 auto;
  padding: 0;
  justify-content: center;
  border: 1px solid transparent;
}

.shell.is-sidebar-collapsed .nav a::before {
  display: none;
}

.shell.is-sidebar-collapsed .nav a::after {
  display: none;
  content: "";
}

.shell.is-sidebar-collapsed .nav__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--text-mid);
}

.shell.is-sidebar-collapsed .nav a.is-active {
  border-color: rgba(27, 120, 200, 0.16);
  background: var(--blue-pale);
}

.shell.is-sidebar-collapsed .nav a.is-active .nav__icon {
  color: var(--navy);
}

.shell.is-sidebar-collapsed .sidebar__footer {
  display: grid;
  place-items: center;
  min-height: 52px;
  padding: 12px;
}

.shell.is-sidebar-collapsed .sidebar__footer-label,
.shell.is-sidebar-collapsed .sidebar__footer-value {
  display: none;
}

.shell.is-sidebar-collapsed .sidebar__footer::before {
  content: "↻";
  color: var(--text-dim);
  font-size: 18px;
}

.topbar,
.page-hd {
  padding: 22px 34px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(241, 238, 232, 0.94)),
    var(--bg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72) inset;
}

.page-title {
  font-size: clamp(22px, 1.7vw, 30px);
  letter-spacing: -0.025em;
}

.page-subtitle,
.page-sub {
  margin-top: 7px;
  font-size: 14px;
}

.page-hd-right {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.page-crumb {
  margin-bottom: 7px;
  font-size: 12.5px;
}

.content > .cards {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin: 20px 34px 34px;
}

.content > .panel:not(.panel--fill),
.content > .grid-2,
.content > .grid-3,
.content > .panel-grid {
  margin-left: 34px;
  margin-right: 34px;
}

.content > .panel:not(.panel--fill) {
  margin-top: 20px;
}

.content > .panel:not(.panel--fill):last-child,
.content > .grid-2:last-child,
.content > .grid-3:last-child,
.content > .panel-grid:last-child {
  margin-bottom: 34px;
}

.content > .channel-report-shell:last-child {
  margin-bottom: 34px;
}

.card {
  padding: 18px;
  border-color: rgba(224, 219, 211, 0.86);
  box-shadow: var(--shadow);
}

.action-card {
  display: flex;
  min-height: 136px;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  position: relative;
  overflow: hidden;
}

.action-card__main {
  display: grid;
  gap: 8px;
}

.action-card__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.action-card--attention {
  border-color: rgba(190, 121, 30, 0.36);
  background: linear-gradient(135deg, #fffaf2 0%, #fffefd 54%, #fff6e8 100%);
  box-shadow: 0 14px 34px rgba(127, 74, 17, 0.13);
}

.action-card--attention::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: #c7781e;
}

.action-card--attention .card__label,
.action-card--attention .card__value {
  color: #7b3f00;
}

.status-pill--attention {
  border-color: rgba(190, 121, 30, 0.28);
  background: #fff3df;
  color: #874805;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.card__label {
  color: #7A8493;
}

.card__value {
  margin-top: 2px;
  font-size: clamp(1.5rem, 1.9vw, 2rem);
  line-height: 1;
  color: var(--navy);
}

.card__meta {
  margin-top: 0;
  color: var(--text-mid);
  font-size: 13.5px;
}

.button,
button.button,
input[type="submit"].button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.button:hover,
button.button:hover,
input[type="submit"].button:hover {
  transform: translateY(-1px);
}

.button--compact,
.app-table .button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
}

.button--attention {
  border-color: rgba(190, 121, 30, 0.42);
  background: #fff8ed;
  color: #7b3f00;
}

.button--attention:hover {
  border-color: #b5640f;
  background: #fbeedc;
  color: #6a3600;
}

.button--back {
  min-height: 36px;
  padding-inline: 12px 14px;
}

.button--back::before {
  content: "<";
  color: currentColor;
  font-weight: 800;
}

.page-hd-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.card__action {
  width: fit-content;
  min-width: 82px;
  align-self: flex-start;
}

.card__action::after {
  content: ">";
  margin-left: 2px;
  color: currentColor;
}

.operation-sections {
  display: grid;
  gap: 30px;
  margin: 24px 34px 36px;
}

.operation-section {
  min-width: 0;
}

.operation-section__header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.operation-section__header h2 {
  margin: 0;
  color: #737d8b;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.operation-section__header > span {
  width: 100%;
  height: 1px;
  background: var(--border);
}

.operation-card-grid {
  display: grid;
  gap: 16px;
}

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

.operation-card-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.operation-card {
  min-width: 0;
  min-height: 174px;
  overflow: hidden;
  border: 1px solid rgba(224, 219, 211, 0.9);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.055);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.operation-card:hover,
.operation-card:focus-within {
  border-color: rgba(27, 120, 200, 0.36);
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.085);
  transform: translateY(-1px);
}

.operation-card--wide {
  grid-column: span 2;
}

.operation-card__link {
  position: relative;
  display: flex;
  height: 100%;
  min-height: inherit;
  padding: 22px 24px 20px;
  flex-direction: column;
  align-items: flex-start;
}

.operation-card__link:focus-visible {
  outline: 3px solid rgba(27, 120, 200, 0.28);
  outline-offset: -3px;
}

.operation-card__icon {
  display: inline-flex;
  width: 40px;
  height: 40px;
  margin-bottom: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--blue-pale);
  color: var(--blue);
}

.operation-card__icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.operation-card__icon svg path[d^="M4 5"] {
  fill: currentColor;
  stroke: none;
}

.operation-card h3 {
  margin: 0 0 7px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.operation-card p {
  max-width: 72ch;
  margin: 0;
  color: var(--text-mid);
  font-size: 13.5px;
  line-height: 1.5;
}

.operation-card__meta {
  margin-top: 10px;
  color: #7d8795;
  font-size: 12.5px;
}

.operation-card__meta strong {
  color: var(--text-mid);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.operation-card__action {
  display: inline-flex;
  margin-top: auto;
  padding-top: 18px;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 750;
}

.operation-card__action > span {
  font-size: 17px;
  line-height: 1;
  transition: transform 150ms ease;
}

.operation-card:hover .operation-card__action > span,
.operation-card:focus-within .operation-card__action > span {
  transform: translateX(3px);
}

.operation-card--compact {
  min-height: 158px;
}

.operation-card--compact .operation-card__link {
  padding-right: 78px;
}

.operation-card--compact .operation-card__icon {
  position: absolute;
  top: 20px;
  right: 20px;
  margin: 0;
}

.operation-card--attention {
  min-height: 142px;
  border-color: rgba(217, 154, 37, 0.5);
  border-left: 5px solid #d99a25;
  background: #fffbeb;
  box-shadow: 0 8px 22px rgba(127, 74, 17, 0.07);
}

.operation-card--attention:hover,
.operation-card--attention:focus-within {
  border-color: rgba(217, 154, 37, 0.72);
  border-left-color: #c47f12;
}

.operation-card--attention .operation-card__link {
  padding-right: 170px;
}

.operation-card--attention .operation-card__action {
  color: #b45309;
}

.operation-card__badge {
  position: absolute;
  top: 20px;
  right: 22px;
  padding: 5px 10px;
  border: 1px solid #fde68a;
  border-radius: 999px;
  background: #fef3c7;
  color: #b45309;
  font-size: 11.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.list-summary {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 6px 8px 6px 14px;
  border: 1px solid rgba(224, 219, 211, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.045);
  color: var(--text-mid);
  white-space: nowrap;
}

.list-summary__value {
  color: var(--navy);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.list-summary__label {
  margin-left: 3px;
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 600;
}

.list-summary__divider {
  width: 1px;
  height: 22px;
  background: var(--border);
}

.list-summary__percent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--blue-pale);
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.panel {
  border-color: rgba(224, 219, 211, 0.86);
}

.panel__header {
  background: var(--surface2);
}

.count-badge {
  background: rgba(27, 120, 200, 0.08);
  color: var(--navy);
}

.finance-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 34px 0;
}

.finance-summary-card {
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid rgba(224, 219, 211, 0.9);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.045);
}

.finance-summary-card--highlight {
  border-color: var(--year-hl-border);
  background: var(--year-hl);
}

.finance-summary-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.finance-summary-card strong {
  display: block;
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.finance-filter {
  margin-top: 20px;
}

.finance-filter .list-filter__fields {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.finance-entry-topbar {
  align-items: end;
  margin-bottom: 0;
}

.finance-entry-list-filter {
  padding: 12px;
}

.finance-entry-filter-primary {
  display: grid;
  grid-template-columns:
    minmax(220px, 1.35fr)
    minmax(132px, 0.72fr)
    minmax(132px, 0.72fr)
    minmax(148px, 0.82fr)
    minmax(190px, 1fr)
    auto;
  gap: 10px;
  align-items: end;
}

.finance-entry-filter-primary__actions {
  justify-content: flex-end;
  align-self: end;
  min-height: 36px;
}

.finance-advanced-filters {
  position: relative;
}

.finance-advanced-filters summary {
  list-style: none;
  cursor: pointer;
}

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

.finance-advanced-filters__panel {
  position: absolute;
  right: 0;
  z-index: 30;
  display: grid;
  width: min(760px, calc(100vw - 48px));
  margin-top: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
}

.finance-account-list-filter .list-filter__fields {
  grid-template-columns:
    minmax(92px, 0.58fr)
    minmax(260px, 2.2fr)
    minmax(132px, 0.78fr)
    minmax(118px, 0.68fr);
}

.finance-account-list-filter .list-filter__actions {
  justify-content: flex-end;
}

.finance-filter input,
.finance-filter select,
.finance-inline-form select,
.finance-inline-form input {
  min-height: 36px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.finance-entry-table th,
.finance-entry-table td,
.finance-pending-table th,
.finance-pending-table td {
  vertical-align: top;
}

.content > .topbar + .list-filter + .panel--fill.finance-entry-ledger-panel {
  padding: 0;
  margin-left: 0;
  margin-right: 0;
  overflow: hidden;
}

.finance-entry-table-wrap {
  margin-left: -1px;
  width: calc(100% + 2px);
  overflow-x: visible;
}

.finance-entry-table--ledger {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.finance-entry-table--ledger th,
.finance-entry-table--ledger td {
  padding: 9px 10px;
  vertical-align: middle;
}

.finance-entry-table--ledger th:nth-child(1) {
  width: 104px;
}

.finance-entry-table--ledger th:nth-child(2) {
  width: 19%;
}

.finance-entry-table--ledger th:nth-child(3) {
  width: 26%;
}

.finance-entry-table--ledger th:nth-child(4) {
  width: 13%;
}

.finance-entry-table--ledger th:nth-child(5) {
  width: 13%;
}

.finance-entry-table--ledger th:nth-child(6) {
  width: 7%;
}

.finance-entry-table--ledger th:nth-child(7) {
  width: 94px;
}

.finance-entry-table--ledger th:nth-child(8) {
  width: 58px;
}

.finance-entry-row {
  cursor: pointer;
}

.finance-entry-row:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.finance-entry-row:hover {
  background: rgba(27, 120, 200, 0.045);
}

.finance-entry-table td:nth-child(2),
.finance-pending-table td:nth-child(2) {
  min-width: 160px;
}

.finance-entry-table td:nth-child(3),
.finance-pending-table td:nth-child(3) {
  min-width: 240px;
}

.finance-entry-table td:nth-child(4) {
  min-width: 150px;
}

.finance-entry-table--ledger td:nth-child(2),
.finance-entry-table--ledger td:nth-child(3),
.finance-entry-table--ledger td:nth-child(4) {
  min-width: 0;
}

.finance-entry-date {
  padding-right: 22px;
  border-right: 1px solid var(--border-light);
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.finance-entry-counterparty {
  padding-left: 22px;
  color: var(--text);
  line-height: 1.35;
}

.finance-description-cell {
  max-width: 360px;
  color: var(--text-mid);
  line-height: 1.35;
}

.finance-entry-cash-account,
.finance-entry-table--ledger td:nth-child(6) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-entry-amount {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.finance-status-icon {
  position: relative;
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--color-warning);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.finance-status-icon::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--color-warning-soft);
  clip-path: polygon(50% 8%, 95% 88%, 5% 88%);
  content: "";
}

.finance-status-icon--classified,
.finance-status-icon--preclassified {
  color: var(--color-success);
}

.finance-status-icon--classified::before,
.finance-status-icon--preclassified::before {
  border-radius: 999px;
  background: var(--color-success-soft);
  clip-path: none;
}

.finance-entry-account__code,
.finance-entry-table td strong,
.finance-pending-table td strong,
.finance-account-name strong {
  font-weight: 500;
}

.finance-load-more {
  padding: 10px 0 0;
}

.finance-load-more-row td {
  padding-top: 12px;
  padding-bottom: 6px;
  border-bottom: 0;
  text-align: center;
}

.finance-entry-drawer[hidden] {
  display: none;
}

.finance-entry-drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  justify-items: end;
}

.finance-entry-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.32);
  cursor: pointer;
}

.finance-entry-drawer__panel {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(520px, 100vw);
  height: 100%;
  padding: 24px;
  overflow-y: auto;
  background: var(--surface);
  box-shadow: -24px 0 48px rgba(15, 23, 42, 0.18);
  flex-direction: column;
  gap: 18px;
}

.finance-entry-drawer__header {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.finance-entry-drawer__header h2 {
  margin: 4px 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.15;
}

.finance-entry-drawer__header p {
  margin: 0;
  color: var(--text-mid);
  font-weight: 750;
}

.finance-entry-drawer__eyebrow {
  color: var(--blue);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.finance-entry-drawer__summary,
.finance-entry-drawer__section dl {
  display: grid;
  margin: 0;
  gap: 10px;
}

.finance-entry-drawer__summary {
  grid-template-columns: repeat(3, 1fr);
}

.finance-entry-drawer__summary div,
.finance-entry-drawer__section dl div {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface2);
}

.finance-entry-drawer dt {
  margin-bottom: 4px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.finance-entry-drawer dd {
  margin: 0;
  color: var(--text);
  font-weight: 750;
}

.finance-entry-drawer__section h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
}

.finance-entry-drawer__description {
  margin: 0 0 12px;
  color: var(--text-mid);
  line-height: 1.5;
}

.finance-entry-drawer__detail-link {
  margin-top: auto;
  align-self: flex-start;
}

.finance-entry-table--ledger td,
.finance-entry-table--ledger td strong,
.finance-entry-table--ledger td span,
.finance-entry-table--ledger .finance-entry-account__code,
.finance-entry-table--ledger .finance-entry-amount {
  font-weight: 400;
}

.finance-entry-table--ledger .finance-status-icon {
  font-weight: 600;
}

.finance-entry-table td strong,
.finance-pending-table td strong,
.finance-account-name strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.25;
}

.finance-entry-table td span,
.finance-pending-table td span,
.finance-account-name span {
  display: block;
  margin-top: 2px;
  color: var(--text-mid);
  font-size: 12px;
  line-height: 1.3;
}

.finance-row-link {
  color: var(--blue);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.finance-suggestion {
  display: block;
  padding: 7px 9px;
  border: 1px solid rgba(27, 120, 200, 0.18);
  border-radius: 8px;
  background: var(--blue-pale);
}

.finance-confidence {
  margin-top: 6px;
  color: var(--text-mid);
  font-size: 11.5px;
  font-weight: 700;
}

.finance-inline-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 220px;
}

.finance-inline-form .button {
  width: fit-content;
  min-height: 32px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--navy);
  box-shadow: none;
  justify-self: start;
}

.finance-inline-form .button:hover {
  border-color: rgba(27, 120, 200, 0.32);
  background: var(--blue-pale);
  color: var(--blue);
}

.finance-bulk-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.finance-bulk-panel {
  margin-bottom: 12px;
}

.content > .topbar + .finance-bulk-panel {
  margin: 12px 32px;
}

.finance-bulk-panel__content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px;
}

.finance-suggestion-confirmation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface2);
}

.finance-suggestion-confirmation h2 {
  margin: 3px 0 4px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.2;
}

.finance-suggestion-confirmation p {
  margin: 0;
  color: var(--text-mid);
  font-size: 13px;
  line-height: 1.35;
}

.finance-suggestion-confirmation .button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.finance-bulk-panel__eyebrow {
  display: block;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.finance-bulk-panel h2 {
  margin: 3px 0 4px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.2;
}

.finance-bulk-panel p {
  margin: 0;
  color: var(--text-mid);
  font-size: 13px;
  line-height: 1.35;
}

.finance-bulk-form__account-field {
  min-width: 300px;
  margin: 0;
}

.finance-bulk-form .finance-account-lookup {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.finance-pending-select-header,
.finance-pending-select-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 94px;
  min-width: 94px;
  text-align: center;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--border);
}

.finance-pending-table thead .finance-pending-select-header {
  z-index: 4;
  background: var(--surface2);
}

.finance-pending-select-label {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
}

.finance-pending-select-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--navy);
}

.finance-management-mapping-table {
  min-width: 920px;
}

.finance-management-mapping-select-header,
.finance-management-mapping-select-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 94px;
  min-width: 94px;
  text-align: center;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--border);
}

.finance-management-mapping-table thead .finance-management-mapping-select-header {
  z-index: 4;
  background: var(--surface2);
}

.finance-management-mapping-select-label {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
}

.finance-management-mapping-select-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--navy);
}

.finance-management-mapping-table td:nth-child(4) strong,
.finance-management-mapping-table td:nth-child(4) span {
  display: block;
}

.finance-management-mapping-table td:nth-child(4) span {
  color: var(--text-mid);
}

.finance-pending-table th:last-child,
.finance-pending-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 250px;
  text-align: left;
  background: var(--surface);
  box-shadow: -1px 0 0 var(--border);
}

.finance-pending-table thead th:last-child {
  z-index: 3;
  background: var(--surface2);
  color: transparent;
}

.finance-pending-table thead th:last-child::after {
  content: "Ação";
  color: var(--text-dim);
}

.finance-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 12px 34px 34px;
  color: var(--text-mid);
  font-size: 13px;
  font-weight: 700;
}

.finance-account-table .finance-code-cell {
  width: 96px;
  color: var(--navy);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.finance-account-table {
  width: 100%;
  table-layout: fixed;
}

.finance-account-table th,
.finance-account-table td {
  padding-top: 10px;
  padding-bottom: 10px;
  vertical-align: middle;
}

.finance-account-table__code {
  width: 96px;
}

.finance-account-table__meta {
  width: 112px;
}

.finance-account-table__actions {
  width: 178px;
}

.finance-tree-toolbar {
  display: flex;
  justify-content: flex-end;
  padding-bottom: 0;
}

.finance-account-name {
  min-width: 0;
}

.finance-account-tree {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.finance-tree-toggle,
.finance-tree-toggle-placeholder {
  width: 18px;
  min-width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.finance-tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-mid);
  cursor: pointer;
  transition: color 0.18s ease, transform 0.18s ease;
}

.finance-tree-toggle:hover,
.finance-tree-toggle:focus-visible {
  color: var(--navy);
}

.finance-tree-toggle span {
  display: inline-block;
  line-height: 1;
  transition: transform 0.18s ease;
}

.finance-tree-toggle.is-collapsed span {
  transform: rotate(-90deg);
}

.finance-account-label {
  display: block;
  color: var(--text);
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.finance-node--group .finance-account-label {
  color: var(--navy);
  font-weight: 700;
}

.finance-node--aggregator .finance-account-label {
  font-weight: 600;
}

.finance-node--account .finance-account-label {
  font-weight: 400;
}

.finance-account-row--group {
  background: rgba(250, 250, 248, 0.62);
}

.finance-account-row--aggregator {
  background: rgba(250, 250, 248, 0.32);
}

.finance-account-row--context .finance-account-label,
.finance-account-row--context .finance-code-cell {
  color: var(--text-mid);
}

.finance-meta-text {
  color: var(--text-mid);
  font-size: 13px;
  white-space: nowrap;
}

.finance-meta-text--inactive {
  color: var(--text-dim);
}

.finance-account-actions {
  justify-content: flex-end;
  white-space: nowrap;
}

.finance-indent-1 {
  padding-left: 18px !important;
}

.finance-indent-2 {
  padding-left: 34px !important;
}

.finance-indent-3 {
  padding-left: 50px !important;
}

.finance-indent-4 {
  padding-left: 66px !important;
}

.finance-indent-5 {
  padding-left: 82px !important;
}

.finance-indent-6 {
  padding-left: 98px !important;
}

.finance-wide-panel .table-wrap {
  overflow: auto;
}

.finance-budget-table {
  min-width: 1320px;
}

.finance-budget-table th,
.finance-budget-table td {
  min-width: 104px;
}

.finance-budget-table .finance-sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 330px;
  max-width: 390px;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--border);
}

.finance-budget-table thead .finance-sticky-col,
.finance-budget-table tfoot .finance-sticky-col {
  background: var(--surface2);
}

.finance-budget-table tfoot th {
  position: sticky;
  bottom: 0;
  z-index: 1;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  color: var(--navy);
  font-weight: 850;
}

.finance-budget-table .finance-total-cell {
  color: var(--navy);
  font-weight: 850;
}

.finance-analysis-shell {
  margin-top: 20px;
}

.finance-summary-line {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.finance-analysis-table tfoot th {
  border-top: 1px solid var(--border);
  background: var(--surface2);
  color: var(--navy);
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.finance-detail-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 34px 34px;
}

.finance-detail-panel {
  margin: 0 !important;
}

.finance-detail-panel .panel__header h2 {
  margin: 0;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.finance-detail-grid div {
  min-width: 0;
}

.finance-detail-grid__wide {
  grid-column: 1 / -1;
}

.finance-detail-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.finance-detail-grid strong {
  display: block;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* =========================================================
   Typography normalization
   Shared scale for navigation, tables, forms and content.
   ========================================================= */

.topbar,
.page-hd {
  padding-bottom: 16px;
}

.page-title {
  font-size: var(--type-page-title);
  line-height: 1.1;
  letter-spacing: -0.022em;
}

.page-subtitle,
.page-sub {
  margin-top: 6px;
  font-size: var(--type-body-lg);
  line-height: var(--leading-body);
}

.page-crumb {
  margin-bottom: 6px;
  font-size: var(--type-body-sm);
}

.nav__group-toggle,
.card__label,
.table-card-hd-title,
.delete-import-modal__eyebrow,
.delete-confirmation-modal__eyebrow,
.dp-section-label,
.channel-date-field label,
.channel-kicker,
.finance-summary-card span,
.finance-detail-panel .panel__header h2,
.finance-detail-grid span,
.operation-section__header h2 {
  font-size: var(--type-micro);
  letter-spacing: var(--tracking-label);
}

.nav a {
  font-size: var(--type-body-lg);
}

.sidebar__footer,
.list-summary__label,
.field label,
.filter-chip,
.badge,
.status-pill,
.chip-row,
.app-table thead th,
.dp-field label,
.dp-applied-label,
.channel-reconciliation,
.report-ranking-table__cell span,
.report-ranking-drawer__summary-item span,
.finance-entry-table td span,
.finance-pending-table td span,
.finance-account-name span,
.finance-pagination {
  font-size: var(--type-body-sm);
}

.field label,
.page-crumb,
.period-badge,
.dp-field label,
.dp-applied-label,
.filter-chip {
  font-weight: 500;
}

.field input,
.field select,
.field textarea,
.list-filter__field input,
.list-filter__field select,
.finance-filter input,
.finance-filter select,
.finance-inline-form select,
.finance-inline-form input,
.report-ranking-drawer__limit input,
.dp-field input[type="date"],
.channel-date-field input[type="date"] {
  font-size: var(--type-body-lg);
  line-height: var(--leading-snug);
}

.help,
.panel__subtitle,
.card__meta,
.operation-card p,
.operation-card__meta,
.channel-note,
.delete-import-modal__copy,
.delete-confirmation-modal__copy,
.finance-description-cell {
  font-size: var(--type-body-md);
  line-height: var(--leading-body);
}

.button,
button.button,
input[type="submit"].button,
.btn,
.period-badge,
.dp-btn-cancel,
.dp-btn-apply {
  font-size: var(--type-body-sm);
}

.button--compact,
.app-table .button,
.table-card-actions .button,
.table-card-actions .btn,
.table-card-actions .button--ghost,
.period-badge,
.dp-field input[type="date"],
.channel-date-field input[type="date"] {
  font-size: 12.5px;
}

.app-table th,
.app-table td {
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: var(--type-table-body);
  line-height: var(--leading-snug);
}

.app-table thead th {
  font-size: var(--type-table-head);
  letter-spacing: 0.08em;
}

.table-card-hd {
  padding-top: 12px;
  padding-bottom: 10px;
}

.report-table thead th {
  padding-top: 9px;
  padding-bottom: 8px;
}

.th-yr,
.v-main,
.td-name.total,
.channel-reconciliation strong,
.report-ranking-drawer__summary strong {
  font-size: var(--type-body-lg);
}

.td-name,
.report-ranking-table__cell strong,
.finance-detail-grid strong {
  font-size: 13px;
  line-height: 1.4;
}

.td-name.sub,
.v-delta,
.v-dv,
.channel-clients summary,
.channel-clients li,
.channel-history-table td span,
.report-ranking-table__position,
.report-ranking-drawer__quick-button,
.report-ranking-drawer__summary-item strong,
.finance-confidence {
  font-size: var(--type-caption-strong);
}

.th-range,
.cur-badge,
.v-delta,
.channel-clients summary,
.channel-history-table td span,
.report-ranking-drawer__eyebrow,
.list-summary__percent {
  letter-spacing: 0.06em;
}

.channel-period-title,
.delete-import-modal__title,
.delete-confirmation-modal__title,
.finance-summary-card strong {
  font-size: var(--type-title-lg);
  line-height: 1.15;
  font-weight: 700;
}

.report-ranking-drawer__title,
.page-title,
.operation-card h3 {
  font-weight: 700;
}

.operation-card h3 {
  font-size: var(--type-title-md);
  line-height: 1.22;
}

.operation-card__action,
.finance-row-link {
  font-size: var(--type-body-md);
  font-weight: 700;
}

.operation-card__meta strong,
.finance-entry-table td strong,
.finance-pending-table td strong,
.finance-account-name strong,
.channel-name-cell > strong,
.channel-history-table td strong {
  font-size: 13px;
  line-height: 1.25;
  font-weight: 700;
}

.channel-detail-table .channel-name-cell > .channel-child-strong,
.channel-history-table td .channel-child-label {
  font-size: var(--type-body-lg);
}

.channel-detail-head h2,
.report-ranking-drawer__controls,
.report-ranking-drawer__limit {
  font-size: var(--type-body-md);
}

.report-ranking-drawer__limit input {
  font-size: var(--type-body-lg);
  font-weight: 700;
}

.report-table .td-in,
.td-name-wrap,
.channel-history-table th,
.channel-history-table td,
.report-ranking-table th,
.report-ranking-table td {
  line-height: var(--leading-snug);
}

.channel-detail-table tfoot th,
.channel-detail-table th,
.channel-detail-table td,
.finance-entry-table th,
.finance-entry-table td,
.finance-pending-table th,
.finance-pending-table td,
.finance-budget-table th,
.finance-budget-table td,
.finance-analysis-table tfoot th {
  line-height: var(--leading-snug);
}

@media (min-width: 1440px) {
  .content > .cards {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

@media (max-width: 1180px) {
  .shell,
  .shell.is-sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .shell.is-sidebar-collapsed .sidebar {
    width: 100%;
    min-width: 0;
  }

  .shell.is-sidebar-collapsed .brand__mark,
  .shell.is-sidebar-collapsed .nav__label,
  .shell.is-sidebar-collapsed .nav__group-toggle {
    display: initial;
  }

  .shell.is-sidebar-collapsed .nav a {
    width: auto;
    justify-content: flex-start;
    padding: 9px 12px 9px 16px;
  }

  .shell.is-sidebar-collapsed .nav a::after {
    display: none;
  }
}

@media (max-width: 860px) {
  .operation-sections {
    gap: 24px;
    margin: 20px 18px 28px;
  }

  .operation-card-grid--2,
  .operation-card-grid--3 {
    grid-template-columns: 1fr;
  }

  .operation-card--wide {
    grid-column: auto;
  }

  .operation-card--attention .operation-card__link {
    padding-right: 24px;
  }

  .operation-card__badge {
    position: static;
    order: -1;
    margin-bottom: 14px;
  }

  .content > .cards {
    margin: 18px;
  }

  .content > .panel:not(.panel--fill),
  .content > .grid-2,
  .content > .grid-3,
  .content > .panel-grid {
    margin-left: 18px;
    margin-right: 18px;
  }

  .finance-summary-strip,
  .finance-detail-layout,
  .finance-pagination {
    margin-left: 18px;
    margin-right: 18px;
  }

  .finance-summary-strip,
  .finance-detail-layout {
    grid-template-columns: 1fr;
  }

  .finance-filter .list-filter__fields {
    grid-template-columns: 1fr;
  }

  .finance-account-list-filter .list-filter__fields {
    grid-template-columns: 1fr;
  }

  .finance-account-table {
    min-width: 720px;
  }

  .finance-inline-form {
    grid-template-columns: 1fr;
    min-width: 260px;
  }

  .finance-bulk-panel__content,
  .finance-suggestion-confirmation,
  .finance-bulk-form {
    align-items: stretch;
    flex-direction: column;
  }

  .finance-bulk-form__account-field {
    min-width: 0;
  }

  .card__action,
  .list-summary,
  .topbar .button,
  .page-hd .button {
    width: 100%;
  }

  .header-actions,
  .user-menu {
    width: auto;
  }

  .topbar > .toolbar,
  .page-hd-right > .toolbar,
  .page-hd-right > .header-actions {
    padding-right: 48px;
  }

  .user-menu__panel {
    right: auto;
    left: 0;
    width: min(320px, 100%);
  }

  .list-summary {
    justify-content: space-between;
    border-radius: 12px;
  }

  .import-detail-metrics {
    grid-template-columns: 1fr;
  }

  .import-detail-metric,
  .import-detail-metric:nth-child(n + 2) {
    min-height: 108px;
    border-top: 1px solid var(--color-border);
    border-left: 0;
  }

  .import-detail-metric:first-child {
    border-top: 0;
  }

  .import-detail-status {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Área de trabalho de tabelas: o contexto local acompanha a rolagem da página;
   cada tabela preserva sua própria rolagem e cabeçalho dentro desse contexto. */
.table-workspace__context {
  position: sticky;
  top: var(--table-workspace-top, 0px);
  z-index: 29;
}

.list-filter.table-workspace__context,
.finance-bulk-panel.table-workspace__context,
.finance-tree-toolbar.table-workspace__context,
.segment-history-head.table-workspace__context,
.channel-detail-head.table-workspace__context {
  background: var(--bg);
}

.panel__header.table-workspace__context,
.table-card-hd.table-workspace__context {
  background: var(--surface2);
}

.panel__header.table-workspace__context,
.table-card-hd.table-workspace__context {
  pointer-events: none;
}

.panel__header.table-workspace__context :is(a, button, input, select, textarea, [role="button"]),
.table-card-hd.table-workspace__context :is(a, button, input, select, textarea, [role="button"]) {
  pointer-events: auto;
}

[data-table-scroll] {
  max-height: var(--table-workspace-height, none);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scroll-padding-top: var(--table-workspace-context-height, 0px);
}

.table-workspace__context + [data-table-scroll] {
  position: sticky;
  top: calc(var(--table-workspace-top, 0px) + var(--table-workspace-context-height, 0px));
  z-index: 1;
}

.financial-staging-panel .panel__header.table-workspace__context {
  top: 0;
}

.financial-staging-panel [data-table-scroll] .app-table thead th {
  top: var(--table-workspace-context-height, 0px);
}

.table-workspace :is(.app-table, .report-table, .channel-history-table, .channel-detail-table, .report-ranking-table) thead th {
  top: 0;
}

.table-workspace :is(.app-table, .report-table, .channel-history-table, .channel-detail-table, .report-ranking-table) :is(tbody td, tfoot th, tfoot td),
.table-workspace :is(.app-table, .report-table, .channel-history-table, .channel-detail-table, .report-ranking-table) :is(tbody td, tfoot th, tfoot td) * {
  font-size: var(--type-table-body);
}

.table-workspace :is(.app-table, .report-table, .channel-history-table, .channel-detail-table, .report-ranking-table) thead th,
.table-workspace :is(.app-table, .report-table, .channel-history-table, .channel-detail-table, .report-ranking-table) thead th * {
  font-size: var(--type-table-head);
}

.table-workspace :is(.app-table, .report-table, .channel-history-table, .channel-detail-table, .report-ranking-table) :is(.button, button.button, input[type="submit"].button) {
  font-size: 12.5px;
}

.list-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--surface2);
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 600;
}

.list-pagination span {
  margin-right: 4px;
  font-variant-numeric: tabular-nums;
}

/* Editorial: fluxo operacional denso, rastreável e alinhado ao design system canônico. */
.editorial-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 32px 0;
}

.editorial-kpis--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.editorial-kpi {
  display: grid;
  gap: 5px;
  min-height: 82px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.editorial-kpi--highlight {
  border-color: var(--year-hl-border);
  background: var(--year-hl);
}

.editorial-kpi span,
.editorial-project-summary span {
  color: var(--text-dim);
  font-size: var(--type-micro);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.editorial-kpi strong {
  color: var(--text);
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

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

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

.editorial-overview-kpis {
  gap: 12px;
  margin-top: 16px;
}

.editorial-overview-kpi {
  min-height: 176px;
  padding: 17px 14px 14px;
  align-content: start;
  gap: 0;
}

.editorial-overview-kpi__top,
.editorial-overview-card header,
.editorial-overview-card__metric,
.editorial-overview-card dl > div {
  display: flex;
  align-items: center;
}

.editorial-overview-kpi__top {
  gap: 12px;
  margin-bottom: 13px;
}

.editorial-overview-icon {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
}

.editorial-overview-icon svg {
  width: 20px;
  height: 20px;
}

.editorial-overview-kpi--submissions .editorial-overview-icon,
.editorial-overview-card--submissions .editorial-overview-icon { color: #1d5ecc; background: #eaf2ff; }
.editorial-overview-kpi--production .editorial-overview-icon,
.editorial-overview-card--production .editorial-overview-icon { color: #d88a12; background: #fff3dc; }
.editorial-overview-kpi--completed .editorial-overview-icon { color: #3a8d41; background: #e9f7e7; }
.editorial-overview-kpi--time .editorial-overview-icon { color: #7742b8; background: #f4eafd; }
.editorial-overview-card--responsible .editorial-overview-icon { color: #7742b8; background: #f4eafd; }

.editorial-overview-kpi strong {
  font-size: 27px;
  line-height: 1;
}

.editorial-overview-kpi strong small {
  margin-left: 3px;
  font-size: 14px;
}

.editorial-overview-kpi h2,
.editorial-overview-card h2 {
  margin: 0;
  color: var(--text);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.editorial-overview-kpi p,
.editorial-overview-kpi > small,
.editorial-overview-card p {
  margin: 8px 0 0;
  color: var(--text-mid);
  font-size: 11.5px;
  line-height: 1.45;
}

.editorial-overview-kpi > a {
  margin-top: auto;
  color: var(--blue-mid);
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
}

.editorial-overview-kpi > a span,
.editorial-overview-card .button span { margin-left: 5px; font-size: 17px; line-height: 0; }

.editorial-overview-cards {
  gap: 12px;
  margin-top: 14px;
}

.editorial-overview-card,
.editorial-overview-card .panel__body {
  min-height: 188px;
}

.editorial-overview-card .panel__body {
  display: flex;
  flex-direction: column;
  padding: 15px;
}

.editorial-overview-card header { gap: 10px; }
.editorial-overview-card header .editorial-overview-icon { width: 36px; height: 36px; }
.editorial-overview-card header .editorial-overview-icon svg { width: 18px; height: 18px; }

.editorial-overview-card__metric {
  justify-content: space-between;
  margin-top: 17px;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 700;
}

.editorial-overview-card__metric strong,
.editorial-overview-card dd {
  color: var(--blue-mid);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.editorial-overview-card dl {
  display: grid;
  gap: 4px;
  margin: 14px 0 0;
}

.editorial-overview-card dl > div { justify-content: space-between; }
.editorial-overview-card dt { color: var(--text); font-size: 11.5px; font-weight: 700; }
.editorial-overview-card dd { margin: 0; }
.editorial-overview-card--production dl > div:nth-child(2) dd { color: #3a8d41; }
.editorial-overview-card--production dl > div:nth-child(3) dd { color: #7742b8; }

.editorial-overview-card__description { max-width: 245px; }

.editorial-overview-card .button {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 11.5px;
}

.editorial-bottleneck-panel,
.editorial-single-form,
.editorial-version-history {
  margin: 12px 32px 28px;
}

.editorial-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.editorial-panel-heading h2,
.editorial-panel-heading p,
.editorial-workflow-stage summary strong,
.editorial-file-list h3 {
  margin: 0;
}

.editorial-panel-heading h2,
.editorial-workflow-stage summary strong,
.editorial-file-list h3,
.editorial-dialog h2,
.editorial-form-layout .panel__header h2,
.editorial-single-form .panel__header h2,
.editorial-workflow-form .panel__header h2,
.editorial-version-history .panel__header h2 {
  color: var(--text);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.editorial-panel-heading p {
  color: var(--text-mid);
  font-size: 12px;
}

.editorial-panel-heading > a {
  color: var(--blue-mid);
  font-size: 12px;
  font-weight: 700;
}

.editorial-priority-list {
  display: grid;
  gap: 0;
  padding-top: 6px;
  padding-bottom: 6px;
}

.editorial-priority-row,
.editorial-people-list > div,
.editorial-file-list > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.editorial-priority-row:last-child,
.editorial-people-list > div:last-child,
.editorial-file-list > a:last-child {
  border-bottom: 0;
}

.editorial-priority-row > span:first-child,
.editorial-people-list > div > span:first-child,
.editorial-file-list > a > span:first-child {
  display: grid;
  min-width: 0;
}

.editorial-priority-row strong,
.editorial-people-list strong,
.editorial-file-list strong {
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.editorial-priority-row small,
.editorial-people-list small,
.editorial-file-list small,
.editorial-stage-table small,
.editorial-communications small {
  color: var(--text-mid);
  font-size: 11.5px;
}

.editorial-bottlenecks {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.editorial-bottlenecks > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface2);
  font-size: 12px;
}

.editorial-bottlenecks strong {
  font-variant-numeric: tabular-nums;
}

.sla-pill {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface2);
  color: var(--text-mid);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.sla-pill--near {
  border-color: var(--year-hl-border);
  background: var(--year-hl);
  color: var(--year-hl-text);
}

.sla-pill--overdue {
  border-color: #fecaca;
  background: var(--neg-bg);
  color: var(--neg);
}

.sla-pill--within {
  border-color: #bbf7d0;
  background: var(--pos-bg);
  color: var(--pos);
}

.editorial-filterbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) minmax(150px, .8fr) minmax(170px, .9fr) minmax(170px, 1fr) max-content max-content;
  align-items: end;
  gap: 10px;
  margin: 12px 32px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.editorial-filterbar .field {
  gap: 4px;
}

.editorial-filterbar .field input,
.editorial-filterbar .field select {
  min-height: 36px;
  padding-top: 7px;
  padding-bottom: 7px;
  font-size: 12.5px;
}

.editorial-filterbar .button {
  min-height: 36px;
}

.editorial-view-toggle {
  display: inline-flex;
  min-height: 36px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
}

.editorial-view-toggle a {
  display: grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--text-mid);
  font-size: 11.5px;
  font-weight: 700;
}

.editorial-view-toggle a.is-active {
  background: var(--blue-pale);
  color: var(--blue-mid);
}

.editorial-list-panel {
  margin: 0 32px 28px;
}

.editorial-table td {
  vertical-align: middle;
}

.editorial-kanban {
  display: grid;
  grid-auto-columns: minmax(205px, 1fr);
  grid-auto-flow: column;
  gap: 10px;
  margin: 0 32px 28px;
  padding-bottom: 8px;
  overflow-x: auto;
  max-width: calc(100vw - 288px);
  box-sizing: border-box;
  overscroll-behavior-inline: contain;
}

.editorial-kanban-column {
  min-width: 240px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
}

.editorial-kanban-column > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 11px;
  border-bottom: 1px solid var(--border-light);
}

.editorial-kanban-column h2 {
  margin: 0;
  color: var(--text-mid);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.editorial-kanban-column > header > span {
  display: grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: var(--blue-pale);
  color: var(--blue-mid);
  font-size: 11px;
  font-weight: 700;
}

.editorial-kanban-stack {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 120px;
  max-height: calc(100vh - 280px);
  padding: 8px;
  overflow-y: auto;
}

.editorial-kanban-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
}

.editorial-kanban-card:hover {
  border-color: #bfd7f2;
  box-shadow: 0 4px 12px rgba(26, 60, 107, .07);
}

.editorial-kanban-card > strong {
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.3;
}

.editorial-kanban-card > span,
.editorial-kanban-card small {
  color: var(--text-mid);
  font-size: 11px;
}

.editorial-kanban-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.editorial-kanban-card progress,
.editorial-project-summary progress {
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  accent-color: var(--blue-mid);
}

.editorial-kanban-empty {
  padding: 16px 8px;
  color: var(--text-dim);
  font-size: 11.5px;
  text-align: center;
}

.editorial-form-layout,
.editorial-workflow-form {
  display: grid;
  gap: 12px;
  margin: 12px 32px 28px;
}

.editorial-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
}

.editorial-submission-form {
  max-width: 1180px;
}

.editorial-submission-section .panel__header {
  padding: 13px 16px;
}

.editorial-submission-section .panel__header h2 {
  margin: 0;
}

.editorial-submission-section .panel__header .panel__subtitle,
.editorial-authors-section .editorial-panel-heading p {
  margin: 3px 0 0;
  color: var(--text-mid);
  font-size: 12px;
  line-height: 1.35;
}

.editorial-submission-section .panel__body {
  padding: 14px 16px;
}

.editorial-submission-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.editorial-submission-fields--assessment {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.editorial-submission-field--title,
.editorial-submission-field--full {
  grid-column: 1 / -1;
}

.editorial-submission-form .field {
  gap: 5px;
  min-width: 0;
}

.editorial-submission-form .field label {
  color: var(--text-mid);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .025em;
}

.editorial-submission-form .field :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  box-sizing: border-box;
  min-height: 38px;
  padding: 8px 10px;
  border-color: var(--border);
  border-radius: 8px;
  box-shadow: none;
}

.editorial-submission-form .field textarea {
  min-height: 82px;
  resize: vertical;
}

.editorial-submission-form .field input[type="file"] {
  min-height: 40px;
  padding: 5px 8px;
  background: var(--surface2);
}

.editorial-submission-form .field input[type="file"]::file-selector-button {
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.editorial-submission-form .field.has-error :is(input, select, textarea) {
  border-color: var(--neg);
}

.editorial-submission-form .errorlist {
  margin: 0;
  padding: 0;
  color: var(--neg);
  font-size: 11.5px;
  list-style: none;
}

.editorial-submission-form .help,
.editorial-upload-status {
  font-size: 11.5px;
}

.editorial-upload-status {
  color: var(--pos);
}

.field-required {
  color: var(--neg);
}

.editorial-form-errors {
  display: grid;
  gap: 5px;
}

.editorial-author-list {
  display: grid;
  gap: 9px;
}

.editorial-author-row {
  position: relative;
  padding: 11px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface2);
}

.editorial-author-row > input[name$="-DELETE"],
.editorial-author-primary-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.editorial-author-row > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.editorial-author-row > header strong {
  color: var(--text);
  font-size: 12px;
}

.editorial-author-remove {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 11px;
}

.editorial-author-remove:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.editorial-author-row__fields {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(190px, 1.3fr) minmax(128px, .75fr) minmax(154px, .9fr);
  gap: 10px;
  align-items: end;
}

.editorial-author-row__settings {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding-bottom: 2px;
}

.editorial-author-switch {
  display: inline-grid;
  grid-template-columns: 1fr 38px;
  align-items: center;
  gap: 8px;
  width: 100%;
  cursor: pointer;
}

.editorial-author-switch > span,
.editorial-primary-choice span {
  color: var(--text-mid);
  font-size: 11.5px;
  font-weight: 600;
}

.editorial-author-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.editorial-author-switch i {
  display: block;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--text-dim);
  transition: background .15s ease;
}

.editorial-author-switch i::after {
  display: block;
  width: 16px;
  height: 16px;
  margin: 3px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 2px rgb(15 23 42 / .2);
  content: "";
  transition: transform .15s ease;
}

.editorial-author-switch input:checked + i {
  background: var(--blue-mid);
}

.editorial-author-switch input:checked + i::after {
  transform: translateX(16px);
}

.editorial-author-switch input:focus-visible + i,
.editorial-primary-choice input:focus-visible + span {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.editorial-primary-choice {
  display: inline-flex;
  align-items: center;
  width: max-content;
  cursor: pointer;
}

.editorial-primary-choice input {
  position: absolute;
  opacity: 0;
}

.editorial-primary-choice span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.editorial-primary-choice input:checked + span {
  border-color: #b9d0ec;
  background: var(--blue-pale);
  color: var(--blue-mid);
}

.editorial-submission-actions {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.editorial-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.editorial-detail-grid,
.editorial-project-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr);
  gap: 12px;
  margin: 12px 32px 28px;
}

.editorial-detail-main,
.editorial-detail-side,
.editorial-project-grid > main,
.editorial-project-grid > aside {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.editorial-detail-grid .panel__header h2,
.editorial-project-grid .panel__header h2 {
  margin: 0;
  color: var(--text);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.editorial-description p,
.editorial-detail-side p {
  margin-top: 0;
  color: var(--text-mid);
  font-size: 13px;
}

.editorial-description dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 0;
}

.editorial-description dl > div {
  padding: 10px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface2);
}

.editorial-description dt {
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.editorial-description dd {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.editorial-file-list h3 {
  margin-top: 12px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-mid);
  font-size: 11px;
  text-transform: uppercase;
}

.editorial-score {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 8px;
}

.editorial-score strong {
  color: var(--navy);
  font-size: 28px;
  line-height: 1;
}

.editorial-score span {
  color: var(--text-dim);
  font-size: 12px;
}

.editorial-decision-panel .panel__body {
  display: grid;
  gap: 8px;
}

.editorial-timeline {
  display: grid;
  gap: 0;
}

.editorial-timeline > div {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  min-height: 44px;
}

.editorial-timeline > div > span {
  position: relative;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--blue-mid);
}

.editorial-timeline > div > span::after {
  content: "";
  position: absolute;
  top: 10px;
  bottom: -30px;
  left: 3px;
  width: 1px;
  background: var(--border);
}

.editorial-timeline > div:last-child > span::after {
  display: none;
}

.editorial-timeline p {
  display: grid;
  margin: 0;
}

.editorial-timeline strong {
  font-size: 12.5px;
}

.editorial-timeline small {
  color: var(--text-mid);
  font-size: 11px;
}

.editorial-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  overflow: auto;
}

.editorial-dialog::backdrop {
  background: rgba(17, 24, 39, .42);
}

.editorial-dialog > form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.editorial-dialog header,
.editorial-dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.editorial-dialog header > button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text-mid);
  cursor: pointer;
}

.editorial-dialog footer {
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.editorial-project-summary {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 1fr 1fr;
  gap: 10px;
  margin: 12px 32px 0;
}

.editorial-project-summary > div {
  display: grid;
  align-content: center;
  gap: 5px;
  min-height: 70px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.editorial-project-summary strong {
  font-size: 13px;
}

.editorial-stage-table td {
  vertical-align: middle;
}

.app-table.editorial-stage-table thead th {
  position: static;
}

.editorial-stage-table td:first-child {
  min-width: 150px;
}

.editorial-stage-table td:first-child strong,
.editorial-stage-table td:first-child small {
  display: block;
}

.editorial-stage-table td:nth-child(3) .sla-pill {
  margin-top: 3px;
}

.editorial-status-select {
  width: 142px;
  min-height: 32px;
  padding: 5px 28px 5px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 11.5px;
}

.editorial-communications {
  display: grid;
  gap: 10px;
}

.editorial-communications article {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.editorial-communications article > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.editorial-communications strong {
  font-size: 12px;
}

.editorial-communications p {
  margin: 4px 0;
  color: var(--neg);
  font-size: 11.5px;
}

.editorial-project-sheet {
  display: grid;
  gap: 10px;
  margin: 0;
}

.editorial-project-sheet > div {
  display: grid;
  gap: 2px;
}

.editorial-project-sheet dt {
  color: var(--text-mid);
  font-size: 11px;
}

.editorial-project-sheet dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}

.editorial-workflow-stages {
  display: grid;
  gap: 10px;
}

.editorial-workflow-stage summary {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
}

.editorial-workflow-stage summary span {
  color: var(--blue-mid);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.editorial-workflow-stage[open] summary {
  border-bottom: 1px solid var(--border-light);
}

.field-error {
  color: var(--neg);
  font-size: 11.5px;
}

.empty-state {
  display: grid;
  gap: 3px;
  padding: 16px 8px;
  color: var(--text-mid);
  font-size: 12px;
  text-align: center;
}

.empty-state--panel {
  min-width: 320px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

@media (max-width: 1180px) {
  .editorial-kpis,
  .editorial-project-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .editorial-filterbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .editorial-dashboard-grid,
  .editorial-detail-grid,
  .editorial-project-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .editorial-kanban { max-width: calc(100vw - 36px); }
  .editorial-kpis,
  .editorial-dashboard-grid,
  .editorial-bottleneck-panel,
  .editorial-filterbar,
  .editorial-list-panel,
  .editorial-kanban,
  .editorial-form-layout,
  .editorial-single-form,
  .editorial-detail-grid,
  .editorial-project-summary,
  .editorial-project-grid,
  .editorial-workflow-form,
  .editorial-version-history {
    margin-left: 18px;
    margin-right: 18px;
  }

  .editorial-kpis,
  .editorial-project-summary,
  .editorial-filterbar,
  .editorial-bottlenecks,
  .editorial-description dl {
    grid-template-columns: 1fr;
  }

  .editorial-filterbar .button,
  .editorial-view-toggle {
    width: 100%;
  }
}

/* Landings operacionais: densidade própria, sem alterar tabelas e fluxos consumidores. */
.landing-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 34px 0;
}

.landing-summary__item {
  display: grid;
  gap: 5px;
  min-width: 0;
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.landing-summary__item span {
  color: var(--text-dim);
  font-size: var(--type-micro);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.landing-summary__item strong {
  color: var(--text);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.operation-sections--landing {
  gap: 24px;
  margin-top: 18px;
}

.operation-sections--landing .operation-section__header {
  margin-bottom: 10px;
}

.operation-sections--landing .operation-card-grid {
  gap: 12px;
}

.operation-sections--landing .operation-card {
  min-height: 150px;
  border-radius: 11px;
  box-shadow: 0 5px 16px rgba(17, 24, 39, 0.045);
}

.operation-sections--landing .operation-card__link {
  padding: 18px 20px 17px;
}

.operation-sections--landing .operation-card__icon {
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
  border-radius: 8px;
}

.operation-sections--landing .operation-card__icon svg {
  width: 17px;
  height: 17px;
}

.operation-sections--landing .operation-card h3 {
  margin-bottom: 5px;
}

.operation-sections--landing .operation-card p {
  font-size: 13px;
  line-height: 1.4;
}

.operation-sections--landing .operation-card__action {
  padding-top: 12px;
}

.operation-sections--landing .operation-card--compact {
  min-height: 138px;
}

.operation-sections--landing .operation-card--compact .operation-card__icon {
  top: 17px;
  right: 17px;
}

.operation-sections--landing .operation-card--attention {
  min-height: 126px;
}

.operation-sections--landing .operation-card--attention .operation-card__link {
  padding-right: 156px;
}

.operation-sections--finance .operation-card--attention {
  min-height: 132px;
}

@media (max-width: 860px) {
  .landing-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 14px 18px 0;
  }

  .operation-sections--landing .operation-card--attention .operation-card__link {
    padding-right: 20px;
  }
}

/* Importações: formulário e histórico formam uma única área operacional compacta. */
.content > .imports-upload-panel {
  margin-top: 14px;
}

.imports-upload-panel .panel__header,
.imports-history-panel .panel__header {
  padding: 12px 16px;
}

.imports-upload-panel .panel__header h2,
.imports-history-panel .panel__header h2 {
  margin: 0;
  font-size: var(--type-body-lg);
  line-height: var(--leading-tight);
}

.imports-upload-panel .panel__body {
  padding: 12px 16px 14px;
}

.imports-upload-form {
  grid-template-columns: minmax(185px, 0.95fr) minmax(260px, 1.45fr) minmax(205px, 1fr) max-content;
  align-items: end;
  gap: 10px 12px;
}

.imports-upload-form .field {
  min-width: 0;
  gap: 5px;
}

.imports-upload-form .field label {
  font-size: var(--type-micro);
  line-height: 1.2;
}

.imports-upload-form .field :is(input, select) {
  min-height: 38px;
}

.imports-upload-form .field input[type="file"] {
  padding-block: 5px;
}

.imports-upload-form .field input[type="file"]::file-selector-button {
  margin-right: 8px;
  padding: 5px 9px;
}

.imports-upload-form__submit .button {
  min-width: 208px;
  min-height: 38px;
  white-space: nowrap;
}

.imports-history-panel {
  margin-top: 12px !important;
}

.imports-history-panel .panel__body.table-wrap {
  padding-inline: 16px;
}

.imports-history-table {
  table-layout: fixed;
}

.imports-history-table th,
.imports-history-table td {
  padding-top: 8px;
  padding-bottom: 8px;
  vertical-align: middle;
}

.imports-history-table th:nth-child(1),
.imports-history-table td:nth-child(1) {
  width: 20%;
}

.imports-history-table th:nth-child(2),
.imports-history-table td:nth-child(2) {
  width: 12%;
}

.imports-history-table th:nth-child(3),
.imports-history-table td:nth-child(3) {
  width: 15%;
}

.imports-history-table th:nth-child(4),
.imports-history-table td:nth-child(4) {
  width: 10%;
}

.imports-history-table th:nth-child(5),
.imports-history-table td:nth-child(5) {
  width: 15%;
}

.imports-history-table th:nth-child(6),
.imports-history-table td:nth-child(6) {
  width: 10%;
}

.imports-history-table th:nth-child(7),
.imports-history-table td:nth-child(7) {
  width: 7%;
}

.imports-history-table th:nth-child(8),
.imports-history-table td:nth-child(8) {
  width: 11%;
}

.imports-history-table__filename {
  overflow-wrap: anywhere;
  font-weight: 600;
}

.imports-history-table .badge {
  min-height: 24px;
  padding: 3px 7px;
  font-size: var(--type-caption);
  line-height: 1.2;
  white-space: nowrap;
}

.imports-progress {
  display: inline-flex;
  width: min(48px, 100%);
  height: 5px;
  overflow: hidden;
  vertical-align: middle;
  border-radius: 999px;
  background: #EAE5DC;
}

.imports-progress__bar {
  display: block;
  min-width: 0;
  border-radius: inherit;
  background: var(--blue-mid);
}

.imports-progress__value {
  display: inline-block;
  min-width: 30px;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

.imports-history-table .table-actions {
  min-width: 0;
}

.imports-history-table .button--table-action {
  min-height: 30px;
  padding-inline: 8px;
}

.imports-history-table .table-actions form .button--table-action {
  width: 30px;
  min-width: 30px;
  padding-inline: 0;
}

@media (max-width: 1120px) {
  .imports-upload-form {
    grid-template-columns: minmax(190px, 1fr) minmax(260px, 1.35fr) minmax(205px, 1fr);
  }

  .imports-upload-form__submit {
    grid-column: 3;
  }
}

@media (max-width: 760px) {
  .imports-upload-form {
    grid-template-columns: 1fr;
  }

  .imports-upload-form__submit {
    grid-column: auto;
  }

  .imports-upload-form__submit .button {
    width: 100%;
  }

  .imports-history-panel .panel__body.table-wrap {
    padding-inline: 12px;
  }

  .imports-history-table {
    min-width: 940px;
  }
}

/* Plano de contas: faixa operacional compacta e árvore densa. */
.list-summary--operational {
  min-height: 36px;
  padding-top: 4px;
  padding-bottom: 4px;
  box-shadow: none;
}

.finance-account-list-filter {
  gap: 8px 12px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.finance-account-list-filter .list-filter__fields {
  grid-template-columns: minmax(148px, 0.72fr) minmax(280px, 2.3fr) minmax(148px, 0.78fr) minmax(150px, 0.78fr);
  gap: 10px;
}

.finance-account-list-filter .list-filter__field {
  display: flex;
  align-items: center;
  gap: 7px;
}

.finance-account-list-filter .list-filter__field label {
  margin: 0;
  color: var(--text-mid);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.finance-account-list-filter .list-filter__field input,
.finance-account-list-filter .list-filter__field select {
  min-height: 34px;
}

.finance-account-list-filter .list-filter__actions {
  align-self: center;
  gap: 8px;
}

.finance-account-list-filter .list-filter__actions .button {
  min-height: 34px;
}

.finance-account-panel > .table-wrap {
  padding: 0 20px 8px;
}

.finance-account-table th,
.finance-account-table td {
  padding-top: 8px;
  padding-bottom: 8px;
}

.finance-account-table__code {
  width: 112px;
}

.finance-account-table__meta {
  width: 98px;
}

.finance-account-table__actions {
  width: 174px;
}

.finance-account-table__controls-row th {
  position: sticky;
  top: 0;
  z-index: 22;
  padding: 7px 10px 4px;
  border-bottom: 0;
  background: var(--surface);
}

.finance-account-table thead tr:nth-child(2) th {
  top: 31px;
  z-index: 21;
}

.finance-tree-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--text-dim);
}

.finance-tree-control {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--navy);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.finance-tree-control:hover,
.finance-tree-control:focus-visible {
  color: var(--blue-mid);
  text-decoration: underline;
}

.finance-code-indent-0 {
  padding-left: 10px !important;
}

.finance-code-indent-1 {
  padding-left: 20px !important;
}

.finance-code-indent-2 {
  padding-left: 30px !important;
}

.finance-code-indent-3 {
  padding-left: 40px !important;
}

.finance-code-indent-4,
.finance-code-indent-5,
.finance-code-indent-6 {
  padding-left: 48px !important;
}

.finance-node--account .finance-tree-toggle-placeholder {
  position: relative;
}

.finance-node--account .finance-tree-toggle-placeholder::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-dim);
}

.finance-node--account .finance-tree-toggle-placeholder::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 8px;
  width: 6px;
  border-top: 1px solid var(--border);
}

.finance-account-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid rgba(21, 128, 61, 0.2);
  border-radius: 999px;
  background: var(--pos-bg);
  color: var(--pos);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.finance-account-status--inactive {
  border-color: var(--border);
  background: var(--surface2);
  color: var(--text-dim);
}

.finance-account-actions {
  gap: 7px;
}

.finance-account-actions .button {
  min-width: 60px;
  justify-content: center;
}

.finance-row-context {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .finance-account-list-filter .list-filter__field {
    display: grid;
    gap: 5px;
  }

  .finance-account-list-filter .list-filter__actions {
    align-self: stretch;
  }

  .finance-account-panel > .table-wrap {
    padding-right: 0;
    padding-left: 0;
  }
}

/* Salvaguardas finais da composição pública contra regras globais posteriores. */
.login-brand__mark img {
  width: auto !important;
  height: 96px !important;
  max-height: 100% !important;
  object-position: center;
}

.login-card h1 {
  font-size: clamp(28px, 3vw, 34px);
}

@media (max-width: 640px) {
  .login-brand__mark img {
    height: 72px !important;
  }
}

/* Ajuste final de densidade: o login deve permanecer compacto em desktop e mobile. */
.login-shell {
  padding: 24px 16px;
}

.login-card {
  width: min(calc(100% - 0px), 520px);
  padding: 36px 40px 30px;
  border-radius: 18px;
}

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

.login-brand__mark {
  width: min(100%, 280px);
  height: 104px;
}

.login-brand__mark img {
  height: 104px !important;
}

.login-card .brand__eyebrow {
  margin-bottom: 8px;
}

.login-card h1 {
  margin-bottom: 8px;
  font-size: 28px;
}

.login-card .help {
  margin-bottom: 20px;
  font-size: 15px;
  line-height: 1.45;
}

.login-card .stack {
  gap: 14px;
}

.login-field-control input {
  min-height: 50px;
}

.login-card .button {
  min-height: 50px;
  margin-top: 2px;
}

.login-divider {
  margin: 18px 0 8px;
}

.auth-links a {
  min-height: 46px;
  font-size: 14px;
}

@media (max-width: 640px) {
  .login-card {
    padding: 28px 24px 24px;
  }

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

  .login-brand__mark {
    width: min(100%, 260px);
    height: 72px;
  }

  .login-brand__mark img {
    height: 72px !important;
  }
}

/* Configuração do workflow editorial */
.editorial-workflow-notice {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 12px 32px 0;
  padding: 14px 18px;
  color: var(--navy);
  background: var(--blue-pale);
  border: 1px solid #B9D3F0;
  border-radius: 12px;
}

.editorial-workflow-notice span { font-size: 21px; }
.editorial-workflow-notice p { margin: 0; }
.editorial-workflow-workspace { margin: 12px 32px 0; }
.editorial-workflow-workspace__grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(390px, .8fr); gap: 16px; align-items: start; }
.editorial-workflow-list-panel__header { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.editorial-workflow-list-panel__header h2, .editorial-workflow-editor-panel h2 { margin: 0; }
.editorial-workflow-list-panel__header p, .editorial-workflow-editor__heading p, .editorial-notification-block p, .editorial-recipient-roles p { margin: 5px 0 0; color: var(--text-mid); }
.editorial-workflow-name { padding: 14px 18px 0; }
.editorial-workflow-table-wrap { margin-top: 14px; overflow-x: auto; }
.editorial-workflow-table { min-width: 730px; }
.editorial-workflow-table th, .editorial-workflow-table td { padding: 14px 12px; vertical-align: middle; }
.editorial-workflow-table th:first-child, .editorial-workflow-table td:first-child { width: 78px; }
.editorial-workflow-table th:nth-child(2), .editorial-workflow-table td:nth-child(2) { width: 58px; }
.editorial-workflow-table th:last-child, .editorial-workflow-table td:last-child { width: 42px; text-align: center; }
.editorial-workflow-table [data-workflow-stage-row] { cursor: pointer; }
.editorial-workflow-table [data-workflow-stage-row].is-selected { background: var(--blue-pale); }
.editorial-workflow-table [data-workflow-stage-row].is-dragging { opacity: .52; }
.editorial-reorder-handle, .editorial-reorder-buttons button, .editorial-stage-edit { color: var(--text-mid); background: transparent; border: 0; cursor: pointer; }
.editorial-reorder-handle { font-size: 20px; line-height: 1; cursor: grab; }
.editorial-reorder-buttons { display: inline-flex; flex-direction: column; margin-left: 4px; vertical-align: middle; }
.editorial-reorder-buttons button { padding: 0 3px; font-size: 11px; }
.editorial-stage-edit { padding: 3px 8px; font-size: 26px; line-height: .8; }
.editorial-workflow-list-empty { padding: 24px; margin: 0; color: var(--text-mid); text-align: center; }
.editorial-workflow-editor-panel { position: sticky; top: 118px; max-height: calc(100vh - 138px); overflow: auto; }
.editorial-workflow-editor-panel__header { padding-bottom: 13px; }
.editorial-workflow-editor-panel__body { padding-top: 16px; }
.editorial-workflow-editor__heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.editorial-workflow-stage-editor [name$="-DELETE"] { display: none !important; }
.editorial-workflow-editor__heading h2 { font-size: 23px; }
.editorial-workflow-editor__fields { gap: 12px; }
.editorial-notification-block, .editorial-recipient-roles { position: relative; padding: 18px 0; border-top: 1px solid var(--border); }
.editorial-notification-block { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 12px; }
.editorial-notification-block h3, .editorial-recipient-roles h3 { margin: 0; font-size: 16px; }
.editorial-notification-fields { grid-column: 1 / -1; display: grid; gap: 12px; margin-top: 14px; }
.editorial-notification-fields[hidden], .editorial-recipient-roles[hidden] { display: none !important; }
.editorial-switch { position: relative; width: 42px; height: 24px; margin-top: 1px; cursor: pointer; }
.editorial-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.editorial-switch span { display: block; width: 42px; height: 24px; border-radius: 999px; background: var(--text-dim); transition: background .15s ease; }
.editorial-switch span::after { content: ""; display: block; width: 18px; height: 18px; margin: 3px; border-radius: 50%; background: white; box-shadow: 0 1px 2px rgb(15 23 42 / .2); transition: transform .15s ease; }
.editorial-switch input:checked + span { background: var(--blue-mid); }
.editorial-switch input:checked + span::after { transform: translateX(18px); }
.editorial-switch input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.editorial-recipient-roles > div { display: grid; gap: 8px; margin-top: 12px; }
.editorial-recipient-roles label { display: flex; align-items: center; gap: 8px; color: var(--text); }
.editorial-workflow-editor-panel__footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface); }
.editorial-workflow-dialog article { width: min(580px, calc(100vw - 36px)); padding: 22px; background: var(--surface); border-radius: 12px; }
.editorial-workflow-dialog header, .editorial-workflow-dialog footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.editorial-workflow-dialog header h2 { margin: 0; }
.editorial-workflow-dialog footer { justify-content: flex-end; margin-top: 20px; }
.editorial-email-preview__recipient { color: var(--text-mid); }
.editorial-workflow-dialog pre { padding: 14px; overflow: auto; color: var(--text); white-space: pre-wrap; background: var(--surface2); border-radius: 8px; font: inherit; }

@media (max-width: 1180px) {
  .editorial-workflow-workspace__grid { grid-template-columns: 1fr; }
  .editorial-workflow-editor-panel { position: static; max-height: none; }
}

@media (max-width: 720px) {
  .editorial-workflow-notice, .editorial-workflow-workspace { margin-left: 18px; margin-right: 18px; }
  .editorial-workflow-list-panel__header, .editorial-workflow-editor-panel__footer { align-items: stretch; flex-direction: column; }
  .editorial-workflow-list-panel__header .button, .editorial-workflow-editor-panel__footer .button { width: 100%; }
}

/* Acabamento da área de trabalho do workflow editorial. */
.editorial-workflow-notice { margin-top: 10px; padding: 11px 16px; font-size: 14px; }
.editorial-workflow-workspace { margin-top: 12px; }
.editorial-workflow-workspace__grid { grid-template-columns: minmax(0, 1.85fr) minmax(378px, 1fr); gap: 14px; }
.editorial-workflow-list-panel__header { min-height: 76px; padding: 16px 20px; }
.editorial-workflow-list-panel__header h2 { font-size: 20px; }
.editorial-workflow-list-panel__header p { font-size: 13px; }
.editorial-workflow-list-panel__header .button { flex: 0 0 auto; }
.editorial-workflow-name { display: flex; align-items: center; gap: 12px; margin: 12px 18px 10px; padding: 10px 12px; background: var(--surface2); border: 1px solid var(--border-light); border-radius: 8px; }
.editorial-workflow-name label { flex: 0 0 auto; margin: 0; color: var(--text-mid); font-size: 12px; font-weight: 600; }
.editorial-workflow-name input { width: min(250px, 100%); }
.editorial-workflow-table-wrap { margin-top: 0; overflow: visible; }
.editorial-workflow-table { width: 100%; min-width: 0; table-layout: fixed; }
.editorial-workflow-table__reorder { width: 30px; }
.editorial-workflow-table__order { width: 44px; }
.editorial-workflow-table__sla { width: 54px; }
.editorial-workflow-table__notice { width: 108px; }
.editorial-workflow-table__action { width: 32px; }
.editorial-workflow-table th, .editorial-workflow-table td { padding: 11px 7px; overflow: hidden; vertical-align: middle; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.editorial-workflow-table th { font-size: 11px; letter-spacing: .045em; }
.editorial-workflow-table td { font-size: 12px; line-height: 1.3; }
.editorial-workflow-table th:first-child, .editorial-workflow-table td:first-child, .editorial-workflow-table th:nth-child(2), .editorial-workflow-table td:nth-child(2), .editorial-workflow-table th:nth-child(5), .editorial-workflow-table td:nth-child(5), .editorial-workflow-table th:last-child, .editorial-workflow-table td:last-child { width: auto; text-align: center; }
.editorial-workflow-table td:nth-child(6) { color: var(--text-mid); }
.editorial-workflow-table [data-workflow-stage-row] { height: 48px; }
.editorial-reorder-handle { padding: 4px; color: var(--text-dim); font-size: 18px; }
.editorial-stage-edit { display: inline-grid; width: 28px; height: 28px; padding: 0; place-items: center; border-radius: 6px; color: var(--navy); font-size: 22px; }
.editorial-stage-edit:hover, .editorial-workflow-table [data-workflow-stage-row]:hover .editorial-stage-edit { background: var(--blue-pale); }
.editorial-workflow-editor-panel { top: 106px; display: flex; flex-direction: column; max-height: calc(100dvh - 230px); overflow: hidden; }
.editorial-workflow-editor-panel__header { flex: 0 0 auto; padding: 16px 20px; }
.editorial-workflow-editor-panel__header h2 { font-size: 20px; line-height: 1.25; }
.editorial-workflow-editor-panel__body { min-height: 0; padding: 14px 20px; overflow-y: auto; }
.editorial-workflow-stage-editor [name$="-DELETE"] { display: none !important; }
.editorial-workflow-editor-group { padding: 14px 0; border-top: 1px solid var(--border-light); }
.editorial-workflow-editor-group--basic { padding-top: 0; border-top: 0; }
.editorial-workflow-editor-group__header { margin-bottom: 12px; }
.editorial-workflow-editor-group__header h3, .editorial-notification-block__heading h3 { margin: 0; color: var(--text); font-size: 14px; line-height: 1.35; }
.editorial-workflow-editor-group__header p, .editorial-notification-block__heading p { margin: 3px 0 0; color: var(--text-mid); font-size: 12px; line-height: 1.4; }
.editorial-workflow-editor__fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(96px, .42fr); gap: 10px; }
.editorial-workflow-field--name { grid-column: 1 / -1; }
.editorial-workflow-editor-panel .form-field { min-width: 0; margin: 0; }
.editorial-workflow-editor-panel .form-field label, .editorial-workflow-name label { display: block; margin-bottom: 5px; color: var(--text-mid); font-size: 11px; font-weight: 700; letter-spacing: .025em; }
.editorial-workflow-editor-panel .form-field :is(input:not([type="checkbox"]), select, textarea), .editorial-workflow-name input { box-sizing: border-box; width: 100%; min-height: 38px; padding: 8px 10px; color: var(--text); font: inherit; line-height: 1.3; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: none; }
.editorial-workflow-editor-panel .form-field textarea { min-height: 82px; resize: vertical; }
.editorial-workflow-editor-panel .form-field :is(input:not([type="checkbox"]), select, textarea):focus, .editorial-workflow-name input:focus { border-color: var(--blue-mid); outline: 2px solid rgb(27 120 200 / .14); outline-offset: 0; }
.editorial-notification-block { display: block; padding: 14px 0; }
.editorial-notification-block__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.editorial-notification-block__heading > div { min-width: 0; }
.editorial-notification-fields { display: grid; gap: 10px; margin-top: 12px; }
.editorial-notification-fields[hidden], .editorial-recipient-roles[hidden] { display: none !important; }
.editorial-switch { flex: 0 0 auto; margin: 1px 0 0; }
.editorial-recipient-roles > div { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; margin-top: 10px; }
.editorial-recipient-roles label { min-width: 0; color: var(--text-mid); font-size: 12px; }
.editorial-workflow-editor-panel__footer { flex: 0 0 auto; justify-content: space-between; padding: 12px 18px; border-top-color: var(--border-light); }
.editorial-workflow-editor-panel__actions { display: flex; justify-content: flex-end; gap: 8px; }
.editorial-workflow-editor-panel__footer .button { min-height: 36px; padding: 7px 11px; font-size: 12px; white-space: nowrap; }
.editorial-workflow-editor-panel__footer .button--secondary { color: var(--navy); background: var(--surface); border-color: var(--border); }
.editorial-workflow-editor-panel__footer .button--secondary:hover { color: var(--navy); background: var(--blue-pale); border-color: var(--blue-mid); }
.editorial-workflow-delete-action { color: var(--neg) !important; background: transparent !important; border-color: transparent !important; }
.editorial-workflow-delete-action:hover { color: var(--neg) !important; background: var(--neg-bg) !important; }
.editorial-version-history { margin: 14px 32px 28px; }
.editorial-version-history summary { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; cursor: pointer; list-style: none; }
.editorial-version-history summary::-webkit-details-marker { display: none; }
.editorial-version-history summary small { display: block; margin-top: 2px; color: var(--text-mid); font-size: 12px; font-weight: 400; }
.editorial-version-history[open] summary { border-bottom: 1px solid var(--border-light); }

@media (max-width: 1180px) {
  .editorial-workflow-workspace__grid { grid-template-columns: 1fr; }
  .editorial-workflow-editor-panel { max-height: none; }
}

@media (max-width: 760px) {
  .editorial-workflow-name { align-items: stretch; flex-direction: column; gap: 5px; }
  .editorial-workflow-name input { width: 100%; }
  .editorial-workflow-table__notice { width: 112px; }
  .editorial-workflow-editor-panel__footer { align-items: stretch; flex-direction: column-reverse; }
  .editorial-workflow-editor-panel__actions { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .editorial-author-row__fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .editorial-submission-fields,
  .editorial-submission-fields--assessment,
  .editorial-author-row__fields { grid-template-columns: 1fr; }
  .editorial-submission-form { margin-left: 18px; margin-right: 18px; }
  .editorial-submission-actions { align-items: stretch; flex-direction: column-reverse; }
  .editorial-submission-actions .button { width: 100%; }
}

.client-review-panel__header {
  position: static;
}

.client-review-table {
  min-width: 980px;
}

.client-review-form {
  display: grid;
  gap: 6px;
  min-width: 185px;
}

.client-review-form select {
  width: 100%;
}

/* Shell autenticado: `1224px` é o breakpoint responsivo global validado.
   Antes de a sidebar aberta comprometer o conteúdo, a preferência manual é
   temporariamente apresentada no modo compacto. */
@media (max-width: 1224px) {
  .shell,
  .shell.is-sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed-w) minmax(0, 1fr);
  }

  .content {
    overflow-y: auto;
  }

  .sidebar,
  .shell.is-sidebar-collapsed .sidebar {
    position: sticky;
    top: 0;
    align-self: stretch;
    width: var(--sidebar-collapsed-w);
    min-width: var(--sidebar-collapsed-w);
    height: 100vh;
    max-height: 100vh;
    padding: 0;
    overflow: hidden;
    border-right: 1px solid var(--border);
    border-bottom: 0;
  }

  .shell.is-sidebar-collapsed .brand {
    padding: 12px 10px;
  }

  .shell.is-sidebar-collapsed .brand__topline {
    justify-content: center;
  }

  .shell.is-sidebar-collapsed .button--icon {
    width: 44px;
    min-width: 44px;
  }

  .shell.is-sidebar-collapsed .brand__mark,
  .shell.is-sidebar-collapsed .nav__label,
  .shell.is-sidebar-collapsed .nav__group-toggle {
    display: none;
  }

  .shell.is-sidebar-collapsed .nav {
    align-items: center;
    gap: 12px;
    padding: 10px 0;
  }

  .shell.is-sidebar-collapsed .nav__group,
  .shell.is-sidebar-collapsed .nav__group-items {
    width: 100%;
  }

  .shell.is-sidebar-collapsed .nav__group-items {
    display: grid !important;
    gap: 8px;
    padding-bottom: 0;
  }

  .shell.is-sidebar-collapsed .nav a {
    width: 48px;
    min-height: 44px;
    margin: 0 auto;
    padding: 0;
    justify-content: center;
    border: 1px solid transparent;
  }

  .shell.is-sidebar-collapsed .nav a::before,
  .shell.is-sidebar-collapsed .nav a::after {
    display: none;
  }

  .shell.is-sidebar-collapsed .nav__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: var(--text-mid);
  }

  .shell.is-sidebar-collapsed .nav a.is-active {
    border-color: rgba(27, 120, 200, 0.16);
    background: var(--blue-pale);
  }

  .shell.is-sidebar-collapsed .nav a.is-active .nav__icon {
    color: var(--navy);
  }
}

/* Lançamentos financeiros: resumo e responsividade permanecem isolados desta tela. */
.finance-entry-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 32px 0;
}

.finance-entry-summary__card {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.finance-entry-summary__card--highlight {
  border-color: var(--year-hl-border);
  background: var(--year-hl);
}

.finance-entry-summary__card span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-dim);
  font-size: var(--type-micro);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.finance-entry-summary__card strong {
  display: block;
  color: var(--text);
  font-size: var(--type-title-md);
  font-variant-numeric: tabular-nums;
  line-height: var(--leading-tight);
  white-space: nowrap;
}

.finance-entry-summary__card strong.is-positive {
  color: var(--pos);
}

.finance-entry-summary__card strong.is-negative {
  color: var(--neg);
}

.content > .topbar + .finance-entry-list-filter + .finance-entry-summary + .finance-entry-ledger-panel {
  display: flex;
  min-height: 0;
  padding: 0;
  margin: 12px 0 0;
  overflow: hidden;
  flex: 1 1 auto;
  flex-direction: column;
}

.content > .topbar + .finance-entry-list-filter + .finance-entry-summary + .finance-entry-ledger-panel > .finance-entry-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

@media (max-width: 1100px) {
  .finance-entry-filter-primary {
    position: relative;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .finance-entry-filter-primary__actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .finance-entry-list-filter .finance-advanced-filters {
    position: static;
  }

  .finance-entry-list-filter .finance-advanced-filters__panel {
    right: 0;
    left: 0;
    width: auto;
  }

  .finance-entry-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .finance-entry-table-wrap {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .finance-entry-table--ledger {
    min-width: 920px;
  }
}

@media (max-width: 800px) {
  .finance-entry-topbar {
    align-items: stretch;
  }

  .finance-entry-topbar > div:first-child,
  .finance-entry-topbar > .toolbar {
    width: 100%;
  }

  .finance-entry-topbar > .toolbar {
    align-items: center;
    justify-content: flex-end;
    padding-right: 48px;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .finance-entry-topbar > .toolbar > .header-actions {
    width: auto;
  }

  .finance-entry-topbar .button {
    width: auto;
  }

  .finance-entry-filter-primary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-entry-filter-primary__field--q,
  .finance-entry-filter-primary__field--cash_account {
    grid-column: 1 / -1;
  }

  .finance-entry-filter-primary__actions {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .finance-entry-filter-primary__actions .button,
  .finance-entry-filter-primary__actions .finance-advanced-filters,
  .finance-entry-filter-primary__actions .finance-advanced-filters summary {
    width: auto;
  }

  .finance-entry-list-filter .finance-advanced-filters__panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-entry-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-right: 18px;
    margin-left: 18px;
  }

  .finance-entry-summary__card:last-child {
    grid-column: 1 / -1;
  }
}

.nav__attention {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 14px;
  margin-left: auto;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: #D99016;
  color: #FFF;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.shell.is-sidebar-collapsed .nav__attention {
  position: absolute;
  top: 3px;
  right: 2px;
  margin: 0;
}
