:root {
  --bg: #f5f6f3;
  --surface: #ffffff;
  --surface-soft: #fafbf8;
  --ink: #202322;
  --muted: #66706d;
  --line: #dfe4df;
  --line-strong: #c7d0ca;
  --teal: #00796f;
  --teal-soft: #e4f3ef;
  --green: #247247;
  --green-soft: #e7f2ea;
  --amber: #a96500;
  --amber-soft: #f8ecd9;
  --coral: #b84d3f;
  --coral-soft: #f7e4e1;
  --blue: #286bb5;
  --blue-soft: #e4edf7;
  --shadow: 0 12px 30px rgba(30, 38, 35, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

body.auth-locked {
  min-height: 100vh;
  overflow: hidden;
}

body.auth-locked .app-shell {
  display: none;
}

body:not(.auth-locked) .login-page {
  display: none;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(10, 102, 194, 0.2);
  outline-offset: 2px;
}

.login-page {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(380px, 0.68fr);
  min-height: 100vh;
  padding: 30px;
  gap: 28px;
  background:
    linear-gradient(135deg, rgba(251, 251, 253, 0.96), rgba(238, 243, 248, 0.92) 48%, rgba(247, 249, 251, 0.98)),
    #f5f5f7;
}

.login-brand-panel,
.login-card {
  border: 1px solid rgba(210, 216, 222, 0.76);
  border-radius: 24px;
  box-shadow: 0 26px 80px rgba(29, 29, 31, 0.12);
  backdrop-filter: blur(28px) saturate(150%);
}

.login-brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: calc(100vh - 60px);
  padding: 42px;
  color: #1d1d1f;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(235, 242, 249, 0.68)),
    rgba(251, 251, 253, 0.72);
  overflow: hidden;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-logo {
  width: 76px;
  height: 95px;
  border-radius: 18px;
  overflow: hidden;
  background: #050b18;
  box-shadow: 0 18px 44px rgba(10, 102, 194, 0.16);
}

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

.login-brand strong,
.login-brand span,
.login-hero p,
.login-hero h1 {
  display: block;
  margin: 0;
}

.login-brand strong {
  color: #1d1d1f;
  font-size: 25px;
  line-height: 1.1;
}

.login-brand span,
.login-hero p,
.login-signal-grid span {
  color: #6e6e73;
}

.login-hero {
  max-width: 620px;
}

.login-hero p {
  color: #0a66c2;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.login-hero h1 {
  margin-top: 16px;
  max-width: 640px;
  color: #1d1d1f;
  font-size: clamp(30px, 3.3vw, 46px);
  line-height: 1.18;
  font-weight: 800;
}

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

.login-signal-grid div {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(210, 216, 222, 0.78);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 12px 30px rgba(29, 29, 31, 0.05);
}

.login-signal-grid span,
.login-signal-grid strong {
  display: block;
}

.login-signal-grid span {
  margin-bottom: 8px;
  font-size: 12px;
}

.login-signal-grid strong {
  color: #1d1d1f;
  font-size: 15px;
  line-height: 1.35;
}

.login-card {
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: min(100%, 500px);
  justify-self: center;
  padding: 38px;
  background: rgba(255, 255, 255, 0.78);
}

.login-card-head p,
.login-card-head h2 {
  margin: 0;
}

.login-card-head p {
  color: #6e6e73;
  font-size: 13px;
  font-weight: 800;
}

.login-card-head h2 {
  margin-top: 8px;
  color: #1d1d1f;
  font-size: 34px;
  line-height: 1.16;
}

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

.login-form label {
  display: grid;
  gap: 8px;
  color: #6e6e73;
  font-size: 13px;
  font-weight: 700;
}

.login-form input,
.login-form select {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  color: #1d1d1f;
  border: 1px solid #d2d2d7;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
}

.login-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.check-line {
  display: inline-flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px !important;
  color: var(--ink) !important;
  font-weight: 600 !important;
}

.check-line input {
  min-height: 0;
  width: auto;
}

.login-submit {
  min-height: 54px;
  color: #fff;
  border: 0;
  border-radius: 14px;
  background: #0a66c2;
  font-weight: 800;
  box-shadow: 0 16px 32px rgba(10, 102, 194, 0.22);
}

.login-submit:hover {
  background: #0959aa;
}

.login-trust {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  color: #6e6e73;
  border-top: 1px solid #e2e2e7;
  font-size: 13px;
}

.login-trust strong {
  color: #1d1d1f;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  padding: 18px;
  overflow-y: auto;
  background: #fcfcf8;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 55px;
  flex: 0 0 auto;
  border-radius: 10px;
  overflow: hidden;
  color: #fff;
  background: #000819;
  box-shadow: 0 8px 18px rgba(10, 102, 194, 0.14);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.brand strong,
.brand span {
  display: block;
  line-height: 1.2;
}

.brand strong {
  font-size: 18px;
}

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

.ledger-summary,
.side-status,
.panel,
.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.ledger-summary {
  padding: 14px;
}

.ledger-summary p,
.side-status p,
.panel-title p,
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.ledger-summary strong {
  display: block;
  margin: 4px 0 12px;
  font-size: 15px;
  line-height: 1.35;
}

.ledger-summary label,
.form-grid label,
.period-picker {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.permission-summary {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.is-permission-disabled {
  cursor: not-allowed !important;
  opacity: 0.48;
}

select,
input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.main-nav {
  display: grid;
  gap: 6px;
}

.nav-extension {
  display: grid;
  gap: 6px;
}

.nav-group-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  color: var(--muted);
  text-align: left;
  background: #f8faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.nav-group-toggle span:first-child {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.nav-group-toggle small {
  font-size: 11px;
}

.nav-group-toggle .icon {
  text-align: right;
  transition: transform 0.18s ease;
}

.nav-extension:not(.is-open) .nav-extension-body {
  display: none;
}

.nav-extension.is-open .nav-group-toggle .icon {
  transform: rotate(180deg);
}

.nav-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 8px 10px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}

.nav-item:hover {
  background: #f1f4ef;
  border-color: var(--line);
}

.nav-item.is-active {
  color: #083b36;
  background: var(--teal-soft);
  border-color: #bddbd4;
}

.nav-item span:not(.icon) {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item small {
  color: var(--muted);
  font-size: 11px;
}

.icon {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  font-weight: 800;
  line-height: 1;
}

.side-status {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 14px;
}

.side-status div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.side-status strong {
  flex: 0 0 auto;
}

.state-good {
  color: var(--green);
}

.main {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  margin-bottom: 18px;
}

.topbar h1,
.view-heading h2 {
  margin: 2px 0 0;
  line-height: 1.12;
}

.topbar h1 {
  font-size: 26px;
}

.view-heading h2 {
  font-size: 24px;
}

.topbar-actions,
.heading-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.period-picker {
  grid-template-columns: auto minmax(120px, 1fr);
  align-items: center;
}

.period-picker select {
  min-height: 36px;
}

.global-search {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(240px, 360px) 34px;
  align-items: center;
  min-height: 38px;
  padding: 0 4px 0 10px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.global-search .icon {
  color: var(--muted);
}

.global-search input {
  min-height: 34px;
  padding: 6px 8px;
  border: 0;
  background: transparent;
}

.global-search input:focus-visible {
  outline: 0;
}

.search-clear {
  width: 30px;
  height: 30px;
  min-height: 30px;
  color: var(--muted);
  border: 0;
  background: transparent;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: none;
  width: min(620px, calc(100vw - 36px));
  max-height: 430px;
  overflow-y: auto;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 44px rgba(16, 24, 32, 0.18);
}

.search-results.is-open {
  display: grid;
  gap: 6px;
}

.search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: 100%;
  padding: 10px;
  text-align: left;
  background: #fff;
  border: 1px solid transparent;
  border-radius: 8px;
}

.search-result:hover,
.search-result.is-active {
  background: #edf7f4;
  border-color: #b8d8d0;
}

.search-result strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.search-result span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.search-result small {
  display: inline-flex;
  align-items: center;
  align-self: center;
  min-height: 24px;
  padding: 3px 8px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.btn,
.icon-btn,
.text-btn,
.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  text-decoration: none;
}

.btn:hover,
.icon-btn:hover,
.text-btn:hover,
.segmented button:hover {
  border-color: #aab8b0;
  background: #f8faf7;
}

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

.btn.primary:hover {
  background: #00665e;
}

.btn.full {
  width: 100%;
  margin-top: 12px;
}

.icon-btn {
  width: 38px;
  padding: 0;
  font-weight: 800;
}

.text-btn {
  min-height: 32px;
  padding: 6px 8px;
  color: var(--teal);
  background: transparent;
  border-color: transparent;
  font-weight: 700;
}

.file-btn {
  position: relative;
  overflow: hidden;
}

.file-btn input,
.dropzone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.view-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-grid.compact {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.metric-card {
  position: relative;
  min-height: 126px;
  padding: 16px;
  overflow: hidden;
}

.metric-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  content: "";
  background: var(--teal);
}

.metric-card:nth-child(2)::before {
  background: var(--blue);
}

.metric-card:nth-child(3)::before {
  background: var(--amber);
}

.metric-card:nth-child(4)::before {
  background: var(--coral);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 25px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.metric-card small {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.workspace-grid,
.module-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.workspace-grid {
  grid-template-columns: minmax(260px, 1fr) minmax(420px, 1.7fr) minmax(260px, 1fr);
}

.module-grid.two,
.reports-layout {
  grid-template-columns: minmax(330px, 1fr) minmax(420px, 1.4fr);
}

.documents-layout,
.expense-layout,
.tax-layout,
.cash-layout,
.voucher-layout,
.crm-layout,
.settings-layout {
  grid-template-columns: minmax(270px, 0.82fr) minmax(520px, 1.5fr) minmax(270px, 0.82fr);
}

.cash-layout,
.tax-layout,
.crm-layout,
.voucher-layout {
  grid-template-columns: minmax(520px, 1.6fr) minmax(300px, 0.9fr);
}

.settings-layout {
  align-items: start;
  grid-template-columns: minmax(320px, 0.88fr) minmax(520px, 1.42fr);
}

.settings-layout .panel.wide {
  grid-column: 2 / 3;
  grid-row: 1 / span 2;
}

.settings-layout > .panel:not(.wide) {
  grid-column: 1 / 2;
}

.crm-layout .integration-log {
  grid-column: 1 / -1;
}

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

.expense-summary strong {
  font-size: 16px;
}

.expense-rules {
  margin-top: 12px;
}

.expense-form label:nth-child(1),
.expense-form label:nth-child(3),
.expense-form label:nth-child(4) {
  grid-column: auto;
}

.wide {
  min-width: 0;
}

.panel {
  min-width: 0;
  padding: 16px;
}

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  line-height: 1.25;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 8px;
  color: var(--blue);
  white-space: nowrap;
  background: var(--blue-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge.success {
  color: var(--green);
  background: var(--green-soft);
}

.badge.warning {
  color: var(--amber);
  background: var(--amber-soft);
}

.badge.danger {
  color: var(--coral);
  background: var(--coral-soft);
}

.task-list,
.insight-list,
.sync-list,
.match-list,
.mapping-list,
.timeline,
.setup-list,
.rule-list {
  display: grid;
  gap: 10px;
}

.task-row,
.insight-row,
.sync-row,
.match-row,
.mapping-row,
.timeline-row,
.setup-list div,
.rule-list div {
  display: grid;
  gap: 4px;
  padding: 11px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.task-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.task-row .icon-chip {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 8px;
  font-weight: 800;
}

.task-row strong,
.insight-row strong,
.sync-row strong,
.match-row strong,
.mapping-row strong,
.timeline-row strong,
.setup-list strong,
.rule-list strong {
  min-width: 0;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.task-row span,
.insight-row span,
.sync-row span,
.match-row span,
.mapping-row span,
.timeline-row span,
.setup-list span,
.rule-list span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.tax-name-cell {
  display: grid;
  gap: 4px;
  min-width: 220px;
}

.tax-name-cell strong {
  color: var(--ink);
  font-size: 13px;
}

.tax-name-cell span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f7f9f6;
  font-size: 12px;
  font-weight: 800;
}

tbody tr {
  transition: background 0.18s ease;
}

tbody tr:hover,
tbody tr.is-selected {
  background: #f1f7f4;
}

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

.ledger-query-panel {
  margin-bottom: 16px;
}

.asset-query-bar {
  display: grid;
  grid-template-columns: minmax(360px, 1.4fr) repeat(3, minmax(110px, 0.55fr)) minmax(180px, 0.9fr);
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.asset-query-bar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.asset-query-bar select,
.asset-query-bar input {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.asset-tabs {
  align-self: end;
  min-width: min(100%, 430px);
}

.asset-search input {
  min-width: 0;
}

.ledger-query-controls {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.ledger-query-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.ledger-query-actions {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 8px;
  align-items: end;
}

.ledger-summary-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 1px;
  margin: 14px 0;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ledger-summary-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  background: #f8faf6;
}

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

.ledger-summary-item strong {
  min-width: 0;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.ledger-book-table {
  min-width: 1040px;
}

.amount-cell {
  text-align: right;
  white-space: nowrap;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.ledger-book-row.is-openable {
  cursor: pointer;
}

.ledger-book-row.is-openable td:nth-child(2),
.ledger-book-row.is-openable td:nth-child(3) {
  color: #0f6d63;
  font-weight: 800;
}

.ledger-book-row.is-openable:hover td {
  background: #e9f5f1;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.channel-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  white-space: nowrap;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.channel-pill.structured {
  color: var(--green);
  background: var(--green-soft);
}

.channel-pill.electronic {
  color: var(--blue);
  background: var(--blue-soft);
}

.channel-pill.fallback {
  color: var(--amber);
  background: var(--amber-soft);
}

.channel-pill.manual {
  color: var(--muted);
  background: #f1f2f2;
}

.status-ok {
  color: var(--green);
  background: var(--green-soft);
}

.status-warn {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-info {
  color: var(--blue);
  background: var(--blue-soft);
}

.status-danger {
  color: var(--coral);
  background: var(--coral-soft);
}

.bar-chart,
.line-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 230px;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bar-item {
  display: grid;
  align-content: end;
  justify-items: center;
  gap: 8px;
  flex: 1;
  min-width: 38px;
  height: 190px;
}

.bar {
  width: 100%;
  max-width: 42px;
  min-height: 18px;
  border-radius: 7px 7px 3px 3px;
  background: var(--teal);
}

.bar-item:nth-child(2) .bar,
.bar-item:nth-child(5) .bar {
  background: var(--blue);
}

.bar-item:nth-child(3) .bar {
  background: var(--amber);
}

.bar-item:nth-child(4) .bar,
.bar-item:nth-child(6) .bar {
  background: var(--green);
}

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

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 180px;
  margin-bottom: 12px;
  padding: 18px;
  color: var(--ink);
  text-align: center;
  background: #f8faf7;
  border: 1px dashed #98aaa2;
  border-radius: 8px;
  cursor: pointer;
}

.dropzone:hover {
  border-color: var(--teal);
  background: #f0f7f4;
}

.capture-flow {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.capture-route {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  width: 100%;
  padding: 11px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.capture-route:hover {
  border-color: #b7d4f3;
  background: #f2f6fb;
}

.capture-route span {
  display: grid;
  grid-row: 1 / span 2;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 8px;
  font-weight: 900;
}

.capture-route strong {
  min-width: 0;
  font-size: 14px;
  line-height: 1.25;
}

.capture-route small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.capture-route.is-primary {
  border-color: #b9d5c7;
  background: #f4faf6;
}

.capture-route.is-primary span {
  color: var(--green);
  background: var(--green-soft);
}

.ops-disclosure {
  margin-bottom: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ops-disclosure summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  min-height: 42px;
  padding: 9px 11px;
  list-style: none;
  cursor: pointer;
}

.ops-disclosure summary::-webkit-details-marker {
  display: none;
}

.ops-disclosure summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 999px;
  font-weight: 900;
}

.ops-disclosure[open] summary::after {
  content: "-";
}

.ops-disclosure summary span {
  min-width: 0;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.25;
}

.ops-disclosure summary small {
  grid-column: 1 / 2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.ops-disclosure.compact {
  background: var(--surface-soft);
}

.ops-disclosure.compact > .capture-flow,
.ops-disclosure.compact > .rule-list {
  padding: 0 10px 10px;
}

.manual-edit-panel {
  margin-top: 12px;
}

.manual-edit-panel .correction-form {
  margin-top: 0;
  padding: 0 10px 10px;
  border-top: 0;
}

.dropzone .icon {
  width: 38px;
  height: 38px;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 8px;
}

.dropzone strong,
.dropzone small {
  display: block;
}

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

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented.small {
  flex-wrap: nowrap;
}

.segmented button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

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

.mini-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.mini-summary div {
  padding: 11px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mini-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.mini-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.detail-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0;
}

.detail-list div {
  display: grid;
  gap: 5px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
}

.detail-list dd {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.ocr-check {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  margin-bottom: 14px;
}

.check-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 10px;
  background: var(--green-soft);
  border: 1px solid #c7dfcf;
  border-radius: 8px;
}

.check-row.warning {
  background: var(--amber-soft);
  border-color: #e4cfa7;
}

.check-row.danger {
  background: var(--coral-soft);
  border-color: #e4bcb5;
}

.check-row strong {
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.check-row span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.ocr-diagnostic {
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ocr-diagnostic summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

.ocr-diagnostic summary::-webkit-details-marker {
  display: none;
}

.ocr-diagnostic summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 999px;
  font-weight: 900;
}

.ocr-diagnostic[open] summary::before {
  content: "-";
}

.ocr-diagnostic summary span {
  flex: 1;
}

.ocr-diagnostic .text-btn {
  min-height: 28px;
  padding: 4px 7px;
  font-size: 12px;
}

.diagnostic-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.diagnostic-grid div {
  display: grid;
  gap: 3px;
  padding: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.diagnostic-grid strong {
  font-size: 12px;
}

.diagnostic-grid span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.ocr-diagnostic pre {
  max-height: 190px;
  margin: 10px 0 0;
  padding: 10px;
  overflow: auto;
  color: #3a3a3c;
  background: #f8f9f8;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.correction-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.correction-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.correction-form label:nth-child(1),
.correction-form label:nth-child(3),
.correction-actions {
  grid-column: 1 / -1;
}

.correction-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 2px;
}

.mapping-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

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

.statement-item {
  display: grid;
  gap: 8px;
  min-height: 108px;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.statement-item strong {
  font-size: 20px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.line-chart {
  position: relative;
  align-items: stretch;
  min-height: 260px;
}

.line-chart svg {
  width: 100%;
  height: 230px;
}

.line-chart text {
  fill: var(--muted);
  font-size: 12px;
}

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

.cost-box {
  display: grid;
  gap: 10px;
}

.cost-box div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.cost-box strong {
  font-size: 14px;
}

.voucher-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 24px;
}

.voucher-modal.is-open {
  display: grid;
}

.voucher-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 20, 24, 0.56);
  backdrop-filter: blur(8px);
}

.voucher-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  width: min(960px, 100%);
  max-height: calc(100vh - 48px);
  padding: 18px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 26px 80px rgba(8, 15, 20, 0.26);
}

.voucher-dialog-head,
.voucher-dialog-actions,
.voucher-line-toolbar,
.voucher-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.voucher-dialog-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.voucher-dialog-head p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.voucher-dialog-head strong {
  font-size: 20px;
}

.voucher-source-meta {
  padding: 10px 12px;
  color: #37424c;
  background: #f4f7f8;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.voucher-attachment-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #f8faf6;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.voucher-attachment-head,
.attachment-card,
.attachment-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voucher-attachment-head {
  justify-content: space-between;
}

.voucher-attachment-list {
  display: grid;
  gap: 8px;
}

.attachment-card {
  justify-content: space-between;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.attachment-card > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.attachment-card span,
.attachment-detail-head span {
  color: var(--muted);
  font-size: 12px;
}

.attachment-card strong,
.attachment-detail-head strong {
  min-width: 0;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.attachment-card small {
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.attachment-actions {
  flex: 0 0 auto;
}

.voucher-attachment-detail {
  display: grid;
  gap: 10px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.attachment-detail-head {
  display: grid;
  gap: 2px;
}

.attachment-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 1px;
  margin: 0;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.attachment-detail-grid div {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: #fff;
}

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

.attachment-detail-grid dd {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.voucher-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
}

.voucher-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.voucher-form-grid .span-2 {
  grid-column: span 2;
}

.voucher-line-toolbar {
  margin: 14px 0 10px;
}

.voucher-edit-table {
  min-width: 760px;
}

.voucher-edit-table input {
  min-height: 34px;
  background: #fff;
}

.amount-input {
  text-align: right;
}

.voucher-balance-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 1px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.voucher-balance-bar span {
  padding: 10px 12px;
  background: #f8faf6;
  color: var(--muted);
  font-size: 13px;
}

.voucher-balance-bar strong {
  color: var(--ink);
}

.voucher-balance-bar.is-balanced span:last-child {
  color: var(--green);
  background: var(--green-soft);
  font-weight: 900;
}

.voucher-balance-bar.is-unbalanced span:last-child {
  color: var(--coral);
  background: var(--coral-soft);
  font-weight: 900;
}

.voucher-modal-footer {
  justify-content: flex-end;
  margin-top: 14px;
}

.voucher-modal-footer [hidden] {
  display: none;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  color: #fff;
  background: #253c35;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .workspace-grid,
  .documents-layout,
  .expense-layout,
  .cash-layout,
  .tax-layout,
  .voucher-layout,
  .reports-layout,
  .crm-layout,
  .settings-layout,
  .module-grid.two {
    grid-template-columns: 1fr;
  }

  .settings-layout .panel.wide,
  .settings-layout > .panel:not(.wide) {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .ledger-query-controls {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }

  .asset-query-bar {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .asset-tabs {
    grid-column: 1 / -1;
  }

  .ledger-query-actions {
    grid-column: 1 / -1;
    justify-content: start;
  }

  .ledger-summary-strip {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .voucher-form-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .attachment-detail-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .voucher-form-grid .span-2 {
    grid-column: 1 / -1;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .main-nav {
    display: flex;
    gap: 8px;
    padding-bottom: 4px;
    overflow-x: auto;
  }

  .nav-item {
    grid-template-columns: 24px minmax(96px, 1fr);
    width: auto;
    min-width: 154px;
  }

  .nav-item small {
    display: none;
  }

  .side-status {
    margin-top: 0;
  }

  .main {
    padding: 16px;
  }

  .topbar,
  .view-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .heading-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .period-picker {
    grid-template-columns: 1fr;
    min-width: 160px;
  }

  .global-search {
    width: 100%;
    grid-template-columns: 24px minmax(0, 1fr) 34px;
  }

  .search-results {
    left: 0;
    right: auto;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .stat-grid,
  .stat-grid.compact,
  .statement-grid,
  .form-grid,
  .correction-form,
  .mini-summary {
    grid-template-columns: 1fr;
  }

  .correction-form label:nth-child(1),
  .correction-form label:nth-child(3),
  .correction-actions {
    grid-column: auto;
  }

  .correction-actions {
    grid-template-columns: 1fr;
  }

  .topbar h1 {
    font-size: 23px;
  }

  .view-heading h2 {
    font-size: 21px;
  }

  .btn,
  .file-btn {
    width: 100%;
  }

  .icon-btn {
    width: 42px;
  }

  .segmented.small {
    flex-wrap: wrap;
  }

  .bar-chart {
    min-height: 220px;
    overflow-x: auto;
  }

  .ledger-query-controls,
  .asset-query-bar,
  .ledger-summary-strip,
  .ledger-query-actions,
  .voucher-form-grid,
  .voucher-balance-bar,
  .attachment-detail-grid {
    grid-template-columns: 1fr;
  }

  .attachment-card {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .voucher-modal {
    padding: 12px;
  }

  .voucher-dialog {
    max-height: calc(100vh - 24px);
  }

  .voucher-dialog-head,
  .voucher-modal-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .bar-item {
    flex: 0 0 42px;
  }

  .metric-card strong {
    font-size: 22px;
  }
}

/* Premium desktop operations theme */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-soft: #f7f8fa;
  --ink: #161b1f;
  --muted: #68727d;
  --line: #d9dee5;
  --line-strong: #b9c2cc;
  --teal: #00836f;
  --teal-soft: #e3f4f0;
  --green: #1f7a4d;
  --green-soft: #e4f2ea;
  --amber: #b56b00;
  --amber-soft: #f7ead4;
  --coral: #bd4a45;
  --coral-soft: #f7e2df;
  --blue: #2368bd;
  --blue-soft: #e1ebf8;
  --shadow: 0 10px 26px rgba(16, 24, 32, 0.07);
}

body {
  background: var(--bg);
}

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

.sidebar {
  gap: 14px;
  padding: 16px;
  background: #171c20;
  border-right: 1px solid #2f3841;
}

.brand {
  padding: 6px 4px 10px;
}

.brand-mark {
  color: #ffffff;
  background: #000819;
  box-shadow: 0 8px 18px rgba(10, 102, 194, 0.14);
}

.brand strong {
  color: #f6f7f5;
  font-size: 20px;
}

.brand span {
  color: #9ba8b3;
}

.ledger-summary,
.side-status {
  color: #f4f7f6;
  background: #20272d;
  border-color: #313b45;
  box-shadow: none;
}

.ledger-summary p,
.side-status p,
.side-status div,
.ledger-summary label {
  color: #9ba8b3;
}

.ledger-summary strong,
.side-status strong {
  color: #f6f7f5;
}

.ledger-summary select {
  color: #f8faf9;
  background: #151a1f;
  border-color: #3a454f;
}

.main-nav {
  gap: 4px;
}

.nav-item {
  min-height: 48px;
  color: #d7dde2;
  border-radius: 8px;
}

.nav-item:hover {
  background: #222a31;
  border-color: #34404a;
}

.nav-item.is-active {
  color: #ffffff;
  background: #0f6d63;
  border-color: #22998b;
}

.nav-item small {
  color: #9ca8b1;
}

.nav-item.is-active small {
  color: #d6fffa;
}

.side-status {
  border-left: 3px solid #d8b25a;
}

.main {
  padding: 18px 22px 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  min-height: 66px;
  margin: -18px -22px 16px;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar h1 {
  font-size: 24px;
}

.eyebrow {
  color: #697684;
  font-weight: 800;
  text-transform: uppercase;
}

.review-console {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px;
  background: #101417;
  border: 1px solid #283039;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.review-head {
  display: grid;
  grid-row: span 2;
  gap: 2px;
  align-content: center;
  padding: 4px 8px;
}

.review-head p {
  margin: 0;
  color: #d8b25a;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.review-head strong {
  color: #f8faf9;
  font-size: 16px;
}

.review-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 54px;
  padding: 10px 12px;
  color: #f8faf9;
  text-align: left;
  background: #1b2228;
  border: 1px solid #303b45;
  border-radius: 8px;
}

.review-chip:hover {
  background: #223039;
  border-color: #4a5965;
}

.review-chip span {
  color: #aeb8c1;
  font-size: 13px;
}

.review-chip strong {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 30px;
  color: #111a18;
  background: #d8b25a;
  border-radius: 8px;
  font-size: 16px;
}

.module-map {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.module-map button {
  display: grid;
  gap: 6px;
  min-height: 78px;
  padding: 12px;
  text-align: left;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.module-map button:hover {
  border-color: #90a5b7;
  box-shadow: 0 8px 18px rgba(18, 29, 39, 0.08);
}

.module-map span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.module-map strong {
  font-size: 14px;
  line-height: 1.35;
}

.panel,
.metric-card {
  border-color: var(--line);
  box-shadow: 0 8px 22px rgba(24, 34, 45, 0.06);
}

.panel {
  padding: 14px;
}

.panel-title {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.panel-title strong {
  font-size: 15px;
}

.metric-card {
  min-height: 112px;
  padding: 14px;
}

.metric-card strong {
  font-size: 23px;
}

.btn,
.icon-btn,
.text-btn,
.segmented button {
  border-radius: 8px;
}

.btn.primary {
  background: #0f6d63;
  border-color: #0f6d63;
}

.btn.primary:hover {
  background: #0b5c54;
}

table {
  min-width: 780px;
}

th {
  color: #5d6875;
  background: #eef2f5;
  text-transform: uppercase;
}

td {
  background: #fff;
}

tbody tr:hover,
tbody tr.is-selected {
  background: #edf7f4;
}

tbody tr:hover td,
tbody tr.is-selected td {
  background: #edf7f4;
}

.status-pill,
.badge {
  border-radius: 999px;
}

.dropzone {
  background: #f5f7f9;
  border-color: #99a9b8;
}

.dropzone:hover {
  background: #eef8f5;
}

@media (max-width: 1180px) {
  .review-console,
  .module-map {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .review-head {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

@media (max-width: 900px) {
  .sidebar {
    background: #171c20;
  }

  .topbar {
    margin: -16px -16px 14px;
    padding: 14px 16px;
  }

  .review-console,
  .module-map {
    grid-template-columns: 1fr;
  }
}

/* Neutral system finance theme */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-soft: #f8f9fb;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #dedee3;
  --line-strong: #c7c7cc;
  --teal: #0a66c2;
  --teal-soft: #eaf2fc;
  --green: #248a3d;
  --green-soft: #eaf6ee;
  --amber: #b26a00;
  --amber-soft: #f8eedf;
  --coral: #c2474c;
  --coral-soft: #f9e7e8;
  --blue: #0a66c2;
  --blue-soft: #eaf2fc;
  --rose: #77757d;
  --rose-soft: #f1f1f4;
  --gold: #8e8e93;
  --shadow: 0 12px 30px rgba(29, 29, 31, 0.08);
}

body {
  background: #f5f5f7;
}

.sidebar {
  background: #fbfbfd;
  border-right: 1px solid #e2e2e7;
  box-shadow: 10px 0 28px rgba(29, 29, 31, 0.04);
}

.brand-mark {
  color: #ffffff;
  background: #000819;
  box-shadow: 0 8px 18px rgba(10, 102, 194, 0.14);
}

.brand strong {
  color: #1d1d1f;
}

.brand span {
  color: #6e6e73;
}

.ledger-summary,
.side-status {
  color: var(--ink);
  background: #ffffff;
  border-color: #e2e2e7;
  box-shadow: 0 10px 24px rgba(29, 29, 31, 0.05);
}

.ledger-summary p,
.side-status p,
.side-status div,
.ledger-summary label {
  color: #6e6e73;
}

.ledger-summary strong,
.side-status strong {
  color: #1d1d1f;
}

.ledger-summary select {
  color: var(--ink);
  background: #ffffff;
  border-color: #c7d1ce;
}

.main-nav {
  gap: 6px;
}

.nav-group-toggle {
  color: #6e6e73;
  background: #ffffff;
  border-color: #e2e2e7;
}

.nav-group-toggle:hover {
  background: #f1f1f4;
  border-color: #d8d8de;
}

.nav-group-toggle span:first-child {
  color: #3a3a3c;
}

.nav-group-toggle small {
  color: #8e8e93;
}

.nav-item {
  color: #3a3a3c;
  background: transparent;
}

.nav-item:hover {
  background: #f1f1f4;
  border-color: #d8d8de;
}

.nav-item.is-active {
  color: #0a4a91;
  background: #eaf2fc;
  border-color: #b7d4f3;
  box-shadow: inset 4px 0 0 #0a66c2;
}

.nav-item small {
  color: #8e8e93;
}

.nav-item.is-active small {
  color: #3f78b5;
}

.side-status {
  border-left: 3px solid #0a66c2;
}

.topbar {
  background: rgba(251, 251, 253, 0.94);
  border-bottom-color: #e2e2e7;
  box-shadow: 0 10px 30px rgba(29, 29, 31, 0.05);
}

.eyebrow {
  color: #6e6e73;
}

.review-console {
  background: #fbfbfd;
  border-color: #e2e2e7;
  box-shadow: 0 10px 24px rgba(29, 29, 31, 0.05);
}

.review-head p {
  color: #0a66c2;
}

.review-head strong {
  color: #1d1d1f;
}

.review-chip {
  color: var(--ink);
  background: #ffffff;
  border-color: #e2e2e7;
}

.review-chip:hover {
  background: #f1f1f4;
  border-color: #c7c7cc;
}

.review-chip span {
  color: #6e6e73;
}

.review-chip strong {
  color: #ffffff;
  background: #0a66c2;
}

.global-search,
.btn,
.icon-btn,
.text-btn,
.segmented button,
select,
input {
  background: #ffffff;
  border-color: #c7c7cc;
}

.global-search {
  box-shadow: 0 8px 18px rgba(29, 29, 31, 0.04);
}

.btn:hover,
.icon-btn:hover,
.text-btn:hover,
.segmented button:hover {
  background: #f1f1f4;
  border-color: #c7c7cc;
}

.btn.primary {
  color: #ffffff;
  background: #0a66c2;
  border-color: #0a66c2;
  box-shadow: 0 10px 18px rgba(10, 102, 194, 0.16);
}

.btn.primary:hover {
  background: #084f99;
}

.panel,
.metric-card,
.module-map button {
  background: #ffffff;
  border-color: #e2e2e7;
  box-shadow: 0 10px 24px rgba(29, 29, 31, 0.05);
}

.panel-title {
  border-bottom-color: #e7e7ec;
}

.metric-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fb 100%);
}

.metric-card span,
.panel-title p {
  color: #6e6e73;
}

.module-map button:hover {
  border-color: #b7d4f3;
  box-shadow: 0 12px 22px rgba(10, 102, 194, 0.1);
}

.module-map span,
.search-result small,
.badge {
  color: #0a4a91;
  background: #eaf2fc;
}

.badge.success {
  color: #2c765c;
  background: #e8f3ee;
}

.badge.warning {
  color: #9a641e;
  background: #f7ecd9;
}

.badge.danger {
  color: #bd5367;
  background: #f8e6eb;
}

th {
  color: #6e6e73;
  background: #f2f2f7;
}

td {
  background: #ffffff;
}

tbody tr:hover,
tbody tr.is-selected,
tbody tr:hover td,
tbody tr.is-selected td {
  background: #f2f6fb;
}

.search-results,
.search-result,
.attachment-card,
.voucher-attachment-detail,
.attachment-detail-grid div,
.voucher-dialog,
.voucher-edit-table input {
  background: #ffffff;
}

.search-result:hover,
.search-result.is-active {
  background: #f2f6fb;
  border-color: #b7d4f3;
}

.dropzone {
  background: #f8f9fb;
  border-color: #c7c7cc;
}

.dropzone:hover {
  background: #f2f6fb;
  border-color: #b7d4f3;
}

.task-row .icon-chip {
  color: #0a4a91;
  background: #eaf2fc;
}

.task-row,
.insight-row,
.sync-row,
.match-row,
.mapping-row,
.timeline-row,
.setup-list div,
.rule-list div,
.ledger-summary-item,
.voucher-balance-bar span,
.voucher-attachment-panel,
.voucher-source-meta {
  background: #f8f9fb;
  border-color: #e2e2e7;
}

.ledger-book-row.is-openable td:nth-child(2),
.ledger-book-row.is-openable td:nth-child(3) {
  color: #0a4a91;
}

.ledger-book-row.is-openable:hover td {
  background: #f2f6fb;
}

.bar-chart,
.line-chart {
  background: #f8f9fb;
  border-color: #e2e2e7;
}

.bar {
  background: linear-gradient(180deg, #0a66c2, #8e8e93);
}

.status-ok {
  color: #2c765c;
  background: #e8f3ee;
}

.status-warn {
  color: #9a641e;
  background: #f7ecd9;
}

.status-info {
  color: #4b6fa8;
  background: #e8eef8;
}

.status-danger {
  color: #bd5367;
  background: #f8e6eb;
}

.toast {
  background: #2c2c2e;
  box-shadow: 0 16px 34px rgba(29, 29, 31, 0.24);
}

@media (max-width: 900px) {
  .sidebar {
    background: #fbfbfd;
  }
}

.compact-select,
.subject-builder-grid label,
.subject-upload-grid label,
.backup-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.compact-select {
  min-width: 96px;
}

.heading-actions .action-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 41px;
}

.heading-actions .action-select span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.heading-actions .action-select select {
  min-width: 96px;
  min-height: 41px;
  padding: 0 34px 0 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.ledger-query-actions {
  grid-template-columns: repeat(4, auto);
}

.ledger-query-controls {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}

.ledger-query-actions {
  grid-column: 1 / -1;
  justify-content: end;
}

.subject-builder-grid,
.subject-upload-grid,
.backup-controls {
  display: grid;
  gap: 10px;
  align-items: end;
}

.subject-builder-grid {
  grid-template-columns: minmax(100px, 0.7fr) minmax(180px, 1.5fr) minmax(100px, 0.7fr) minmax(120px, 0.9fr) minmax(160px, 1.2fr) auto;
}

.subject-upload-grid {
  grid-template-columns: minmax(120px, 0.7fr) minmax(300px, 1.8fr);
}

.subject-upload-grid .btn {
  justify-content: center;
}

.upload-card {
  position: relative;
  min-height: 74px;
  padding: 12px 14px 12px 54px;
  border: 1px dashed #aeb4bd;
  border-radius: 8px;
  background: #fbfbfd;
  cursor: pointer;
}

.upload-card input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-card strong,
.upload-card small {
  display: block;
}

.upload-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.upload-plus {
  position: absolute;
  left: 14px;
  top: 18px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: #0a66c2;
  font-weight: 900;
}

.template-file-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #f8f9fb;
  color: var(--muted);
  font-size: 13px;
}

.template-file-hint a {
  color: #0a66c2;
  font-weight: 800;
  text-decoration: none;
}

.subject-balance-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 1px;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.backup-controls {
  grid-template-columns: 1fr auto auto;
}

.subject-chip-list,
.backup-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.subject-chip,
.backup-row,
.backup-status {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f9fb;
}

.subject-chip {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.subject-chip strong,
.backup-row strong,
.backup-status strong {
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.subject-chip span,
.backup-row span,
.backup-status span {
  color: var(--muted);
  font-size: 12px;
}

.voucher-row.is-openable {
  cursor: pointer;
}

.voucher-row.is-openable:hover td {
  background: #f2f6fb;
}

.print-root {
  display: none;
}

@media print {
  body.print-mode > *:not(.print-root) {
    display: none !important;
  }

  body.print-mode {
    background: #fff !important;
  }

  .print-root {
    display: block;
    color: #111;
    font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  }

  .print-page {
    break-after: page;
    page-break-after: always;
  }

  .print-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .print-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 14px;
    border-bottom: 2px solid #222;
    padding-bottom: 8px;
  }

  .print-head h1 {
    margin: 0;
    font-size: 18px;
  }

  .print-meta,
  .print-subtitle {
    color: #555;
    font-size: 11px;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10.5px;
  }

  .print-table th,
  .print-table td {
    border: 1px solid #555;
    padding: 5px 6px;
    text-align: left;
    vertical-align: top;
  }

  .print-table th {
    background: #f1f1f1;
  }

  .print-amount {
    text-align: right !important;
    white-space: nowrap;
  }
}

@media (max-width: 1180px) {
  .subject-builder-grid,
  .subject-upload-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .subject-builder-grid .btn {
    justify-content: center;
  }
}

@media (max-width: 760px) {
  .ledger-query-actions,
  .backup-controls {
    grid-template-columns: 1fr;
  }

  .subject-builder-grid,
  .subject-upload-grid,
  .subject-balance-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .login-page {
    grid-template-columns: 1fr;
    padding: 18px;
    overflow-y: auto;
  }

  .login-brand-panel {
    min-height: auto;
    gap: 44px;
  }

  .login-signal-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    align-self: start;
  }
}

@media (max-width: 560px) {
  body.auth-locked {
    overflow: auto;
  }

  .login-page {
    padding: 12px;
  }

  .login-brand-panel,
  .login-card {
    border-radius: 12px;
    padding: 22px;
  }

  .login-hero h1 {
    font-size: 28px;
    line-height: 1.18;
  }

  .login-inline {
    grid-template-columns: 1fr;
  }

  .login-trust {
    display: grid;
  }
}
