:root {
  --background: #f4f6fa;
  --surface: #ffffff;
  --surface-secondary: #f8fafc;
  --surface-hover: #f1f5f9;

  --border: #e2e8f0;

  --text: #172033;
  --text-muted: #68758c;

  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-rgb: 37, 99, 235;

  --success: #15803d;
  --success-light: #dcfce7;

  --danger: #dc2626;
  --danger-light: #fee2e2;

  --warning: #c2410c;
  --warning-light: #ffedd5;

  --sidebar-width: 240px;
  --topbar-height: 72px;

  --shadow:
    0 12px 30px rgba(15, 23, 42, 0.07);
}

html[data-theme-color="blue"] {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-rgb: 37, 99, 235;
}

html[data-theme-color="pink"] {
  --primary: #db2777;
  --primary-dark: #be185d;
  --primary-light: #fce7f3;
  --primary-rgb: 219, 39, 119;
}

html[data-theme-color="red"] {
  --primary: #dc2626;
  --primary-dark: #b91c1c;
  --primary-light: #fee2e2;
  --primary-rgb: 220, 38, 38;
}

html[data-theme-color="orange"] {
  --primary: #ea580c;
  --primary-dark: #c2410c;
  --primary-light: #ffedd5;
  --primary-rgb: 234, 88, 12;
}

html[data-theme-color="green"] {
  --primary: #16a34a;
  --primary-dark: #15803d;
  --primary-light: #dcfce7;
  --primary-rgb: 22, 163, 74;
}

html[data-theme-mode="dark"] {
  color-scheme: dark;

  --background: #0f172a;
  --surface: #111827;
  --surface-secondary: #182133;
  --surface-hover: #1e293b;

  --border: #2a3548;

  --text: #f8fafc;
  --text-muted: #9aa7ba;

  --shadow:
    0 12px 30px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family: "Inter", sans-serif;
  line-height: 1.5;
}

body.modal-open {
  overflow: hidden;
}

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

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

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

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

.hidden {
  display: none !important;
}

/* Authentication */

.auth-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, #6366f1 0, transparent 35%),
    linear-gradient(135deg, #111827, #1e1b4b);
}

.auth-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 1fr 1fr;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.auth-introduction {
  color: #ffffff;
  flex-direction: column;
  align-items: flex-start;
  gap: 56px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.auth-brand h1 {
  margin-bottom: 6px;
  font-size: 34px;
}

.auth-brand p {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.72);
}

.brand-mark {
  display: inline-flex;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  color: #ffffff;
  background: var(--primary);
  font-weight: 700;
}

.brand-mark-large {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.15);
  font-size: 24px;
  backdrop-filter: blur(12px);
}

.auth-feature-list {
  display: grid;
  gap: 18px;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-feature span {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.13);
}

.auth-feature p {
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
}

.auth-form-panel {
  background: rgba(255, 255, 255, 0.96);
}

.auth-card {
  width: 100%;
  max-width: 430px;
}

.auth-heading {
  margin-bottom: 30px;
}

.auth-heading h2 {
  margin-bottom: 8px;
  font-size: 30px;
}

.auth-heading p:last-child {
  margin-bottom: 0;
  color: var(--text-muted);
}

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

.auth-switch a {
  color: var(--primary);
  font-weight: 600;
}

/* Header */

.topbar {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
}

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

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
}

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

.username {
  color: var(--text-muted);
  font-size: 14px;
}

.mobile-menu-button {
  display: none;
  border: 0;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
}

/* Sidebar and layout */

.app-layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--topbar-height);
}

.sidebar {
  position: fixed;
  z-index: 40;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 16px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

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

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
  color: var(--primary);
  background: var(--primary-light);
}

.sidebar-icon {
  display: inline-flex;
  width: 24px;
  justify-content: center;
  font-size: 17px;
}

.sidebar-footer {
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-secondary);
}

.sidebar-footer p {
  margin-bottom: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.sidebar-footer strong {
  font-size: 14px;
}

.sidebar-overlay {
  display: none;
}

.main-content {
  width: calc(100% - var(--sidebar-width));
  max-width: 1500px;
  margin-left: var(--sidebar-width);
  padding: 34px;
}

/* General components */

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.page-heading h1 {
  margin-bottom: 7px;
  font-size: 30px;
}

.page-heading p:last-child {
  margin-bottom: 0;
  color: var(--text-muted);
}

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

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

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

.button-primary {
  color: #ffffff;
  background: var(--primary);
}

.button-primary:hover {
  background: var(--primary-dark);
}

.button-secondary {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}

.button-success {
  color: #ffffff;
  background: var(--success);
}

.button-danger-text {
  color: var(--danger);
  background: transparent;
}

.button-small {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 13px;
}

.button-full {
  width: 100%;
}

.panel {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.panel-heading h2 {
  margin-bottom: 4px;
  font-size: 20px;
}

.panel-heading p {
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.text-link,
.stat-link {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  display: flex;
  min-height: 170px;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.balance-card {
  color: #ffffff;
  border-color: transparent;
  background:
    linear-gradient(
      135deg,
      var(--primary),
      var(--primary-dark)
    );
}

.balance-card .stat-link,
.balance-card .stat-header {
  color: rgba(255, 255, 255, 0.82);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.stat-icon {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.1);
}

.balance-card .stat-icon {
  background: rgba(255, 255, 255, 0.16);
}

.stat-value {
  margin: 22px 0 12px;
  font-size: 31px;
}

.stat-subtitle {
  color: var(--text-muted);
  font-size: 13px;
}

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

.list {
  display: grid;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}

.list-item:last-child {
  border-bottom: 0;
}

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

.list-item span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.empty-state {
  padding: 52px 20px;
  text-align: center;
}

.empty-state h3 {
  margin-bottom: 8px;
}

.empty-state p {
  max-width: 420px;
  margin: 0 auto 18px;
  color: var(--text-muted);
}

.completed-text {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* Forms */

.form-stack {
  display: grid;
  gap: 18px;
}

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

.form-group {
  display: grid;
  gap: 7px;
}

.form-group label {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  min-height: 45px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  color: var(--text);
  background: var(--surface);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.form-group textarea {
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow:
    0 0 0 3px rgba(var(--primary-rgb), 0.14);
}

.form-message {
  padding: 11px 13px;
  border-radius: 9px;
  font-size: 13px;
}

.form-message-error {
  color: #991b1b;
  background: var(--danger-light);
}

.form-message-success {
  color: #166534;
  background: var(--success-light);
}

/* Bills */

.balance-panel {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 24px;
  padding: 26px;
  border-radius: 18px;
  color: #ffffff;
  background:
  linear-gradient(
    135deg,
    var(--primary),
    var(--primary-dark)
  );
  box-shadow: var(--shadow);
}

.balance-panel span,
.balance-panel strong,
.balance-panel small {
  display: block;
}

.balance-panel span {
  margin-bottom: 6px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
}

.balance-panel strong {
  margin-bottom: 5px;
  font-size: 34px;
}

.balance-panel small {
  color: rgba(255, 255, 255, 0.68);
}

.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.inline-form .form-group label {
  color: rgba(255, 255, 255, 0.85);
}

.inline-form input {
  min-width: 170px;
}

.filter-group {
  display: flex;
  gap: 6px;
}

.filter-button {
  padding: 7px 12px;
  border-radius: 9px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.filter-button:hover,
.filter-button.active {
  color: var(--primary);
  background: var(--primary-light);
}

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

.bill-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-secondary);
}

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

.bill-card h3 {
  margin: 5px 0 0;
  font-size: 17px;
}

.ticket-number {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.bill-amount {
  display: block;
  margin: 22px 0;
  font-size: 29px;
}

.bill-details {
  display: grid;
  gap: 10px;
  margin: 0;
}

.bill-details div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.bill-details dt,
.bill-details dd {
  margin: 0;
  font-size: 12px;
}

.bill-details dt {
  color: var(--text-muted);
}

.bill-details dd {
  font-weight: 600;
  text-transform: capitalize;
}

.bill-notes {
  margin: 16px 0 0;
  padding: 12px;
  border-radius: 10px;
  color: var(--text-muted);
  background: var(--surface);
  font-size: 12px;
}

.bill-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 20px;
}

.status-badge,
.priority-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}

.status-paid {
  color: var(--success);
  background: var(--success-light);
}

.status-unpaid {
  color: var(--warning);
  background: var(--warning-light);
}

/* Reminders */

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

.reminder-card {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-secondary);
}

.reminder-completed {
  opacity: 0.7;
}

.reminder-completed h3 {
  text-decoration: line-through;
}

.completion-button {
  display: inline-flex;
  width: 25px;
  height: 25px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  color: #ffffff;
  background: transparent;
  cursor: pointer;
}

.completion-button.completed {
  border-color: var(--success);
  background: var(--success);
}

.reminder-content {
  min-width: 0;
  flex: 1;
}

.reminder-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.reminder-heading h3 {
  margin-bottom: 3px;
  font-size: 16px;
}

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

.reminder-content > p {
  margin: 13px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.priority-low {
  color: #0369a1;
  background: #e0f2fe;
}

.priority-medium {
  color: #a16207;
  background: #fef9c3;
}

.priority-high {
  color: var(--danger);
  background: var(--danger-light);
}

.icon-button {
  display: inline-flex;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  font-size: 20px;
}

.icon-button.danger {
  color: var(--danger);
}

/* Modal */

.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.visible {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 25px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}

.modal-header h2 {
  margin-bottom: 0;
}

.modal-close {
  border: 0;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  font-size: 28px;
}

/* Toast */

.toast-container {
  position: fixed;
  z-index: 200;
  top: 90px;
  right: 22px;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 260px;
  max-width: 380px;
  padding: 13px 16px;
  border-radius: 11px;
  color: #ffffff;
  opacity: 0;
  box-shadow: var(--shadow);
  transform: translateY(-8px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: #166534;
}

.toast-error {
  background: #b91c1c;
}

html[data-theme-mode="dark"] body {
  background: var(--background);
  color: var(--text);
}

html[data-theme-mode="dark"] .topbar {
  background: rgba(17, 24, 39, 0.95);
}

html[data-theme-mode="dark"] .auth-form-panel {
  background: rgba(17, 24, 39, 0.98);
}

html[data-theme-mode="dark"] .form-group input,
html[data-theme-mode="dark"] .form-group select,
html[data-theme-mode="dark"] .form-group textarea {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-secondary);
}

html[data-theme-mode="dark"] .button-secondary {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-secondary);
}

html[data-theme-mode="dark"] .modal-dialog {
  background: var(--surface);
}

html[data-theme-mode="dark"] .bill-notes {
  background: var(--surface);
}

html[data-theme-mode="dark"] .sidebar-overlay {
  background: rgba(0, 0, 0, 0.65);
}

.settings-grid {
  display: grid;
  gap: 24px;
}

.settings-panel {
  overflow: hidden;
}

.theme-color-grid {
  display: grid;
  grid-template-columns:
    repeat(5, minmax(120px, 1fr));
  gap: 14px;
}

.theme-color-option {
  position: relative;
  display: flex;
  min-height: 120px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px;
  border: 2px solid var(--border);
  border-radius: 15px;
  color: var(--text);
  background: var(--surface-secondary);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.theme-color-option:hover {
  transform: translateY(-2px);
  background: var(--surface-hover);
}

.theme-color-option.selected {
  border-color: var(--primary);
  box-shadow:
    0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.theme-color-preview {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  box-shadow:
    0 6px 16px rgba(15, 23, 42, 0.18);
}

.theme-blue {
  background: #2563eb;
}

.theme-pink {
  background: #db2777;
}

.theme-red {
  background: #dc2626;
}

.theme-orange {
  background: #ea580c;
}

.theme-green {
  background: #16a34a;
}

.theme-check {
  position: absolute;
  top: 10px;
  right: 12px;
  display: none;
  color: var(--primary);
  font-weight: 700;
}

.theme-color-option.selected .theme-check {
  display: block;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.setting-row h2 {
  margin-bottom: 5px;
  font-size: 20px;
}

.setting-row p {
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 30px;
  flex-shrink: 0;
}

.switch input {
  width: 0;
  height: 0;
  opacity: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5e1;
  cursor: pointer;
  transition: background 0.2s ease;
}

.switch-slider::before {
  position: absolute;
  bottom: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  content: "";
  box-shadow:
    0 2px 6px rgba(15, 23, 42, 0.25);
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-slider {
  background: var(--primary);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(26px);
}

.theme-preview-card {
  max-width: 500px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-secondary);
}

.theme-preview-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.theme-preview-header strong,
.theme-preview-header span {
  display: block;
}

.theme-preview-header span {
  color: var(--text-muted);
  font-size: 12px;
}

.theme-preview-balance {
  margin-bottom: 18px;
  padding: 20px;
  border-radius: 14px;
  color: #ffffff;
  background:
    linear-gradient(
      135deg,
      var(--primary),
      var(--primary-dark)
    );
}

.theme-preview-balance span,
.theme-preview-balance strong {
  display: block;
}

.theme-preview-balance span {
  margin-bottom: 5px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
}

.theme-preview-balance strong {
  font-size: 27px;
}

.danger-settings-panel {
  border-color: rgba(220, 38, 38, 0.22);
}

.site-footer {
  width: calc(100% - var(--sidebar-width));
  margin-left: var(--sidebar-width);
  padding: 22px 34px 28px;
  color: var(--text-muted);
  text-align: center;
  font-size: 13px;
}

.site-footer p {
  margin: 0;
}

.settings-section {
  margin-top: 32px;
}

.settings-section:first-child {
  margin-top: 0;
}

.settings-section-heading {
  margin-bottom: 18px;
}

.settings-section-heading h2 {
  margin-bottom: 5px;
}

.settings-section-heading p:last-child {
  margin-bottom: 0;
  color: var(--text-muted);
}

.settings-two-column {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.settings-action-grid {
  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.settings-panel h3 {
  margin-bottom: 16px;
}

.settings-panel > p {
  color: var(--text-muted);
}

.setting-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 18px;
  cursor: pointer;
}

.setting-checkbox input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 3px;
  accent-color: var(--primary);
}

.setting-checkbox strong,
.setting-checkbox small {
  display: block;
}

.setting-checkbox small {
  margin-top: 3px;
  color: var(--text-muted);
}

.settings-number-field {
  max-width: 320px;
  margin-top: 20px;
}

.settings-action-grid .settings-panel {
  display: flex;
  min-height: 220px;
  flex-direction: column;
}

.settings-action-grid .button {
  margin-top: auto;
}

.button-danger {
  color: #ffffff;
  background: var(--danger);
}

.button-danger:hover {
  background: #b91c1c;
}

.about-list {
  display: grid;
  gap: 14px;
  margin: 0;
}

.about-list div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.about-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.about-list dt {
  color: var(--text-muted);
}

.about-list dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.settings-button-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-help-text {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.legal-panel {
  margin-top: 20px;
}

.legal-panel p {
  color: var(--text-muted);
  line-height: 1.75;
}

.delete-account-panel {
  border-color: rgba(220, 38, 38, 0.4);
}

.delete-account-panel h2 {
  color: var(--danger);
}

.reminder-overdue {
  border-color: rgba(220, 38, 38, 0.45);
}

.status-overdue {
  color: var(--danger);
  background: var(--danger-light);
}

html.hide-balances .private-balance {
  color: transparent !important;
  user-select: none;
}

html.hide-balances .private-balance::selection {
  background: transparent;
}

html.hide-balances .private-balance {
  position: relative;
}

html.hide-balances .private-balance::after {
  position: absolute;
  left: 0;
  color: var(--text);
  content: "••••••";
  white-space: nowrap;
}

html.hide-balances .balance-card .private-balance::after,
html.hide-balances .balance-panel .private-balance::after {
  color: #ffffff;
}

.reminder-overdue {
  border-color: rgba(220, 38, 38, 0.45);
  background: rgba(220, 38, 38, 0.04);
}

.status-overdue {
  color: var(--danger);
  background: var(--danger-light);
}

.reminder-badges {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

/* Responsive */

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

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

@media (max-width: 1000px) {
  .theme-color-grid {
    grid-template-columns:
      repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1000px) {
  .settings-action-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 850px) {
  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-introduction {
    display: none;
  }

  .auth-form-panel {
    padding: 28px;
  }

  .mobile-menu-button {
    display: block;
  }

  .brand small,
  .username {
    display: none;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

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

  .sidebar-overlay {
    position: fixed;
    z-index: 35;
    inset: var(--topbar-height) 0 0;
    display: block;
    visibility: hidden;
    opacity: 0;
    background: rgba(15, 23, 42, 0.5);
    transition:
      opacity 0.2s ease,
      visibility 0.2s ease;
  }

  .sidebar-overlay.visible {
    visibility: visible;
    opacity: 1;
  }

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

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

  .balance-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .inline-form {
    align-items: stretch;
  }

  .site-footer {
    width: 100%;
    margin-left: 0;
    padding-right: 24px;
    padding-left: 24px;
  }
}

@media (max-width: 700px) {
  .settings-two-column,
  .settings-action-grid {
    grid-template-columns: 1fr;
  }

  .about-list div {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .about-list dd {
    text-align: left;
  }
}

@media (max-width: 650px) {
  .topbar {
    padding: 0 16px;
  }

  .topbar-actions {
    gap: 7px;
  }

  .main-content {
    padding: 20px 15px;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .page-actions {
    flex-wrap: wrap;
  }

  .stat-grid,
  .card-grid {
    grid-template-columns: 1fr;
  }

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

  .responsive-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-group {
    width: 100%;
    overflow-x: auto;
  }

  .inline-form {
    flex-direction: column;
  }

  .inline-form input {
    min-width: 0;
  }

  .reminder-heading {
    flex-direction: column;
  }

  .toast-container {
    right: 15px;
    left: 15px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }

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

.setting-row {
  align-items: flex-start;
  flex-direction: column;
  }

.site-footer {
  padding-right: 15px;
  padding-left: 15px;
  }
}

.site-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
}

.site-logo-log-reg {
  width: 92px;
  height: 92px;
  object-fit: contain;
  border-radius: 10px;
}