:root {
  --bg: #05010a;
  --bg-accent: linear-gradient(135deg, #0f0f2d, #241043, #4b007d);
  --card-bg: rgba(19, 10, 32, 0.88);
  --card-border: rgba(255, 255, 255, 0.08);
  --text: #f6f2ff;
  --muted: #b7a9d9;
  --accent: #a883ff;
  --accent-strong: #ed51ff;
  --danger: #ff7b8f;
  --success: #5bfab5;
  --warning: #ffb347;
  --grid-gap: 24px;
  --glow: 0 20px 60px rgba(117, 64, 255, 0.3);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

.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;
}

body.theme-dark {
  margin: 0;
  min-height: 100vh;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(77, 0, 128, 0.35), transparent 40%),
    radial-gradient(
      circle at 20% 20%,
      rgba(0, 146, 255, 0.15),
      transparent 45%
    ),
    var(--bg);
}

.topbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar .brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.topbar .brand img {
  height: 150px;
  width: auto;
  object-fit: cover;
}

.topbar h1 {
  font-size: 3rem;
  margin: 0 0 12px;
  letter-spacing: 1px;
}

.topbar select,
.topbar button,
.topbar a {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}

.topbar button:hover,
.topbar a:hover,
.topbar select:focus {
  border-color: var(--accent);
  outline: none;
}

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

.month-strip {
  max-width: 1200px;
  margin: 0 auto 16px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  align-items: center;
}

.date-pill {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.date-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-left: 8px;
}

#currentDateDisplay {
  font-size: 0.95rem;
  margin-left: 8px;
}

.month-selector-group select {
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 10px 16px;
}

.month-strip .primary {
  justify-self: flex-end;
}

.dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding: 0 8px;
}

.tab {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 10px 18px;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease;
}

.tab:hover {
  border-color: var(--accent);
}

.tab.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #0d031b;
  box-shadow: 0 15px 35px rgba(168, 131, 255, 0.35);
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--grid-gap);
}

.history-card .history-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
}

.history-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.history-card .carry-btn {
  align-self: flex-start;
}

@media (min-width: 768px) {
  .history-card .history-header {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
  }

  .history-card .carry-btn {
    align-self: center;
  }
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  font-variant-numeric: tabular-nums;
}

.history-item .label {
  color: var(--muted);
}

.history-item .value {
  font-weight: 600;
}

.history-item.positive .value {
  color: var(--success);
}

.history-item.negative .value {
  color: var(--danger);
}

.charges-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 0 0 12px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--glow);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: calc(var(--radius) - 2px);
  background: rgba(255, 255, 255, 0.01);
  pointer-events: none;
  mix-blend-mode: screen;
}

.card > * {
  position: relative;
  z-index: 2;
}

.summary-card {
  text-align: center;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
}

.summary-grid .label {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 1.4px;
  color: var(--muted);
  margin-bottom: 6px;
}

.summary-grid .value {
  font-size: 1.8rem;
  font-weight: 600;
  margin: 0;
}

.summary-grid .value.accent {
  color: var(--accent);
}

.summary-grid .value.highlight {
  color: var(--accent-strong);
  text-shadow: 0 0 15px rgba(237, 81, 255, 0.4);
}

.incomes-card h2,
.recurring-card h2,
.expenses-card h2 {
  margin-top: 0;
  margin-bottom: 12px;
}

.incomes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.carry-btn {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
  padding-inline: 14px;
}

.settings-link {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  border: none;
  color: #0d031b;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(173, 132, 255, 0.35);
}

.button-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #0d031b;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(168, 131, 255, 0.35);
  border: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.button-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(168, 131, 255, 0.45);
}

button {
  border-radius: 999px;
  padding: 12px 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
}

.icon-button {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
}

.icon-button img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

button.icon-only {
  padding: 8px 12px;
  min-width: 44px;
}

button.danger {
  background: rgba(255, 123, 143, 0.12);
  border-color: rgba(255, 123, 143, 0.4);
  color: var(--danger);
}

button:hover {
  filter: brightness(1.1);
}

.row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.row input.text,
.row input.num,
.expense-form input,
.expense-form select {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
}

.row input.num {
  max-width: 180px;
}

@media (max-width: 640px) {
  .incomes-card .row {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .incomes-card .row input.text {
    flex: 1.8;
    padding: 9px;
  }

  .incomes-card .row input.num {
    flex: 0.8;
    max-width: 90px;
    padding: 9px;
    font-size: 0.9rem;
  }

  .incomes-card .row button {
    padding: 8px;
    width: 36px;
    font-size: 0;
  }

  .incomes-card .row button::after {
    content: "✕";
    font-size: 16px;
    color: var(--danger);
  }
}

.row-readonly {
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.row-readonly .label {
  font-weight: 600;
}

.row-readonly .amount {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.row-recurring-toggle {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 16px;
  transition:
    transform 0.15s ease,
    background 0.25s ease,
    border-color 0.25s ease,
    color 0.25s ease;
  cursor: pointer;
}

.row-recurring-toggle:is(:hover, :focus-visible) {
  border-color: rgba(168, 131, 255, 0.5);
  background: rgba(168, 131, 255, 0.1);
}

.row-recurring-toggle:focus-visible {
  outline: 2px solid rgba(168, 131, 255, 0.6);
  outline-offset: 2px;
}

.row-fixed-charge.is-paid {
  background: rgba(91, 250, 181, 0.18);
  border-color: rgba(91, 250, 181, 0.55);
  box-shadow: 0 10px 25px rgba(91, 250, 181, 0.25);
}

.row-fixed-charge.is-paid .amount {
  color: var(--success);
}

.row-subscription.is-paid {
  background: rgba(168, 131, 255, 0.18);
  border-color: rgba(168, 131, 255, 0.55);
  box-shadow: 0 10px 25px rgba(168, 131, 255, 0.3);
}

.row-subscription.is-paid .amount {
  color: var(--accent-strong);
}

.row-credit.is-paid {
  background: rgba(255, 179, 71, 0.2);
  border-color: rgba(255, 179, 71, 0.6);
  box-shadow: 0 10px 25px rgba(255, 179, 71, 0.35);
}

.row-credit.is-paid .amount {
  color: var(--warning);
}

.row-recurring-toggle.is-animating {
  transform: scale(0.97);
}

.fixed-list {
  margin-bottom: 12px;
}

.grid.recurring-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--grid-gap);
}

.savings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--grid-gap);
}

.savings-chart-wrapper {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.savings-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.savings-card-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.savings-category-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.savings-category-form input {
  flex: 1;
  min-width: 220px;
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.savings-category-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 16px;
}

@media (max-width: 640px) {
  .savings-category-list {
    grid-template-columns: 1fr;
  }

  .variable-delete {
    padding: 10px;
    width: 44px;
    font-size: 0;
  }

  .variable-delete::after {
    content: "✕";
    font-size: 20px;
    color: var(--danger);
  }
}

.savings-category-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.savings-category-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.savings-category-card header h3 {
  margin: 0;
}

.savings-category-card table {
  width: 100%;
  border-collapse: collapse;
}

.savings-category-card th,
.savings-category-card td {
  text-align: left;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.savings-category-card td:last-child {
  text-align: right;
}

.savings-entry-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.savings-entry-form input {
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.savings-amount {
  color: var(--success);
  font-weight: 600;
}

.savings-entry-empty {
  margin: 0;
  font-style: italic;
  color: var(--muted);
}

.savings-month-total {
  margin: 0;
  font-weight: 600;
  align-self: flex-end;
}

.recurring-card.wide {
  grid-column: span 2;
}

@media (max-width: 640px) {
  .recurring-card.wide {
    grid-column: span 1;
  }
}

.recurring-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.totals {
  font-weight: 600;
  color: var(--muted);
}

.recurring-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  gap: 12px;
}

.recurring-card .fixed-list {
  flex: 1;
}

.recurring-card .totals {
  margin-top: auto;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  opacity: 0.95;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(168, 131, 255, 0.08);
  box-shadow: 0 12px 35px rgba(168, 131, 255, 0.25);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.recurring-card .totals span {
  color: var(--accent-strong);
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
}

.expense-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.9rem;
}

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

.expenses-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.expenses-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.expenses-header-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.expense-sort-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.expense-sort-select {
  min-width: 170px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 1, 10, 0.7);
  color: var(--text);
  padding: 6px 36px 6px 12px;
  font-size: 0.95rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath fill='%23A883FF' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 14px) center;
  background-size: 12px 7px;
}

.expense-sort-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(168, 131, 255, 0.2);
}

.sort-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.sort-toggle img {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.sort-toggle[data-dir="desc"] img {
  transform: rotate(180deg);
}

.sort-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(168, 131, 255, 0.4);
}

.sort-toggle:hover {
  border-color: var(--accent);
}

.table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 560px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
}

#expensesTable tr.is-latest,
#variableChargesTable tr.is-latest {
  background: rgba(168, 131, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(168, 131, 255, 0.4);
}

#expensesTable td:last-child,
#variableChargesTable td:last-child {
  width: 90px;
  text-align: center;
}

#expensesTable td:last-child button,
#variableChargesTable td:last-child button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.variable-charges-chart {
  margin-top: 16px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
}

.variable-charges-chart h3 {
  margin: 0 0 1em;
}

.variable-charges-chart canvas {
  max-width: 420px;
  width: 100%;
}

.savings-chart-wrapper .chart-wrapper {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.savings-chart-wrapper canvas {
  width: 100% !important;
  height: auto !important;
  max-width: 420px;
}

.chart-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
}

.chart-card-duo {
  align-items: stretch;
}

.chart-duo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  width: 100%;
}

.chart-unit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
}

.chart-unit h3 {
  margin: 0;
  font-size: 1.1rem;
}

.chart-card-header h2 {
  margin: 0;
}

.chart-card-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.chart-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.chart-wrapper canvas {
  max-width: 320px;
}

.chart-empty {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
}

thead {
  background: rgba(255, 255, 255, 0.04);
}

thead th {
  text-align: left;
  padding: 14px 16px;
  font-size: 0.9rem;
  letter-spacing: 0.4px;
}

tbody td {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

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

.expense-flag {
  width: 60px;
  text-align: center;
  font-weight: 600;
}

.expense-flag .flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.06);
}

.expense-flag .flag.expense {
  color: var(--danger);
  border: 1px solid rgba(255, 123, 143, 0.5);
}

.expense-flag .flag.refund {
  color: var(--success);
  border: 1px solid rgba(91, 250, 181, 0.5);
}

.expense-amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

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

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

.imp-low td {
  opacity: 0.95;
  border-left: 4px solid var(--success);
}

.imp-med td {
  font-weight: 600;
  border-left: 4px solid var(--warning);
}

.imp-high td {
  font-weight: 700;
  border-left: 4px solid var(--danger);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(20, 20, 45, 0.9);
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  font-size: 0.9rem;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
}

.toast[data-type="warn"] {
  background: rgba(255, 145, 0, 0.85);
}

.toast.toast-error {
  background: var(--danger);
  color: var(--bg);
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.empty {
  color: var(--muted);
  font-style: italic;
}

/* Settings page adjustments */

.settings-page {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 32px 24px 60px;
  font-family: "Inter", system-ui, sans-serif;
}

.settings-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.settings-tip {
  color: var(--muted);
  margin-bottom: 24px;
}

.settings-note {
  color: var(--muted);
  margin: 0;
}

.manage-list .row-manage {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.manage-card {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row-manage {
  gap: 12px;
  align-items: center;
}

.row-manage input.text {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
}

.row-manage input.num {
  max-width: 160px;
}

.row-manage button.icon-only {
  padding: 10px 14px;
  min-width: 44px;
}

.manage-add-btn {
  margin-top: 12px;
  align-self: flex-start;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 1, 10, 0.88);
  backdrop-filter: blur(6px);
  z-index: 999;
  transition: opacity 0.2s ease;
}

.auth-overlay.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 32px;
  width: min(360px, 90vw);
  box-shadow: var(--glow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-card h2 {
  margin: 0;
  font-size: 1.5rem;
}

.auth-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

.auth-form input {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.auth-form button.primary {
  width: 100%;
}

.auth-error {
  min-height: 1.25em;
  color: var(--danger);
  margin: 0;
  font-size: 0.9rem;
}

.auth-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.auth-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  justify-content: center;
}

.auth-switch-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.profile-shell {
  position: relative;
}

.profile-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  padding: 6px 12px;
  cursor: pointer;
  color: var(--text);
}

.profile-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  min-width: 220px;
  padding: 16px;
  box-shadow: var(--glow);
  display: none;
  flex-direction: column;
  gap: 12px;
  z-index: 20;
}

.profile-shell.is-open .profile-menu {
  display: flex;
}

.profile-email {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  word-break: break-all;
}

.profile-logout {
  border-radius: 999px;
  background: var(--danger);
  border: none;
  color: var(--bg);
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
}
