:root {
  --bg: #ffffff;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --surface-3: #f6f8fb;
  --text: #17212b;
  --ink: #101828;
  --muted: #687366;
  --faint: #8c9588;
  --line: #dfe4d8;
  --line-strong: #cbd6c7;
  --green: #1f6fb2;
  --green-deep: #174a7c;
  --green-bg: #e8f2fc;
  --yellow: #946810;
  --yellow-bg: #fff2c7;
  --red: #b43d36;
  --red-bg: #fee4dd;
  --maroon: #761927;
  --maroon-bg: #f8d2d8;
  --blue: #246185;
  --blue-bg: #e5f0f6;
  --shadow-sm: 0 10px 26px rgba(29, 42, 30, 0.07);
  --shadow-md: 0 18px 48px rgba(29, 42, 30, 0.12);
  --focus: 0 0 0 4px rgba(31, 111, 178, 0.18);
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: #ffffff;
  font-family: "Manrope", Inter, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

body::before {
  content: none;
}

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

button,
a.primary-btn {
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  align-items: center;
  gap: 28px;
  padding: 34px;
  overflow-y: auto;
  background:
    linear-gradient(135deg, rgba(20, 37, 26, 0.96), rgba(29, 72, 47, 0.92)),
    var(--bg);
}

.login-screen.hidden {
  display: none;
}

.login-card {
  display: grid;
  gap: 14px;
  width: 100%;
  align-self: center;
  padding: 24px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  box-shadow: 0 28px 90px rgba(8, 17, 10, 0.34);
}

#forgotPasswordForm {
  align-self: start;
  margin: 16px 0;
}

.login-welcome {
  max-width: 680px;
  color: #ffffff;
}

.login-logo {
  margin-bottom: 22px;
}

.login-welcome .eyebrow {
  color: #cfe4c9;
}

.login-welcome h1 {
  margin: 8px 0 12px;
  font-size: 42px;
  line-height: 1.08;
}

.login-welcome p:last-child {
  max-width: 520px;
  margin: 0;
  color: #d9e9d4;
  font-size: 16px;
  line-height: 1.55;
}

.compact-brand h1 {
  color: var(--ink);
}

.compact-brand p {
  color: var(--muted);
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.login-help {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.role-hidden,
[hidden] {
  display: none !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 0;
  box-shadow: var(--focus);
}

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

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: none;
  background: rgba(9, 18, 11, 0.42);
  border: 0;
}

.sidebar {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 292px;
  height: 100vh;
  padding: 24px 18px 34px;
  color: #edf6ec;
  background:
    linear-gradient(180deg, #0f5d9b, #083a6b),
    #0f5d9b;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 16px 0 40px rgba(22, 38, 27, 0.16);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.34) transparent;
  transform: translateX(0);
  transition: transform 180ms ease;
}

.app-shell.nav-collapsed .sidebar {
  transform: translateX(-105%);
}

.app-shell:not(.nav-collapsed) .menu-backdrop {
  display: block;
}

.module-quick-menu {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
}

.module-quick-menu a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 12px;
  color: #083a6b;
  background: #ffffff;
  border-radius: 8px;
  font-weight: 900;
  text-decoration: none;
}

.module-quick-menu a:hover {
  background: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 8px 6px 12px;
}

.sidebar-close {
  margin-left: auto;
  min-height: 34px;
  padding: 0 10px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #083a6b;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  box-shadow: 0 12px 22px rgba(2, 10, 4, 0.28);
  font-weight: 900;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3 {
  margin: 0;
}

.brand h1 {
  color: #ffffff;
  font-size: 18px;
  line-height: 1.15;
}

.brand p {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 10px;
  padding-bottom: 26px;
}

.nav::after {
  content: "";
  display: block;
  height: 18px;
}

.nav-btn,
.text-btn {
  border: 0;
  background: transparent;
}

.menu-group {
  display: grid;
  gap: 6px;
}

.menu-group summary {
  min-height: 38px;
  padding: 9px 12px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.095);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
  list-style-position: inside;
}

.menu-group[open] summary {
  background: rgba(255, 255, 255, 0.16);
}

.menu-group .nav-btn {
  margin-left: 10px;
  width: calc(100% - 10px);
}

.menu-group .module-nav-link {
  margin-left: 10px;
  width: calc(100% - 10px);
}

.nav-btn {
  position: relative;
  min-height: 40px;
  padding: 9px 12px 9px 15px;
  color: rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  text-align: left;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.module-nav-link {
  display: block;
  position: relative;
  min-height: 40px;
  padding: 9px 12px 9px 15px;
  color: rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  text-align: left;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.module-nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-btn.active {
  color: #083a6b;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.nav-home {
  width: 100%;
  color: #083a6b;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 900;
}

.nav-btn.active::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 999px;
  background: var(--green);
}

.nav-btn.profit-shortcut {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ghost-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  color: var(--green-deep);
  background: var(--green-bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-weight: 900;
  text-decoration: none;
}

.welcome-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px 16px;
  background:
    linear-gradient(135deg, rgba(255, 253, 248, 0.96), rgba(230, 243, 232, 0.92)),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.dashboard-eye-btn {
  margin-left: auto;
  color: var(--green-deep);
  background: var(--green-bg);
}

.private-number {
  position: relative;
  color: transparent !important;
  user-select: none;
}

.private-number::after {
  content: "••••";
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: inherit;
  color: var(--ink);
  font-weight: 900;
}

td.private-number::after {
  justify-content: flex-end;
  padding-right: inherit;
}

.welcome-logo {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 54px;
  height: 54px;
  color: #11321f;
  background: linear-gradient(145deg, #eff8d6, #a8dbb1);
  border: 1px solid rgba(17, 50, 31, 0.14);
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(28, 53, 34, 0.16);
  font-size: 17px;
  font-weight: 950;
}

.small-logo {
  width: 46px;
  height: 46px;
  font-size: 14px;
}

.welcome-panel h1 {
  margin: 3px 0 4px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.15;
}

.welcome-panel p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.legend {
  display: grid;
  gap: 11px;
  margin-top: auto;
  margin-bottom: 6px;
  padding: 15px;
  color: #d9e7d8;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font-size: 12px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 9px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.green { background: var(--green); }
.yellow { background: #d89a14; }
.red { background: var(--red); }
.maroon { background: var(--maroon); }

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

.topbar,
.panel-head,
.filterbar,
menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar {
  min-height: 96px;
  margin-bottom: 22px;
  padding: 22px 24px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.menu-left-btn {
  flex: 0 0 auto;
}

.eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.topbar h2 {
  margin-top: 5px;
  color: var(--ink);
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.02;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  color: var(--green-deep);
  background: var(--green-bg);
  border: 1px solid #c3e1c8;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.logout-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
}

.power-btn {
  color: #b42318;
  background: #fff5f5;
  border-color: #fecaca;
  font-size: 18px;
  font-weight: 950;
}

.logout-control.open .power-btn,
.power-btn:hover {
  color: #ffffff;
  background: #b42318;
  border-color: #b42318;
}

.logout-confirm-btn {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 6;
  min-height: 38px;
  min-width: 92px;
  padding: 0 14px;
  color: #ffffff;
  background: #b42318;
  border: 1px solid #b42318;
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(180, 35, 24, 0.24);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.logout-confirm-btn:hover {
  background: #971b12;
}

.primary-btn,
.icon-btn,
.text-btn {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  color: #fff;
  background:
    linear-gradient(180deg, #2e8753, #1e6d3f);
  border-color: rgba(17, 77, 42, 0.42);
  box-shadow: 0 11px 22px rgba(25, 100, 57, 0.24);
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-btn:hover {
  background:
    linear-gradient(180deg, #34915a, #1c633a);
  box-shadow: 0 14px 28px rgba(25, 100, 57, 0.3);
  transform: translateY(-1px);
}

.icon-btn {
  width: 40px;
  padding: 0;
  color: var(--text);
  background: rgba(255, 253, 248, 0.86);
  border-color: var(--line);
  box-shadow: 0 8px 18px rgba(29, 42, 30, 0.08);
  font-size: 20px;
}

.text-btn {
  padding: 0 10px;
  color: var(--blue);
  font-weight: 800;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 15px;
  margin-bottom: 18px;
}

.business-card {
  position: relative;
  display: grid;
  gap: 9px;
  min-height: 178px;
  padding: 18px;
  overflow: hidden;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.business-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--green);
}

.business-card.blue::before { background: var(--blue); }
.business-card.yellow::before { background: var(--yellow); }

.business-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.business-card-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.business-card strong {
  font-size: 30px;
  line-height: 1.05;
}

.business-card small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.business-card-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.business-card-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.business-card-grid b {
  color: var(--ink);
  font-size: 12px;
  font-weight: 950;
  text-align: right;
}

.kpi {
  position: relative;
  min-height: 126px;
  overflow: hidden;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.93), rgba(255, 253, 248, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

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

.kpi:nth-child(2)::before { background: var(--yellow); }
.kpi:nth-child(3)::before { background: var(--blue); }
.kpi:nth-child(4)::before { background: var(--maroon); }

.kpi::after {
  content: "";
  position: absolute;
  right: -26px;
  bottom: -34px;
  width: 110px;
  height: 110px;
  border-radius: 8px;
  background: rgba(36, 115, 69, 0.08);
  transform: rotate(18deg);
}

.kpi:nth-child(2)::after { background: rgba(216, 154, 20, 0.1); }
.kpi:nth-child(3)::after { background: rgba(36, 97, 133, 0.1); }
.kpi:nth-child(4)::after { background: rgba(118, 25, 39, 0.09); }

.kpi span,
.kpi strong,
.kpi small {
  position: relative;
  z-index: 1;
}

.kpi span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  margin-top: 14px;
  color: var(--ink);
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.kpi small {
  display: block;
  margin-top: 11px;
  color: var(--faint);
}

.split,
.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.15fr) minmax(280px, 0.85fr);
  gap: 18px;
}

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

.panel {
  min-width: 0;
  padding: 17px;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.panel.wide {
  min-width: 0;
}

.panel h3 {
  color: var(--ink);
  font-size: 16px;
}

.panel-head p,
.month-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.month-panel {
  padding: 17px;
  margin-bottom: 16px;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.month-panel .panel-head label,
.panel-head label {
  min-width: 190px;
}

.month-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.ledger-total-card {
  width: min(360px, 100%);
  margin: 14px 0;
  padding: 14px 16px;
  border: 1px solid rgba(22, 54, 85, 0.12);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(22, 54, 85, 0.08);
}

.ledger-total-card span,
.ledger-total-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ledger-total-card strong {
  display: block;
  margin: 4px 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.1;
}

.ledger-total-card small {
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
}

.ageing-boxes {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.ageing-box {
  min-height: 104px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.ageing-box:hover,
.ageing-box.active {
  transform: translateY(-1px);
  border-color: rgba(43, 119, 71, 0.45);
  box-shadow: 0 14px 28px rgba(22, 45, 31, 0.13);
}

.ageing-box span,
.ageing-box small {
  display: block;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.ageing-box span {
  font-size: 11px;
}

.ageing-box strong {
  display: block;
  margin-top: 9px;
  font-size: 21px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ageing-box small {
  margin-top: 9px;
  font-size: 12px;
  text-transform: none;
}

.ageing-box.age-green { border-top: 4px solid var(--green); }
.ageing-box.age-yellow { border-top: 4px solid #d89a14; }
.ageing-box.age-red { border-top: 4px solid var(--red); }
.ageing-box.age-maroon { border-top: 4px solid var(--maroon); }

.terms-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 14px;
}

.terms-column {
  min-width: 0;
  padding: 15px;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.terms-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.terms-head h3 {
  margin: 0;
  font-size: 16px;
}

.terms-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.terms-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.term-card {
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.term-card strong {
  color: var(--ink);
  line-height: 1.25;
}

.term-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.term-money {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}

.term-money small {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.month-card {
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 249, 242, 0.96));
  border: 1px solid var(--line);
  border-radius: 8px;
}

.month-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.month-card strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.month-card small {
  display: block;
  margin-top: 8px;
  color: var(--faint);
}

.month-card.clickable-card {
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.month-card.clickable-card:hover {
  transform: translateY(-1px);
  border-color: rgba(43, 119, 71, 0.45);
  box-shadow: var(--shadow-sm);
}

.month-card.active-filter {
  border-color: rgba(12, 86, 55, 0.65);
  background: #eaf5ee;
  box-shadow: var(--shadow-sm);
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

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

#millsView table {
  min-width: 920px;
}

#expensesView table {
  min-width: 940px;
}

#emisView table,
#taxView table,
#investmentsView table,
#salesView table,
#importView table,
#receiptsView table {
  min-width: 940px;
}

#millsView > .split {
  grid-template-columns: 1fr;
}

#millsView .stack-form {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  align-items: end;
}

#millsView .stack-form .primary-btn {
  align-self: end;
}

#millsView th,
#millsView td {
  padding-inline: 9px;
}

#dashboardView .panel.wide table {
  min-width: 640px;
}

#dashboardView .panel.wide th,
#dashboardView .panel.wide td {
  padding-inline: 10px;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #59655a;
  background:
    linear-gradient(180deg, #f2f6ed, #e8efe3);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  color: #243025;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: #fbf7ed;
}

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

td strong {
  color: var(--ink);
}

.amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 750;
}

.debit-note-cell small {
  display: block;
  margin-top: 4px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  white-space: normal;
}

.payment-entry-cell {
  white-space: normal;
}

.payment-entry-list {
  display: grid;
  gap: 6px;
  min-width: 170px;
}

.payment-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  align-items: center;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.payment-entry span,
.payment-entry small {
  overflow-wrap: anywhere;
}

.payment-entry small {
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
}

.payment-entry button {
  grid-row: span 2;
  min-height: 30px;
  padding: 0 9px;
  color: var(--red);
  background: #ffffff;
  border: 1px solid #efbbb2;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

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

.gain-text {
  color: var(--green);
}

.loss-text {
  color: var(--red);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.pill.green {
  color: var(--green-deep);
  background: var(--green-bg);
  border-color: #c3e1c8;
}

.pill.yellow {
  color: var(--yellow);
  background: var(--yellow-bg);
  border-color: #ecd38d;
}

.pill.red {
  color: var(--red);
  background: var(--red-bg);
  border-color: #efbbb2;
}

.pill.maroon {
  color: var(--maroon);
  background: var(--maroon-bg);
  border-color: #e6a9b2;
}

.pill.gray {
  color: #5d675e;
  background: #edf0ed;
}

.pill.blue {
  color: var(--blue);
  background: var(--blue-bg);
  border-color: #bdd7e6;
}

.row-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.row-actions button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 5px 12px rgba(29, 42, 30, 0.06);
  font-size: 12px;
  font-weight: 800;
}

.row-actions button:hover {
  background: var(--surface-3);
}

.inline-term-edit,
.party-inline-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-term-edit input {
  width: 76px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-weight: 900;
}

.inline-term-edit button,
.compact-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.party-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  color: var(--green-deep);
  background: transparent;
  border: 0;
  text-align: left;
  font-weight: 900;
}

.party-toggle span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #ffffff;
  background: var(--green);
  border-radius: 999px;
  font-size: 15px;
  line-height: 1;
}

.party-due-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mini-danger {
  padding: 6px 10px;
  color: var(--danger);
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.mini-danger:hover {
  background: #ffe4e6;
}

.input-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.input-with-action .ghost-chip {
  min-height: 38px;
  white-space: nowrap;
}

.quotation-paper {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 22px;
  color: #111827;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.quotation-paper header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--green-deep);
}

.quotation-paper header strong {
  display: block;
  color: var(--green-deep);
  font-size: 20px;
  letter-spacing: 0;
}

.quotation-paper header span,
.quotation-paper small,
.quotation-paper footer {
  color: var(--muted);
}

.quotation-meta {
  display: grid;
  gap: 5px;
  min-width: 180px;
  text-align: right;
  font-weight: 800;
}

.quotation-to {
  display: grid;
  gap: 4px;
  margin: 16px 0;
  padding: 12px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quotation-to span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.quotation-paper table,
.quotation-history-card table {
  width: 100%;
  border-collapse: collapse;
}

.quotation-paper th,
.quotation-paper td,
.quotation-history-card th,
.quotation-history-card td {
  padding: 9px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.quotation-paper th,
.quotation-history-card th {
  background: var(--green-bg);
  color: var(--green-deep);
  font-size: 12px;
  text-transform: uppercase;
}

.quotation-paper footer {
  margin-top: 14px;
  font-size: 12px;
  font-weight: 800;
}

.quotation-history-list {
  display: grid;
  gap: 12px;
}

.quotation-history-card {
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quotation-history-card > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.quotation-history-card > div > div:first-child {
  display: grid;
  gap: 2px;
}

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

.party-bill-detail-row > td {
  padding: 0;
  background: #f3f7f0;
}

.party-bill-detail {
  padding: 12px;
}

.party-inline-edit {
  justify-content: space-between;
  padding: 10px;
  margin-bottom: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.party-inline-edit > div {
  display: grid;
  gap: 2px;
}

.party-inline-edit span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.party-inline-edit label {
  display: grid;
  gap: 4px;
  min-width: 120px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.party-inline-edit input {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 900;
}

.party-bill-detail table {
  min-width: 780px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.inline-bill-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.inline-bill-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.inline-bill-form input {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 10px;
}

.form-grid,
.filterbar {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.filterbar {
  grid-template-columns: minmax(220px, 1fr) 180px auto;
  padding: 13px;
  background: rgba(255, 253, 248, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

label,
.full-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  color: var(--text);
  background: #fffefa;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aebead;
}

textarea {
  resize: vertical;
}

.form-action {
  align-self: end;
}

.import-form {
  grid-template-columns: minmax(220px, 0.7fr) minmax(320px, 1.4fr) auto;
}

.mini-input {
  max-width: 96px;
  min-height: 34px;
  padding: 7px 9px;
}

.salary-name-input {
  width: min(260px, 100%);
  max-width: 260px;
}

.stack-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.stack-form .primary-btn {
  width: 100%;
}

.auto-apply-preview {
  padding: 11px 12px;
  color: var(--green-deep);
  background: #eef8f1;
  border: 1px solid #cfe8d6;
  border-radius: 8px;
  font-size: 13px;
}

.auto-apply-preview:empty {
  display: none;
}

.auto-apply-preview strong,
.auto-apply-preview small {
  display: block;
}

.auto-apply-preview small {
  margin-top: 4px;
  color: var(--muted);
}

.receipt-preview-lines {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #cfe8d6;
}

.receipt-preview-lines span {
  display: block;
  color: var(--text);
  font-weight: 800;
}

.receipt-adjustment span {
  display: block;
  white-space: nowrap;
}

.mill-form {
  grid-template-columns: 2fr 150px 1fr 1fr auto;
}

#expensesView .stack-form {
  gap: 11px;
}

.compact-report {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

#expensesView.entry-only .split {
  grid-template-columns: minmax(280px, 520px);
}

.alert-list,
.followup-list,
.report-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.alert-item,
.followup-item,
.report-item {
  position: relative;
  padding: 13px 13px 13px 15px;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 7px 18px rgba(29, 42, 30, 0.05);
}

.alert-item::before,
.followup-item::before,
.report-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 999px;
  background: var(--green);
}

.report-item::before {
  background: var(--blue);
}

.alert-item strong,
.followup-item strong,
.report-item strong {
  display: block;
  color: var(--ink);
}

.alert-item span,
.followup-item span,
.report-item span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.4;
}

.alert-item.urgent {
  border-color: #e9b7be;
  background:
    linear-gradient(180deg, #fff8f7, var(--maroon-bg));
}

.alert-item.urgent::before {
  background: var(--maroon);
}

dialog {
  width: min(720px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 28px 90px rgba(8, 17, 10, 0.34);
}

dialog::backdrop {
  background: rgba(10, 17, 12, 0.48);
  backdrop-filter: blur(5px);
}

.app-confirm {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(8, 16, 10, 0.42);
  backdrop-filter: blur(3px);
}

.app-confirm.hidden {
  display: none;
}

.app-confirm-card {
  width: min(330px, 100%);
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(8, 17, 10, 0.22);
}

.app-confirm-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.app-confirm-head h3,
.app-confirm-card p {
  margin: 0;
}

.app-confirm-head .small-logo {
  width: 34px;
  height: 34px;
}

.app-confirm-head .eyebrow {
  margin-bottom: 1px;
  font-size: 0.58rem;
}

.app-confirm-head h3 {
  font-size: 1rem;
  line-height: 1.15;
}

.app-confirm-card p {
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.35;
}

.app-confirm-input {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.app-confirm-input input {
  min-height: 34px;
  padding: 7px 9px;
}

.app-confirm-input.hidden {
  display: none;
}

.app-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 12px;
}

.app-confirm-actions button {
  min-height: 32px;
  padding: 7px 12px;
  font-size: 0.78rem;
}

.dialog-card {
  padding: 19px;
  background:
    linear-gradient(180deg, #fffefa, #f8fbf4);
}

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

.dialog-card menu {
  margin: 16px 0 0;
  padding: 0;
  justify-content: flex-end;
}

.context-line {
  margin: 8px 0 14px;
  color: var(--muted);
}

.checkbox-label {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  color: var(--text);
}

.checkbox-label input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--green);
}

.empty {
  padding: 18px;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .login-screen {
    grid-template-columns: 1fr;
    align-content: center;
  }

  .login-welcome {
    max-width: none;
  }

  .login-welcome h1 {
    font-size: 34px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    height: 100vh;
    gap: 22px;
  }

  .nav {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  .legend {
    grid-template-columns: repeat(4, max-content);
    overflow-x: auto;
  }

  .kpi-grid,
  .report-grid,
  .month-summary,
  .ageing-boxes,
  .terms-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

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

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

@media (max-width: 720px) {
  .login-screen {
    padding: 18px;
  }

  .login-welcome h1 {
    font-size: 28px;
  }

  .login-welcome p:last-child {
    font-size: 14px;
  }

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

  .dashboard-eye-btn {
    margin-left: 0;
  }

  .main {
    padding: 16px 12px;
  }

  .topbar,
  .toolbar,
  .filterbar,
  menu {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding: 18px;
  }

  .toolbar,
  .filterbar {
    width: 100%;
  }

  .primary-btn,
  .text-btn {
    width: 100%;
  }

  .icon-btn {
    align-self: flex-start;
  }

  .kpi-grid,
  .report-grid,
  .month-summary,
  .form-grid,
  .dialog-card .compact {
    grid-template-columns: 1fr;
  }

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

  #millsView .stack-form {
    grid-template-columns: 1fr;
  }

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

/* Professional banking-style visual layer */
:root {
  --bg: #f3f6fb;
  --bg-2: #eef3f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef4f9;
  --text: #172033;
  --ink: #0f172a;
  --muted: #64748b;
  --faint: #8793a6;
  --line: #d9e2ec;
  --line-strong: #bdc9d8;
  --green: #087443;
  --green-deep: #065f46;
  --green-bg: #e7f7ef;
  --blue: #165d8f;
  --blue-bg: #e8f2fb;
  --yellow: #a56b05;
  --yellow-bg: #fff4d6;
  --red: #b42318;
  --red-bg: #fee8e7;
  --maroon: #861b2c;
  --maroon-bg: #fae1e6;
  --shadow-sm: 0 10px 28px rgba(16, 24, 40, 0.07);
  --shadow-md: 0 20px 52px rgba(16, 24, 40, 0.12);
  --focus: 0 0 0 4px rgba(22, 93, 143, 0.18);
}

body {
  background: linear-gradient(180deg, #f7f9fc 0%, #eef3f8 100%);
}

.login-screen {
  grid-template-columns: minmax(320px, 430px);
  justify-content: center;
  justify-items: center;
  gap: 16px;
  background: #ffffff;
}

.login-welcome .eyebrow,
.login-welcome p:last-child {
  color: var(--muted);
}

.login-welcome {
  display: grid;
  justify-items: center;
  max-width: 430px;
  color: var(--ink);
  text-align: center;
}

.login-welcome h1 {
  color: var(--ink);
  font-size: 30px;
}

.login-welcome p:last-child {
  font-size: 14px;
}

.login-logo {
  margin-bottom: 14px;
}

.login-card {
  box-shadow: 0 22px 64px rgba(16, 24, 40, 0.12);
}

.login-card,
.topbar,
.panel,
.month-panel,
.terms-column,
.welcome-panel,
.business-card,
.kpi,
.month-card,
.ageing-box,
.filterbar,
.dialog-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.sidebar {
  color: #eaf4ff;
  background:
    linear-gradient(180deg, #123f6d 0%, #0b3158 58%, #08243f 100%),
    #0b3158;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 20px 0 46px rgba(8, 36, 63, 0.22);
}

.brand {
  padding: 10px 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark,
.module-quick-menu a {
  color: #0b3158;
  background: #ffffff;
}

.brand h1 {
  font-size: 17px;
  letter-spacing: 0;
}

.brand p,
.legend {
  color: rgba(234, 244, 255, 0.78);
}

.module-quick-menu,
.legend {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
}

.menu-group summary {
  min-height: 40px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
}

.menu-group[open] summary {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.18);
}

.nav-btn,
.module-nav-link {
  color: rgba(234, 244, 255, 0.85);
  font-weight: 800;
}

.nav-btn:hover,
.module-nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.11);
}

.nav-btn.active,
.nav-home {
  color: #0b3158;
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.2);
}

.nav-btn.active::before {
  background: #0ea5a3;
}

.main {
  padding: 24px;
}

.topbar {
  min-height: 82px;
  margin-bottom: 20px;
  padding: 18px 22px;
}

.topbar h2 {
  font-size: clamp(24px, 2.2vw, 34px);
  letter-spacing: 0;
}

.eyebrow {
  color: var(--blue);
}

.welcome-panel {
  background: #ffffff;
}

.welcome-logo {
  color: #ffffff;
  background: linear-gradient(145deg, #165d8f, #0ea5a3);
  border-color: rgba(255, 255, 255, 0.2);
}

.primary-btn {
  background: linear-gradient(180deg, #17679c, #104d79);
  border-color: #104d79;
  box-shadow: 0 10px 22px rgba(16, 77, 121, 0.22);
}

.primary-btn:hover {
  background: linear-gradient(180deg, #1d74ad, #0f466e);
  box-shadow: 0 13px 26px rgba(16, 77, 121, 0.28);
}

.ghost-chip,
.user-pill,
.dashboard-eye-btn {
  color: #104d79;
  background: #e9f4fb;
  border-color: #c7dceb;
}

.icon-btn,
.text-btn {
  color: #104d79;
}

input,
select,
textarea {
  background: #ffffff;
  border: 1px solid #cfd9e6;
  border-radius: 8px;
  color: var(--ink);
}

label {
  color: #526176;
  font-weight: 850;
}

.filterbar {
  padding: 14px;
  margin-bottom: 14px;
}

.business-card,
.kpi,
.month-card,
.ageing-box {
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.business-card:hover,
.kpi:hover,
.month-card.clickable-card:hover,
.ageing-box:hover,
.ageing-box.active {
  transform: translateY(-2px);
  border-color: #b8c7d8;
  box-shadow: 0 16px 34px rgba(16, 24, 40, 0.11);
}

.business-card::before,
.kpi::before {
  height: 4px;
  background: linear-gradient(90deg, #165d8f, #0ea5a3);
}

.business-card.yellow::before,
.kpi:nth-child(2)::before {
  background: linear-gradient(90deg, #a56b05, #d89a14);
}

.business-card.blue::before,
.kpi:nth-child(3)::before {
  background: linear-gradient(90deg, #165d8f, #4f8db7);
}

.panel h3,
.terms-head h3 {
  color: #172033;
  font-size: 15px;
  letter-spacing: 0;
}

.panel-head {
  padding-bottom: 10px;
  border-bottom: 1px solid #eef2f6;
}

.month-summary,
.ageing-boxes,
.kpi-grid {
  gap: 14px;
}

.table-wrap {
  background: #ffffff;
  border: 1px solid #d9e2ec;
  box-shadow: none;
}

th {
  color: #526176;
  background: #f5f8fb;
  border-bottom: 1px solid #d9e2ec;
  font-size: 11px;
  letter-spacing: 0;
}

td {
  color: #1f2937;
  border-bottom: 1px solid #edf1f5;
}

tbody tr:hover {
  background: #f7fbff;
}

.amount,
td strong,
.business-card strong,
.kpi strong,
.month-card strong,
.ageing-box strong {
  color: #111827;
}

.pill {
  border-radius: 999px;
}

.pill.green,
.green {
  background: #e7f7ef;
  color: #067647;
}

.pill.blue,
.blue {
  background: #e8f2fb;
  color: #145886;
}

.pill.yellow,
.yellow {
  background: #fff4d6;
  color: #9a6700;
}

.pill.red,
.red {
  background: #fee8e7;
  color: #b42318;
}

.pill.maroon,
.maroon {
  background: #fae1e6;
  color: #861b2c;
}

.row-actions button,
.mini-danger,
.payment-entry button {
  border-radius: 8px;
  font-weight: 850;
}

.app-confirm-card,
.dialog-card {
  border-radius: 8px;
}

@media (max-width: 720px) {
  .main {
    padding: 14px 10px;
  }

  .topbar,
  .panel,
  .month-panel,
  .filterbar {
    padding: 14px;
  }
}

.brand-logo,
.app-logo {
  display: block;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.brand-logo {
  width: 52px;
  height: 52px;
  padding: 5px;
  flex: 0 0 auto;
}

.app-logo {
  width: 72px;
  height: 72px;
  padding: 6px;
}

.login-logo {
  margin-bottom: 14px;
}

.small-logo {
  width: 54px;
  height: 54px;
  padding: 5px;
}

.login-card .brand-logo {
  width: 46px;
  height: 46px;
}

.module-quick-menu {
  gap: 6px;
  padding: 8px 0 12px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
}

.module-quick-menu a,
.menu-group summary,
.nav-btn,
.module-nav-link {
  min-height: 38px;
  border-radius: 7px;
  box-shadow: none;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.module-quick-menu a {
  padding: 8px 10px;
  color: rgba(234, 244, 255, 0.88);
  background: transparent;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 800;
}

.module-quick-menu a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.menu-group {
  gap: 4px;
}

.menu-group summary {
  padding: 8px 10px;
  color: rgba(234, 244, 255, 0.8);
  background: transparent;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.menu-group[open] summary {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.menu-group .nav-btn,
.menu-group .module-nav-link {
  margin-left: 0;
  width: 100%;
}

.nav-btn,
.module-nav-link {
  padding: 8px 10px 8px 14px;
  color: rgba(234, 244, 255, 0.76);
  background: transparent;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 700;
}

.nav-btn.profit-shortcut {
  color: rgba(234, 244, 255, 0.76);
  background: transparent;
  border-color: transparent;
}

.nav-btn:hover,
.module-nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.08);
}

.nav-btn.active,
.nav-home {
  color: #0b3158;
  background: #fff;
  border-color: #fff;
  box-shadow: none;
}

.nav-btn.active::before {
  width: 3px;
  background: #2563eb;
  border-radius: 999px;
}

.inline-script {
  width: min(360px, 100%);
  min-height: 72px;
  padding: 8px;
  border: 1px solid #dbe4ef;
  background: #f8fbff;
  color: #1f2937;
  font: inherit;
  font-size: 12px;
  resize: vertical;
}

.stacked-actions {
  align-items: stretch;
  min-width: 150px;
}

.mini-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0b3158;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 720px) {
  .topbar {
    gap: 12px;
  }

  .topbar-title {
    width: 100%;
    align-items: flex-start;
  }

  .topbar .toolbar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-left: 0;
  }

  .topbar .toolbar .ghost-chip,
  .topbar .toolbar .primary-btn,
  .topbar .toolbar #resetDataBtn {
    display: none;
  }

  .topbar .toolbar .user-pill {
    max-width: calc(100% - 56px);
  }

  .topbar .toolbar .logout-control {
    margin-left: auto;
  }

  .topbar .toolbar .icon-btn {
    align-self: center;
  }
}

button,
.primary-btn,
.ghost-chip,
.nav-btn,
.module-nav-link,
.icon-btn,
.row-actions button,
.payment-entry button,
.app-confirm-actions button,
a.primary-btn {
  border-radius: 2px !important;
}

/* Corporate visual refresh */
:root {
  --bg: #f4f6fa;
  --bg-2: #eef2f7;
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --surface-3: #f7f9fc;
  --text: #1d2939;
  --ink: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #d9e1ea;
  --line-strong: #c3ceda;
  --green: #0f5d9b;
  --green-deep: #0b3158;
  --green-bg: #eaf3fb;
  --blue: #1f6fb2;
  --blue-bg: #eaf3fb;
  --yellow: #9a6b12;
  --yellow-bg: #fff4d6;
  --red: #b42318;
  --red-bg: #fff1f0;
  --maroon: #7f1d1d;
  --maroon-bg: #fef2f2;
  --shadow-sm: 0 8px 22px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 18px 44px rgba(15, 23, 42, 0.1);
  --focus: 0 0 0 3px rgba(31, 111, 178, 0.18);
}

body {
  background: var(--bg);
  font-family: "Manrope", Inter, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
}

.login-screen {
  grid-template-columns: minmax(320px, 620px) minmax(320px, 430px);
  background: #ffffff;
}

.login-welcome {
  max-width: 620px;
  padding: 28px;
  color: var(--ink);
  background: transparent;
  border: 0;
  box-shadow: none;
}

.login-welcome .eyebrow,
.login-welcome p:last-child {
  color: var(--muted);
}

.login-welcome h1 {
  color: var(--ink);
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 900;
}

.login-card {
  border-color: var(--line);
  box-shadow: var(--shadow-md);
}

.sidebar {
  color: #edf6ff;
  background: #0b3158;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 18px 0 44px rgba(8, 25, 47, 0.22);
}

.brand {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand h1 {
  font-size: 17px;
  font-weight: 900;
}

.brand p {
  color: rgba(237, 246, 255, 0.68);
}

.menu-group summary {
  color: rgba(237, 246, 255, 0.76);
  letter-spacing: 0.04em;
}

.menu-group[open] summary {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.075);
}

.nav-btn,
.module-nav-link {
  color: rgba(237, 246, 255, 0.76);
}

.nav-btn:hover,
.module-nav-link:hover {
  background: rgba(255, 255, 255, 0.09);
}

.nav-btn.active,
.nav-home {
  color: #0b3158;
  background: #ffffff;
  border-color: #ffffff;
  font-weight: 900;
}

.main {
  padding: 24px;
}

.topbar,
.panel,
.welcome-panel,
.login-card,
.ledger-total-card,
.stat-card,
.kpi-card,
.summary-card,
.form-grid,
.table-wrap,
.month-summary,
.alert-list,
.terms-card {
  border-color: var(--line) !important;
  box-shadow: var(--shadow-sm);
}

.topbar {
  min-height: 84px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
}

.topbar h2 {
  font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 900;
}

.eyebrow {
  color: #0f5d9b;
  letter-spacing: 0.08em;
}

.panel,
.form-grid,
.table-wrap,
.welcome-panel,
.month-summary,
.alert-list,
.ledger-total-card,
.terms-card {
  background: #ffffff;
}

.panel {
  border: 1px solid var(--line);
}

.panel-head h3,
.panel h3,
.welcome-panel h1 {
  color: var(--ink);
  font-weight: 900;
}

input,
select,
textarea {
  color: var(--ink);
  background: #ffffff;
  border-color: #cfd8e3;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #1f6fb2;
}

.primary-btn,
button.primary-btn,
a.primary-btn {
  color: #ffffff;
  background: #0b3158;
  border: 1px solid #0b3158;
  box-shadow: 0 8px 18px rgba(11, 49, 88, 0.16);
}

.primary-btn:hover,
button.primary-btn:hover,
a.primary-btn:hover {
  background: #0f5d9b;
  border-color: #0f5d9b;
}

.ghost-chip,
.text-btn,
.icon-btn,
.mini-link {
  color: #0b3158;
  background: #f8fafc;
  border: 1px solid #cfd8e3;
}

.ghost-chip:hover,
.text-btn:hover,
.icon-btn:hover,
.mini-link:hover {
  background: #eaf3fb;
  border-color: #a8c7de;
}

table {
  border-color: var(--line);
}

thead th {
  color: #334155;
  background: #eef3f8;
  border-bottom: 1px solid #cfd8e3;
  font-size: 11px;
  letter-spacing: 0.06em;
}

tbody td {
  border-bottom: 1px solid #e7ecf2;
}

tbody tr:hover {
  background: #f8fbff;
}

/* Keep page content visible while the slide-out menu is open. */
.menu-backdrop,
.app-shell:not(.nav-collapsed) .menu-backdrop {
  display: none !important;
  background: transparent !important;
  pointer-events: none !important;
}

.kpi-card,
.stat-card,
.summary-card {
  background: #ffffff;
  border: 1px solid var(--line);
}

.user-pill {
  color: #0b3158;
  background: #eef6ff;
  border-color: #bfd8ec;
}

.logout-confirm-btn {
  box-shadow: var(--shadow-sm);
}

.app-confirm-card,
.dialog-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}

@media (max-width: 860px) {
  .login-screen {
    grid-template-columns: 1fr;
    align-content: start;
    padding: 18px;
  }

  .login-welcome {
    padding: 20px;
  }

  .main {
    padding: 14px;
  }
}
