:root {
  --ink-950: #050b14;
  --ink-900: #07111f;
  --ink-850: #0a1625;
  --ink-800: #0d1b2d;
  --ink-700: #14263c;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.22);
  --text: #f7f9fc;
  --muted: #8e9caf;
  --muted-strong: #b7c1ce;
  --positive: #42d392;
  --negative: #ff6476;
  --gold: #f5c84b;
  --orange: #ff5a1f;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--ink-950);
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 74% -10%, rgba(36, 93, 140, 0.13), transparent 34rem),
    var(--ink-950);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica, sans-serif;
  min-width: 320px;
}

[hidden] {
  display: none !important;
}

body.modal-open {
  overflow: hidden;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg:not(.evolution-chart):not(.svg-sprite) {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 238px;
  display: flex;
  flex-direction: column;
  padding: 28px 18px 22px;
  background: rgba(7, 17, 31, 0.96);
  border-right: 1px solid var(--line);
  z-index: 20;
}

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

.brand-mark {
  width: 39px;
  height: 39px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--ink-950);
  font-weight: 850;
  font-size: 20px;
  letter-spacing: -0.08em;
  background: linear-gradient(145deg, #ffe58a, var(--gold));
  border-radius: 11px;
  box-shadow: 0 10px 30px rgba(245, 200, 75, 0.15);
}

.brand > span:last-child {
  display: grid;
  gap: 2px;
}

.brand strong {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand small {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

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

.side-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 13px;
  color: var(--muted-strong);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 620;
  transition: background 160ms ease, color 160ms ease;
}

.side-nav a:hover {
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
}

.side-nav a.active {
  color: #fff4c1;
  background: rgba(245, 200, 75, 0.09);
  box-shadow: inset 3px 0 0 var(--gold);
}

.side-nav svg {
  width: 19px;
}

.sidebar-houses {
  display: grid;
  gap: 9px;
  margin-top: 38px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.sidebar-houses > span:first-child {
  margin: 0 8px 4px;
  color: #65758a;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-houses .house-mark {
  width: 100%;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid transparent;
}

.save-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 14px 8px 0;
  color: #73839a;
  font-size: 10px;
}

.logout-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.logout-form button {
  width: 100%;
  padding: 8px;
  color: #6f8097;
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 10px;
  cursor: pointer;
}

.logout-form button:hover {
  color: #d8e0e9;
  background: rgba(255, 255, 255, 0.035);
}

.status-dot,
.live-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  flex: 0 0 auto;
  background: var(--positive);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(66, 211, 146, 0.09);
}

.main-content {
  width: calc(100% - 238px);
  max-width: 1680px;
  min-height: 100vh;
  margin-left: 238px;
  padding: 38px clamp(28px, 3.2vw, 58px) 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  max-width: 1370px;
  margin: 0 auto 30px;
}

.eyebrow {
  display: block;
  color: #78879a;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.14em;
}

.topbar h1 {
  margin: 8px 0 6px;
  font-size: clamp(26px, 3vw, 39px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.topbar p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.mobile-brand {
  display: none;
}

.mobile-logout-form {
  margin-left: auto;
}

.mobile-logout-form button {
  min-height: 34px;
  padding: 0 13px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button,
.secondary-button {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 17px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 720;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.primary-button {
  color: #07111f;
  background: linear-gradient(135deg, #ffe486, var(--gold));
  box-shadow: 0 12px 30px rgba(245, 200, 75, 0.13);
}

.primary-button:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #ffebaa, #ffd95f);
}

.primary-button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.secondary-button {
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.025);
  border-color: var(--line-strong);
}

.secondary-button:hover {
  color: var(--text);
  border-color: rgba(245, 200, 75, 0.32);
}

.filter-bar {
  max-width: 1370px;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 0 auto 22px;
  padding: 10px 12px;
  background: rgba(10, 22, 37, 0.72);
  border: 1px solid var(--line);
  border-radius: 13px;
  backdrop-filter: blur(14px);
}

.segmented-control {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: rgba(3, 10, 18, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 9px;
}

.segmented-control button {
  min-height: 34px;
  padding: 0 14px;
  color: #7f8da0;
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 670;
  cursor: pointer;
}

.segmented-control button.active {
  color: var(--text);
  background: var(--ink-700);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.month-field {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  color: var(--muted);
  border-left: 1px solid var(--line);
}

.month-field input {
  width: 145px;
  color: var(--muted-strong);
  color-scheme: dark;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.filter-context {
  margin-left: auto;
  padding-right: 7px;
  color: #6d7d91;
  font-size: 10px;
}

.alert {
  max-width: 1370px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 18px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 12px;
}

.error-alert {
  color: #ffd9de;
  background: rgba(255, 100, 118, 0.1);
  border: 1px solid rgba(255, 100, 118, 0.2);
}

.alert button {
  display: grid;
  place-items: center;
  padding: 2px;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.overview,
.entries-panel,
.app-footer {
  max-width: 1370px;
  margin-inline: auto;
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1.4fr 1.15fr repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

.kpi-card {
  position: relative;
  min-height: 151px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 19px 18px 17px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(15, 31, 50, 0.93), rgba(9, 21, 36, 0.96));
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.11);
}

.kpi-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.25), transparent);
}

.kpi-main {
  border-color: rgba(245, 200, 75, 0.22);
  background:
    radial-gradient(circle at 90% 0%, rgba(245, 200, 75, 0.11), transparent 48%),
    linear-gradient(145deg, rgba(17, 34, 53, 0.97), rgba(9, 21, 36, 0.96));
}

.kpi-main::after {
  background: linear-gradient(90deg, var(--gold), rgba(245, 200, 75, 0.05));
}

.profit-card::after {
  background: linear-gradient(90deg, var(--positive), rgba(66, 211, 146, 0.04));
}

.kpi-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #8796aa;
  font-size: 11px;
  font-weight: 630;
}

.icon-box {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #a9b5c5;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 8px;
}

.kpi-value {
  display: block;
  margin-top: 15px;
  color: #fbfcff;
  font-size: clamp(24px, 2.15vw, 34px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.055em;
  line-height: 1;
}

.kpi-value.small {
  font-size: clamp(21px, 1.7vw, 27px);
}

.kpi-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 18px;
  color: #68798f;
  font-size: 9px;
}

.positive {
  color: var(--positive) !important;
}

.negative {
  color: var(--negative) !important;
}

.muted {
  color: var(--muted) !important;
}

.insight-strip {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0;
  padding: 14px 18px;
  background: linear-gradient(90deg, rgba(245, 200, 75, 0.055), rgba(10, 22, 37, 0.6));
  border: 1px solid rgba(245, 200, 75, 0.12);
  border-radius: 12px;
}

.insight-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--gold);
  background: rgba(245, 200, 75, 0.08);
  border-radius: 10px;
}

.insight-strip p {
  margin: 5px 0 0;
  color: #c3ccd7;
  font-size: 12px;
  line-height: 1.45;
}

.open-badge {
  margin-left: auto;
  padding: 7px 10px;
  color: #ffc489;
  white-space: nowrap;
  background: rgba(255, 138, 54, 0.08);
  border: 1px solid rgba(255, 138, 54, 0.14);
  border-radius: 7px;
  font-size: 9px;
  font-weight: 700;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.75fr);
  gap: 14px;
}

.panel {
  background: rgba(10, 22, 37, 0.86);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.1);
}

.chart-panel,
.performance-panel {
  min-height: 382px;
  padding: 22px 22px 14px;
}

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

.panel-heading h2 {
  margin: 6px 0 0;
  font-size: 17px;
  letter-spacing: -0.03em;
}

.panel-period {
  color: #8190a2;
  font-size: 10px;
}

.chart-wrap {
  margin-top: 22px;
}

.chart-value-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.chart-value-row strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
}

.chart-caption {
  color: #66768b;
  font-size: 9px;
}

.evolution-chart {
  width: 100%;
  height: 245px;
  display: block;
  margin-top: 2px;
  overflow: visible;
}

.chart-grid {
  stroke: rgba(148, 163, 184, 0.11);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}

.chart-line {
  fill: none;
  stroke: var(--positive);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 5px 9px rgba(66, 211, 146, 0.25));
}

.evolution-chart.is-negative .chart-line {
  stroke: var(--negative);
  filter: drop-shadow(0 5px 9px rgba(255, 100, 118, 0.25));
}

.evolution-chart.is-negative .chart-dot {
  stroke: var(--negative);
}

.chart-dot {
  fill: var(--ink-900);
  stroke: var(--positive);
  stroke-width: 3;
}

.chart-label {
  fill: #65758a;
  font-size: 10px;
}

.performance-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 292px;
}

.performance-meter {
  height: 11px;
  display: flex;
  gap: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}

.performance-meter span {
  min-width: 4px;
  transition: width 300ms ease;
}

.meter-betnacional {
  background: linear-gradient(90deg, #dfac24, var(--gold));
}

.meter-betano {
  background: linear-gradient(90deg, var(--orange), #ff845b);
}

.performance-list {
  display: grid;
  gap: 2px;
  margin-top: 25px;
}

.performance-row {
  min-height: 75px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.performance-row:last-child {
  border-bottom: 0;
}

.performance-house {
  display: flex;
  align-items: center;
  gap: 11px;
}

.performance-house > div {
  display: grid;
  gap: 4px;
}

.performance-house strong,
.performance-row > strong {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.performance-house span {
  color: #6c7b90;
  font-size: 9px;
}

.house-mark {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d8dfe8;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  border-radius: 7px;
}

.house-symbol {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 9px;
  font-weight: 850;
}

.house-betnacional .house-symbol {
  color: #081b3b;
  background: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.house-betano .house-symbol {
  color: #fff;
  background: var(--orange);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.house-mark.compact .house-symbol {
  width: 31px;
  height: 31px;
}

.entries-panel {
  margin-top: 14px;
  overflow: hidden;
}

.entries-heading {
  align-items: center;
  padding: 21px 22px 18px;
  border-bottom: 1px solid var(--line);
}

.entries-heading p {
  margin: 6px 0 0;
  color: #66768b;
  font-size: 9px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

th {
  padding: 12px 18px;
  color: #647489;
  background: rgba(4, 13, 23, 0.28);
  font-size: 9px;
  font-weight: 720;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

td {
  padding: 16px 18px;
  color: #b9c3cf;
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  font-variant-numeric: tabular-nums;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.018);
}

td:first-child strong {
  color: #e2e7ee;
}

.in-progress {
  display: inline-block;
  padding: 5px 7px;
  color: #ffc07f;
  background: rgba(255, 138, 54, 0.08);
  border: 1px solid rgba(255, 138, 54, 0.12);
  border-radius: 6px;
  font-size: 9px;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.row-actions button,
.modal-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: #7d8da1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.row-actions button:hover,
.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}

.row-actions .danger-action:hover {
  color: var(--negative);
  background: rgba(255, 100, 118, 0.07);
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 52px 20px;
  text-align: center;
}

.empty-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 5px;
  color: #78879a;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}

.empty-state strong {
  font-size: 13px;
}

.empty-state p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 10px;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 4px 0;
  color: #536277;
  font-size: 9px;
}

.floating-action {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 7, 13, 0.77);
  backdrop-filter: blur(10px);
  z-index: 100;
  animation: fade-in 160ms ease;
}

.entry-modal {
  width: min(620px, 100%);
  max-height: calc(100vh - 34px);
  overflow-y: auto;
  padding: 25px;
  background:
    radial-gradient(circle at 100% 0%, rgba(245, 200, 75, 0.055), transparent 19rem),
    #0a1727;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.48);
  animation: modal-in 190ms ease;
}

.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.modal-heading h2 {
  margin: 7px 0 5px;
  font-size: 21px;
  letter-spacing: -0.035em;
}

.modal-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.entry-modal form {
  display: grid;
  gap: 17px;
  padding-top: 20px;
}

.house-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 0;
  padding: 0;
  border: 0;
}

.house-choice legend,
.form-field > span {
  grid-column: 1 / -1;
  display: block;
  margin-bottom: 8px;
  color: #9ba8b8;
  font-size: 10px;
  font-weight: 650;
}

.house-choice button {
  min-height: 51px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.house-choice button.selected {
  background: rgba(245, 200, 75, 0.055);
  border-color: rgba(245, 200, 75, 0.3);
}

.house-choice .selection-check {
  display: none;
  color: var(--gold);
}

.house-choice button.selected .selection-check {
  display: block;
}

.form-field {
  display: block;
}

.form-field em {
  color: #637287;
  font-size: 9px;
  font-style: normal;
  font-weight: 450;
}

.form-field input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  color: var(--text);
  color-scheme: dark;
  background: rgba(3, 11, 19, 0.52);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: 0;
  font-size: 12px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-field input:focus {
  border-color: rgba(245, 200, 75, 0.48);
  box-shadow: 0 0 0 3px rgba(245, 200, 75, 0.06);
}

.form-field small {
  display: block;
  margin-top: 6px;
  color: #607086;
  font-size: 9px;
}

.input-with-icon,
.money-input {
  position: relative;
}

.input-with-icon > svg {
  position: absolute;
  left: 13px;
  top: 13px;
  color: #8391a4;
  pointer-events: none;
}

.input-with-icon input {
  padding-left: 42px;
  cursor: pointer;
}

.money-input > span {
  position: absolute;
  left: 13px;
  top: 15px;
  color: #76859a;
  font-size: 11px;
  pointer-events: none;
}

.money-input input {
  padding-left: 38px;
  font-variant-numeric: tabular-nums;
}

.money-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.result-preview {
  min-height: 67px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 15px;
  background: rgba(3, 11, 19, 0.36);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.result-preview > span {
  color: #8e9caf;
  font-size: 10px;
}

.result-preview > strong {
  font-size: 12px;
}

.result-preview > div {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.result-preview > div strong {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.result-preview > div small {
  color: #748398;
  font-size: 9px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 3px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px 10px 10px;
  color: #dfe6ed;
  background: #112238;
  border: 1px solid rgba(66, 211, 146, 0.22);
  border-radius: 11px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  font-size: 11px;
  z-index: 130;
  animation: toast-in 220ms ease;
}

.toast > span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--positive);
  background: rgba(66, 211, 146, 0.08);
  border-radius: 8px;
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(6, 1fr);
  }

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

  .kpi-main,
  .profit-card {
    grid-column: span 3;
  }
}

@media (max-width: 980px) {
  .sidebar {
    width: 82px;
    align-items: center;
    padding-inline: 12px;
  }

  .sidebar .brand > span:last-child,
  .side-nav a span,
  .side-nav a:not(.active)::after,
  .sidebar-houses > span:first-child,
  .sidebar-houses .house-mark > span:last-child,
  .save-status {
    display: none;
  }

  .brand {
    padding-inline: 0;
  }

  .side-nav a {
    width: 48px;
    justify-content: center;
    padding: 0;
  }

  .sidebar-houses .house-mark {
    width: 48px;
    justify-content: center;
  }

  .main-content {
    width: calc(100% - 82px);
    margin-left: 82px;
  }

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

  .performance-panel {
    min-height: auto;
  }

  .performance-content {
    min-height: 220px;
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: 76px;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    width: 100%;
    margin: 0;
    padding: 18px 14px 24px;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 20px;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
  }

  .mobile-brand .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    font-size: 17px;
  }

  .topbar h1 {
    margin-top: 7px;
    font-size: 28px;
  }

  .topbar p {
    max-width: 320px;
    font-size: 11px;
    line-height: 1.5;
  }

  .desktop-action {
    display: none;
  }

  .filter-bar {
    position: sticky;
    top: 8px;
    z-index: 15;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 9px;
    margin-bottom: 14px;
    padding: 8px;
    background: rgba(7, 17, 31, 0.93);
  }

  .segmented-control {
    overflow-x: auto;
  }

  .segmented-control button {
    min-width: max-content;
    padding-inline: 11px;
  }

  .month-field {
    min-width: 42px;
    padding: 0 8px;
    border-left: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .month-field input {
    width: 22px;
    color: transparent;
  }

  .month-field input::-webkit-calendar-picker-indicator {
    width: 22px;
    opacity: 0;
  }

  .filter-context {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0 4px 2px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .kpi-card,
  .kpi-main,
  .profit-card {
    grid-column: span 1;
    min-height: 132px;
    padding: 15px;
  }

  .kpi-main,
  .profit-card {
    grid-column: span 2;
  }

  .kpi-card:last-child {
    grid-column: span 2;
  }

  .kpi-value,
  .kpi-value.small {
    font-size: 23px;
  }

  .kpi-main .kpi-value,
  .profit-card .kpi-value {
    font-size: 29px;
  }

  .insight-strip {
    align-items: flex-start;
    padding: 14px;
  }

  .insight-strip p {
    font-size: 10px;
  }

  .open-badge {
    display: none;
  }

  .chart-panel,
  .performance-panel {
    min-height: auto;
    padding: 18px 15px 10px;
  }

  .evolution-chart {
    height: 215px;
  }

  .entries-panel {
    overflow: visible;
  }

  .entries-heading {
    padding: 17px 15px;
  }

  .entries-heading .secondary-button {
    width: 38px;
    min-height: 38px;
    padding: 0;
    font-size: 0;
  }

  .table-wrap {
    overflow: visible;
    padding: 10px;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 9px;
  }

  tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px 12px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.018);
    border: 1px solid var(--line);
    border-radius: 11px;
  }

  td {
    display: grid;
    justify-items: start;
    gap: 5px;
    padding: 0;
    border: 0;
  }

  td::before {
    content: attr(data-label);
    color: #627287;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .row-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    padding-top: 9px;
    border-top: 1px solid var(--line);
  }

  .row-actions::before {
    display: none;
  }

  .app-footer {
    display: grid;
    gap: 5px;
    padding-inline: 2px;
  }

  .floating-action {
    position: fixed;
    right: 14px;
    bottom: 14px;
    min-height: 49px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 17px;
    color: var(--ink-950);
    background: linear-gradient(135deg, #ffe486, var(--gold));
    border: 0;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
    font-size: 11px;
    font-weight: 760;
    z-index: 40;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .entry-modal {
    width: 100%;
    max-height: 94vh;
    padding: 21px 16px 18px;
    border-radius: 17px 17px 0 0;
  }

  .money-fields {
    grid-template-columns: 1fr;
    gap: 17px;
  }

  .modal-actions {
    position: sticky;
    bottom: -18px;
    margin: 0 -16px -18px;
    padding: 13px 16px 18px;
    background: #0a1727;
    border-top: 1px solid var(--line);
  }

  .modal-actions button {
    flex: 1;
  }

  .toast {
    right: 14px;
    bottom: 76px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 15%, rgba(245, 200, 75, 0.08), transparent 28rem),
    radial-gradient(circle at 90% 5%, rgba(29, 101, 150, 0.16), transparent 34rem),
    #050b14;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(430px, 100%);
  padding: 34px;
  background:
    radial-gradient(circle at 100% 0%, rgba(245, 200, 75, 0.08), transparent 18rem),
    linear-gradient(145deg, rgba(13, 28, 46, 0.98), rgba(7, 17, 31, 0.98));
  border: 1px solid rgba(245, 200, 75, 0.16);
  border-radius: 20px;
  box-shadow: 0 36px 100px rgba(0, 0, 0, 0.42);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.login-brand > span:last-child {
  display: grid;
  gap: 2px;
}

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

.login-brand small {
  color: var(--muted);
  font-size: 10px;
}

.login-heading {
  padding: 28px 0 22px;
}

.login-heading h1 {
  margin: 8px 0 7px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

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

.login-form {
  display: grid;
  gap: 17px;
}

.login-submit {
  width: 100%;
  margin-top: 4px;
}

.login-alert {
  margin-bottom: 18px;
  padding: 11px 12px;
  color: #ffd9de;
  background: rgba(255, 100, 118, 0.09);
  border: 1px solid rgba(255, 100, 118, 0.2);
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.45;
}

.login-security {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 22px 0 0;
  color: #66778d;
  font-size: 9px;
}

.login-security a {
  color: inherit;
  text-decoration-color: rgba(255, 255, 255, 0.38);
  text-underline-offset: 3px;
}

.legal-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(33, 211, 154, 0.12), transparent 32rem),
    #07111f;
  color: #dce8f5;
}

.legal-shell {
  width: min(860px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 64px;
}

.legal-brand {
  display: inline-flex;
  margin-bottom: 24px;
  color: #fff;
  text-decoration: none;
}

.legal-card {
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 26px;
  background: rgba(12, 28, 46, 0.9);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.3);
}

.legal-card h1 {
  margin: 10px 0 6px;
  color: #fff;
  font-size: clamp(2rem, 5vw, 3.2rem);
}

.legal-card h2 {
  margin: 30px 0 8px;
  color: #fff;
  font-size: 1.08rem;
}

.legal-card p {
  margin: 0;
  color: #9fb1c5;
  line-height: 1.75;
}

.legal-card .legal-updated {
  color: #6f849a;
}

.legal-back {
  display: inline-flex;
  margin-top: 34px;
  text-decoration: none;
}

@media (max-width: 520px) {
  .login-shell {
    align-items: start;
    padding: 18px 14px;
  }

  .login-card {
    margin-top: 5vh;
    padding: 26px 20px;
    border-radius: 16px;
  }
}

.login-divider {
  position: relative;
  display: grid;
  place-items: center;
  margin: 20px 0 15px;
  color: #66778d;
  font-size: 10px;
}

.login-divider::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  height: 1px;
  background: var(--line);
}

.login-divider span {
  position: relative;
  padding: 0 10px;
  background: #0b192a;
}

.google-login-button {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  color: #1f2937;
  background: #fff;
  border: 1px solid #d8dee7;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 720;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.google-login-button:hover {
  background: #f7f9fc;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.google-g {
  width: 18px;
  height: 18px;
  display: block;
}

.sidebar-profile,
.user-chip {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}

.sidebar-profile {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 10px;
  border-radius: 12px;
  text-align: left;
}

.sidebar-profile:hover,
.user-chip:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line-strong);
}

.sidebar-profile > span:nth-child(2),
.user-chip > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.sidebar-profile strong,
.user-chip strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-profile small,
.user-chip small {
  color: var(--muted);
  font-size: 8px;
}

.sidebar-profile > svg {
  width: 16px !important;
  height: 16px !important;
  color: var(--muted);
}

.user-avatar {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: #ffe8a0;
  background: linear-gradient(145deg, rgba(245, 200, 75, 0.2), rgba(245, 200, 75, 0.08));
  border: 1px solid rgba(245, 200, 75, 0.22);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
}

.user-avatar.large {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  font-size: 16px;
}

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

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 160px;
  padding: 6px 10px 6px 7px;
  border-radius: 11px;
  text-align: left;
}

.mobile-profile-button {
  width: 34px;
  height: 34px;
  display: none;
  place-items: center;
  margin-left: auto;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.users-panel {
  margin-top: 18px;
  scroll-margin-top: 24px;
}

.users-heading,
.users-heading-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.users-heading {
  justify-content: space-between;
}

.users-explainer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 20px 14px;
  padding: 13px 14px;
  background: rgba(66, 211, 146, 0.045);
  border: 1px solid rgba(66, 211, 146, 0.12);
  border-radius: 11px;
}

.users-explainer .icon-box {
  color: var(--positive);
}

.users-explainer div:last-child {
  display: grid;
  gap: 3px;
}

.users-explainer strong {
  font-size: 11px;
}

.users-explainer p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.users-table-wrap {
  padding-top: 0;
}

.user-person,
.google-account-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.user-person > div,
.google-account-cell {
  min-width: 0;
}

.user-person > div,
.google-account-cell {
  display: grid;
  gap: 4px;
}

.google-account-cell strong {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
}

.google-account-cell span {
  color: var(--muted);
  font-size: 8px;
}

.role-badge,
.status-badge {
  width: max-content;
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 99px;
  font-size: 7px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.role-badge {
  color: #a8b6c8;
  background: rgba(148, 163, 184, 0.08);
}

.role-badge.is-admin {
  color: #ffe395;
  background: rgba(245, 200, 75, 0.09);
}

.status-badge.is-active {
  color: #8ce7bc;
  background: rgba(66, 211, 146, 0.09);
}

.status-badge.is-inactive {
  color: #ff9aa6;
  background: rgba(255, 100, 118, 0.09);
}

.user-row-actions {
  min-width: 210px;
}

.user-row-actions button {
  width: auto;
  min-width: 52px;
  padding: 0 9px;
  font-size: 8px;
}

.account-modal {
  width: min(520px, calc(100% - 28px));
}

.compact-modal {
  width: min(460px, calc(100% - 28px));
}

.account-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -4px 0 18px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.account-identity > div {
  display: grid;
  gap: 4px;
}

.account-identity strong {
  font-size: 12px;
}

.account-identity span:last-child {
  color: var(--muted);
  font-size: 9px;
}

.modal-form-error {
  padding: 10px 11px;
  color: #ffd9de;
  background: rgba(255, 100, 118, 0.09);
  border: 1px solid rgba(255, 100, 118, 0.18);
  border-radius: 9px;
  font-size: 10px;
  line-height: 1.45;
}

.password-generator {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.password-generator .secondary-button {
  min-width: 72px;
}

.credential-result {
  display: grid;
  gap: 12px;
  text-align: center;
}

.credential-success-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin: 2px auto 0;
  color: var(--positive);
  background: rgba(66, 211, 146, 0.08);
  border: 1px solid rgba(66, 211, 146, 0.18);
  border-radius: 16px;
}

.credential-result > strong {
  font-size: 16px;
}

.credential-result > p {
  margin: -6px 0 2px;
  color: var(--muted);
  font-size: 10px;
}

.credential-result label {
  display: grid;
  gap: 5px;
  text-align: left;
}

.credential-result label span {
  color: var(--muted-strong);
  font-size: 9px;
  font-weight: 700;
}

.credential-result input {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  color: #dce5ef;
  background: #081321;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 11px;
}

@media (max-width: 1020px) {
  .user-chip {
    display: none;
  }

  .topbar-actions {
    align-self: end;
  }
}

@media (min-width: 721px) and (max-width: 980px) {
  .sidebar-profile {
    width: 48px;
    height: 48px;
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    padding: 0;
  }

  .sidebar-profile > span:nth-child(2),
  .sidebar-profile > svg {
    display: none;
  }
}

@media (max-width: 720px) {
  .mobile-profile-button {
    display: grid;
  }

  .mobile-logout-form {
    margin-left: 0;
  }

  .users-heading {
    align-items: flex-start;
    gap: 14px;
  }

  .users-heading-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .users-explainer {
    margin: 0 12px 12px;
  }

  .users-table .user-row-actions {
    min-width: 0;
  }

  .users-table .user-row-actions button {
    min-height: 34px;
  }
}

@media (max-width: 520px) {
  .users-heading {
    display: grid;
  }

  .users-heading-actions {
    justify-content: stretch;
  }

  .users-heading-actions button {
    flex: 1;
  }

  .users-explainer {
    align-items: flex-start;
  }

  .password-generator {
    grid-template-columns: 1fr;
  }

  .account-modal {
    width: 100%;
  }
}
