:root {
  --ink: #101816;
  --muted: #66726f;
  --line: #d7dedb;
  --paper: #f3f6f2;
  --surface: #ffffff;
  --panel: rgba(255, 255, 255, 0.88);
  --sidebar: #111b19;
  --blue: #285d8f;
  --green: #247a57;
  --amber: #b37a24;
  --red: #b64d48;
  --violet: #5a5f93;
  --shadow: 0 22px 55px rgba(16, 24, 22, 0.1);
  --soft-shadow: 0 12px 28px rgba(16, 24, 22, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #eef3ee 0%, #f8faf6 42%, #f2f5f1 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #e9eee7;
}

.auth-card {
  width: min(100%, 460px);
  display: grid;
  gap: 22px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-mode {
  display: grid;
  gap: 16px;
}

.auth-alert {
  padding: 12px 14px;
  border: 1px solid #e0b16c;
  border-radius: 8px;
  color: #5f3a08;
  background: #fff6e7;
  font-size: 14px;
  line-height: 1.4;
}

.auth-mode h1 {
  font-size: 25px;
}

.brand-lockup.dark {
  color: var(--ink);
}

.brand-lockup.dark span {
  color: var(--muted);
}

.qr-box {
  display: grid;
  place-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.qr-box img {
  width: min(100%, 236px);
  aspect-ratio: 1;
  display: block;
}

.secret-box {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

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

.secret-box strong {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  color: #eef5eb;
  background:
    linear-gradient(180deg, rgba(39, 121, 86, 0.22), rgba(40, 93, 143, 0.08) 34%, rgba(17, 27, 25, 0) 64%),
    var(--sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #e7f0df;
  color: #15311f;
  font-size: 16px;
  font-weight: 800;
}

.auth-card .brand-mark {
  width: 34px;
  height: 34px;
  font-size: 15px;
}

.brand-lockup strong,
.brand-lockup span {
  display: block;
}

.brand-lockup span,
.bank-status span {
  color: rgba(238, 245, 235, 0.7);
  font-size: 13px;
}

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

.side-nav a {
  color: rgba(238, 245, 235, 0.8);
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
  font-weight: 750;
}

.side-nav a.active,
.side-nav a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 3px 0 0 #72d6a7;
}

.bank-status {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
}

.status-dot.connected {
  background: #68d391;
}

.workspace {
  display: grid;
  gap: 20px;
  align-content: start;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 4px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  font-size: 17px;
  line-height: 1.2;
}

p,
.subtle {
  color: var(--muted);
  font-size: 13px;
}

.toolbar,
.inline-tools,
.bank-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar {
  padding: 8px;
  border: 1px solid rgba(215, 222, 219, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--soft-shadow);
}

.field {
  display: grid;
  gap: 6px;
}

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

.field input,
.field select,
.search,
.select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 8px 10px;
}

.field.compact input {
  width: 148px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 13px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: linear-gradient(135deg, #247a57, #1f6a8d);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(36, 122, 87, 0.22);
}

.button.secondary {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
}

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

.button.full {
  width: 100%;
}

.page-section {
  display: none;
  gap: 20px;
}

.page-section.active {
  display: grid;
}

.page-hero {
  min-height: 178px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, auto);
  gap: 20px;
  align-items: end;
  padding: 24px;
  border: 1px solid rgba(215, 222, 219, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(238, 246, 241, 0.82)),
    linear-gradient(90deg, rgba(40, 93, 143, 0.16), rgba(179, 122, 36, 0.12));
  box-shadow: var(--shadow);
}

.page-hero.compact {
  min-height: 152px;
}

.page-hero h2 {
  max-width: 740px;
  margin-top: 10px;
  font-size: 28px;
  line-height: 1.08;
}

.page-hero p {
  max-width: 720px;
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.45;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(36, 122, 87, 0.26);
  border-radius: 999px;
  color: #1f6a4d;
  background: rgba(225, 241, 231, 0.86);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.hero-stats {
  display: grid;
  gap: 8px;
  justify-items: end;
  padding: 16px;
  border: 1px solid rgba(16, 24, 22, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

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

.hero-stats strong {
  font-size: 30px;
  line-height: 1;
}

.command-landing {
  min-height: 360px;
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.2fr);
  align-items: stretch;
  overflow: hidden;
  color: #eefaf3;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 78% 18%, rgba(78, 178, 216, 0.26), transparent 26%),
    linear-gradient(135deg, #0b1513 0%, #12251e 42%, #17253a 100%);
  background-size: 42px 42px, 42px 42px, auto, auto;
}

.command-copy {
  display: grid;
  align-content: end;
  gap: 0;
  position: relative;
  z-index: 1;
}

.command-landing h2 {
  color: #ffffff;
  font-size: 34px;
}

.command-landing p {
  color: rgba(238, 250, 243, 0.72);
}

.hero-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.mode-chip {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 6px 11px;
  color: rgba(238, 250, 243, 0.76);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.mode-chip.active,
.mode-chip:hover {
  color: #081512;
  background: #8be7b7;
  box-shadow: 0 0 22px rgba(139, 231, 183, 0.28);
}

.command-visual {
  min-height: 312px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 22px 46px rgba(0, 0, 0, 0.18);
}

.visual-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.visual-header span,
.visual-header em {
  display: block;
  color: rgba(238, 250, 243, 0.7);
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
  text-transform: uppercase;
}

.visual-header strong {
  display: block;
  margin-top: 5px;
  color: #ffffff;
  font-size: 30px;
  line-height: 1;
}

.visual-header em {
  min-width: 70px;
  padding: 7px 9px;
  border-radius: 999px;
  color: #081512;
  background: #8be7b7;
  text-align: center;
}

.visual-header em.negative {
  color: #ffffff;
  background: #c75d5a;
}

.command-chart {
  min-height: 220px;
  display: grid;
  grid-template-columns: repeat(8, minmax(44px, 1fr));
  align-items: end;
  gap: 12px;
}

.matrix-column {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(28px, 1fr) auto;
  gap: 8px;
  align-items: end;
  border: 0;
  background: transparent;
  color: rgba(238, 250, 243, 0.78);
  cursor: pointer;
  padding: 0;
}

.matrix-column i {
  display: block;
  width: 100%;
  height: var(--height);
  min-height: 12px;
  border: 1px solid rgba(139, 231, 183, 0.42);
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, rgba(139, 231, 183, 0.95), rgba(37, 124, 88, 0.54));
  box-shadow: 0 0 24px rgba(139, 231, 183, 0.2);
}

.matrix-column.negative i {
  border-color: rgba(224, 113, 104, 0.46);
  background: linear-gradient(180deg, rgba(224, 113, 104, 0.95), rgba(122, 57, 54, 0.6));
  box-shadow: 0 0 24px rgba(224, 113, 104, 0.22);
}

.matrix-column.active i,
.matrix-column:hover i {
  transform: translateY(-4px);
  box-shadow: 0 0 34px rgba(139, 231, 183, 0.38);
}

.matrix-value {
  opacity: 0;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.matrix-column.active .matrix-value,
.matrix-column:hover .matrix-value {
  opacity: 1;
}

.matrix-column em {
  color: rgba(238, 250, 243, 0.66);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.command-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.85fr) minmax(300px, 0.85fr);
  gap: 18px;
}

.insight-stream {
  display: grid;
  gap: 10px;
}

.insight-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 1px solid rgba(215, 222, 219, 0.86);
  border-radius: 8px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.insight-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.insight-row strong {
  font-size: 14px;
}

.insight-row.good {
  box-shadow: inset 3px 0 0 var(--green);
}

.insight-row.watch {
  box-shadow: inset 3px 0 0 var(--amber);
}

.insight-row.danger {
  box-shadow: inset 3px 0 0 var(--red);
}

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

.radar-ring {
  min-height: 116px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  border-radius: 8px;
  background:
    radial-gradient(circle at center, #ffffff 0 48%, transparent 49%),
    conic-gradient(var(--green) var(--score), #e5ebe7 0);
}

.radar-ring strong,
.radar-ring span {
  position: relative;
  z-index: 1;
  display: block;
}

.radar-ring strong {
  font-size: 23px;
}

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

.category-orbit {
  min-height: 244px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(215, 222, 219, 0.8);
  border-radius: 8px;
  background:
    linear-gradient(rgba(16, 24, 22, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 24, 22, 0.04) 1px, transparent 1px),
    rgba(255, 255, 255, 0.58);
  background-size: 28px 28px;
}

.category-orbit::before,
.category-orbit::after {
  content: "";
  position: absolute;
  inset: 28px;
  border: 1px dashed rgba(40, 93, 143, 0.22);
  border-radius: 50%;
}

.category-orbit::after {
  inset: 62px;
  border-color: rgba(36, 122, 87, 0.24);
}

.orbit-node {
  position: absolute;
  z-index: 1;
  width: calc(118px * var(--scale));
  min-height: calc(62px * var(--scale));
  border: 1px solid rgba(40, 93, 143, 0.18);
  border-radius: 8px;
  padding: 9px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--soft-shadow);
  cursor: pointer;
}

.orbit-node strong,
.orbit-node span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orbit-node strong {
  font-size: 12px;
}

.orbit-node span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.orbit-0 {
  transform: translate(-6%, -86%);
}

.orbit-1 {
  transform: translate(68%, -16%);
}

.orbit-2 {
  transform: translate(-78%, 12%);
}

.orbit-3 {
  transform: translate(28%, 74%);
}

.orbit-4 {
  transform: translate(-50%, 78%);
}

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

.metric {
  min-height: 112px;
  display: grid;
  align-content: space-between;
  padding: 18px;
  border: 1px solid rgba(215, 222, 219, 0.84);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--soft-shadow);
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  font-size: 28px;
  line-height: 1;
}

.metric small,
.report-kpi small {
  color: var(--muted);
  font-size: 12px;
}

.accent-green {
  border-top: 3px solid var(--green);
}

.accent-red {
  border-top: 3px solid var(--red);
}

.accent-blue {
  border-top: 3px solid var(--blue);
}

.accent-amber {
  border-top: 3px solid var(--amber);
}

.overview-grid,
.content-grid,
.transaction-layout,
.invoice-layout,
.banking-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.8fr);
  gap: 20px;
}

.panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(215, 222, 219, 0.86);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(12px);
}

.panel.full-width {
  box-shadow: var(--soft-shadow);
}

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

.priority-list,
.signal-grid,
.summary-strip {
  display: grid;
  gap: 10px;
}

.priority-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(215, 222, 219, 0.86);
  border-radius: 8px;
  background: rgba(248, 250, 247, 0.82);
}

.priority-item strong,
.priority-item span,
.priority-item em {
  display: block;
}

.priority-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.priority-item em {
  min-width: 72px;
  border-radius: 999px;
  padding: 5px 8px;
  color: #1e5f47;
  background: #e1f1e7;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
  text-align: center;
}

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

.signal-card,
.summary-pill,
.report-kpi {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(215, 222, 219, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.signal-card span,
.summary-pill span,
.report-kpi span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.signal-card strong,
.summary-pill strong {
  font-size: 18px;
}

.summary-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

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

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

.report-kpi strong {
  font-size: 24px;
  line-height: 1;
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 18px;
}

.premium-report {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
}

.chart-surface {
  min-height: 280px;
  border: 1px solid rgba(215, 222, 219, 0.86);
  border-radius: 8px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(248, 250, 247, 0.94), rgba(239, 246, 242, 0.72));
}

.bar-chart {
  height: 240px;
  display: flex;
  align-items: end;
  gap: 14px;
}

.bar-item {
  flex: 1;
  min-width: 42px;
  display: grid;
  gap: 8px;
  align-items: end;
  text-align: center;
}

.bar {
  min-height: 6px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #2e79ad, #285d8f);
  box-shadow: 0 10px 18px rgba(40, 93, 143, 0.16);
}

.bar.negative {
  background: linear-gradient(180deg, #cb6962, var(--red));
}

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

.statement-table,
.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: #5c6965;
  font-size: 12px;
  text-transform: uppercase;
  background: rgba(241, 246, 242, 0.74);
}

tbody tr:hover {
  background: rgba(225, 241, 231, 0.35);
}

td.amount,
th.amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.category-select {
  width: 100%;
  min-width: 140px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  background: #ffffff;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
  background: #edf1ec;
  color: var(--muted);
}

.badge.reviewed {
  background: #e1f1e7;
  color: var(--green);
}

.status-badge {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
  text-transform: capitalize;
  background: #edf1ec;
  color: var(--muted);
}

.status-badge.sent {
  background: #e7f1ff;
  color: #285d8f;
}

.status-badge.paid {
  background: #e1f1e7;
  color: var(--green);
}

.status-badge.void {
  background: #f7e6e4;
  color: var(--red);
}

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

.invoice-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(215, 222, 219, 0.9);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(244, 249, 246, 0.86)),
    radial-gradient(circle at 100% 0%, rgba(113, 200, 231, 0.14), transparent 38%);
}

.invoice-card-main {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.invoice-card h3 {
  margin: 4px 0;
  font-size: 20px;
}

.invoice-card p,
.invoice-number {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.invoice-number {
  font-weight: 900;
  text-transform: uppercase;
}

.invoice-amount {
  display: grid;
  gap: 8px;
  justify-items: end;
  white-space: nowrap;
}

.invoice-amount strong {
  font-size: 24px;
}

.invoice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.invoice-share {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(36, 122, 87, 0.22);
  border-radius: 8px;
  background: rgba(225, 241, 231, 0.72);
}

.invoice-share span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
}

.invoice-studio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 24px;
}

.invoice-workbench {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  margin-bottom: 24px;
}

.invoice-studio-grid .panel,
.invoice-workbench .panel {
  padding: 22px;
}

.invoice-brand-panel {
  grid-column: 1 / -1;
}

.invoice-brand-panel {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(239, 248, 244, 0.88)),
    radial-gradient(circle at 100% 0%, rgba(113, 200, 231, 0.16), transparent 34%);
}

.brand-uploader {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.invoice-logo-preview,
.invoice-preview-logo {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(36, 122, 87, 0.2);
  border-radius: 8px;
  background: #e8f2e3;
  color: #153b2f;
  font-weight: 950;
}

.invoice-logo-preview {
  width: 112px;
  height: 112px;
  font-size: 28px;
}

.invoice-logo-preview img,
.invoice-preview-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.compact-stack,
.mini-list,
.template-options,
.invoice-line-items {
  display: grid;
  gap: 14px;
}

.invoice-brand-panel .stacked-form {
  gap: 16px;
}

.invoice-brand-panel > form {
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 0.8fr);
  align-items: start;
}

.invoice-brand-panel .brand-uploader,
.invoice-brand-panel .field:has(textarea),
.invoice-brand-panel button {
  grid-column: 1 / -1;
}

.mini-list {
  margin-top: 14px;
}

.mini-list-item {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid rgba(215, 222, 219, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

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

.template-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.template-option {
  display: grid;
  gap: 6px;
  min-height: 118px;
  padding: 16px;
  border: 1px solid rgba(215, 222, 219, 0.9);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
  cursor: pointer;
}

.template-option span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.template-option.active {
  border-color: rgba(36, 122, 87, 0.42);
  background: linear-gradient(135deg, rgba(225, 241, 231, 0.94), rgba(239, 248, 244, 0.9));
  box-shadow: 0 14px 26px rgba(36, 122, 87, 0.12);
}

.invoice-line-row {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 90px 130px 112px auto;
  gap: 14px;
  align-items: end;
  padding: 16px;
  border: 1px solid rgba(215, 222, 219, 0.86);
  border-radius: 8px;
  background: rgba(248, 250, 247, 0.84);
}

.field.compact-number input {
  min-width: 0;
}

.check-field {
  align-content: end;
  grid-template-columns: auto 1fr;
  min-height: 44px;
}

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

.icon-line-remove {
  min-height: 44px;
  white-space: nowrap;
}

.invoice-preview-panel {
  align-self: start;
}

.invoice-preview {
  --invoice-accent: #247a57;
  display: grid;
  gap: 16px;
  min-height: 420px;
  padding: 28px;
  border: 1px solid rgba(215, 222, 219, 0.92);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 248, 0.96)),
    linear-gradient(90deg, var(--invoice-accent), var(--invoice-accent));
  box-shadow: 0 24px 54px rgba(16, 24, 22, 0.13);
}

.invoice-preview.template-studio {
  background:
    linear-gradient(90deg, var(--invoice-accent) 0 8px, transparent 8px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 248, 0.96));
}

.invoice-preview.template-classic {
  background: #ffffff;
}

.invoice-preview-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding-bottom: 16px;
  border-bottom: 2px solid color-mix(in srgb, var(--invoice-accent) 45%, #dbe4df);
}

.invoice-preview-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.invoice-preview-logo {
  width: 58px;
  height: 58px;
  color: var(--invoice-accent);
  background: color-mix(in srgb, var(--invoice-accent) 12%, #ffffff);
}

.invoice-preview-brand strong,
.invoice-preview-brand span,
.invoice-preview-total span,
.invoice-preview-meta span,
.invoice-preview-meta strong,
.invoice-preview-meta em {
  display: block;
}

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

.invoice-preview-brand span,
.invoice-preview-total span,
.invoice-preview-meta span,
.invoice-preview-meta em,
.invoice-preview p {
  color: var(--muted);
  font-size: 12px;
}

.invoice-preview-total {
  display: grid;
  justify-items: end;
  gap: 5px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--invoice-accent);
}

.invoice-preview-total span,
.invoice-preview-total strong {
  color: #ffffff;
}

.invoice-preview-total strong {
  font-size: 24px;
}

.invoice-preview-meta {
  display: grid;
  gap: 4px;
}

.invoice-preview-meta strong {
  font-size: 18px;
}

.invoice-preview-lines {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.invoice-preview-lines > div,
.invoice-preview-summary span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.invoice-preview-summary {
  display: grid;
  gap: 2px;
  margin-top: auto;
  justify-self: end;
  width: min(420px, 100%);
}

.invoice-preview-summary .grand-total {
  margin-top: 6px;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: color-mix(in srgb, var(--invoice-accent) 12%, #ffffff);
  font-size: 16px;
  font-weight: 900;
}

@media (max-width: 1320px) {
  .invoice-line-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .invoice-preview-lines {
    grid-template-columns: 1fr;
  }
}

.split-fields {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 10px;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  font: inherit;
}

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

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

.account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(215, 222, 219, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.account-row-primary {
  grid-column: 1 / -1;
  align-items: center;
  border-color: rgba(36, 122, 87, 0.22);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(232, 246, 238, 0.9)),
    radial-gradient(circle at 100% 0%, rgba(113, 200, 231, 0.18), transparent 36%);
  box-shadow: 0 18px 40px rgba(16, 24, 22, 0.1);
}

.account-row-primary > strong {
  font-size: 22px;
}

.account-row strong,
.account-row span {
  display: block;
}

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

.stacked-form {
  display: grid;
  gap: 12px;
}

.import-box {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.action-panel,
.bank-control {
  align-self: start;
}

.import-box input {
  max-width: 100%;
}

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

.category-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 252, 251, 0.9);
}

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

.category-meter {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece5;
}

.category-meter i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--amber), var(--green));
}

.empty-state,
.empty-row {
  padding: 18px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  transform: translateY(140%);
  transition: transform 160ms ease;
  padding: 13px 15px;
  border-radius: 8px;
  color: #ffffff;
  background: #1f2e27;
  box-shadow: var(--shadow);
}

.toast.show {
  transform: translateY(0);
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .side-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .overview-grid,
  .command-grid,
  .content-grid,
  .transaction-layout,
  .invoice-layout,
  .banking-grid,
  .report-layout,
  .premium-report {
    grid-template-columns: 1fr;
  }

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

  .account-list.account-cards {
    grid-template-columns: 1fr;
  }

  .command-landing {
    grid-template-columns: 1fr;
  }

  .invoice-studio-grid,
  .invoice-workbench {
    grid-template-columns: 1fr;
  }

  .invoice-preview-panel {
    position: static;
  }

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

  .command-chart {
    min-height: 180px;
  }
}

@media (max-width: 720px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .panel-heading,
  .page-hero {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbar,
  .inline-tools,
  .bank-actions {
    align-items: stretch;
  }

  .toolbar > *,
  .inline-tools > *,
  .bank-actions > * {
    width: 100%;
  }

  .field.compact input {
    width: 100%;
  }

  .toolbar {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .hero-stats {
    justify-items: start;
  }

  .command-landing {
    min-height: auto;
  }

  .command-landing h2 {
    font-size: 27px;
  }

  .command-visual {
    min-height: 260px;
    padding: 14px;
  }

  .visual-header {
    display: grid;
  }

  .command-chart {
    grid-template-columns: repeat(4, minmax(42px, 1fr));
    min-height: 190px;
  }

  .risk-radar {
    grid-template-columns: 1fr;
  }

  .category-orbit {
    min-height: 320px;
  }

  .side-nav,
  .metric-grid,
  .category-grid,
  .report-kpi-grid,
  .invoice-kpi-grid,
  .signal-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .invoice-card-main,
  .invoice-actions,
  .split-fields,
  .template-options,
  .invoice-line-row,
  .brand-uploader,
  .invoice-preview-top {
    display: grid;
    grid-template-columns: 1fr;
  }

  .invoice-preview-total,
  .invoice-amount {
    justify-items: start;
  }

  th,
  td {
    min-width: 120px;
  }
}

@media print {
  .sidebar,
  .toolbar,
  .bank-actions,
  .stacked-form,
  .import-box {
    display: none;
  }

  .app-shell,
  .workspace,
  .content-grid,
  .report-layout,
  .metric-grid,
  .category-grid {
    display: block;
  }

  .panel,
  .metric {
    margin-bottom: 16px;
    box-shadow: none;
  }
}
