:root {
  --bg-deep: #0a0a0b;
  --bg: #121212;
  --surface: #1a1a1c;
  --surface-elevated: #242428;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --orange: #ff7a45;
  --orange-dark: #fc4c02;
  --green: #2e7d32;
  --red: #e53935;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.5;
  color-scheme: dark;
}

/* Browsers default buttons to black text — reset, except styled controls */
.admin-shell button:not(.btn):not(.tile):not(.filter-chip):not(.feedback-image-btn):not([data-hour]),
.login-page button:not(.btn) {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  text-align: inherit;
}

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

input,
select,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.admin-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 12px 16px;
  background: rgba(18, 18, 18, 0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.admin-topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  min-width: 0;
}

.admin-brand span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-brand img {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.admin-nav a,
.admin-nav .nav-signout {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.admin-nav a:hover,
.admin-nav .nav-signout:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.admin-nav a.active {
  background: var(--orange);
  color: #fff;
  font-weight: 700;
}

.admin-nav .nav-signout {
  color: #ffab91;
}

.admin-main {
  flex: 1;
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 20px 16px 28px;
}

.page-title {
  margin: 0 0 6px;
  font-size: 1.6rem;
}

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

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

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

.card h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 600;
}

.card .value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--orange);
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  color: var(--text);
  text-align: left;
  width: 100%;
}

.tile:hover {
  border-color: rgba(255, 122, 69, 0.45);
  transform: translateY(-1px);
  background: var(--surface-elevated);
}

.tile h3 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
}

.tile p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary {
  background: var(--orange);
  color: #fff;
}

.btn-secondary {
  background: var(--surface-elevated);
  color: #fff;
  border: 1px solid var(--border);
}

.btn-danger {
  background: rgba(229, 57, 53, 0.55);
  color: #fff;
  border: 1px solid rgba(229, 57, 53, 0.65);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.login-card h1 {
  margin: 0 0 8px;
  color: var(--text);
}

.login-card p {
  margin: 0 0 20px;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface);
}

td {
  color: var(--text);
}

tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: capitalize;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid transparent;
}

.badge-admin {
  background: rgba(255, 122, 69, 0.22);
  color: #ffb899;
  border-color: rgba(255, 122, 69, 0.45);
  margin-left: 6px;
  vertical-align: middle;
}

.badge-pending {
  background: rgba(255, 122, 69, 0.18);
  color: #ffb899;
  border-color: rgba(255, 122, 69, 0.35);
}

.badge-resolved,
.badge-active {
  background: rgba(76, 175, 80, 0.18);
  color: #b9f6ca;
  border-color: rgba(129, 199, 132, 0.4);
}

.badge-blocked {
  background: rgba(229, 57, 53, 0.18);
  color: #ffab91;
  border-color: rgba(229, 57, 53, 0.4);
}

.badge-info {
  background: rgba(161, 161, 170, 0.15);
  color: #d4d4d8;
  border-color: rgba(161, 161, 170, 0.3);
}

.section-block {
  margin-bottom: 24px;
}

.section-block h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: var(--text);
}

.feedback-item,
.alert-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.feedback-item header,
.alert-item header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.feedback-item p,
.alert-item p {
  margin: 0 0 8px;
  color: var(--text);
  line-height: 1.5;
}

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

.config-section h3 {
  margin: 0 0 4px;
  color: var(--text);
}

.switch-row span {
  color: var(--text);
  font-size: 0.92rem;
}

.user-picker label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.92rem;
}

.user-picker label span {
  color: var(--text);
}

.signed-in-as {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.85rem;
}

#sync-current {
  margin: 10px 0;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 122, 69, 0.1);
  color: var(--text);
  font-size: 0.92rem;
}

#sync-percent {
  text-align: center;
  font-weight: 700;
  color: var(--orange);
}

.feedback-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.feedback-image-btn {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: transparent;
  line-height: 0;
}

.feedback-image-btn img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  display: block;
}

.feedback-image-btn:hover {
  border-color: rgba(255, 122, 69, 0.55);
}

.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.image-lightbox-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: min(70vh, 720px);
}

.image-lightbox-wrap img {
  max-width: 100%;
  max-height: min(70vh, 720px);
  object-fit: contain;
  border-radius: 8px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.toolbar input[type="search"] {
  flex: 1;
  min-width: 220px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-group-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-right: 4px;
}

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

.filter-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.filter-chip:hover {
  border-color: rgba(255, 122, 69, 0.35);
  color: var(--text);
}

.filter-chip.active {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

.users-summary {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.push-yes {
  color: #b9f6ca;
  font-weight: 600;
}

.push-no {
  color: var(--muted);
}

.config-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.config-section .doc-path {
  margin: 0 0 12px;
  font-size: 0.75rem;
  color: var(--muted);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--orange);
  border-color: var(--orange);
}

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

.toggle-switch input:focus-visible + .toggle-slider {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-elevated);
}

.segmented button[data-hour] {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}

.segmented button[data-hour]:hover:not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.segmented button[data-hour].active {
  background: var(--orange);
  color: #fff;
  font-weight: 700;
}

.user-picker {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.toast.success {
  border-color: rgba(46, 125, 50, 0.45);
}

.toast.error {
  border-color: rgba(229, 57, 53, 0.45);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.72);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: min(440px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.modal.modal-wide {
  width: min(720px, 100%);
}

.dialog-title {
  margin: 0 0 10px;
  font-size: 1.25rem;
  font-weight: 700;
}

.dialog-message {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.95rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.dialog-actions-single {
  justify-content: stretch;
}

.dialog-actions-single .btn {
  width: 100%;
}

.sync-dialog-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 1.25rem;
  font-weight: 700;
}

.sync-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 122, 69, 0.25);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.action-loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}

.action-loader.hidden {
  display: none;
}

.action-loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-width: 200px;
  padding: 24px 28px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.action-loader-text {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.sync-status-line {
  margin: 0 0 10px;
  font-size: 0.92rem;
  color: var(--text);
}

.sync-current-box {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 122, 69, 0.1);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
}

.sync-current-box:empty {
  display: none;
}

.sync-log-label {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sync-log {
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 0.85rem;
}

.log-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.log-row:last-child {
  border-bottom: 0;
}

.log-icon {
  width: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 0.85rem;
  line-height: 1;
}

.log-body {
  flex: 1;
  min-width: 0;
}

.log-message {
  font-size: 0.84rem;
  line-height: 1.35;
}

.log-time {
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--muted);
}

.sync-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.sync-actions .btn {
  min-height: 44px;
}

.sync-user-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.sync-user-picker {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 16px;
}

.sync-user-picker label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  color: var(--text);
}

.sync-user-picker label:last-child {
  border-bottom: 0;
}

.sync-user-picker .user-line-main {
  font-weight: 600;
  font-size: 0.92rem;
}

.sync-user-picker .user-line-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.modal h2 {
  margin-top: 0;
  color: var(--text);
}

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

.form-max {
  max-width: 760px;
}

.form-max-sm {
  max-width: 420px;
}

.feedback-item strong,
.alert-item strong {
  color: var(--text);
}

.progress-bar {
  height: 8px;
  background: rgba(255, 122, 69, 0.15);
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0;
}

.progress-bar > span {
  display: block;
  height: 100%;
  background: var(--orange);
  width: 0;
  transition: width 0.25s ease;
}

.log-syncing { color: var(--orange); }
.log-message.log-syncing { color: var(--orange); font-weight: 600; }
.log-message.log-success { color: #81c784; }
.log-message.log-warning { color: var(--orange-dark); }
.log-message.log-error { color: #ff8a80; }
.log-message.log-skipped { color: var(--muted); }
.log-message.log-info { color: var(--muted); }
.log-icon.log-syncing { color: var(--orange); }
.log-icon.log-success { color: #81c784; }
.log-icon.log-warning { color: var(--orange-dark); }
.log-icon.log-error { color: #ff8a80; }
.log-icon.log-skipped { color: var(--muted); }
.log-icon.log-info { color: var(--muted); }

.empty-state {
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.modal.profile-modal {
  width: min(640px, 100%);
}

.profile-modal-top {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.profile-back-btn {
  min-width: 88px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.profile-avatar-img,
.profile-avatar-fallback {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  flex-shrink: 0;
}

.profile-avatar-img {
  object-fit: cover;
  border: 2px solid var(--border);
}

.profile-avatar-fallback {
  display: grid;
  place-items: center;
  background: rgba(255, 122, 69, 0.18);
  color: var(--orange);
  font-size: 1.6rem;
  font-weight: 700;
}

.profile-name {
  margin: 0;
  font-size: 1.2rem;
}

.profile-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-hub-tiles {
  display: grid;
  gap: 10px;
}

.profile-hub-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-elevated);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.profile-hub-tile:hover {
  border-color: rgba(255, 122, 69, 0.35);
}

.profile-hub-icon {
  width: 28px;
  text-align: center;
  font-size: 1.1rem;
}

.profile-hub-copy {
  display: grid;
  gap: 2px;
  flex: 1;
}

.profile-hub-copy strong {
  font-size: 0.98rem;
}

.profile-hub-copy span {
  color: var(--muted);
  font-size: 0.85rem;
}

.profile-hub-chevron {
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
}

.profile-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-elevated);
  padding: 14px 16px;
}

.profile-card + .profile-card {
  margin-top: 12px;
}

.profile-highlight-card {
  margin-bottom: 12px;
}

.profile-highlight-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.profile-highlight-value {
  margin: 4px 0 14px;
  font-size: 2rem;
  font-weight: 800;
  color: var(--orange);
}

.profile-section-label {
  margin-bottom: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--orange);
}

.profile-metric-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-metric-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.profile-metric-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-range {
  display: block;
  font-size: 0.78rem;
}

.profile-metric-value {
  font-weight: 700;
  text-align: right;
}

.profile-stats-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.profile-period-list {
  display: grid;
  gap: 8px;
}

.profile-period-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface-elevated);
}

.profile-period-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.profile-period-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  color: var(--muted);
  font-size: 0.88rem;
}

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

.ride-user-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  margin-bottom: 20px;
}

.ride-user-option {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.ride-user-option:hover {
  border-color: var(--orange);
  background: var(--surface-elevated);
}

.ride-user-option.active {
  border-color: var(--orange);
  background: rgba(255, 122, 69, 0.24);
  box-shadow: inset 4px 0 0 var(--orange);
}

.ride-user-option.active span {
  color: #ffd0bd;
}

.ride-user-option span {
  color: var(--muted);
  font-size: 0.8rem;
}

.rides-section {
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.rides-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.rides-heading h2,
.rides-heading p {
  margin: 0;
}

.ride-filters {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(150px, 1fr) minmax(150px, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.ride-filters input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
}

.rides-table {
  min-width: 980px;
}

.rides-table th:first-child,
.rides-table td:first-child {
  width: 44px;
  text-align: center;
}

.rides-table .duplicate-date-row td {
  background: rgba(229, 57, 53, 0.2);
  border-bottom-color: rgba(255, 138, 128, 0.28);
}

.rides-table .duplicate-date-row td:first-child {
  box-shadow: inset 4px 0 0 var(--red);
}

.duplicate-date-badge {
  display: block;
  width: fit-content;
  margin-top: 5px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 138, 128, 0.5);
  border-radius: 999px;
  background: rgba(229, 57, 53, 0.28);
  color: #ffcdd2;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

@media (min-width: 901px) {
  .admin-topbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    gap: 16px;
  }

  .admin-topbar-row {
    width: auto;
    flex-shrink: 0;
  }

  .admin-nav {
    flex: 1;
    justify-content: flex-end;
    padding-top: 0;
    margin-top: 0;
    border-top: none;
  }
}

@media (max-width: 900px) {
  .nav-toggle {
    display: flex;
  }

  .admin-nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 100%;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid var(--border);
  }

  .admin-nav.is-open {
    display: flex;
  }

  .admin-nav a,
  .admin-nav .nav-signout {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border-radius: 10px;
    white-space: normal;
  }

  .admin-nav a.active {
    background: var(--orange);
    color: #fff;
  }

  .admin-nav .nav-signout {
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    border-radius: 0;
  }

  .admin-main {
    padding: 14px 12px 24px;
  }

  .page-title {
    font-size: 1.35rem;
  }

  .page-subtitle {
    font-size: 0.88rem;
    margin-bottom: 16px;
  }

  .card-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .card {
    padding: 12px;
  }

  .card .value {
    font-size: 1.45rem;
  }

  .tile-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

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

  .toolbar input[type="search"] {
    min-width: 0;
    width: 100%;
  }

  .filter-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .filter-chips {
    width: 100%;
  }

  .filter-chip {
    font-size: 0.78rem;
    padding: 7px 11px;
  }

  .table-wrap {
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
  }

  table {
    min-width: 640px;
  }

  th,
  td {
    padding: 10px 12px;
    font-size: 0.88rem;
  }

  .table-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

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

  .feedback-item header,
  .alert-item header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .feedback-actions {
    flex-direction: column;
  }

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

  .modal-backdrop {
    padding: 10px;
    align-items: flex-end;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    padding: 18px 16px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .modal.modal-wide,
  .modal.profile-modal {
    width: 100%;
  }

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

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

  .segmented {
    display: flex;
    width: 100%;
  }

  .segmented button[data-hour] {
    flex: 1;
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .sync-log {
    max-height: 220px;
  }

  .sync-user-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .sync-user-toolbar .btn {
    width: 100%;
    justify-content: center;
  }

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

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

  .profile-stats-tabs {
    gap: 6px;
  }

  .profile-stats-tabs .filter-chip {
    flex: 1 1 auto;
    text-align: center;
  }

  .ride-user-picker {
    grid-template-columns: 1fr;
    max-height: 220px;
  }

  .ride-filters {
    grid-template-columns: 1fr;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .login-page {
    padding: 16px;
    align-items: flex-start;
    padding-top: 12vh;
  }

  .login-card {
    padding: 22px 18px;
  }

  .config-section {
    padding: 14px 12px;
  }

  .users-summary {
    font-size: 0.85rem;
    line-height: 1.45;
  }
}

@media (max-width: 420px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .admin-brand span {
    font-size: 0.92rem;
  }
}
