:root {
  --bg: #eef1f3;
  --panel: #ffffff;
  --ink: #26313d;
  --muted: #6b747d;
  --line: #dfe5e8;
  --teal: #04aa9a;
  --teal-dark: #078c82;
  --coral: #ff5959;
  --slate: #405060;
  --amber: #e9a93a;
  --shadow: 0 18px 50px rgba(37, 49, 61, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, rgba(238, 241, 243, 0.96), rgba(220, 231, 233, 0.96));
}

.ledger-choice-screen {
  position: fixed;
  inset: 0;
  z-index: 21;
  display: none;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, rgba(12, 8, 45, 0.97), rgba(29, 11, 78, 0.97));
}

.ledger-choice-screen.active {
  display: grid;
}

.ledger-choice-card {
  display: grid;
  gap: 14px;
}

.ledger-choice-card h2 {
  margin: 8px 0 0;
}

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

.login-screen.active {
  display: grid;
}

.login-card {
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.login-card h2 {
  margin: 22px 0 16px;
}

.login-card label {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.login-card button {
  width: 100%;
  margin-top: 16px;
}

.login-brand {
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding-bottom: 18px;
  text-align: center;
}

.login-brand .brand-mark {
  width: 150px;
  height: 72px;
  font-size: 22px;
  background: linear-gradient(135deg, #11d0c0, #7b4dff);
  box-shadow: 0 12px 28px rgba(47, 216, 204, 0.22);
}

.login-brand .brand-mark.has-logo img {
  object-fit: contain;
}

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

.login-error {
  min-height: 18px;
  margin: 10px 0 0;
  color: #d64242;
  font-size: 13px;
  font-weight: 800;
}

.login-hint {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.app-shell.locked {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 140px minmax(210px, 250px) 180px;
  gap: 14px;
  align-items: end;
  height: auto;
  padding: 14px 18px;
  background: #f8fafb;
  border-bottom: 1px solid var(--line);
  overflow: visible;
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: white;
  background: var(--teal);
  border-radius: 8px;
  font-weight: 800;
}

.brand-mark.has-logo {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  padding: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar .brand-mark {
  width: 98px;
  height: 42px;
}

.sidebar .brand-mark.has-logo img {
  object-fit: contain;
}

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

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.filter-block {
  margin-top: 0;
}

.filter-block label,
.add-year label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
}

.add-year {
  margin-top: 0;
}

.add-year div {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
}

.add-year button {
  border: 0;
  border-radius: 8px;
  color: white;
  background: var(--slate);
  font-size: 20px;
  font-weight: 800;
}

select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: white;
}

.month-list {
  display: grid;
  gap: 6px;
}

.month-list button {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.month-list button.active {
  color: white;
  background: #087cc7;
  font-weight: 700;
}

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

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.topbar-menu {
  position: relative;
}

.menu-trigger {
  min-width: 92px;
  justify-content: center;
}

.topbar-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid;
  min-width: 190px;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(16, 24, 40, 0.18);
}

.topbar-menu-panel[hidden] {
  display: none;
}

.topbar-menu-panel button {
  display: flex;
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  color: var(--ink);
  background: transparent;
  font-weight: 800;
  text-align: left;
}

.topbar-menu-panel button:hover {
  background: rgba(102, 216, 238, 0.12);
}

.presence-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(151, 126, 255, 0.32);
  border-radius: 8px;
  background: rgba(35, 23, 87, 0.88);
}

.presence-bar[hidden] {
  display: none;
}

.presence-bar > div:first-child {
  min-width: 170px;
}

.presence-bar strong,
.presence-bar span {
  display: block;
}

.presence-bar strong {
  color: white;
  font-size: 13px;
}

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

.presence-users {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.presence-user {
  display: inline-flex;
  align-items: center;
  max-width: 300px;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid rgba(151, 126, 255, 0.35);
  border-radius: 8px;
  color: #eef4ff;
  background: rgba(19, 11, 57, 0.58);
  font-size: 12px;
  font-weight: 900;
}

.presence-user i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(11, 176, 158, 0.16);
}

.presence-user small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.presence-user.editing {
  border-color: rgba(255, 61, 135, 0.55);
}

.presence-user.editing i {
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(255, 61, 135, 0.18);
}

.user-chip {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--slate);
  background: white;
  font-size: 12px;
  font-weight: 800;
}

.view-tabs {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 14px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.view-tabs button {
  border: 0;
  border-radius: 6px;
  padding: 10px 18px;
  color: var(--slate);
  background: transparent;
  font-weight: 800;
}

.view-tabs button.active {
  color: white;
  background: var(--teal);
}

.app-view {
  display: none;
}

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

.icon-button,
.primary-button,
.secondary-button,
.danger-button {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 10px 14px;
  font-weight: 800;
}

.icon-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
}

.primary-button {
  color: white;
  background: var(--teal);
}

.secondary-button {
  width: 100%;
  margin-top: 22px;
  color: var(--slate);
  background: white;
  border: 1px solid var(--line);
}

.danger-button {
  color: white;
  background: var(--coral);
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.month-snapshot {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.snapshot-card {
  position: relative;
  min-width: 0;
  min-height: 118px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  padding: 14px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid rgba(223, 229, 232, 0.8);
  box-shadow: var(--shadow);
}

.snapshot-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--teal);
}

.snapshot-card span,
.snapshot-card small {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.snapshot-card strong {
  position: relative;
  z-index: 1;
  min-width: 0;
  color: var(--ink);
  font-size: clamp(22px, 2.4vw, 34px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.snapshot-period::before {
  background: linear-gradient(90deg, #7c5cff, #66d8ee);
}

.snapshot-card.income::before,
.snapshot-card.collected::before {
  background: #18c6c3;
}

.snapshot-card.expense::before,
.snapshot-card.paid::before {
  background: #ff4a91;
}

.snapshot-card.receivable::before {
  background: #66d8ee;
}

.snapshot-card.payable::before {
  background: #e9a93a;
}

.snapshot-card.profit::before {
  background: linear-gradient(90deg, #18c6c3, #7c5cff, #ff4a91);
}

.cash-alerts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.cash-alert {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(37, 25, 90, 0.82), rgba(29, 19, 76, 0.78));
  box-shadow: var(--shadow);
}

.cash-alert span,
.cash-alert small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cash-alert strong {
  display: block;
  margin: 7px 0 6px;
  color: var(--ink);
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.cash-alert.receivable {
  border-color: rgba(255, 74, 145, 0.48);
}

.cash-alert.payable {
  border-color: rgba(233, 169, 58, 0.5);
}

.cash-alert.incoming {
  border-color: rgba(102, 216, 238, 0.5);
}

.cash-alert.outgoing {
  border-color: rgba(124, 92, 255, 0.5);
}

.report-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.report-cards article {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.report-cards span,
.report-cards small,
.modal-info {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-cards strong {
  display: block;
  margin: 8px 0;
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.due-calendar-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.due-calendar-cards article {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--teal);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.due-calendar-cards article.payable {
  border-top-color: var(--coral);
}

.due-calendar-cards article.today {
  border-top-color: var(--amber);
}

.due-calendar-cards article.week {
  border-top-color: #66d8ee;
}

.due-calendar-cards article.overdue {
  background: rgba(255, 74, 145, 0.12);
}

.due-calendar-cards span,
.due-calendar-cards small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.due-calendar-cards strong {
  display: block;
  margin: 8px 0;
  color: var(--ink);
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.due-calendar-list {
  display: grid;
  gap: 10px;
}

.due-calendar-entry {
  grid-template-columns: minmax(86px, 112px) minmax(118px, 146px) minmax(0, 1fr) minmax(88px, auto) repeat(3, 34px);
}

.due-calendar-entry.overdue {
  background: rgba(255, 74, 145, 0.12);
  border-color: rgba(255, 74, 145, 0.52);
}

.due-calendar-entry.today {
  border-color: rgba(233, 169, 58, 0.55);
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.report-grid section,
.report-wide {
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.report-wide {
  margin-top: 14px;
}

.compact-title {
  min-height: 26px;
}

.compact-title h2 {
  font-size: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 3, 24, 0.72);
}

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

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 80;
  display: grid;
  width: min(360px, calc(100vw - 24px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 12px 14px;
  border: 1px solid rgba(151, 126, 255, 0.34);
  border-left: 5px solid var(--teal);
  border-radius: 8px;
  background: rgba(28, 18, 77, 0.96);
  color: #eef4ff;
  box-shadow: 0 18px 45px rgba(5, 3, 24, 0.28);
  pointer-events: auto;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

.toast small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.toast.success {
  border-left-color: var(--teal);
}

.toast.error {
  border-left-color: var(--coral);
}

.toast.warning {
  border-left-color: var(--amber);
}

.modal-card {
  width: min(620px, 100%);
  padding: 18px;
  border: 1px solid rgba(151, 126, 255, 0.38);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(37, 25, 90, 0.98), rgba(29, 19, 76, 0.98));
  box-shadow: 0 28px 90px rgba(4, 2, 28, 0.55);
}

.modal-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 7px;
  color: white;
  background: var(--slate);
  font-size: 20px;
  line-height: 1;
}

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

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.modal-actions button {
  width: auto;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1.45fr 0.7fr 1.45fr;
  gap: 10px;
}

.panel,
.kpi-card {
  background: var(--panel);
  border: 1px solid rgba(223, 229, 232, 0.8);
  box-shadow: var(--shadow);
}

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

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 32px;
  margin-bottom: 10px;
}

.panel-title h2,
.kpi-card h3 {
  margin: 0;
  font-size: 16px;
  text-align: center;
}

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

.waterfall {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  align-items: end;
  min-height: 250px;
  padding: 18px 8px 2px;
  border-bottom: 1px solid var(--line);
}

.wf-item {
  display: grid;
  gap: 7px;
  justify-items: center;
  align-content: end;
  height: 230px;
}

.wf-value {
  font-size: 12px;
  font-weight: 800;
}

.wf-bar {
  width: min(52px, 80%);
  min-height: 10px;
  background: var(--teal);
}

.wf-bar.base {
  background: var(--slate);
}

.wf-bar.negative {
  background: var(--coral);
}

.wf-bar.expected {
  background: var(--amber);
}

.wf-label {
  min-height: 34px;
  color: #1d252c;
  font-size: 11px;
  text-align: center;
}

.gauge-panel {
  display: grid;
  align-content: start;
}

.gauge {
  position: relative;
  width: min(210px, 85%);
  aspect-ratio: 1;
  margin: 18px auto 0;
  border-radius: 50%;
  background: conic-gradient(var(--teal) 0deg, var(--teal) 56deg, var(--coral) 56deg, var(--coral) 360deg);
}

.gauge::after {
  content: "";
  position: absolute;
  inset: 26px;
  background: white;
  border-radius: 50%;
}

.gauge-core {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-content: center;
  text-align: center;
}

.gauge-core strong {
  font-size: 28px;
}

.gauge-core span {
  margin-top: 8px;
  color: var(--teal-dark);
  font-weight: 800;
}

#monthlyChart {
  width: 100%;
  height: 250px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.kpi-card {
  min-height: 154px;
  padding: 13px;
  text-align: center;
}

.kpi-card strong {
  display: block;
  margin-top: 12px;
  font-size: 34px;
}

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

.spark {
  width: 100%;
  height: 38px;
  margin: 4px auto;
}

.mini-ring {
  position: relative;
  display: grid;
  width: 116px;
  aspect-ratio: 1;
  place-items: center;
  margin: 10px auto 0;
  border-radius: 50%;
  background: conic-gradient(var(--teal) 0deg, var(--teal) 342deg, #edf1f3 342deg);
}

.mini-ring.accent {
  background: conic-gradient(var(--teal) 0deg, var(--teal) 295deg, #edf1f3 295deg);
}

.mini-ring::after {
  content: "";
  position: absolute;
  inset: 9px;
  background: white;
  border-radius: 50%;
}

.mini-ring strong {
  position: relative;
  z-index: 1;
  margin: 0;
}

.ledger-view .entry-panel {
  width: 100%;
  overflow-x: hidden;
}

.table-panel {
  margin-top: 10px;
}

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

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

.transaction-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr 1.6fr;
  gap: 14px;
  align-items: end;
}

.user-form,
.employee-form,
.counterparty-form,
.company-form {
  display: grid;
  grid-template-columns: 1fr 1fr 0.8fr 1fr auto;
  gap: 14px;
  align-items: end;
}

.settings-admin-form {
  display: grid;
  grid-template-columns: 86px minmax(240px, 1fr) auto auto;
  gap: 14px;
  align-items: end;
}

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

.settings-admin-form button {
  min-height: 46px;
}

.logo-preview {
  display: grid;
  place-items: center;
}

.company-logo-preview {
  min-height: 58px;
  align-self: end;
  justify-items: start;
}

.company-card-logo {
  flex: 0 0 42px;
}

.settings-panel {
  width: 100%;
}

.finance-form label,
.transaction-form label,
.user-form label,
.user-row label,
.company-form label,
.employee-form label,
.counterparty-form label,
.overtime-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.finance-form button,
.transaction-form button,
.user-form button,
.company-form button,
.employee-form button,
.overtime-form button {
  min-height: 46px;
}

.type-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  align-self: stretch;
  grid-column: 1 / -1;
}

.type-picker label {
  display: block;
  min-width: 0;
}

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

.type-picker span {
  display: grid;
  min-height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--slate);
  background: #f8fafb;
  font-size: 12px;
  font-weight: 800;
}

.type-picker input:checked + span {
  color: white;
  background: var(--teal);
  border-color: var(--teal);
}

.type-picker label:nth-child(2) input:checked + span {
  background: var(--coral);
  border-color: var(--coral);
}

.type-picker label:nth-child(3) input:checked + span {
  background: var(--amber);
  border-color: var(--amber);
}

.compact-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

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

.inline-button {
  margin-top: 0;
}

.entry-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  max-width: 100%;
  overflow-x: hidden;
}

.ledger-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.customer-toolbar {
  grid-template-columns: minmax(220px, 1fr) 180px;
}

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

.ledger-toolbar button {
  min-height: 44px;
  align-self: end;
}

.advanced-filter-panel {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.advanced-filter-panel[hidden] {
  display: none;
}

.active-filter-button {
  border-color: rgba(102, 216, 238, 0.65);
  color: var(--ink);
}

.check-filter {
  display: flex !important;
  min-height: 44px;
  flex-direction: row;
  gap: 8px !important;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.check-filter input {
  width: auto;
}

.entry-row {
  display: grid;
  grid-template-columns: minmax(86px, 112px) minmax(118px, 146px) minmax(0, 1fr) minmax(88px, auto) repeat(4, 34px);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  max-width: 100%;
  min-width: 0;
}

.entry-row > * {
  min-width: 0;
}

.entry-row strong,
.entry-row small {
  display: block;
}

.entry-row small {
  margin-top: 3px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-history {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.payment-history span {
  display: inline-flex;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  font-size: 11px;
  font-weight: 800;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.attachment-list a {
  display: inline-flex;
  max-width: 100%;
  gap: 6px;
  align-items: center;
  padding: 5px 8px;
  border: 1px solid rgba(102, 216, 238, 0.4);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(102, 216, 238, 0.08);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}

.attachment-list span {
  color: var(--teal);
}

.entry-money {
  display: grid;
  gap: 3px;
  justify-items: end;
}

.entry-money b {
  white-space: nowrap;
}

.entry-money small {
  margin-top: 0;
  text-align: right;
  white-space: nowrap;
}

.entry-row button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  color: white;
  background: var(--slate);
  font-size: 18px;
  line-height: 1;
}

.entry-row button[data-edit] {
  background: var(--teal);
}

.entry-row button[data-close],
.entry-row button[data-due-close] {
  background: var(--amber);
}

.entry-row button[data-pay],
.entry-row button[data-due-pay] {
  background: #1faec6;
}

.entry-row button[data-due-open] {
  background: var(--violet);
}

.entry-type {
  display: inline-grid;
  min-height: 32px;
  place-items: center;
  border-radius: 7px;
  color: white;
  background: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

.entry-date {
  color: var(--slate);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-row.expense .entry-type {
  background: var(--coral);
}

.detail-entry.expense .entry-type {
  background: var(--coral);
}

.entry-row.expected .entry-type {
  background: var(--amber);
}

.detail-entry.expected .entry-type {
  background: var(--amber);
}

.entry-row.payable .entry-type {
  background: var(--slate);
}

.detail-entry.payable .entry-type {
  background: var(--slate);
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafb;
  text-align: center;
}

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

.summary-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.summary-row.overdue {
  border-color: rgba(255, 89, 89, 0.45);
  background: #fff7f7;
}

.summary-row span {
  display: inline-grid;
  min-height: 28px;
  place-items: center;
  border-radius: 7px;
  color: white;
  background: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

.summary-row.expense span {
  background: var(--coral);
}

.summary-row.expected span {
  background: var(--amber);
}

.summary-row.payable span {
  background: var(--slate);
}

.summary-row.method span {
  background: var(--slate);
}

.summary-row strong,
.summary-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-row strong {
  white-space: nowrap;
}

.summary-row small {
  grid-column: 2 / 3;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  white-space: normal;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.summary-row b {
  grid-column: 3 / 4;
  grid-row: 1 / span 2;
  justify-self: end;
  white-space: nowrap;
}

.users-panel,
.employees-panel {
  width: 100%;
}

.customer-panel {
  width: 100%;
}

.user-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.company-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.company-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(145, 123, 255, 0.22);
  border-radius: 8px;
  background: rgba(20, 13, 58, 0.72);
}

.company-card.warning,
.company-card.critical,
.company-card.expired,
.company-card.passive {
  border-color: rgba(233, 169, 58, 0.52);
}

.company-card.critical,
.company-card.expired,
.company-card.passive {
  border-color: rgba(255, 61, 135, 0.58);
}

.company-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.company-title {
  display: grid;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.company-title strong,
.company-title small {
  display: block;
}

.company-title small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.license-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid rgba(11, 176, 158, 0.42);
  border-radius: 8px;
  color: #eafdff;
  background: rgba(11, 176, 158, 0.18);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.license-badge.warning,
.license-badge.future {
  border-color: rgba(233, 169, 58, 0.55);
  background: rgba(233, 169, 58, 0.18);
}

.license-badge.critical,
.license-badge.expired,
.license-badge.passive {
  border-color: rgba(255, 61, 135, 0.6);
  background: rgba(255, 61, 135, 0.18);
}

.company-detail {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(145, 123, 255, 0.2);
}

.company-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.company-meta span {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.company-data-tools {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 180px) auto auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid rgba(255, 61, 135, 0.28);
  border-radius: 8px;
  background: rgba(255, 61, 135, 0.08);
}

.company-data-tools strong {
  align-self: center;
}

.company-user-create,
.company-users form {
  display: grid;
  grid-template-columns: 1fr 1fr 0.8fr 1fr auto;
  gap: 8px;
  align-items: end;
}

.company-users {
  display: grid;
  gap: 8px;
}

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

.employee-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.counterparty-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.counterparty-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(37, 25, 90, 0.82);
}

.counterparty-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

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

.counterparty-actions button {
  width: auto;
  margin-top: 0;
}

.counterparty-head strong,
.counterparty-head small {
  display: block;
}

.counterparty-head small {
  color: var(--muted);
  font-size: 12px;
}

.counterparty-head strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.counterparty-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.8fr);
  gap: 10px;
  margin-bottom: 12px;
}

.counterparty-overview-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.counterparty-overview-cards article,
.counterparty-risk-list {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 9, 48, 0.28);
}

.counterparty-overview-cards article {
  border-top: 4px solid var(--teal);
}

.counterparty-overview-cards article.payable {
  border-top-color: var(--coral);
}

.counterparty-overview-cards article.overdue {
  background: rgba(255, 74, 145, 0.12);
}

.counterparty-overview-cards span,
.counterparty-overview-cards small,
.counterparty-risk-list small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.counterparty-overview-cards strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 22px;
  overflow-wrap: anywhere;
}

.counterparty-risk-list {
  display: grid;
  gap: 8px;
}

.counterparty-risk-list strong,
.counterparty-risk-list b {
  color: var(--ink);
}

.counterparty-risk-list span {
  display: grid;
  gap: 3px;
}

.counterparty-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.counterparty-metrics span {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(13, 9, 48, 0.34);
  font-size: 12px;
  font-weight: 800;
}

.counterparty-metrics b {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.counterparty-aging {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.counterparty-aging span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(13, 9, 48, 0.24);
  font-size: 12px;
  font-weight: 800;
}

.counterparty-aging span.payable {
  border-left-color: var(--coral);
}

.counterparty-aging span.overdue {
  background: rgba(255, 74, 145, 0.12);
}

.counterparty-aging b {
  color: var(--ink);
  overflow-wrap: anywhere;
}

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

.detail-metrics + .counterparty-aging {
  margin-bottom: 12px;
}

.wide-modal {
  width: min(980px, 100%);
  max-height: min(820px, calc(100vh - 36px));
  overflow: auto;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.detail-metrics article {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.detail-metrics span,
.detail-metrics strong,
.counterparty-detail-meta span {
  display: block;
}

.detail-metrics span,
.counterparty-detail-meta span,
.detail-entry small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-metrics strong {
  margin-top: 7px;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.counterparty-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.counterparty-detail-meta span {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
}

.detail-entry-list {
  display: grid;
  gap: 9px;
}

.detail-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, auto);
  gap: 12px;
  align-items: start;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.detail-entry.overdue {
  border-color: rgba(255, 74, 145, 0.5);
}

.detail-entry strong,
.detail-entry small {
  display: block;
  margin-top: 4px;
}

.detail-entry-money {
  text-align: right;
}

.detail-entry-money b,
.detail-entry-money small {
  display: block;
}

.employee-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.employee-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
}

.employee-head strong,
.employee-head small,
.employee-money span,
.employee-money b {
  display: block;
}

.employee-head small,
.employee-money span,
.employee-note {
  color: var(--muted);
  font-size: 12px;
}

.employee-money {
  text-align: right;
}

.employee-note {
  margin: 0;
}

.employee-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.employee-breakdown span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  font-weight: 800;
}

.overtime-form {
  display: grid;
  grid-template-columns: 150px 160px 110px 160px minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

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

.overtime-row {
  display: grid;
  grid-template-columns: 160px 130px minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.overtime-row span,
.overtime-row small {
  color: var(--muted);
  font-size: 12px;
}

.overtime-row strong {
  white-space: nowrap;
}

.overtime-row button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  color: white;
  background: var(--slate);
  font-size: 18px;
  line-height: 1;
}

.advance-row {
  border-color: rgba(233, 169, 58, 0.45);
}

.compact-empty {
  padding: 10px;
  text-align: left;
}

.user-row {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 0.9fr 1.1fr auto auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.user-row strong,
.user-row small {
  display: block;
}

.user-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

td strong,
td small {
  display: block;
}

td small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.segmented {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.segmented button {
  border: 0;
  padding: 7px 12px;
  background: transparent;
  font-weight: 800;
}

.segmented button.active {
  color: white;
  background: var(--slate);
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
  font-weight: 800;
}

th {
  color: var(--muted);
  background: #f8fafb;
  font-size: 12px;
}

.positive {
  color: var(--teal-dark);
  font-weight: 800;
}

.negative-text {
  color: #d64242;
  font-weight: 800;
}

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

  .sidebar {
    position: sticky;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
  }

  .sidebar .brand {
    grid-column: 1 / -1;
  }

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

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

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

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

  .report-cards,
  .due-calendar-cards,
  .report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .counterparty-overview {
    grid-template-columns: 1fr;
  }

  .counterparty-overview-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analysis-grid {
    grid-template-columns: 1fr;
  }

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

  .user-form,
  .employee-form,
  .counterparty-form,
  .user-row,
  .overtime-form,
  .ledger-toolbar,
  .advanced-filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .counterparty-metrics span:last-child {
    grid-column: 1 / -1;
  }

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

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

@media (max-width: 640px) {
  .dashboard {
    padding: 18px 12px;
  }

  .sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 14px 12px;
  }

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

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .topbar-menu {
    margin-left: auto;
  }

  .topbar-menu-panel {
    right: 0;
    min-width: min(220px, calc(100vw - 24px));
  }

  .presence-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .presence-users {
    justify-content: flex-start;
  }

  .presence-user {
    max-width: 100%;
  }

  .company-head {
    display: grid;
  }

  .company-actions {
    justify-content: flex-start;
  }

  .license-badge {
    width: fit-content;
  }

  .toast-stack {
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto;
  }

  .view-tabs,
  .view-tabs button {
    width: 100%;
  }

  .view-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .month-snapshot {
    grid-template-columns: 1fr;
  }

  .cash-alerts {
    grid-template-columns: 1fr;
  }

  .report-cards,
  .due-calendar-cards,
  .report-grid,
  .counterparty-overview,
  .counterparty-overview-cards,
  .payment-form-grid {
    grid-template-columns: 1fr;
  }

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

  h1 {
    font-size: 26px;
  }

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

  .kpi-grid,
  .finance-form,
  .transaction-form,
  .compact-form,
  .user-form,
  .company-form,
  .company-data-tools,
  .company-user-create,
  .company-users form,
  .company-meta,
  .employee-form,
  .counterparty-form,
  .settings-admin-form,
  .user-row,
  .employee-summary,
  .employee-head,
  .overtime-form,
  .overtime-row,
  .ledger-toolbar,
  .advanced-filter-panel {
    grid-template-columns: 1fr;
  }

  .counterparty-metrics,
  .counterparty-aging {
    grid-template-columns: 1fr;
  }

  .counterparty-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .counterparty-actions {
    justify-content: flex-start;
  }

  .counterparty-actions button {
    flex: 1 1 118px;
    min-width: 0;
  }

  .detail-metrics,
  .detail-entry {
    grid-template-columns: 1fr;
  }

  .detail-entry-money {
    text-align: left;
  }

  .counterparty-metrics span:last-child {
    grid-column: auto;
  }

  .entry-row,
  .due-calendar-entry {
    grid-template-columns: repeat(4, 34px) minmax(0, 1fr);
    align-items: start;
    gap: 8px;
  }

  .due-calendar-entry {
    grid-template-columns: repeat(3, 34px) minmax(0, 1fr);
  }

  .entry-row > div:not(.entry-money) {
    grid-column: 1 / -1;
  }

  .due-calendar-entry > div:not(.entry-money) small {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.45;
  }

  .due-calendar-entry .payment-history {
    display: grid;
    grid-template-columns: 1fr;
  }

  .due-calendar-entry .payment-history span {
    display: block;
    width: 100%;
    max-width: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .entry-row b {
    justify-self: start;
  }

  .entry-money {
    grid-column: 1 / -1;
    justify-items: start;
  }

  .entry-money small {
    text-align: left;
  }

  .summary-row {
    grid-template-columns: 1fr auto;
  }

  .summary-row span,
  .summary-row strong,
  .summary-row small {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .summary-row b {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-self: start;
  }

  .entry-type {
    grid-column: 1 / -1;
    justify-self: start;
    padding: 0 10px;
  }

  .entry-date {
    grid-column: 1 / -1;
  }

  .entry-row button {
    grid-row: auto;
  }

  .waterfall {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media print {
  .sidebar,
  .topbar-actions,
  .entry-panel {
    display: none;
  }

  .app-shell,
  .summary-grid,
  .kpi-grid,
  .app-view {
    display: block;
  }

  .panel,
  .kpi-card {
    box-shadow: none;
    break-inside: avoid;
    margin-bottom: 10px;
  }
}

/* Premium dashboard theme */
:root {
  --bg: #130b3f;
  --panel: rgba(34, 22, 84, 0.9);
  --ink: #f8fbff;
  --muted: #a9b4df;
  --line: rgba(151, 126, 255, 0.22);
  --teal: #66d8ee;
  --teal-dark: #4fc7dc;
  --coral: #ff4a91;
  --slate: #7c5cff;
  --amber: #b35cff;
  --shadow: 0 20px 60px rgba(4, 2, 28, 0.35);
}

body {
  background:
    radial-gradient(circle at 20% -10%, rgba(103, 77, 255, 0.45), transparent 34%),
    radial-gradient(circle at 90% 0%, rgba(255, 72, 163, 0.28), transparent 30%),
    linear-gradient(135deg, #130b3f 0%, #1c0e55 42%, #09072b 100%);
}

.app-shell {
  margin: 20px;
  min-height: calc(100vh - 40px);
  border: 1px solid rgba(117, 92, 255, 0.72);
  background: rgba(15, 10, 48, 0.72);
  box-shadow: 0 0 0 1px rgba(105, 215, 238, 0.08), 0 26px 90px rgba(7, 4, 38, 0.6);
}

.sidebar {
  background: rgba(20, 12, 66, 0.92);
  border-right: 0;
  border-bottom: 1px solid rgba(117, 92, 255, 0.44);
}

.brand {
  border-bottom: 0;
}

.brand-mark {
  color: #eafdff;
  background: linear-gradient(135deg, #2d62ff, #7a4dff 55%, #42d4ed);
  box-shadow: 0 12px 34px rgba(72, 103, 255, 0.35);
}

.brand small,
.filter-block label,
.add-year label,
.panel-title span,
.kpi-card span,
.entry-row small,
.summary-row small,
.user-row small,
.ledger-toolbar label,
.finance-form label,
.transaction-form label,
.user-form label,
.user-row label,
.employee-form label,
.overtime-form label,
.employee-head small,
.employee-money span,
.employee-note,
.overtime-row span,
.overtime-row small,
.login-card label {
  color: var(--muted);
}

select,
input {
  color: #f8fbff;
  background: rgba(13, 9, 48, 0.68);
  border-color: rgba(145, 123, 255, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

input::placeholder {
  color: rgba(214, 220, 255, 0.55);
}

.month-list button {
  color: #d9defd;
}

.month-list button.active,
.view-tabs button.active,
.segmented button.active {
  background: linear-gradient(135deg, #6f4dff, #915cff);
  box-shadow: 0 12px 28px rgba(108, 77, 255, 0.3);
}

.dashboard {
  background: rgba(9, 7, 41, 0.32);
}

.topbar {
  min-height: 64px;
  margin: -28px -28px 18px;
  padding: 16px 22px;
  background: rgba(26, 15, 72, 0.75);
  border-bottom: 1px solid rgba(117, 92, 255, 0.38);
}

.eyebrow {
  color: #75e8ff;
}

h1,
h2,
h3,
.brand strong {
  color: #ffffff;
}

.user-chip,
.icon-button,
.secondary-button,
.view-tabs,
.segmented {
  color: #eef4ff;
  background: rgba(28, 18, 77, 0.82);
  border-color: rgba(145, 123, 255, 0.34);
}

.topbar-menu-panel {
  background: rgba(28, 18, 77, 0.98);
  border-color: rgba(145, 123, 255, 0.34);
  box-shadow: 0 20px 55px rgba(5, 3, 24, 0.35);
}

.topbar-menu-panel button {
  color: #eef4ff;
}

.topbar-menu-panel button:hover {
  background: rgba(102, 216, 238, 0.13);
}

.account-chip {
  border-color: rgba(102, 216, 238, 0.5);
}

button.account-chip {
  cursor: pointer;
}

button.account-chip:hover {
  border-color: rgba(102, 216, 238, 0.82);
  transform: translateY(-1px);
}

.account-chip.unofficial {
  border-color: rgba(255, 74, 145, 0.62);
  background: rgba(255, 74, 145, 0.18);
  color: #ffd6e6;
}

.icon-button:hover,
.secondary-button:hover {
  border-color: rgba(102, 216, 238, 0.65);
}

.primary-button {
  color: #ffffff;
  background: linear-gradient(135deg, #18c6c3, #12a99d);
  box-shadow: 0 14px 30px rgba(18, 198, 195, 0.25);
}

.danger-button {
  background: linear-gradient(135deg, #ff4a91, #d83278);
}

.panel,
.kpi-card,
.snapshot-card,
.login-card {
  background: linear-gradient(180deg, rgba(37, 25, 90, 0.95), rgba(29, 19, 76, 0.92));
  border-color: rgba(151, 126, 255, 0.27);
  box-shadow: var(--shadow);
}

.kpi-card {
  position: relative;
  overflow: hidden;
  min-height: 154px;
  text-align: left;
}

.kpi-card::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 18px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 10px solid rgba(255, 255, 255, 0.15);
}

.kpi-card:nth-child(1),
.kpi-card:nth-child(6) {
  background: linear-gradient(135deg, #2c38f0, #674dff);
}

.kpi-card:nth-child(2),
.kpi-card:nth-child(7) {
  background: linear-gradient(135deg, #1faec6, #42d4ed);
}

.kpi-card:nth-child(3),
.kpi-card:nth-child(8) {
  background: linear-gradient(135deg, #7a17d7, #c018df);
}

.kpi-card:nth-child(4),
.kpi-card:nth-child(9) {
  background: linear-gradient(135deg, #c018df, #ff4a91);
}

.kpi-card:nth-child(5),
.kpi-card:nth-child(10) {
  background: linear-gradient(135deg, #312071, #6f4dff);
}

.kpi-card h3 {
  text-align: left;
  color: rgba(255, 255, 255, 0.86);
}

.kpi-card strong {
  color: #ffffff;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.kpi-card span {
  color: rgba(244, 247, 255, 0.76);
}

.panel-title {
  border-bottom: 1px solid rgba(145, 123, 255, 0.14);
  padding-bottom: 8px;
}

.waterfall {
  border-bottom-color: rgba(145, 123, 255, 0.18);
}

.wf-label {
  color: #dce5ff;
}

.wf-value {
  color: #ffffff;
}

.wf-bar {
  border-radius: 7px 7px 0 0;
  box-shadow: 0 0 18px rgba(102, 216, 238, 0.28);
}

.wf-bar.base {
  background: linear-gradient(180deg, #7c5cff, #5542bb);
}

.wf-bar.negative {
  background: linear-gradient(180deg, #ff4a91, #c93078);
}

.wf-bar.expected {
  background: linear-gradient(180deg, #b35cff, #7a3fdf);
}

.gauge::after,
.mini-ring::after {
  background: #241657;
}

.gauge-core strong,
.mini-ring strong {
  color: #ffffff;
}

.gauge-core span {
  color: #75e8ff;
}

.entry-row,
.summary-row,
.user-row,
.employee-card,
.overtime-row,
.empty-state {
  background: rgba(20, 13, 58, 0.72);
  border-color: rgba(145, 123, 255, 0.22);
}

.summary-row.overdue {
  background: rgba(255, 74, 145, 0.12);
  border-color: rgba(255, 74, 145, 0.52);
}

.entry-row button,
.user-row button,
.overtime-row button {
  box-shadow: 0 10px 20px rgba(5, 3, 24, 0.25);
}

.entry-type,
.summary-row span {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.table-wrap {
  border-radius: 8px;
  border: 1px solid rgba(145, 123, 255, 0.18);
}

table {
  color: #eef4ff;
}

th {
  color: #bfc8f4;
  background: rgba(16, 10, 51, 0.92);
}

td {
  border-bottom-color: rgba(145, 123, 255, 0.16);
}

.positive {
  color: #75e8ff;
}

.negative-text {
  color: #ff74a9;
}

body.theme-light {
  color: #1f2937;
  background: #eef3f8;
}

body.theme-light .app-shell {
  border-color: #d7e0eb;
  background: #f8fbff;
  box-shadow: 0 22px 70px rgba(31, 41, 55, 0.12);
}

body.theme-light .sidebar,
body.theme-light .topbar,
body.theme-light .user-chip,
body.theme-light .icon-button,
body.theme-light .topbar-menu-panel,
body.theme-light .secondary-button,
body.theme-light .view-tabs,
body.theme-light .segmented {
  color: #1f2937;
  background: #ffffff;
  border-color: #d7e0eb;
}

body.theme-light .topbar-menu-panel button {
  color: #1f2937;
}

body.theme-light .topbar-menu-panel button:hover {
  background: #eef6fb;
}

body.theme-light .presence-bar,
body.theme-light .presence-user,
body.theme-light .license-badge {
  color: #1f2937;
  background: #ffffff;
  border-color: #dbe4ee;
}

body.theme-light .presence-bar strong {
  color: #172033;
}

body.theme-light .presence-bar span,
body.theme-light .presence-user small,
body.theme-light .company-title small {
  color: #64748b;
}

body.theme-light .dashboard {
  background: #f4f7fb;
}

body.theme-light .panel,
body.theme-light .login-card,
body.theme-light .snapshot-card,
body.theme-light .toast,
body.theme-light .modal-card,
body.theme-light .report-cards article,
body.theme-light .due-calendar-cards article,
body.theme-light .cash-alert,
body.theme-light .counterparty-card,
body.theme-light .counterparty-overview-cards article,
body.theme-light .counterparty-risk-list,
body.theme-light .counterparty-aging span,
body.theme-light .detail-metrics article,
body.theme-light .counterparty-detail-meta span,
body.theme-light .detail-entry,
body.theme-light .entry-row,
body.theme-light .summary-row,
body.theme-light .user-row,
body.theme-light .company-card,
body.theme-light .employee-card,
body.theme-light .overtime-row,
body.theme-light .empty-state {
  color: #1f2937;
  background: #ffffff;
  border-color: #dbe4ee;
  box-shadow: 0 16px 45px rgba(31, 41, 55, 0.08);
}

body.theme-light h1,
body.theme-light h2,
body.theme-light h3,
body.theme-light .brand strong,
body.theme-light .kpi-card h3,
body.theme-light .kpi-card strong,
body.theme-light .snapshot-card strong,
body.theme-light .cash-alert strong,
body.theme-light .due-calendar-cards strong {
  color: #172033;
  text-shadow: none;
}

body.theme-light .brand small,
body.theme-light .filter-block label,
body.theme-light .add-year label,
body.theme-light .panel-title span,
body.theme-light .snapshot-card span,
body.theme-light .snapshot-card small,
body.theme-light .cash-alert span,
body.theme-light .cash-alert small,
body.theme-light .due-calendar-cards span,
body.theme-light .due-calendar-cards small,
body.theme-light .counterparty-overview-cards span,
body.theme-light .counterparty-overview-cards small,
body.theme-light .counterparty-risk-list small,
body.theme-light .report-cards span,
body.theme-light .report-cards small,
body.theme-light .payment-form-grid label,
body.theme-light .modal-info,
body.theme-light .toast small,
body.theme-light .entry-row small,
body.theme-light .summary-row small,
body.theme-light .user-row small,
body.theme-light .employee-head small,
body.theme-light .employee-money span,
body.theme-light .employee-note,
body.theme-light .employee-breakdown span,
body.theme-light .counterparty-head small,
body.theme-light .counterparty-metrics span,
body.theme-light .counterparty-aging span,
body.theme-light .counterparty-aging small,
body.theme-light .detail-metrics span,
body.theme-light .counterparty-detail-meta span,
body.theme-light .detail-entry small,
body.theme-light .attachment-list a,
body.theme-light .overtime-row span,
body.theme-light .overtime-row small,
body.theme-light .ledger-toolbar label,
body.theme-light .finance-form label,
body.theme-light .transaction-form label,
body.theme-light .user-form label,
body.theme-light .employee-form label,
body.theme-light .counterparty-form label,
body.theme-light .settings-admin-form label,
body.theme-light .overtime-form label {
  color: #64748b;
}

body.theme-light .counterparty-head strong,
body.theme-light .counterparty-overview-cards strong,
body.theme-light .counterparty-risk-list strong,
body.theme-light .counterparty-risk-list b,
body.theme-light .counterparty-metrics b,
body.theme-light .counterparty-aging b {
  color: #172033;
}

body.theme-light .counterparty-overview-cards article.overdue,
body.theme-light .due-calendar-cards article.overdue,
body.theme-light .due-calendar-entry.overdue,
body.theme-light .counterparty-aging span.overdue {
  background: #fff1f7;
}

body.theme-light select,
body.theme-light input {
  color: #172033;
  background: #ffffff;
  border-color: #d7e0eb;
}

body.theme-light th {
  color: #64748b;
  background: #f0f4f8;
}

body.theme-light table {
  color: #1f2937;
}

body.theme-light td {
  border-bottom-color: #e5edf5;
}

body.theme-light .gauge::after,
body.theme-light .mini-ring::after {
  background: #ffffff;
}

body.theme-light .gauge-core strong,
body.theme-light .mini-ring strong {
  color: #172033;
}

body.theme-light .positive {
  color: #07998b;
}

body.theme-light .negative-text {
  color: #d83278;
}

.login-screen {
  background:
    radial-gradient(circle at 20% 0%, rgba(103, 77, 255, 0.42), transparent 36%),
    linear-gradient(135deg, rgba(12, 8, 45, 0.97), rgba(29, 11, 78, 0.97));
}

@media (max-width: 1150px) {
  .app-shell {
    margin: 0;
    min-height: 100vh;
    border-width: 0;
  }

  .topbar {
    margin: -28px -28px 18px;
  }
}

@media (max-width: 640px) {
  .topbar {
    margin: -18px -12px 16px;
  }
}
