:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #172026;
  --muted: #667085;
  --line: #d9dee7;
  --primary: #1f6feb;
  --primary-strong: #195cc5;
  --button-text: #ffffff;
  --active-bg: #edf4ff;
  --active-text: #114a9f;
  --secondary-hover: #f1f4f8;
  --danger: #a41919;
  --success: #156f45;
  --warning: #875300;
  --shadow: 0 10px 28px rgb(23 32 38 / 7%);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f141b;
  --panel: #151c25;
  --text: #e5edf5;
  --muted: #9aa8b8;
  --line: #2b3746;
  --primary: #6aa8ff;
  --primary-strong: #8bbdff;
  --button-text: #08111c;
  --active-bg: #173457;
  --active-text: #d2e5ff;
  --secondary-hover: #1c2632;
  --danger: #ff9ca3;
  --success: #8bd9ad;
  --warning: #ffd47a;
  --shadow: 0 10px 30px rgb(0 0 0 / 28%);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: var(--button-text);
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--primary-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.secondary-button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.secondary-button:hover {
  background: var(--secondary-hover);
}

.compact-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.9rem;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel,
.entry-panel,
.list-panel,
.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel {
  width: min(460px, 100%);
  padding: 28px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h1,
.section-heading h2,
.sidebar-brand h2 {
  margin: 0;
  line-height: 1.15;
}

.section-heading p,
.sidebar-brand p,
.metric-card span,
.muted {
  color: var(--muted);
}

.row-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.stacked-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
}

.form-status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
}

.form-status[data-status="error"] {
  color: var(--danger);
}

.form-status[data-status="success"] {
  color: var(--success);
}

.app-frame {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--primary);
}

.sidebar-menu,
.sidebar-footer {
  display: grid;
  gap: 10px;
}

.sidebar-menu {
  margin-top: 28px;
}

.sidebar-lower-menu {
  display: grid;
  gap: 10px;
}

.tab-button.collapsible-tab {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chevron-icon {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.tab-button.collapsible-tab[aria-expanded="true"] .chevron-icon {
  transform: rotate(225deg);
}

.submenu {
  display: grid;
  gap: 6px;
  padding-left: 12px;
}

.submenu-button {
  width: 100%;
  min-height: 36px;
  justify-content: flex-start;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  text-align: left;
  font-size: 0.9rem;
}

.submenu-button.active,
.submenu-button:hover {
  background: var(--active-bg);
  color: var(--active-text);
}

.tab-button {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.tab-button.active,
.tab-button:hover {
  background: var(--active-bg);
  color: var(--active-text);
}

.session-user {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-weight: 700;
}

.theme-switcher {
  display: grid;
  gap: 8px;
}

.settings-theme-switcher {
  max-width: 360px;
}

.theme-switcher-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.theme-option {
  min-height: 34px;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 6px;
  font-size: 0.82rem;
}

.theme-option[aria-pressed="true"] {
  background: var(--primary);
  color: var(--button-text);
}

.app-content {
  padding: 28px;
  min-width: 0;
}

.dashboard-layout,
.settings-layout,
.admin-grid {
  display: grid;
  gap: 20px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.account-panel {
  max-width: 460px;
}

.metric-card {
  padding: 22px;
  box-shadow: none;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 2.2rem;
}

.admin-grid {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  align-items: start;
}

.entry-panel,
.list-panel {
  padding: 20px;
  box-shadow: none;
}

.invite-result {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
}

.strong {
  font-weight: 800;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.status-ok {
  background: rgba(21, 115, 71, 0.14);
  color: var(--success);
}

.status-warning {
  background: rgba(154, 103, 0, 0.14);
  color: var(--warning);
}

.status-error {
  background: rgba(180, 35, 24, 0.14);
  color: var(--danger);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-select {
  min-height: 34px;
  min-width: 120px;
}

.mobile-app-bar,
.sidebar-backdrop {
  display: none;
}

@media (max-width: 980px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-frame {
    display: block;
  }

  .mobile-app-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
    padding: 10px 16px;
  }

  .mobile-app-title {
    display: grid;
    gap: 2px;
  }

  .mobile-menu-button {
    width: 44px;
    padding: 0;
  }

  .hamburger-icon,
  .hamburger-icon span {
    display: block;
  }

  .hamburger-icon {
    width: 18px;
    margin: auto;
  }

  .hamburger-icon span {
    height: 2px;
    margin: 4px 0;
    background: var(--button-text);
  }

  .app-sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    width: min(84vw, 300px);
    transform: translateX(-105%);
    transition: transform 160ms ease;
  }

  .app-frame.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .app-frame.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    z-index: 25;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
  }

  .app-content {
    padding: 18px;
  }

  .row-heading,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .row-heading {
    display: grid;
  }

  th,
  td {
    padding: 10px 8px;
  }
}
