:root {
  --bg: #f5f7fb;
  --bg-card: #ffffff;
  --sidebar: #ffffff;
  --sidebar-muted: #e2e8f0;
  --primary: #2563eb;
  --accent: #0ea5e9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5f5;
  --shadow-soft: 0 10px 25px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 30px 60px rgba(15, 23, 42, 0.1);
  --radius: 18px;
  --transition: 200ms cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body.command-open {
  overflow: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent);
}

.container {
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.app-shell__main {
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-sidebar {
  width: 260px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: width var(--transition), transform var(--transition);
  box-shadow: 6px 0 30px rgba(15, 23, 42, 0.05);
  z-index: 900;
}

.app-shell.sidebar-collapsed .app-sidebar {
  width: 84px;
}

.app-shell.sidebar-collapsed .app-sidebar__brand {
  justify-content: center;
  gap: 0.5rem;
}

.app-shell.sidebar-collapsed .brand {
  justify-content: center;
}

.app-shell.sidebar-collapsed .brand__text {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-collapse {
  transform: translateX(0);
}

.app-shell.sidebar-collapsed .app-sidebar__footer {
  align-items: center;
}

.app-shell.sidebar-collapsed .user-chip {
  justify-content: center;
}

.app-shell.sidebar-collapsed .user-chip__meta {
  display: none;
}

.app-sidebar__brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--text);
}

.brand__mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(37, 99, 235, .15), rgba(14, 165, 233, .3));
  display: grid;
  place-items: center;
}

.brand__logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.brand__text {
  display: flex;
  flex-direction: column;
}

.brand__title {
  font-weight: 700;
  letter-spacing: .04em;
}

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

.sidebar-collapse {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: background var(--transition), color var(--transition);
}

.sidebar-collapse:hover {
  background: rgba(37, 99, 235, .1);
  color: var(--primary);
}

.sidebar-collapse__icon {
  width: 16px;
  height: 16px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(135deg);
}

.app-shell.sidebar-collapsed .sidebar-collapse__icon {
  transform: rotate(-45deg);
}

.app-sidebar__nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.app-sidebar__section {
  font-size: 0.7rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.75rem 1rem 0.25rem;
}

.app-sidebar__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background var(--transition), color var(--transition);
}

.app-sidebar__link:hover {
  background: rgba(37, 99, 235, .08);
  color: var(--primary);
}

.app-sidebar__link.is-active {
  background: rgba(37, 99, 235, .15);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .25);
}

.app-sidebar__icon {
  font-size: 1.1rem;
}

.app-sidebar__label {
  white-space: nowrap;
}

.app-shell.sidebar-collapsed .app-sidebar__label {
  opacity: 0;
  visibility: hidden;
  width: 0;
}

.app-shell.sidebar-collapsed .app-sidebar__link {
  justify-content: center;
}

.app-shell.sidebar-collapsed .app-sidebar__link::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 8px);
  background: #111827;
  color: #fff;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  opacity: 0;
  transform: translateY(-50%);
  top: 50%;
  pointer-events: none;
  transition: opacity var(--transition);
  white-space: nowrap;
}

.app-shell.sidebar-collapsed .app-sidebar__link:hover::after {
  opacity: 1;
}

.app-sidebar__footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: rgba(37, 99, 235, .08);
}

.user-chip__avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(37, 99, 235, .2);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--primary);
}

.user-chip__meta {
  display: flex;
  flex-direction: column;
}

.user-chip__name {
  font-size: 0.9rem;
  font-weight: 600;
}

.user-chip__role {
  font-size: 0.75rem;
  color: var(--muted);
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 800;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  padding: 0.6rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-topbar__title {
  flex: 1;
}

.app-topbar__title h1 {
  margin: 0;
  font-size: 1.35rem;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: .3em;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.app-topbar__actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.topbar-menu-toggle {
  display: none;
  border: none;
  background: transparent;
  padding: 0.25rem;
  margin-right: 0.25rem;
  border-radius: 10px;
  cursor: pointer;
}

.topbar-menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.topbar-menu-toggle span+span {
  margin-top: 4px;
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.icon-button span {
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 999px;
  display: block;
}

.app-content {
  flex: 1;
  padding: 1.5rem 0 3rem;
}

.page-head {
  padding: 0 2rem 1rem;
}

.breadcrumbs {
  font-size: 0.85rem;
  color: var(--muted);
}

.breadcrumbs ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.breadcrumbs li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.breadcrumbs li+li::before {
  content: '/';
  color: var(--border-strong);
}

.breadcrumbs a {
  color: var(--primary);
  border-bottom: 1px dotted rgba(37, 99, 235, .4);
}

.page-main {
  padding: 0 2rem 2rem;
  display: block;
}

.app-footer {
  padding: 1.5rem 2rem 2.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.btn.primary,
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.3);
}

.btn.secondary,
.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.secondary:hover,
.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn.ghost,
.btn-ghost {
  background: rgba(37, 99, 235, .08);
  color: var(--primary);
}

.btn.ghost:hover,
.btn-ghost:hover {
  background: rgba(37, 99, 235, .15);
}

.btn.danger,
.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.btn.danger:hover,
.btn-danger:hover {
  background: #fecaca;
}

.btn.small {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.btn-compact {
  padding: 0.25rem 0.6rem !important;
  font-size: 0.7rem !important;
  min-height: auto;
}

.btn.wide {
  width: 100%;
  justify-content: center;
}

.btn-icon {
  font-size: 1rem;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(15, 23, 42, 0.04);
}

.card+.card {
  margin-top: 1.5rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

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

.filters input,
.filters select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  background: var(--bg-card);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

table thead {
  background: rgba(15, 23, 42, 0.05);
}

table th,
table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.95rem;
}

table tbody tr:hover {
  background: rgba(37, 99, 235, 0.05);
}

table tbody tr:last-child td {
  border-bottom: none;
}

.table.compact-rows th,
.table.compact-rows td,
.table-excel.compact-rows th,
.table-excel.compact-rows td {
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.success {
  background: #dcfce7;
  color: #15803d;
}

.badge.warning {
  background: #fef3c7;
  color: #b45309;
}

.badge.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.flash {
  padding: 0.9rem 1.2rem;
  border-radius: 14px;
  background: rgba(37, 99, 235, .1);
  color: var(--text);
  margin-bottom: 1rem;
}

.flash.flash-success {
  background: #dcfce7;
  color: #166534;
}

.flash.flash-error {
  background: #fee2e2;
  color: #b91c1c;
}

.flash.flash-info {
  background: #dbeafe;
  color: #1d4ed8;
}

.flash.flash-warning {
  background: #fef3c7;
  color: #92400e;
}

.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1500;
}

.toast {
  min-width: 240px;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(148, 163, 184, .35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  animation: toast-in 160ms ease forwards;
}

.toast__message {
  flex: 1;
}

.toast__close {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  color: var(--muted);
  cursor: pointer;
}

.toast-info {
  border-color: rgba(37, 99, 235, .2);
}

.toast-success {
  border-color: rgba(34, 197, 94, .3);
}

.toast-error {
  border-color: rgba(248, 113, 113, .4);
}

.toast-warning {
  border-color: rgba(251, 191, 36, .4);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 1600;
}

.command-palette[hidden] {
  display: none;
}

.command-palette__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.command-palette__panel {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, calc(100% - 2rem));
  background: var(--bg-card);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
}

.command-palette__search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.command-palette__search input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem 1rem;
}

.command-palette__shortcut {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
}

.command-palette__results {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}

.command-palette__item {
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.command-palette__item:hover,
.command-palette__item.is-active {
  background: rgba(37, 99, 235, 0.12);
}

.command-palette__item-meta {
  display: flex;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.command-palette__group {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--muted);
  padding: 0.5rem 0.9rem 0.25rem;
}

.command-palette__hint {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.photo-modal.hidden {
  display: none;
}

.photo-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 11, 25, 0.7);
  backdrop-filter: blur(6px);
}

.photo-modal-box {
  position: relative;
  width: min(920px, 100%);
  max-height: min(92vh, 960px);
  border-radius: 22px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.photo-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.photo-modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
}

.photo-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.photo-modal-body img {
  width: 100%;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.close-btn {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
}

.close-btn:hover {
  color: var(--text);
}

.photo-modal .text-muted {
  color: var(--muted);
}

.app-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.app-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 1023px) {
  .app-shell {
    flex-direction: column;
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    width: 260px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.4);
  }

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

  .app-topbar {
    padding: 0.85rem 1rem;
  }

  .app-content {
    padding: 1rem 0 3rem;
  }

  .page-head,
  .page-main,
  .app-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .app-shell.sidebar-collapsed .app-sidebar {
    width: 260px;
  }

  .app-shell.sidebar-collapsed .app-sidebar__label,
  .app-shell.sidebar-collapsed .user-chip__meta {
    opacity: 1;
    visibility: visible;
    width: auto;
  }

  .app-shell.sidebar-collapsed .app-sidebar__link {
    justify-content: flex-start;
  }

  .app-shell.sidebar-collapsed .app-sidebar__link::after {
    display: none;
  }

  .app-shell.sidebar-collapsed .brand__text {
    display: flex;
  }

  .app-shell.sidebar-collapsed .user-chip {
    justify-content: flex-start;
  }

  .topbar-menu-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .app-topbar__title h1 {
    font-size: 1.2rem;
  }
}

@media (max-width: 640px) {
  .btn {
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
  }

  .app-topbar__actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  table {
    font-size: 0.9rem;
  }

  .toast {
    min-width: auto;
    width: calc(100vw - 2.5rem);
  }

  .photo-modal {
    padding: 1rem;
  }

  .photo-modal-body {
    grid-template-columns: 1fr;
  }
}

.small {
  font-size: 0.8rem;
}

.muted,
.text-muted {
  color: var(--muted);
}

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

.text-right {
  text-align: right;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.pref-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pref-row {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) auto auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.pref-row__info h3 {
  margin: 0;
}

.pref-row__toggles {
  display: flex;
  gap: 1rem;
}

.pref-row__mute {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

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

.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch__control {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  transition: background var(--transition);
}

.switch__control::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
  transition: transform var(--transition);
}

.switch input:checked+.switch__control {
  background: rgba(37, 99, 235, 0.8);
}

.switch input:checked+.switch__control::after {
  transform: translateX(18px);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.timeline__title {
  font-weight: 600;
}

.timeline__details {
  color: var(--muted);
}

.timeline__meta,
.timeline__time {
  font-size: 0.85rem;
  color: var(--muted);
}

.device-list,
.inbox-list,
.export-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.device-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  align-items: center;
}

.device-row__kind {
  font-weight: 700;
}

.device-row__meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.device-row__actions {
  margin: 0;
}

.inbox-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.inbox-item:last-child {
  border-bottom: none;
}

.inbox-item__status {
  width: 8px;
  border-radius: 999px;
  background: var(--primary);
  margin-top: 0.35rem;
}

.inbox-item.is-read .inbox-item__status {
  background: rgba(148, 163, 184, 0.6);
}

.inbox-item__title {
  font-weight: 600;
}

.inbox-item__body {
  margin: 0.2rem 0;
  color: var(--muted);
}

.inbox-item__meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.profile-meter {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-meter__row {
  display: grid;
  grid-template-columns: 1fr minmax(120px, 2fr) auto;
  align-items: center;
  gap: 0.75rem;
}

.profile-meter__bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.3);
  overflow: hidden;
}

.profile-meter__bar span {
  position: absolute;
  inset: 0;
  width: var(--value, 0);
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width var(--transition);
}

.profile-meter__value {
  font-weight: 700;
}

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

.profile-subgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.profile-span-2 {
  grid-column: span 2;
}

.export-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.export-row:last-child {
  border-bottom: none;
}

.export-row__link {
  font-weight: 600;
}

.export-row__chevron {
  font-size: 1.25rem;
  color: var(--muted);
}

@media (max-width: 1023px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-subgrid {
    grid-template-columns: 1fr;
  }

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

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

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

  .profile-quick-action {
    flex-direction: column;
  }
}

/* Prevent sidebar scrolling when collapsed */
.app-shell.sidebar-collapsed .app-sidebar__nav {
  overflow: hidden;
}

/* Sidebar Dropdown Styles */
.app-sidebar__item {
  position: relative;
  margin-bottom: 0.25rem;
}

.app-sidebar__chevron {
  margin-left: auto;
  font-size: 0.7rem;
  transition: transform var(--transition);
  opacity: 0.5;
}

.app-sidebar__item.is-expanded .app-sidebar__chevron {
  transform: rotate(180deg);
}

.app-sidebar__dropdown {
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.25rem 0 0.5rem 2.5rem;
  animation: slide-down 200ms ease forwards;
}

.app-sidebar__item.is-expanded .app-sidebar__dropdown {
  display: flex;
}

.app-sidebar__dropdown-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  border-radius: 10px;
  transition: color var(--transition), background var(--transition);
  text-decoration: none;
}

.app-sidebar__dropdown-link:hover {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

.app-sidebar__dropdown-link.is-active {
  color: var(--primary);
  font-weight: 600;
  background: rgba(37, 99, 235, 0.1);
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Collapsed state adjustments */
.app-shell.sidebar-collapsed .app-sidebar__chevron {
  display: none;
}

@media (min-width: 1024px) {
  .app-shell.sidebar-collapsed .app-sidebar__dropdown {
    display: none !important;
    /* Hide dropdowns when collapsed only on desktop */
  }
}

/* Ensure tooltips appear above all content */
.app-sidebar__link::after {
  z-index: 9999 !important;
}

.custom-tooltip {
  z-index: 9999 !important;
}

/* Compact user chip for header */
.user-chip-compact {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 12px;
  background: rgba(37, 99, 235, .08);
  border: 1px solid rgba(37, 99, 235, .1);
}

.user-chip-compact__avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(37, 99, 235, .2);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--primary);
}

.user-chip-compact__meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.user-chip-compact__name {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.user-chip-compact__role {
  font-size: 0.65rem;
  color: var(--muted);
}

/* Make the compact button even more compact already overridden above */

/* Mobile responsive for compact user chip */
@media (max-width: 640px) {
  .user-chip-compact {
    gap: 0.3rem;
    padding: 0.3rem;
  }

  .user-chip-compact__meta {
    display: none;
  }

  .user-chip-compact__avatar {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }
}

/* Table as cards on mobile */
@media (max-width: 920px) {
  .table--cards {
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
    box-shadow: none;
  }

  .table--cards thead {
    display: none;
  }

  .table--cards tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .table--cards tr {
    display: block;
    width: 100%;
    border-radius: var(--radius);
    background: var(--bg-card);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border);
    padding: 0.75rem 0.9rem;
  }

  .table--cards td {
    display: block;
    width: 100%;
    padding: 0.25rem 0;
    border-bottom: none;
  }

  .table--cards td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: .15em;
    color: var(--muted);
    margin-bottom: 0.1rem;
  }

  .table--cards .col-check {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.25rem;
  }

  .table--cards .col-actions {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .table--cards .btn.small {
    width: auto;
  }
}