:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #1a2741;
  background: #f4f6fa;
  font-synthesis: none;
  --muted: #596783;
  --line: #e0e6ef;
  --accent: #255ad4;
  --sidebar: #111b31;
}

* { box-sizing: border-box; }
[hidden], .icon-library { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body { margin: 0; display: grid; grid-template-columns: 221px minmax(0, 1fr); min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
svg { display: block; width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg:not([aria-label]) { pointer-events: none; }
:focus-visible { outline: 2px solid #3a74f6; outline-offset: 3px; }
.skip-link { position: fixed; z-index: 5; top: 8px; left: 8px; padding: 12px; background: #fff; transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 25px 16px 18px; color: #d1dbef; background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 10px; padding-left: 10px; color: #fff; }
.brand-icon, .category-icon, .empty-icon { display: grid; place-items: center; flex: none; }
.brand-icon { width: 35px; height: 35px; border-radius: 9px; background: #376cec; }
.brand-icon svg { width: 22px; height: 22px; stroke-width: 2.2; }
.brand-name { font-size: 1.22rem; letter-spacing: -.04em; font-weight: 720; }
.navigation { display: grid; gap: 5px; margin-top: 41px; }
.navigation a { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 9px 12px; border-radius: 8px; font-size: .93rem; font-weight: 600; text-decoration: none; }
.navigation a:hover { background: #202e49; }
.navigation a[aria-current="page"] { color: #fff; background: #254782; box-shadow: inset 3px 0 #7ca7ff; }
.connection { margin-top: auto; border-top: 1px solid #33405b; padding: 17px 9px 2px; display: flex; gap: 9px; align-items: flex-start; }
.connection strong, .connection div span { display: block; }
.connection strong { color: #edf2ff; font-size: .83rem; letter-spacing: .02em; }
.connection div span { margin-top: 3px; color: #a9b7d0; font-size: .79rem; }
.connection-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; margin-top: 5px; background: #a8b7d5; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 65px; padding: 11px clamp(20px, 3vw, 47px); background: #fff; border-bottom: 1px solid var(--line); }
.breadcrumbs { display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: .875rem; }
.breadcrumbs strong { color: #273752; font-weight: 650; }
.breadcrumb-divider { color: #8997b1; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 6px 12px; border: 1px solid #d9e1ef; border-radius: 7px; background: #fff; font-size: .875rem; font-weight: 620; text-decoration: none; cursor: pointer; }
.button:hover:not(:disabled) { background: #eef4ff; border-color: #b6c9ee; }
.button:disabled { color: #76849e; opacity: .62; cursor: default; }
.refresh svg { color: #48618c; }
.workspace { max-width: 1530px; margin: 0 auto; padding: 27px clamp(20px, 3vw, 47px) 30px; }
.action-overview { margin-bottom: 22px; }
.action-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 11px; margin-bottom: 12px; background: #fff; border: 1px solid var(--line); border-radius: 11px; }
.action-toolbar .search-field { flex: 1 1 220px; }
.action-toolbar .button { min-height: 37px; }
.primary-button { color: #fff; background: #254782; border-color: #254782; }
.primary-button:hover:not(:disabled) { color: #fff; background: #1b3769; border-color: #1b3769; }
.range { position: relative; }
.range summary { list-style: none; white-space: nowrap; }
.range summary::-webkit-details-marker { display: none; }
.range summary svg { color: #48618c; }
.range-picker { position: absolute; z-index: 2; inset: calc(100% + 7px) auto auto 0; display: grid; gap: 10px; width: 275px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 12px 32px #10254424; }
.range-picker .date-field { justify-content: space-between; }
.range-picker small { font-size: .78rem; font-weight: 450; }
.range-buttons { display: flex; justify-content: space-between; gap: 7px; margin-top: 3px; }
.action-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.action-card { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 67px; padding: 13px 11px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 2px 6px #1c336307; }
.action-card.urgent { --status-ink: #aa2534; --status-fill: #ffeded; }
.action-card.important { --status-ink: #a34e14; --status-fill: #fff0e3; }
.action-card.approvals { --status-ink: #805d0c; --status-fill: #fff6dc; }
.action-card.followups { --status-ink: #255ad4; --status-fill: #edf3ff; }
.action-card.completed { --status-ink: #14764f; --status-fill: #e6f6ef; }
.action-icon { display: grid; place-items: center; background: var(--status-fill); color: var(--status-ink); border-radius: 8px; width: 31px; height: 31px; flex: none; }
.action-card h2 { font-size: .935rem; }
.action-count { margin-top: 2px; color: var(--status-ink); font-size: 1.35rem; font-weight: 720; line-height: 1.2; font-variant-numeric: tabular-nums; }
.action-count-label { margin-top: 2px; color: var(--muted); font-size: .8rem; }
.action-count:empty, .action-count:empty + .action-count-label { display: none; }
.category-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.category-card { display: flex; align-items: center; gap: 13px; min-width: 0; min-height: 100px; padding: 17px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 2px 6px #1c336307; }
.category-card h2 { font-size: 1rem; }
.category-icon { width: 37px; height: 37px; border-radius: 9px; color: var(--category-ink); background: var(--category-fill); }
.category-card.finance { --category-ink: #a82942; --category-fill: #fcecf0; display: block; }
.category-heading { display: flex; align-items: center; gap: 13px; }
.finance-action { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 13px; padding: 10px 8px; border-left: 3px solid #c45668; border-radius: 6px; background: #f7f8fc; }
.finance-action.collections { margin-top: 8px; border-left-color: #c78230; }
.finance-action.reconciliation { margin-top: 8px; border-left-color: #b49242; }
.finance-action.cash-plan { margin-top: 8px; }
.finance-action-label { display: flex; align-items: center; flex: 1 1 150px; gap: 7px; min-width: 0; }
.finance-action-icon { display: grid; place-items: center; flex: none; width: 27px; height: 27px; border-radius: 6px; color: #455570; background: #e8edf5; }
.finance-action h3 { margin: 0; font-size: .9rem; line-height: 1.3; font-weight: 680; }
.finance-action p, .bill-dialog-heading p { margin-top: 4px; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.finance-action-buttons { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.finance-badge { padding: 3px 6px; border-radius: 5px; font-size: .79rem; font-weight: 680; }
.finance-badge.urgent { color: #9b2537; background: #fce4e8; }
.finance-badge.important { color: #884608; background: #ffedd6; }
.finance-badge.approval { color: #76560b; background: #fff3cc; }
.finance-action-button { min-height: 32px; padding-inline: 8px; color: #553800; background: #ffe49c; border-color: #f2ce72; font-size: .875rem; }
.finance-action-button:hover:not(:disabled) { color: #553800; background: #ffda79; border-color: #dfb650; }
.bill-dialog { width: min(930px, calc(100% - 24px)); max-height: 84dvh; padding: 0; overflow: hidden; color: inherit; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 55px #0b18374d; }
.bill-dialog[open] { display: flex; flex-direction: column; }
.bill-dialog::backdrop { background: #0e1936a8; }
.bill-dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 17px 20px; }
.bill-table-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.bill-table-scroll:focus-visible { outline-offset: -3px; }
.bill-table { width: 100%; min-width: 650px; border-collapse: separate; border-spacing: 0; font-size: .875rem; text-align: left; }
.bill-table th, .bill-table td { padding: 11px 13px; border-bottom: 1px solid var(--line); }
.bill-table th { position: sticky; top: 0; z-index: 1; color: #4d5e7a; background: #f1f4f9; white-space: nowrap; }
.bill-table th:first-child, .bill-table td:first-child { padding-left: 20px; }
.bill-table td:nth-child(3), .bill-amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bill-amount { font-weight: 680; text-align: right; }
.bill-table tbody tr:nth-child(even) { background: #f8faff; }
.reconciliation-table { min-width: 790px; }
.reconciliation-table td:last-child { white-space: nowrap; }
.cash-plan-content { min-height: 0; overflow: auto; padding: 0 20px 20px; overscroll-behavior: contain; }
.cash-plan-content p { color: var(--muted); font-size: .875rem; }
.cash-plan-demo { margin-bottom: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.cash-plan-demo h3, .cash-plan-data-title { font-size: .9375rem; }
.cash-plan-demo p { margin: 4px 0 10px; }
.cash-plan-data-title { margin-bottom: 8px; }
.cash-plan-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
.cash-plan-demo .cash-plan-metrics { margin: 0; }
.cash-plan-metrics div { padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: #f7f8fc; }
.cash-plan-metrics .demo-cash-result { grid-column: 1 / -1; background: #fff3e7; }
.cash-plan-metrics dt { color: var(--muted); font-size: .875rem; }
.cash-plan-metrics dd { margin: 5px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.cash-plan-detail { margin-top: 9px; border: 1px solid var(--line); border-radius: 8px; }
.cash-plan-detail summary { padding: 10px 12px; cursor: pointer; font-size: .875rem; font-weight: 650; }
.cash-plan-detail p { padding: 8px 12px 12px; }
.cash-plan-table { min-width: 525px; }
.bill-table .button { min-height: 30px; padding: 4px 10px; }
.collection-draft { padding: 0 20px 20px; overflow: auto; }
.draft-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 12px; }
.draft-heading h3 { margin: 0; font-size: 1rem; }
.collection-draft p, .collection-draft label { margin-bottom: 8px; font-size: .875rem; }
.collection-draft p { overflow-wrap: anywhere; }
.collection-draft label { display: block; font-weight: 650; }
.collection-draft textarea { display: block; width: 100%; margin-bottom: 12px; padding: 10px; resize: vertical; border: 1px solid var(--line); border-radius: 7px; color: inherit; font: inherit; }
#collection-copy-status { margin-inline-start: 8px; color: var(--muted); font-size: .875rem; }
.category-card.purchase { --category-ink: #1f697d; --category-fill: #e6f4f7; display: block; }
.category-card[data-operations] { display: block; }
.operational-action { border-left-color: var(--category-ink); }
.operational-action + .operational-action { margin-top: 8px; }
.purchase-action { border-left-color: #6696a5; }
.purchase-action + .purchase-action { margin-top: 8px; }
.purchase-dialog { width: min(1100px, calc(100% - 24px)); }
.purchase-detail-table { min-width: 720px; }
.category-card.production { --category-ink: #b14238; --category-fill: #fff0eb; }
.category-card.people { --category-ink: #86418e; --category-fill: #f7edf8; }
.category-card.customers { --category-ink: #14764f; --category-fill: #e6f6ef; }
.category-card.other { --category-ink: #a34e14; --category-fill: #fff1e1; }
.page-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 15px; margin-bottom: 20px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 2.6vw, 2.3rem); line-height: 1.15; letter-spacing: -.044em; font-weight: 730; }
h2 { font-size: 1.16rem; line-height: 1.3; letter-spacing: -.015em; font-weight: 680; }
.date-field { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .875rem; font-weight: 620; }
.date-field input { border: 1px solid #d9e1ef; border-radius: 7px; min-height: 37px; padding: 5px 8px 5px 10px; background: #fff; color: #253655; }

.search-field, .location-field { position: relative; display: flex; align-items: center; }
.search-field svg, .location-field svg { position: absolute; z-index: 1; color: #53688b; }
.search-field svg, .location-icon { left: 9px; }
.select-icon { right: 8px; }
.search-field input, .location-field select { width: 100%; min-height: 37px; padding: 5px 9px 5px 33px; border: 1px solid #d9e1ef; border-radius: 7px; background: #fff; font-size: .875rem; }
.search-field input { min-width: 0; }
.search-field input::placeholder { color: #61718c; opacity: 1; }
.search-field input:disabled { background: #f6f8fb; }
.location-field select { appearance: none; min-width: 147px; padding-right: 29px; cursor: pointer; font-weight: 590; }
.reports-empty { display: grid; justify-items: center; gap: 15px; padding: 64px 20px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: center; }
.empty-icon { width: 44px; height: 44px; border-radius: 9px; color: var(--accent); background: #edf3ff; }

@media (max-width: 1000px) {
  body { grid-template-columns: 184px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1110px) {
  .action-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 740px) {
  body { display: block; }
  .sidebar { position: static; height: auto; padding: 12px 16px; gap: 10px; }
  .brand { padding-left: 0; }
  .brand-icon { width: 30px; height: 30px; }
  .navigation { display: flex; gap: 6px; margin-top: 0; }
  .navigation a { min-height: 37px; }
  .connection { position: absolute; top: 13px; right: 16px; border: 0; padding: 0; }
  .topbar { padding-inline: 16px; min-height: 56px; }
  .workspace { padding: 19px 16px 24px; }
}
@media (max-width: 500px) {
  .cash-plan-metrics { grid-template-columns: 1fr; }
  .action-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-toolbar { display: grid; grid-template-columns: minmax(120px, .9fr) minmax(0, 1fr) auto; }
  .action-toolbar .location-field { grid-row: 2; grid-column: 1; }
  .action-toolbar .location-field select { min-width: 0; }
  .action-toolbar .search-field { grid-row: 2; grid-column: 2 / 4; }
  .range { grid-row: 1; grid-column: 1 / 3; }
  .range summary { display: flex; justify-content: flex-start; }
  #today { grid-row: 1; grid-column: 3; }
  .category-grid { grid-template-columns: 1fr; gap: 9px; }
  .category-card { min-height: 65px; padding: 11px 14px; }
}
