:root {
  color-scheme: light dark;
  --bg: #f5f6f9;
  --panel: #ffffff;
  --panel-subtle: #fafbfc;
  --border: #e6e8ee;
  --text: #1f2126;
  --muted: #6b6f78;
  --accent: #3355d1;
  --accent-hover: #2945ad;
  --accent-tint: color-mix(in srgb, var(--accent) 10%, transparent);
  --danger: #b3392f;
  --danger-hover: #952f27;
  --danger-tint: color-mix(in srgb, var(--danger) 10%, transparent);
  --paid: #1f7a4d;
  --paid-tint: color-mix(in srgb, var(--paid) 12%, transparent);
  --partial: #a3720a;
  --partial-tint: color-mix(in srgb, var(--partial) 13%, transparent);
  --unpaid: #b3392f;

  /* Layered "elevation" shadows for a modern, depth-y feel */
  --shadow-xs: 0 1px 2px rgba(20, 24, 40, 0.04);
  --shadow-sm: 0 1px 2px rgba(20, 24, 40, 0.04), 0 4px 10px rgba(20, 24, 40, 0.05);
  --shadow-md: 0 2px 4px rgba(20, 24, 40, 0.05), 0 10px 24px rgba(20, 24, 40, 0.08);
  --shadow-lg: 0 8px 16px rgba(20, 24, 40, 0.08), 0 20px 40px rgba(20, 24, 40, 0.12);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --radius: 14px;
  --radius-sm: 9px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101114;
    --panel: #1a1b1f;
    --panel-subtle: #202126;
    --border: #2c2e35;
    --text: #ecedf0;
    --muted: #999ba5;
    --accent: #7d92e8;
    --accent-hover: #93a5ec;
    --danger-hover: #d1584c;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.4), 0 24px 48px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

@media (max-width: 640px) {
  html {
    /* Prevents iOS Safari's auto-zoom-on-focus, which otherwise makes the whole
       page appear to load "zoomed in" once any input has been focused */
    -webkit-text-size-adjust: 100%;
  }
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- App shell: sidebar + main content --- */

.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

.sidebar {
  flex-shrink: 0;
  width: 220px;
  background: var(--panel);
  color: var(--text);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.1rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.brand-badge {
  width: 1.9rem;
  height: 1.9rem;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--panel-subtle);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.brand-name {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.sidebar-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-account {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.account-name {
  font-size: 0.78rem;
  color: var(--text);
  margin-bottom: 0.15rem;
  word-break: break-word;
}

.period-picker {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.period-picker label {
  color: var(--muted);
}

.period-picker input,
.period-picker select {
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: block;
}

.class-row {
  display: flex;
  gap: 0.6rem;
}

.class-row label {
  flex: 1;
}

.app-main {
  flex: 1;
  min-width: 0;
  max-width: 1300px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2.5rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem 1.1rem;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.35s var(--ease) both;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.panel-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.panel-header h2 {
  font-size: 0.92rem;
  margin: 0;
}

button {
  font: inherit;
  padding: 0.35rem 0.75rem;
  min-height: 2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.85rem;
  box-shadow: var(--shadow-xs);
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease),
              transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

button:hover {
  border-color: color-mix(in srgb, var(--text) 22%, var(--border));
  background: color-mix(in srgb, var(--text) 4%, var(--panel));
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

button:active {
  transform: scale(0.97) translateY(0);
  box-shadow: var(--shadow-xs);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

#newStudentBtn, button[type="submit"], button[data-action="pay"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-xs), 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent);
}

#newStudentBtn:hover, button[type="submit"]:hover, button[data-action="pay"]:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-sm), 0 4px 14px color-mix(in srgb, var(--accent) 45%, transparent);
}

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

button.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  min-width: 640px;
  font-variant-numeric: tabular-nums;
}

th, td {
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--panel-subtle);
  border-bottom: 1px solid var(--border);
}

tbody tr:nth-child(even) {
  background: var(--panel-subtle);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 1.5rem 1rem;
  font-style: italic;
}

tr.row-link {
  cursor: pointer;
  transition: background-color 0.15s var(--ease);
}

tr.row-link:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  box-shadow: var(--shadow-xs);
}

.status::before {
  content: "";
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: currentColor;
}

.status.paid { background: var(--paid-tint); color: var(--paid); }
.status.partial { background: var(--partial-tint); color: var(--partial); }
.status.unpaid { background: var(--danger-tint); color: var(--unpaid); }

.totals {
  margin-top: 0.85rem;
  display: flex;
  gap: 1.25rem;
  font-size: 0.83rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.totals strong {
  color: var(--text);
}

dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  background: var(--panel);
  color: var(--text);
  width: min(400px, 90vw);
  box-shadow: var(--shadow-lg);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), display 0.2s allow-discrete, overlay 0.2s allow-discrete;
}

dialog[open] {
  animation: dialogIn 0.2s var(--ease) both;
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

dialog::backdrop {
  background: rgba(10, 10, 20, 0.4);
}

dialog form {
  padding: 1.1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

dialog h3 {
  margin: 0 0 0.15rem;
  font-size: 1rem;
}

dialog h4 {
  margin: 0.4rem 0 0.15rem;
  font-size: 0.8rem;
  color: var(--muted);
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

label > input,
label > select,
label > textarea {
  width: 100%;
  font-weight: 400;
}

input,
select,
textarea {
  font: inherit;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
  outline: none;
}

@media (max-width: 640px) {
  input, select, textarea {
    /* iOS Safari auto-zooms the page when focusing a field smaller than 16px —
       this is what caused the app to open "zoomed in" once a field was tapped. */
    font-size: 16px;
  }
}

textarea {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
}

input:hover,
select:hover {
  border-color: color-mix(in srgb, var(--text) 18%, var(--border));
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
  align-items: center;
}

.spacer { flex: 1; }

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

.auth-card .muted {
  text-align: center;
  font-size: 1rem;
  color: #5b6b8c;
}

.payment-history {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 130px;
  overflow-y: auto;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.payment-history li {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0.55rem;
  border-bottom: 1px solid var(--border);
}

.payment-history li:last-child { border-bottom: none; }

.payment-history .del {
  color: var(--danger);
  cursor: pointer;
  font-size: 0.76rem;
}

.history-actions {
  display: flex;
  gap: 0.65rem;
  flex-shrink: 0;
}

.payment-history .receipt {
  color: var(--accent);
  cursor: pointer;
  font-size: 0.76rem;
}

.auth-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: #f5f8ff;
  background-image:
    radial-gradient(ellipse 55% 35% at 12% 0%, rgba(23, 105, 232, 0.05), transparent),
    radial-gradient(ellipse 45% 35% at 100% 100%, rgba(23, 105, 232, 0.05), transparent);
}

.auth-card {
  background: #ffffff;
  border: 1px solid #e6edfb;
  border-radius: 28px;
  padding: 2.25rem 2rem;
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.1rem;
  box-shadow: 0 4px 14px rgba(23, 105, 232, 0.06), 0 20px 45px rgba(23, 105, 232, 0.10);
  animation: fadeInUp 0.4s var(--ease) both;
}

.auth-card button[type="submit"] {
  width: 100%;
  margin-top: 0.35rem;
  height: 60px;
  min-height: 60px;
  border-radius: 16px;
  background: #1769e8;
  border-color: #1769e8;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  box-shadow: 0 10px 22px rgba(23, 105, 232, 0.28);
}

.auth-card button[type="submit"]:hover {
  background: #145ecb;
  border-color: #145ecb;
  box-shadow: 0 12px 26px rgba(23, 105, 232, 0.32);
}

.auth-card button[type="submit"]:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 6px 14px rgba(23, 105, 232, 0.26);
}

@media (max-width: 480px) {
  .auth-view {
    padding: 20px;
    padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    align-items: center;
  }

  .auth-card {
    width: 100%;
    border-radius: 24px;
    padding: 1.85rem 1.4rem;
  }

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

.auth-badge {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: #e9f1ff;
  box-shadow: inset 0 0 0 1px rgba(23, 105, 232, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 0.25rem;
}

.auth-card h2 {
  margin: 0 0 0.15rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: #101b33;
  text-align: center;
  letter-spacing: -0.01em;
}

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

.auth-card .error {
  text-align: center;
  font-size: 0.85rem;
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrap input {
  width: 100%;
  height: 60px;
  padding: 0 2.75rem 0 3rem;
  border-radius: 16px;
  background: #f7faff;
  border: 1px solid #dce6f7;
  color: #101b33;
}

.input-icon-wrap input:focus-visible {
  border-color: #1769e8;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(23, 105, 232, 0.12);
  outline: none;
}

.input-icon-wrap .password-toggle {
  padding-right: 2.5rem;
}

.input-icon-wrap > svg.input-icon {
  position: absolute;
  left: 1rem;
  width: 1.15rem;
  height: 1.15rem;
  color: #6b7ba3;
  pointer-events: none;
}

.password-toggle {
  position: absolute;
  right: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  box-shadow: none;
  min-height: auto;
  padding: 0.3rem;
  color: var(--muted);
}

.password-toggle:hover {
  background: transparent;
  color: var(--text);
  transform: none;
  box-shadow: none;
}

.password-toggle .input-icon {
  width: 1.1rem;
  height: 1.1rem;
}

#usersModal {
  width: min(460px, 92vw);
}

#bulkImportModal {
  width: min(600px, 94vw);
}

.link-action {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.import-preview {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.import-preview table {
  min-width: 0;
  font-size: 0.78rem;
}

.import-preview .row-error td {
  background: var(--danger-tint);
  color: var(--danger);
}

.import-summary {
  font-size: 0.8rem;
  margin: 0.4rem 0;
}

.users-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.4rem;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.users-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--border);
}

.users-list li:last-child { border-bottom: none; }

.users-list .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.users-list button {
  padding: 0.2rem 0.5rem;
  font-size: 0.74rem;
  min-height: auto;
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  animation: fadeInUp 0.35s var(--ease) both;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-card:has(.stat-value.collected) { border-left-color: var(--paid); }
.stat-card:has(.stat-value.outstanding) { border-left-color: var(--unpaid); }

.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-value.collected { color: var(--paid); }
.stat-value.outstanding { color: var(--unpaid); }

@media (max-width: 640px) {
  .dashboard-cards {
    grid-template-columns: 1fr;
  }
}

.section-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.section-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  animation: fadeInUp 0.35s var(--ease) both;
}

.section-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.section-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
}

.section-stats {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.section-stats > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.section-stats .stat-value {
  font-size: 1rem;
}

/* --- Mobile top bar + off-canvas sidebar (hamburger menu) --- */

.mobile-topbar {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.icon-btn {
  min-height: auto;
  padding: 0.35rem 0.55rem;
  font-size: 1.1rem;
  line-height: 1;
}

@media (max-width: 640px) {
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
  }

  .mobile-topbar .sidebar-brand {
    gap: 0.5rem;
  }

  .mobile-topbar .brand-name {
    font-size: 0.85rem;
  }

  .app-shell {
    flex-direction: column;
    min-height: 0;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    width: min(280px, 82vw);
    max-width: 82vw;
    z-index: 40;
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
  }

  .sidebar-backdrop.visible {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 20, 0.4);
    z-index: 35;
  }

  .sidebar-brand {
    justify-content: flex-start;
  }

  .period-picker {
    flex-direction: column;
  }

  .period-picker label {
    flex: none;
  }

  .sidebar-account {
    flex-direction: column;
  }

  .app-main {
    padding: 1rem 0.85rem 1.5rem;
  }

  .modal-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .modal-actions button {
    width: 100%;
  }

  .modal-actions .spacer {
    display: none;
  }

  .users-list .row-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .users-list .row-actions button {
    width: 100%;
  }

  /* Student table -> stacked cards (no horizontal scrolling, reads as a native mobile list) */
  #summaryTable, #summaryTable thead, #summaryTable tbody, #summaryTable tr, #summaryTable td {
    display: block;
    width: 100%;
  }

  #summaryTable {
    min-width: 0;
  }

  #summaryTable thead {
    display: none;
  }

  #summaryTable tbody tr {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.7rem;
    margin-bottom: 0.6rem;
    box-shadow: var(--shadow-sm);
  }

  #summaryTable tbody tr:nth-child(even) {
    background: var(--panel);
  }

  #summaryTable td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.3rem 0;
    border-bottom: none;
    text-align: right;
  }

  #summaryTable td[data-label]::before {
    content: attr(data-label);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    text-align: left;
  }

  #summaryTable td[data-label="Name"] {
    font-weight: 600;
    font-size: 0.95rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.3rem;
  }

  #summaryTable td:last-child {
    padding-top: 0.5rem;
    display: block;
  }

  #summaryTable td:last-child .table-actions {
    flex-direction: column;
    align-items: stretch;
  }

  #summaryTable td:last-child .table-actions button {
    width: 100%;
  }

  .empty-state {
    display: block !important;
    text-align: center !important;
  }
}

@media (max-width: 480px) {
  .brand-name {
    font-size: 0.75rem;
  }

  .stat-value {
    font-size: 1.1rem;
  }

  th, td {
    padding: 0.4rem 0.35rem;
  }

  button {
    padding: 0.45rem 0.7rem;
    font-size: 0.82rem;
  }
}

@media (min-width: 1024px) {
  .stat-card {
    padding: 0.9rem 1.15rem;
  }

  .stat-value {
    font-size: 1.4rem;
  }

  .section-card {
    padding: 0.9rem 1.15rem;
  }

  table {
    font-size: 0.85rem;
  }

  th, td {
    padding: 0.5rem 0.55rem;
  }
}
