:root {
  --bg: #f5faf7;
  --surface: #ffffff;
  --surface-2: #eef7f2;
  --text: #0d1f18;
  --muted: #6c8178;
  --line: #dbe8e2;
  --primary: #25945f;
  --primary-2: #38be7d;
  --danger: #e43636;
  --danger-soft: #fee9e9;
  --pink: #dc3971;
  --warning: #d89b24;
  --shadow: 0 16px 35px rgba(20, 65, 43, 0.08);
  --radius: 8px;
  --font-sans: "Aptos", "Segoe UI Variable", "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", var(--font-sans);
  --font-number: "Aptos", "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  font-family: var(--font-sans);
}

body.dark {
  --bg: #0a1711;
  --surface: #102019;
  --surface-2: #132a20;
  --text: #eefbf4;
  --muted: #91a99e;
  --line: #244338;
  --shadow: 0 16px 35px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button {
  cursor: pointer;
}

.ui-icon {
  width: 1em;
  height: 1em;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(37, 148, 95, 0.12), transparent 38%),
    linear-gradient(315deg, rgba(220, 57, 113, 0.09), transparent 42%),
    var(--bg);
}

.auth-panel {
  width: min(960px, 100%);
  min-height: 600px;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.auth-brand {
  background: #102019;
  color: #f6fff9;
  padding: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.auth-brand > div {
  width: 100%;
  display: grid;
  justify-items: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  font-size: 24px;
  font-weight: 700;
}

.auth-logo {
  width: min(280px, 82%);
  height: auto;
  display: block;
  margin: 0 auto 26px;
}

.auth-brand h1 {
  margin: 24px 0 10px;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1;
  letter-spacing: 0;
  font-family: var(--font-display);
  font-weight: 800;
  text-align: center;
}

.auth-brand p,
.auth-small {
  color: #b7cec3;
  line-height: 1.6;
}

.auth-brand p {
  max-width: 340px;
  text-align: center;
}

.auth-form-wrap {
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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

h1,
h2,
h3,
strong {
  font-family: var(--font-display);
}

.auth-form-wrap h2 {
  font-size: 30px;
  line-height: 1.15;
  font-weight: 800;
  margin: 8px 0 8px;
}

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

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px;
  outline: none;
  font-weight: 500;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 148, 95, 0.14);
}

.btn {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
}

.btn:hover {
  filter: brightness(1.03);
}

.btn.secondary {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.btn.danger {
  background: var(--danger);
}

.btn.ghost {
  color: var(--primary);
  background: transparent;
  min-height: auto;
  padding: 0;
}

.btn:disabled {
  cursor: default;
  opacity: 0.72;
}

.switch-auth {
  margin-top: 16px;
  color: var(--muted);
  text-align: center;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 276px 1fr;
}

.mobile-topbar,
.bottom-nav,
.mobile-scrim,
.mobile-drawer-head {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  overflow-y: auto;
}

.logo {
  display: grid;
  justify-items: center;
  padding: 0 6px 12px;
}

.sidebar-logo {
  width: 190px;
  max-width: 100%;
  height: auto;
  display: block;
}

.logo strong {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
}

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

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

.nav button,
.side-actions button {
  min-height: 44px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  color: var(--muted);
  background: transparent;
  border-radius: var(--radius);
  padding: 11px 14px;
  text-align: left;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 20px;
  opacity: 0.9;
}

.nav-icon .ui-icon {
  width: 22px;
  height: 22px;
}

.nav button.active,
.nav button:hover,
.side-actions button:hover {
  color: #fff;
  background: var(--primary);
}

.side-actions {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 6px;
}

.main {
  padding: 24px 38px 44px;
  overflow: hidden;
}

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

.topbar h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
  font-weight: 800;
}

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

.trial-banner {
  margin: -8px 0 22px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.trial-banner.expired {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.trial-banner.card-warning {
  border-left-color: var(--warning);
}

.info-panel {
  border-left: 4px solid var(--primary);
}

.danger-panel {
  max-width: 760px;
  border-left: 4px solid var(--danger);
}

.danger-panel p {
  color: var(--muted);
}

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

.reset-summary span {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.trial-banner strong {
  display: block;
  margin-bottom: 4px;
}

.trial-banner p {
  margin: 0;
  color: var(--muted);
}

.trial-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.month-control {
  margin: -4px 0 18px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.month-control small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.month-control strong {
  display: block;
  margin-top: 2px;
}

.month-control.closed {
  border-left: 4px solid var(--warning);
}

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

.metric,
.panel,
.item-card,
.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric {
  position: relative;
  overflow: hidden;
  padding: 20px;
  min-height: 94px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.metric > div:first-child {
  min-width: 0;
}

.metric.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
}

.metric small,
.metric span {
  color: inherit;
  opacity: 0.75;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-family: var(--font-number);
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 800;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  white-space: nowrap;
}

.metric-icon,
.tx-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 148, 95, 0.12);
  color: var(--primary);
  font-family: var(--font-number);
  font-weight: 800;
}

.metric.hideable .metric-icon {
  display: none;
}

.metric-visibility {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  background: rgba(37, 148, 95, 0.12);
}

.metric.primary .metric-visibility {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
}

.metric-visibility .ui-icon {
  width: 22px;
  height: 22px;
}

.metric-icon .ui-icon,
.tx-icon .ui-icon {
  width: 21px;
  height: 21px;
}

.metric.primary .metric-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.metric:not(.primary) .metric-icon {
  display: none;
}

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

.panel {
  padding: 20px;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 800;
}

.chart {
  height: 270px;
  width: 100%;
  font-family: var(--font-number);
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 14px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.chart-legend span {
  width: 22px;
  height: 5px;
  border-radius: 999px;
}

.legend-income {
  background: var(--primary);
}

.legend-expense {
  background: var(--danger);
}

.legend-card {
  background: var(--warning);
}

.donut-wrap {
  min-height: 270px;
  display: grid;
  grid-template-columns: 210px 1fr;
  align-items: center;
  gap: 20px;
}

.donut {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: conic-gradient(var(--pink) var(--slice, 100%), var(--surface-2) 0);
  position: relative;
  margin: auto;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 30px;
  border-radius: 50%;
  background: var(--surface);
}

.legend {
  display: grid;
  gap: 10px;
}

.legend-row,
.tx-row,
.budget-row,
.goal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--pink);
  flex: none;
}

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

.tx-row,
.budget-row,
.goal-row {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.tx-row:last-child,
.budget-row:last-child,
.goal-row:last-child {
  border-bottom: 0;
}

.tx-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.tx-title {
  font-family: var(--font-display);
  font-weight: 750;
  overflow-wrap: anywhere;
}

.tx-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.amount.income {
  color: var(--primary);
}

.amount.expense {
  color: var(--danger);
}

.amount {
  font-family: var(--font-number);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.empty {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.page-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
}

.item-card {
  padding: 16px;
}

.card-item {
  display: grid;
  gap: 8px;
}

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

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

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

.admin-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.admin-table td small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

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

.admin-plan-select {
  min-width: 150px;
  padding: 9px 10px;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-actions .btn {
  padding: 9px 11px;
  font-size: 12px;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar input,
.toolbar select {
  max-width: 230px;
}

.progress {
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: var(--primary);
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--primary);
  background: rgba(37, 148, 95, 0.12);
  font-weight: 700;
  font-size: 12px;
}

.badge.success {
  color: var(--primary);
  background: rgba(37, 148, 95, 0.16);
}

.badge.warning {
  color: var(--warning);
  background: rgba(216, 155, 36, 0.16);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(2, 10, 6, 0.62);
  z-index: 10;
}

.modal.open {
  display: grid;
}

.modal-card {
  width: min(560px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 22px;
}

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

.modal-head h2 {
  margin: 0;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--text);
  background: var(--surface-2);
}

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

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.check-row input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.report-toolbar {
  align-items: center;
}

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

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 13px 15px;
  color: #fff;
  background: #102019;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: translateY(120px);
  transition: 0.25s ease;
  z-index: 20;
}

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

.ai-assistant {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 18;
}

.ai-fab {
  width: 68px;
  height: 68px;
  border: 1px solid var(--line);
  border-radius: 50%;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.ai-fab img,
.ai-head img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ai-panel {
  position: absolute;
  right: 0;
  bottom: 82px;
  width: min(380px, calc(100vw - 44px));
  display: none;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.ai-assistant.open .ai-panel {
  display: block;
}

.ai-head {
  display: grid;
  grid-template-columns: 48px 1fr 38px;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.ai-head img {
  border-radius: 50%;
}

.ai-head strong,
.ai-head span {
  display: block;
}

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

.ai-messages {
  max-height: 300px;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.ai-messages p {
  margin: 0;
  max-width: 88%;
  padding: 10px 12px;
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}

.ai-messages .assistant {
  justify-self: start;
  background: var(--surface-2);
}

.ai-messages .user {
  justify-self: end;
  color: #fff;
  background: var(--primary);
}

.ai-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

@media (max-width: 1100px) {
  .cards,
  .learn-grid,
  .plans-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-2,
  .page-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  body {
    --bg: #020f0b;
    --surface: rgba(12, 35, 28, 0.86);
    --surface-2: rgba(22, 55, 44, 0.92);
    --text: #f3fff8;
    --muted: #a8bdb5;
    --line: rgba(99, 157, 131, 0.22);
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.34);
    background:
      radial-gradient(circle at 25% 0%, rgba(33, 198, 118, 0.14), transparent 32%),
      radial-gradient(circle at 90% 18%, rgba(46, 154, 108, 0.18), transparent 32%),
      linear-gradient(160deg, #03110c 0%, #061a13 46%, #020907 100%);
  }

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

  .auth-brand {
    min-height: 300px;
  }

  .sidebar {
    position: fixed;
    inset: 20px auto 20px 16px;
    width: min(340px, calc(100vw - 48px));
    height: auto;
    max-height: calc(100vh - 40px);
    z-index: 31;
    transform: translateX(calc(-100% - 28px));
    transition: transform 0.22s ease;
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 22px;
    background:
      linear-gradient(145deg, rgba(20, 47, 39, 0.94), rgba(2, 12, 9, 0.96)),
      var(--surface);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(18px);
  }

  .main {
    min-height: 100vh;
    padding: 18px 16px 92px;
    overflow: visible;
  }

  .mobile-menu-open .sidebar {
    transform: translateX(0);
  }

  .mobile-scrim {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(0, 0, 0, 0.42);
  }

  .mobile-menu-open .mobile-scrim {
    display: block;
  }

  .mobile-topbar {
    min-height: 58px;
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    margin-bottom: 22px;
  }

  .mobile-menu-btn,
  .mobile-bell {
    width: 44px;
    height: 44px;
    border: 0;
    color: var(--text);
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
  }

  .mobile-bell {
    position: relative;
    font-size: 27px;
  }

  .mobile-menu-btn .ui-icon {
    width: 29px;
    height: 29px;
  }

  .mobile-bell .ui-icon {
    width: 27px;
    height: 27px;
  }

  .mobile-bell::after {
    content: "";
    position: absolute;
    right: 9px;
    top: 9px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ef3d76;
  }

  .mobile-logo {
    justify-self: center;
    width: 214px;
    max-width: 64vw;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.28));
  }

  .mobile-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
  }

  .mobile-drawer-head .sidebar-logo {
    width: 220px;
  }

  .logo {
    display: none;
  }

  .nav {
    gap: 8px;
  }

  .nav button,
  .side-actions button {
    min-height: 56px;
    padding: 13px 12px;
    color: rgba(243, 255, 248, 0.86);
    font-size: 17px;
    border-radius: 12px;
  }

  .nav-icon {
    width: 38px;
    height: 38px;
    font-size: 26px;
    color: rgba(243, 255, 248, 0.8);
  }

  .nav-icon .ui-icon {
    width: 27px;
    height: 27px;
  }

  .nav button.active,
  .nav button:hover,
  .side-actions button:hover {
    background: linear-gradient(135deg, rgba(45, 198, 117, 0.95), rgba(24, 121, 79, 0.95));
    box-shadow: 0 12px 24px rgba(12, 97, 58, 0.22);
  }

  .nav button.active .nav-icon,
  .nav button:hover .nav-icon {
    color: #d8ffe8;
  }

  .side-actions {
    margin-top: 12px;
    border-top-color: rgba(255, 255, 255, 0.1);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
  }

  .topbar h1 {
    font-size: 23px;
  }

  .quick-actions {
    display: none;
  }

  .trial-banner {
    align-items: flex-start;
    flex-direction: column;
    border-left-width: 3px;
    border-radius: 14px;
    background: rgba(11, 34, 27, 0.9);
  }

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

  .reset-summary span {
    background: rgba(255, 255, 255, 0.05);
  }

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

  .month-control {
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: 14px;
    border-color: rgba(104, 171, 140, 0.2);
    background:
      linear-gradient(145deg, rgba(18, 49, 40, 0.86), rgba(6, 20, 15, 0.9));
  }

  .month-control .btn {
    min-height: 38px;
    padding: 9px 12px;
    white-space: nowrap;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
  }

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

  .cards .metric.primary {
    grid-column: 1 / -1;
  }

  .metric,
  .panel,
  .item-card,
  .modal-card {
    border-color: rgba(104, 171, 140, 0.2);
    border-radius: 13px;
    background:
      linear-gradient(145deg, rgba(18, 49, 40, 0.9), rgba(6, 20, 15, 0.92));
  }

  .metric {
    min-height: 114px;
    padding: 18px;
  }

  .metric.primary {
    min-height: 136px;
    background: linear-gradient(135deg, #1c8d5b, #29c274);
  }

  .metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    position: absolute;
    top: 18px;
    right: 18px;
    flex: none;
    pointer-events: none;
    z-index: 1;
  }

  .metric-icon .ui-icon {
    width: 24px;
    height: 24px;
  }

  .metric strong {
    max-width: 100%;
    padding-right: 0;
    font-size: 30px;
    line-height: 1.08;
    white-space: nowrap;
  }

  .cards .metric:not(.primary) strong {
    margin-top: 22px;
    font-size: 24px;
    letter-spacing: 0;
  }

  .cards .metric.primary strong {
    max-width: calc(100% - 76px);
    font-size: 34px;
  }

  .metric-visibility {
    top: 18px;
    right: 18px;
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  .metric-visibility .ui-icon {
    width: 25px;
    height: 25px;
  }

  .cards .metric.hideable:not(.primary) .metric-visibility {
    top: 10px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .cards .metric.hideable:not(.primary) .metric-visibility .ui-icon {
    width: 18px;
    height: 18px;
  }

  .cards .metric.hideable:not(.primary) small {
    padding-right: 42px;
  }

  .grid-2,
  .page-grid {
    gap: 16px;
  }

  .panel {
    padding: 18px;
  }

  input,
  select,
  textarea {
    background: rgba(5, 20, 15, 0.88);
  }

  .btn.secondary {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
  }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    height: 74px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(104, 171, 140, 0.22);
    background: rgba(5, 23, 17, 0.94);
    backdrop-filter: blur(18px);
  }

  .bottom-nav button {
    border: 0;
    display: grid;
    place-items: center;
    gap: 2px;
    color: var(--muted);
    background: transparent;
    font-size: 11px;
  }

  .bottom-nav span {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
  }

  .bottom-nav .ui-icon {
    width: 22px;
    height: 22px;
  }

  .bottom-nav button.active {
    color: var(--primary-2);
  }

  .ai-assistant {
    right: 18px;
    bottom: 84px;
  }

  .ai-fab {
    width: 58px;
    height: 58px;
  }
}

@media (max-width: 580px) {
  .auth-form-wrap,
  .auth-brand {
    padding: 26px;
  }

  .learn-grid,
  .plans-grid,
  .admin-form-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .toolbar input,
  .toolbar select {
    max-width: none;
  }

  .ai-assistant {
    right: 14px;
    bottom: 84px;
  }

  .ai-form {
    grid-template-columns: 1fr;
  }
}

/* Administrative layout for touch screens. */
@media (max-width: 820px) {
  .admin-shell .main { min-width: 0; }
  .admin-shell .quick-actions { display: flex; width: 100%; }
  .admin-shell .quick-actions .btn { width: 100%; }
  .admin-shell .panel { padding: 16px; min-width: 0; }
  .admin-shell .panel-head { flex-wrap: wrap; gap: 12px; }
  .admin-shell .panel-head h2 { overflow-wrap: anywhere; }
  .admin-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-shell input, .admin-shell select { font-size: 16px; min-height: 44px; min-width: 0; width: 100%; }
  .admin-shell .btn { min-height: 44px; }
  .admin-users-table, .admin-users-table tbody { display: block; min-width: 0; width: 100%; }
  .admin-users-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .admin-users-table tr { display: block; margin-bottom: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  .admin-users-table td { display: block; padding: 10px 0; overflow-wrap: anywhere; }
  .admin-users-table td::before { content: attr(data-label); display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
  .admin-users-table td:first-child { padding-top: 0; font-size: 18px; }
  .admin-users-table td:last-child { border-bottom: 0; padding-bottom: 0; }
  .admin-users-table .admin-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .admin-users-table .admin-actions .btn { width: 100%; font-size: 14px; }
  .admin-bottom-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}
@media (max-width: 580px) { .admin-form-grid { grid-template-columns: 1fr; } }

.trial-expired-dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow:auto; padding:28px; border:1px solid var(--line); border-radius:18px; background:var(--bg); color:var(--text); box-shadow:var(--shadow); }
.trial-expired-dialog::backdrop { background:rgba(0,0,0,.75); backdrop-filter:blur(4px); }
.trial-expired-dialog h2 { margin-top:0; }
.trial-expired-dialog .btn { display:flex; justify-content:center; width:100%; min-height:48px; margin-top:12px; text-decoration:none; }
