:root {
  --ink: #2c2329;
  --muted: #776d74;
  --line: #e9e1e6;
  --paper: #ffffff;
  --canvas: #f6f4f7;
  --rose: #d21b73;
  --rose-dark: #9b164f;
  --rose-soft: #fce8f2;
  --brown: #432a29;
  --brown-soft: #d2a392;
  --green: #087d67;
  --gold: #c98b22;
  --danger: #b3263f;
  --shadow: 0 14px 40px rgba(66, 35, 51, .07);
  --shadow-hover: 0 18px 46px rgba(66, 35, 51, .12);
  --sidebar: #2b191f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 0 0 auto;
  width: 268px;
  background:
    radial-gradient(circle at 20% 0%, rgba(210,27,115,.16), transparent 25%),
    linear-gradient(175deg, #43272b 0%, var(--sidebar) 62%, #1f1116 100%);
  color: #fff;
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 36px rgba(42, 21, 32, .16);
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--rose) 0 45%, var(--green) 45% 82%, var(--gold) 82%);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 6px 28px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand img { width: 54px; height: 54px; border-radius: 15px; object-fit: cover; border: 2px solid rgba(255,255,255,.7); background: #d2a392; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 17px; letter-spacing: -.2px; }
.brand span { margin-top: 5px; color: rgba(255,255,255,.62); font-size: 12px; }
nav { padding-top: 24px; display: grid; gap: 7px; }
.nav-link {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.68);
  border-radius: 12px;
  padding: 12px 13px;
  text-align: right;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: .2s ease;
}
.nav-link span { width: 22px; text-align: center; font-size: 19px; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: linear-gradient(90deg, var(--rose-dark), var(--rose)); color: #fff; box-shadow: 0 12px 25px rgba(208,24,120,.25); }
.sidebar-contact { margin-top: auto; padding: 18px 8px 0; display: grid; gap: 7px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-contact small { color: rgba(255,255,255,.46); margin-bottom: 4px; }
.sidebar-contact a { font-size: 11px; direction: ltr; text-align: right; overflow-wrap: anywhere; }

.main-content { margin-right: 268px; min-height: 100vh; padding: 0 34px 50px; }
.topbar {
  min-height: 96px;
  display: grid;
  grid-template-columns: minmax(210px, auto) minmax(260px, 480px) auto;
  align-items: center;
  gap: 22px;
  position: sticky;
  z-index: 20;
  top: 0;
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(18px);
}
.topbar h1 { margin: 0; font-size: 23px; }
.topbar p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.year-switcher { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.year-switcher select { width: 92px; margin: 0; padding: 8px 10px; border-color: #dbcdd0; font-weight: 700; direction: ltr; }
.save-state { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 7px; }
.save-state i { width: 8px; height: 8px; border-radius: 50%; background: #27a17d; box-shadow: 0 0 0 4px rgba(39,161,125,.12); }
.mobile-menu { display: none; border: 0; background: transparent; font-size: 22px; margin-left: 8px; }

.view { display: none; animation: fade .2s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: .55; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.welcome-card {
  min-height: 228px;
  border-radius: 26px;
  padding: 38px 42px;
  background:
    radial-gradient(circle at 12% 20%, rgba(255,255,255,.12), transparent 24%),
    linear-gradient(120deg, #85133f, var(--rose) 58%, #e34b96);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 22px 55px rgba(179, 20, 104, .2);
  position: relative;
  overflow: hidden;
}
.welcome-card::after { content: ""; width: 165px; height: 165px; border: 35px solid rgba(255,255,255,.07); border-radius: 50%; position: absolute; left: 9%; bottom: -105px; }
.welcome-card h2 { margin: 8px 0 10px; font-size: clamp(27px, 3vw, 38px); letter-spacing: -.8px; }
.welcome-card p { margin: 0; color: rgba(255,255,255,.8); max-width: 650px; line-height: 1.8; }
.eyebrow { color: var(--rose); font-size: 11px; font-weight: 700; letter-spacing: .4px; }
.welcome-card .eyebrow { color: rgba(255,255,255,.68); }
.light-button { border: 1px solid rgba(255,255,255,.32); background: rgba(255,255,255,.12); color: #fff; border-radius: 12px; padding: 12px 18px; position: relative; z-index: 2; white-space: nowrap; }

.currency-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 18px 0; }
.currency-card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.currency-card::before { content: ""; position: absolute; inset: 0 0 0 auto; width: 4px; background: var(--rose); }
.currency-card.usd::before { background: var(--green); }
.currency-card.eur::before { background: var(--gold); }
.currency-head { display: flex; justify-content: space-between; align-items: flex-start; }
.currency-head strong { display: block; font-size: 15px; }
.currency-head small { display: block; margin-top: 5px; color: var(--muted); }
.currency-code { padding: 7px 9px; border-radius: 9px; background: var(--rose-soft); color: var(--rose); font-size: 12px; font-weight: 700; direction: ltr; }
.usd .currency-code { background: #e7f6f2; color: var(--green); }
.eur .currency-code { background: #fff4dd; color: #a76e0b; }
.currency-balance { margin: 22px 0 14px; }
.currency-balance span { color: var(--muted); font-size: 11px; display: block; }
.currency-balance strong { font-size: 24px; direction: ltr; display: inline-block; margin-top: 6px; }
.currency-metrics { border-top: 1px solid var(--line); padding-top: 13px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.currency-metrics span { color: var(--muted); font-size: 10px; display: block; }
.currency-metrics strong { display: block; font-size: 13px; margin-top: 5px; direction: ltr; text-align: right; }

.supplier-due-shortcuts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 0 0 20px; }
.workflow-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 20px; }
.workflow-steps button { border: 1px solid var(--line); background: #fff; border-radius: 15px; padding: 15px; display: flex; align-items: center; gap: 12px; text-align: right; color: var(--ink); box-shadow: var(--shadow); }
.workflow-steps button:hover { border-color: var(--rose); transform: translateY(-1px); }
.workflow-steps b { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: linear-gradient(135deg, var(--rose-dark), var(--rose)); direction: ltr; }
.workflow-steps strong, .workflow-steps small { display: block; }
.workflow-steps small { color: var(--muted); font-size: 10px; margin-top: 4px; }
.supplier-due-button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 17px 19px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: right;
}
.supplier-due-button:hover { border-color: var(--rose); transform: translateY(-1px); }
.supplier-due-button span { display: block; color: var(--muted); font-size: 11px; }
.supplier-due-button strong { display: block; direction: ltr; margin-top: 6px; font-size: 19px; color: var(--rose-dark); }
.supplier-due-button small { display: block; color: var(--muted); font-size: 9px; margin-top: 5px; }
.supplier-due-button i { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: var(--rose-soft); color: var(--rose); font-style: normal; font-size: 18px; }

.dashboard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 18px; align-items: start; }
.span-2 { grid-column: span 2; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel-head h3 { margin: 5px 0 0; font-size: 17px; }
.text-button { border: 0; background: transparent; color: var(--rose); font-size: 12px; }
.mini-stats { display: grid; gap: 10px; margin-bottom: 18px; }
.mini-stat { display: flex; align-items: center; justify-content: space-between; padding: 14px; border-radius: 12px; background: #faf7f8; }
.mini-stat span { color: var(--muted); }
.mini-stat strong { font-size: 20px; }

button.primary, button.secondary, .file-button { border-radius: 11px; padding: 11px 17px; font-weight: 700; border: 1px solid transparent; }
button.primary { color: #fff; background: linear-gradient(90deg, var(--rose-dark), var(--rose)); box-shadow: 0 9px 20px rgba(208,24,120,.17); }
button.primary:hover { filter: brightness(1.04); }
button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none !important; }
button.secondary, .file-button { background: #fff; color: var(--brown); border-color: #dfd1d1; box-shadow: none; }
button.small { padding: 8px 12px; font-size: 12px; }
.full { width: 100%; }
.button-row { display: flex; gap: 9px; }
.danger-outline { color: var(--danger); border: 1px solid #e6b8c2; background: #fff; border-radius: 11px; padding: 11px 17px; font-weight: 700; }

.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 840px; }
th { color: #8a7c80; background: #faf8f8; font-weight: 500; font-size: 11px; text-align: right; padding: 11px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid #f0e8e9; font-size: 12px; vertical-align: middle; }
tbody tr:hover { background: #fffafb; }
tbody tr:last-child td { border-bottom: 0; }
.compact td { padding: 11px 10px; }
.amount { direction: ltr; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount.debit { color: #a32840; }
.amount.credit { color: var(--green); }
.row-main { display: block; max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.tag { display: inline-flex; padding: 5px 8px; border-radius: 8px; background: var(--rose-soft); color: var(--rose-dark); font-size: 10px; white-space: nowrap; }
.tag.green { background: #e6f6f2; color: var(--green); }
.tag.gray { background: #f0eeee; color: #756a6d; }
.currency-dot { display: inline-flex; direction: ltr; align-items: center; justify-content: center; min-width: 44px; padding: 5px 7px; border-radius: 7px; background: #f4edef; font-weight: 700; }
.icon-button { border: 1px solid var(--line); background: #fff; width: 31px; height: 31px; border-radius: 9px; color: var(--rose); }

.section-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 8px 0 20px; }
.section-intro h2 { margin: 5px 0 6px; font-size: 24px; }
.section-intro p { margin: 0; color: var(--muted); }
.form-panel { padding: 26px; }
.entry-mode-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 6px; background: #f5f0f1; border-radius: 14px; margin-bottom: 23px; }
.entry-mode-switch button { border: 0; background: transparent; color: var(--muted); border-radius: 10px; padding: 12px; font-weight: 700; }
.entry-mode-switch button span { margin-left: 5px; font-size: 16px; }
.entry-mode-switch button.active { background: #fff; color: var(--rose-dark); box-shadow: 0 7px 18px rgba(72,42,38,.09); }
.form-grid { display: grid; gap: 15px; }
.form-grid.two { grid-template-columns: repeat(2, 1fr); }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid.four { grid-template-columns: repeat(4, 1fr); }
.form-grid.five { grid-template-columns: repeat(5, 1fr); }
label { color: #62565a; font-size: 12px; display: block; }
input, select, textarea {
  width: 100%;
  border: 1px solid #dfd3d5;
  color: var(--ink);
  background: #fff;
  border-radius: 10px;
  padding: 11px 12px;
  margin-top: 7px;
  outline: none;
  transition: .18s ease;
}
textarea { resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(208,24,120,.08); }
.form-divider { display: flex; align-items: center; gap: 14px; color: var(--rose-dark); font-weight: 700; font-size: 12px; margin: 24px 0 14px; }
.form-divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.field-help { margin: -7px 0 12px; color: var(--muted); font-size: 11px; }
.input-action { display: flex; align-items: flex-end; gap: 7px; }
.inline-add { width: 41px; height: 41px; flex: 0 0 41px; margin-bottom: 0; border: 0; border-radius: 10px; background: var(--rose-soft); color: var(--rose); font-size: 19px; }
.calculation-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin: 20px 0; }
.calculation-strip div { padding: 15px; background: #faf8f8; }
.calculation-strip span { display: block; color: var(--muted); font-size: 10px; }
.calculation-strip strong { display: block; margin-top: 7px; direction: ltr; text-align: right; font-size: 13px; }
.calculation-strip .accent { background: var(--rose-soft); }
.calculation-strip .accent strong { color: var(--rose-dark); }
.calculation-strip .profit { background: #e8f7f3; }
.calculation-strip .profit strong { color: var(--green); }
.receipt-amount-card { display: grid; grid-template-columns: 1fr minmax(260px, .45fr); gap: 20px; align-items: end; margin: 20px 0; padding: 19px; background: linear-gradient(120deg, #fbf3f7, #fff); border: 1px solid #ecd8e2; border-radius: 14px; }
.receipt-amount-card[hidden] { display: none; }
.receipt-amount-card > div > span { display: block; color: var(--rose-dark); font-weight: 700; }
.receipt-amount-card > div > strong { display: block; color: var(--muted); font-size: 11px; margin-top: 8px; font-weight: 400; }
.settlement-card { margin: -8px 0 20px; padding: 18px; border: 1px solid #dbe9e6; border-radius: 14px; background: linear-gradient(120deg, #f1faf7, #fff); }
.settlement-card[hidden], #ticketReceiptFields[hidden] { display: none; }
.settlement-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 14px; margin-top: 12px; border-top: 1px solid #dbe9e6; }
.settlement-summary span, .settlement-summary small { display: block; color: var(--muted); font-size: 10px; }
.settlement-summary strong { display: block; direction: ltr; text-align: right; margin: 6px 0; font-size: 20px; color: var(--green); }
.settlement-summary button { white-space: nowrap; }
.row-actions { display: flex; gap: 5px; }
.collect-button { width: auto; padding: 0 9px; color: var(--green); font-weight: 700; }
.stacked-fields { display: grid; grid-template-columns: 1fr; gap: 10px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; margin-top: 20px; }

.filters { display: grid; grid-template-columns: minmax(260px, 2fr) repeat(4, 1fr); gap: 10px; margin-bottom: 14px; padding: 14px; }
.filters input, .filters select { margin: 0; }
.search-box { position: relative; }
.search-box span { position: absolute; right: 13px; top: 10px; color: #9b8c90; font-size: 18px; }
.search-box input { padding-right: 38px; }
.table-panel { padding: 0; overflow: hidden; }
.table-panel .table-wrap { padding: 0 13px; }
.table-meta { padding: 15px 19px; display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; border-bottom: 1px solid var(--line); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 15px; padding: 14px; border-top: 1px solid var(--line); }
.pagination span { color: var(--muted); font-size: 12px; }

.party-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.party-kpi { padding: 17px; border-radius: 15px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.party-kpi span { color: var(--muted); font-size: 11px; }
.party-kpi strong { display: block; font-size: 23px; margin-top: 7px; }
.party-filters { grid-template-columns: 1fr 220px; }
.balance-chip { display: inline-flex; direction: ltr; padding: 5px 7px; border-radius: 7px; background: #f7f1f2; font-variant-numeric: tabular-nums; }
.balance-chip.due { color: #a32840; background: #fff0f2; }
.balance-chip.credit { color: var(--green); background: #e9f8f4; }

.report-layout { display: grid; grid-template-columns: 310px 1fr; gap: 18px; align-items: start; }
.report-controls { position: sticky; top: 15px; display: grid; gap: 13px; }
.muted-note { color: var(--muted); line-height: 1.7; font-size: 11px; margin: 0; }
.report-preview { min-width: 0; }
.currency-badge { display: inline-flex; padding: 7px 10px; background: var(--brown); color: #fff; border-radius: 9px; font-weight: 700; direction: ltr; }
.report-balances { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 18px; }
.report-balance { border-radius: 11px; background: #faf7f8; padding: 13px; }
.report-balance span { color: var(--muted); font-size: 10px; display: block; }
.report-balance strong { margin-top: 6px; display: block; direction: ltr; text-align: right; }

.treasury-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.treasury-card { border-radius: 18px; background: #fff; border: 1px solid var(--line); padding: 20px; box-shadow: var(--shadow); }
.treasury-icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 12px; background: var(--rose-soft); color: var(--rose); font-size: 20px; }
.treasury-card h3 { margin: 13px 0 16px; }
.treasury-currencies { display: grid; gap: 7px; }
.treasury-currencies div { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 9px; }
.treasury-currencies span { direction: ltr; color: var(--muted); }
.treasury-currencies strong { direction: ltr; font-size: 13px; }

.settings-logo { width: 72px; height: 72px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }
.backup-panel { display: grid; gap: 12px; }
.file-button { text-align: center; cursor: pointer; }
.file-button input { display: none; }
.sources-panel { margin-top: 18px; }
.pill { border-radius: 99px; background: var(--rose-soft); color: var(--rose); padding: 6px 10px; font-size: 11px; }
.source-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.source-item { display: flex; justify-content: space-between; gap: 15px; padding: 13px; border-radius: 11px; background: #faf8f8; }
.source-item span { color: var(--muted); font-size: 11px; }
.source-item strong { font-size: 12px; }

.year-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 18px; }
.year-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.year-card.active { border-color: var(--rose); box-shadow: 0 18px 45px rgba(208,24,120,.12); }
.year-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.year-card h3 { margin: 0; font-size: 23px; direction: ltr; text-align: right; }
.year-card p { color: var(--muted); font-size: 11px; margin: 7px 0 16px; }
.year-card-balances { display: grid; gap: 7px; margin-bottom: 15px; }
.year-card-balances div { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--line); }
.year-card-balances span { color: var(--muted); direction: ltr; }
.year-card-balances strong { direction: ltr; font-size: 12px; }
.year-close-panel { max-width: 900px; }
.year-close-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.year-close-currency { border-radius: 12px; background: #faf7f8; padding: 14px; }
.year-close-currency span { display: block; color: var(--muted); font-size: 10px; }
.year-close-currency strong { display: block; margin-top: 7px; direction: ltr; text-align: right; font-size: 15px; }
.year-close-currency small { display: block; margin-top: 8px; color: var(--muted); direction: ltr; text-align: right; font-size: 9px; }
.year-close-note { padding: 13px 15px; border-right: 3px solid var(--gold); background: #fff9ec; color: #7b632f; border-radius: 9px; line-height: 1.8; margin-bottom: 16px; font-size: 11px; }

dialog { border: 0; padding: 0; border-radius: 20px; box-shadow: 0 30px 90px rgba(48, 25, 29, .25); width: min(560px, calc(100% - 28px)); }
dialog::backdrop { background: rgba(44,28,31,.5); backdrop-filter: blur(3px); }
.dialog-card { padding: 28px; position: relative; background: #fff; }
.dialog-card h2 { margin: 6px 0 20px; }
.dialog-close { position: absolute; left: 15px; top: 14px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f3eeee; color: #705e62; font-size: 22px; }
.detail-card { max-height: 80vh; overflow: auto; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.detail-item { background: #faf7f8; padding: 12px; border-radius: 10px; }
.detail-item span { display: block; color: var(--muted); font-size: 10px; }
.detail-item strong { display: block; margin-top: 6px; word-break: break-word; }
.detail-wide { grid-column: 1 / -1; }
.toast { position: fixed; z-index: 99; left: 25px; bottom: 25px; background: #2e2523; color: #fff; border-radius: 11px; padding: 13px 17px; box-shadow: 0 15px 35px rgba(0,0,0,.2); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.muted { color: var(--muted); }
.empty { text-align: center; padding: 34px !important; color: var(--muted); }

.page-heading { display: flex; align-items: center; min-width: 0; }
.global-search {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  box-shadow: 0 6px 22px rgba(67,34,43,.045);
}
.global-search > span { color: var(--rose); font-size: 20px; }
.global-search input { border: 0; box-shadow: none; margin: 0; padding: 0; background: transparent; }
.global-search input:focus { border: 0; box-shadow: none; }
kbd { min-width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--canvas); color: var(--muted); font: 11px/1 monospace; }
.icon-action {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: var(--paper);
  font-size: 18px;
}
.icon-action:hover { color: var(--rose); border-color: rgba(210,27,115,.35); }
.nav-label { padding: 17px 13px 3px; color: rgba(255,255,255,.34); font-size: 9px; font-weight: 700; letter-spacing: .5px; }
.sidebar-close { display: none; margin-right: auto; width: 34px; height: 34px; border: 0; border-radius: 10px; color: #fff; background: rgba(255,255,255,.08); font-size: 20px; }
.system-status { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; color: rgba(255,255,255,.72); font-size: 10px; }
.system-status i { width: 7px; height: 7px; border-radius: 50%; background: #3ad19e; box-shadow: 0 0 0 4px rgba(58,209,158,.12); }
.sidebar-backdrop { display: none; }
.hero-actions { display: flex; gap: 9px; margin-top: 22px; }
.hero-actions button { border-radius: 12px; padding: 11px 17px; font-weight: 700; }
.hero-primary { border: 1px solid #fff; background: #fff; color: var(--rose-dark); box-shadow: 0 12px 28px rgba(74,10,43,.18); }
.hero-secondary { border: 1px solid rgba(255,255,255,.3); color: #fff; background: rgba(255,255,255,.1); }
.hero-summary {
  min-width: 300px;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 18px;
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(10px);
}
.hero-summary > div { padding: 22px; background: rgba(255,255,255,.055); }
.hero-summary span { display: block; color: rgba(255,255,255,.68); font-size: 10px; }
.hero-summary strong { display: block; margin-top: 7px; font-size: 28px; direction: ltr; text-align: right; }
.hero-summary small { grid-column: 1 / -1; padding: 11px 16px; color: rgba(255,255,255,.65); }
.hero-summary small i { display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: #7cf2c8; }
.insight-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 16px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--line);
  box-shadow: var(--shadow);
}
.insight-item { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px 16px; background: var(--paper); }
.insight-item small { display: block; color: var(--muted); font-size: 10px; }
.insight-item strong { display: block; margin-top: 4px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insight-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 10px; font-weight: 700; }
.insight-icon.rose { color: var(--rose); background: var(--rose-soft); }
.insight-icon.green { color: var(--green); background: #e7f6f2; }
.insight-icon.gold { color: #a76e0b; background: #fff4dd; }
.insight-icon.brown { color: var(--brown); background: #eee6e3; }
.currency-card { cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.currency-card:hover, .currency-card:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: rgba(210,27,115,.24); outline: none; }
.currency-link { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 13px; color: var(--rose); font-size: 10px; font-weight: 700; }
.currency-link b { transition: transform .2s ease; }
.currency-card:hover .currency-link b { transform: translateX(-3px); }
.panel-actions { display: flex; align-items: center; gap: 8px; }
.ghost-button { border: 1px solid var(--line); background: var(--paper); color: var(--muted); border-radius: 9px; padding: 7px 10px; font-size: 10px; }
.ghost-button:hover { color: var(--rose); border-color: rgba(210,27,115,.3); }
button, .currency-card, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(210,27,115,.2); outline-offset: 2px; }
.table-wrap { scrollbar-width: thin; scrollbar-color: #d7c8d0 transparent; }
.table-wrap thead { position: sticky; top: 0; z-index: 2; }
.table-panel tbody tr:nth-child(even) { background: rgba(250,248,248,.55); }
.row-actions { white-space: nowrap; }
.mobile-dock { display: none; }

body[data-theme="dark"] {
  --ink: #f5edf2;
  --muted: #b6a9b2;
  --line: #48343f;
  --paper: #2c2229;
  --canvas: #20191e;
  --rose-soft: #4b2038;
  --brown: #f0dcd5;
  --shadow: 0 16px 45px rgba(0,0,0,.18);
  --shadow-hover: 0 20px 50px rgba(0,0,0,.28);
}
body[data-theme="dark"] .topbar { background: color-mix(in srgb, var(--canvas) 88%, transparent); }
body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea,
body[data-theme="dark"] button.secondary,
body[data-theme="dark"] .file-button,
body[data-theme="dark"] .icon-button,
body[data-theme="dark"] .workflow-steps button,
body[data-theme="dark"] .supplier-due-button,
body[data-theme="dark"] .party-kpi,
body[data-theme="dark"] .treasury-card,
body[data-theme="dark"] .year-card,
body[data-theme="dark"] .dialog-card { background: #30252c; color: var(--ink); border-color: var(--line); }
body[data-theme="dark"] .mini-stat,
body[data-theme="dark"] .calculation-strip div,
body[data-theme="dark"] th,
body[data-theme="dark"] .report-balance,
body[data-theme="dark"] .year-close-currency,
body[data-theme="dark"] .detail-item,
body[data-theme="dark"] .source-item { background: #261d23; }
body[data-theme="dark"] .table-panel tbody tr:nth-child(even),
body[data-theme="dark"] tbody tr:hover { background: rgba(255,255,255,.025); }
body[data-theme="dark"] .currency-dot,
body[data-theme="dark"] .tag.gray,
body[data-theme="dark"] kbd { background: #3b2e36; color: #d7c8d1; }
body[data-theme="dark"] .year-close-note { background: #3b301f; color: #e1c783; }
body[data-theme="dark"] dialog::backdrop { background: rgba(5,3,4,.72); }

@media (max-width: 1180px) {
  .topbar { grid-template-columns: minmax(190px, auto) 1fr auto; }
  .top-actions .save-state { display: none; }
  .form-grid.five { grid-template-columns: repeat(3, 1fr); }
  .calculation-strip { grid-template-columns: repeat(3, 1fr); }
  .currency-grid, .treasury-grid { grid-template-columns: 1fr; }
  .currency-card { min-height: 0; }
  .filters { grid-template-columns: 1fr 1fr; }
  .insight-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(105%); transition: .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: grid; place-items: center; }
  .sidebar-backdrop { position: fixed; z-index: 25; inset: 0; background: rgba(28,18,23,.55); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: .2s ease; }
  .sidebar-backdrop.show { display: block; opacity: 1; pointer-events: auto; }
  body.menu-open { overflow: hidden; }
  .main-content { margin-right: 0; padding: 0 18px 88px; }
  .mobile-menu { display: inline-block; }
  .topbar { grid-template-columns: minmax(210px, 1fr) auto; }
  .global-search { grid-column: 1 / -1; grid-row: 2; margin-top: -12px; margin-bottom: 14px; }
  .top-actions .icon-action { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .report-layout { grid-template-columns: 1fr; }
  .report-controls { position: static; }
  .form-grid.four { grid-template-columns: repeat(2, 1fr); }
  .form-grid.three { grid-template-columns: 1fr; }
  .source-list { grid-template-columns: 1fr; }
  .year-cards { grid-template-columns: 1fr; }
  .mobile-dock {
    position: fixed;
    z-index: 24;
    inset: auto 12px 12px;
    height: 66px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: color-mix(in srgb, var(--paper) 94%, transparent);
    backdrop-filter: blur(18px);
    box-shadow: 0 16px 45px rgba(40,20,31,.2);
  }
  .mobile-dock button { display: grid; place-items: center; align-content: center; gap: 2px; border: 0; border-radius: 12px; color: var(--muted); background: transparent; }
  .mobile-dock button span { font-size: 18px; }
  .mobile-dock button small { font-size: 9px; }
  .mobile-dock button.active { color: #fff; background: linear-gradient(135deg, var(--rose-dark), var(--rose)); }
}

@media (max-width: 620px) {
  .main-content { padding-inline: 12px; }
  .topbar { min-height: 82px; grid-template-columns: 1fr auto; gap: 10px; padding-top: 10px; }
  .topbar h1 { font-size: 19px; }
  .topbar p { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top-actions .save-state { display: none; }
  .top-actions .primary { display: none; }
  .year-switcher { display: none; }
  .global-search { height: 42px; margin-top: 0; }
  .global-search kbd { display: none; }
  .welcome-card { padding: 27px 23px; display: block; }
  .welcome-card h2 { font-size: 23px; }
  .welcome-card .light-button { margin-top: 18px; }
  .hero-actions { display: grid; grid-template-columns: 1fr; }
  .hero-summary { min-width: 0; margin-top: 22px; }
  .hero-summary > div { padding: 17px; }
  .insight-strip { grid-template-columns: 1fr; }
  .form-grid.two, .form-grid.three, .form-grid.four, .form-grid.five, .calculation-strip, .party-kpis, .report-balances, .supplier-due-shortcuts, .receipt-amount-card, .year-close-summary, .workflow-steps { grid-template-columns: 1fr; }
  .settlement-summary { display: block; }
  .settlement-summary button { width: 100%; margin-top: 10px; }
  .entry-mode-switch { grid-template-columns: 1fr; }
  .filters, .party-filters { grid-template-columns: 1fr; }
  .section-intro { display: block; }
  .section-intro .button-row, .section-intro > button { margin-top: 14px; }
  .form-panel, .panel { padding: 16px; }
  .table-panel { padding: 0; }
  .table-meta { display: block; line-height: 1.8; }
  .detail-grid { grid-template-columns: 1fr; }
  .panel-head { align-items: flex-start; }
  .panel-actions { flex-wrap: wrap; justify-content: flex-end; }
  .section-intro .button-row { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .section-intro .button-row .primary { grid-column: 1 / -1; }
}

@media print {
  body { background: #fff !important; color: #111 !important; }
  .sidebar, .topbar, .mobile-dock, .sidebar-backdrop, .report-controls, .section-intro, .toast { display: none !important; }
  .main-content { margin: 0 !important; padding: 0 !important; }
  .view { display: none !important; }
  #view-reports { display: block !important; }
  .report-layout { display: block !important; }
  .report-preview { border: 0 !important; box-shadow: none !important; padding: 0 !important; }
  th, td { color: #111 !important; background: #fff !important; }
}
