:root {
  --bg: #0f172a;
  --bg-soft: #111827;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #0f172a;
  --text-soft: #475569;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #e2e8f0;
  --secondary-hover: #cbd5e1;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --max-width: 1400px;
  --header-height: 64px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 32%),
    linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

body.modal-open {
  overflow: hidden;
}

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

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

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

button {
  cursor: pointer;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1100;
  min-height: var(--header-height);
  backdrop-filter: blur(14px);
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner {
  position: relative;
  z-index: 1101;
  max-width: var(--max-width);
  min-height: var(--header-height);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-left {
  display: flex;
  justify-content: flex-start;
  flex: 0 0 auto;
}

.brand {
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.app-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.app-nav a,
.nav-text-link {
  color: rgba(255, 255, 255, 0.92);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 600;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.app-nav a:hover,
.app-nav a:focus-visible,
.nav-text-link:hover,
.nav-text-link:focus-visible,
.app-nav a.is-active,
.nav-text-link.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  transform: translateY(-1px);
  outline: none;
}

/* Mobile nav toggle */
.nav-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.nav-btn {
  display: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
}

.nav-btn span {
  width: 18px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  display: block;
  transition: transform 180ms ease, opacity 180ms ease;
  transform-origin: center;
}

.app-header.nav-is-open .nav-btn span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.app-header.nav-is-open .nav-btn span:nth-child(2) {
  opacity: 0;
}

.app-header.nav-is-open .nav-btn span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-text-link {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  line-height: 1.2;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.nav-notif {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.notif-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.nav-backdrop {
  display: none;
  z-index: 1099;
}

/* Layout */
.container,
.container-wide {
  width: min(100% - 32px, var(--max-width));
  margin: 28px auto;
}

.container {
  max-width: 720px;
}

.container-wide {
  max-width: var(--max-width);
}

.page-title,
h1,
h2,
h3 {
  color: var(--text);
  line-height: 1.2;
}

h1 {
  font-size: clamp(1.8rem, 2.8vw, 2.4rem);
  margin: 0 0 10px;
}

h2 {
  font-size: 1.2rem;
  margin: 0 0 10px;
}

h3 {
  font-size: 1rem;
  margin: 0 0 8px;
}

p {
  margin: 0 0 14px;
}

.small {
  font-size: 0.92rem;
  color: var(--text-soft);
}

/* Cards */
.card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.card + .card {
  margin-top: 18px;
}

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

/* Buttons */
.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease,
    color 0.18s ease,
    opacity 0.18s ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

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

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.24);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--text);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: var(--secondary-hover);
}

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

.btn-danger:hover,
.btn-danger:focus-visible {
  filter: brightness(0.96);
}

.btn-compact {
  padding: 5px 11px;
  font-size: 0.82rem;
  line-height: 1.2;
  border-radius: 8px;
  min-height: 30px;
  min-width: 66px;
}

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

/* Forms */
.form-group {
  margin-bottom: 16px;
}

label {
  display: inline-block;
  margin-bottom: 6px;
  font-weight: 700;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.6);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* Alerts / messages */
.alert,
.notice,
.error,
.success {
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 16px;
  border: 1px solid transparent;
}

.alert,
.notice {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #ffffff;
}

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

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

th {
  background: #f8fafc;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
}

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

tbody tr:hover {
  background: #f8fafc;
}

/* Status pills */
.badge,
.pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
}

.badge.pending,
.pill.pending,
.status-pill.pending {
  background: #fff7ed;
  color: #c2410c;
}

.badge.approved,
.pill.approved,
.status-pill.approved,
.badge.active,
.pill.active,
.status-pill.active {
  background: #f0fdf4;
  color: #166534;
}

.badge.rejected,
.pill.rejected,
.status-pill.rejected,
.badge.inactive,
.pill.inactive,
.status-pill.inactive {
  background: #fef2f2;
  color: #b91c1c;
}

/* Utility */
.row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.col {
  flex: 1 1 260px;
}

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

.center {
  text-align: center;
}

.right {
  text-align: right;
}

.spacer {
  height: 12px;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* Login page niceties */
.auth-shell {
  min-height: calc(100vh - var(--header-height) - 56px);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(100%, 520px);
}

/* Admin dashboard layout */
.admin-dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.admin-todo-section {
  margin: 0;
  height: 100%;
  align-self: start;
}

.admin-dashboard-side {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.admin-dashboard-panel {
  width: 100%;
  margin: 0;
  align-self: start;
}

.admin-dashboard-panel-wide {
  grid-column: auto;
}

.admin-dashboard-panel.card + .card {
  margin-top: 0;
}

/* Admin dashboard to do list */
.admin-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.admin-section-head h2 {
  margin: 0;
}

.admin-todo-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-todo-card {
  border-radius: 14px;
  padding: 16px;
  border: 1px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.admin-todo-card.priority-normal {
  background: #2563eb;
  border-color: #2563eb;
}

.admin-todo-card.priority-important {
  background: #d97706;
  border-color: #d97706;
}

.admin-todo-card.priority-urgent {
  background: #dc2626;
  border-color: #dc2626;
}

.admin-todo-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

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

.admin-todo-card h3 {
  margin: 0 0 8px;
  color: #ffffff;
}

.admin-todo-card .small,
.admin-todo-card .admin-todo-meta {
  color: rgba(255, 255, 255, 0.9);
}

.admin-todo-card strong {
  color: #ffffff;
}

.admin-todo-actions-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.admin-todo-actions-wrap .btn {
  width: auto;
  min-width: 140px;
}

/* Admin profile */
.avatar-circle {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 96px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #163766;
  border: 2px solid #1e3a8a;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.avatar-circle img,
img.avatar-circle {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-placeholder {
  color: #cbd5f5;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  margin-bottom: 14px;
}

.profile-avatar-upload {
  flex: 1;
  min-width: 0;
}

/* Messages */
.messages-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.messages-mode-toggle {
  display: inline-flex;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 8px;
}

.messages-mode-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  background: var(--surface-soft, #f8fafc);
  color: var(--text);
  border: 1px solid var(--border);
}

.messages-mode-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Override admin global grid cards for messages page */
.container > .card > .card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  grid-template-columns: none;
}

.message-card {
  color: #fff;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.message-card-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.message-card-avatar-wrap {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  margin-right: 2px;
}

.message-card-avatar,
.message-card-avatar-fallback {
  width: 64px;
  height: 64px;
  border-radius: 999px;
}

.message-card-avatar {
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.message-card-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary, #2563eb);
  color: #fff;
  font-weight: 800;
  font-size: 1.4rem;
}

.message-card-main {
  flex: 1;
  min-width: 0;
}

.message-card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.message-card-heading {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.message-card-sender,
.message-card-date,
.message-thread-subject {
  color: #fff;
}

.message-thread-subject {
  margin-bottom: 2px;
}

.message-thread-preview {
  color: rgba(255, 255, 255, 0.88);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.message-text-unread {
  font-weight: 700;
}

.message-text-read {
  font-weight: 400;
  color: rgba(255, 255, 255, 0.92);
}

.message-body {
  margin-top: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-priority-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.message-read {
  opacity: 0.92;
}

.message-unread {
  outline: 2px solid rgba(255, 255, 255, 0.2);
}

.message-card-action-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 7px;
  margin-left: auto;
  flex: 0 0 auto;
  min-width: 72px;
}

.thread-expand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  transition: transform 220ms ease;
}

.thread-card-shell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.thread-card-click-area {
  cursor: pointer;
}

.thread-card-shell .thread-previous-list {
  width: 100%;
}

.thread-previous-list {
  display: block;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    max-height 260ms ease,
    opacity 220ms ease,
    transform 220ms ease,
    margin-top 220ms ease;
  margin-top: 0;
  padding-left: 84px;
  pointer-events: none;
}

.thread-previous-list.is-open {
  opacity: 1;
  transform: translateY(0);
  margin-top: 8px;
  pointer-events: auto;
}

.thread-previous-list[aria-hidden="true"] {
  max-height: 0 !important;
}

.thread-previous-list-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.thread-previous-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  background: var(--surface-soft, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.thread-previous-main {
  flex: 1;
  min-width: 0;
}

.thread-previous-sender {
  color: var(--text);
  margin-bottom: 4px;
  font-weight: 700;
}

.thread-previous-preview {
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
  margin-bottom: 6px;
}

.thread-previous-date {
  color: var(--text-soft);
}

.thread-previous-actions {
  flex: 0 0 auto;
}

.thread-load-more-row {
  padding-left: 0;
  display: flex;
  justify-content: center;
}

/* Legacy modal system */
.modal-overlay[hidden] {
  display: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(2, 6, 23, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: min(560px, 100%);
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.modal-header h2 {
  margin: 0;
}

.modal-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.message-detail-modal {
  max-width: 560px;
}

.message-reply-modal {
  max-width: 560px;
}

.delete-message-modal {
  max-width: 460px;
}

.message-detail-content {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
}

.message-sender-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-top: 4px;
  margin-bottom: 14px;
}

.message-sender-avatar,
.message-sender-avatar-fallback {
  width: 132px;
  height: 132px;
  border-radius: 999px;
}

.message-sender-avatar {
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.message-sender-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary, #2563eb);
  color: #fff;
  font-weight: 800;
  font-size: 2.5rem;
  border: 3px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.message-detail-from {
  text-align: left;
  margin-bottom: 14px;
}

.message-detail-body {
  margin-top: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 16px;
  padding: 14px;
  text-align: left;
  line-height: 1.5;
  color: var(--text);
}

.message-detail-actions {
  justify-content: center;
  margin-top: 16px;
}

.reply-preview-box {
  margin-top: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-soft, #f8fafc);
}

.reply-preview-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-soft);
  margin-bottom: 6px;
}

.reply-preview-text {
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.message-reply-modal textarea {
  min-height: 140px;
}

.delete-message-text {
  text-align: center;
  margin: 12px 0 4px;
}

/* Shared messaging compatibility layer */

/* Priority compatibility */
.priority-urgent,
.message-priority-urgent {
  background: #dc2626;
  border: 1px solid #ef4444;
  box-shadow: 0 12px 32px rgba(220, 38, 38, 0.45);
  color: #fff;
}

.priority-important,
.message-priority-important {
  background: #d97706;
  border: 1px solid #f59e0b;
  box-shadow: 0 12px 32px rgba(217, 119, 6, 0.35);
  color: #fff;
}

.priority-normal,
.message-priority-normal {
  background: #2563eb;
  border: 1px solid #60a5fa;
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.35);
  color: #fff;
}

.priority-low {
  background: #64748b;
  border: 1px solid #94a3b8;
  box-shadow: 0 12px 32px rgba(100, 116, 139, 0.25);
  color: #fff;
}

/* Shared modal system */
.app-modal-shell {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
}

.app-modal-shell.is-open {
  display: block;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
}

.app-modal-card {
  position: relative;
  z-index: 1201;
  width: min(560px, 100%);
  margin: 40px auto;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.app-modal-card--md {
  max-width: 560px;
}

.app-modal-card--lg {
  max-width: 760px;
}

/* Navigator directory */
.navigator-directory-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.navigator-directory-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.navigator-directory-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.navigator-directory-avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  flex: 0 0 44px;
  display: block;
  border-radius: 999px;
  object-fit: cover;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--secondary);
}

.navigator-directory-avatar.avatar-placeholder,
.navigator-directory-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-soft);
}

.navigator-directory-summary {
  min-width: 0;
}

.navigator-directory-name {
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
  word-break: break-word;
}

.navigator-directory-city {
  margin-top: 2px;
  font-size: 0.95rem;
  color: var(--text-soft);
  word-break: break-word;
}

.navigator-directory-actions {
  flex: 0 0 auto;
}

.navigator-profile-modal {
  width: min(420px, calc(100% - 24px));
}

.navigator-profile-modal-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4px 2px;
}

.navigator-profile-avatar {
  width: 88px;
  height: 88px;
  min-width: 88px;
  min-height: 88px;
  display: block;
  border-radius: 999px;
  object-fit: cover;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--secondary);
  margin: 0 auto 14px;
}

.navigator-profile-name {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.2;
  font-weight: 800;
  color: var(--text);
}

.navigator-profile-city {
  margin-top: 6px;
  color: var(--text-soft);
}

.navigator-profile-detail {
  margin-top: 8px;
  color: var(--text);
  word-break: break-word;
}

.navigator-profile-bio {
  margin-top: 12px;
  color: var(--text-soft);
  text-align: center;
}

.navigator-profile-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 18px;
}

.navigator-profile-actions .btn {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.navigator-profile-footer {
  width: 100%;
  margin-top: 10px;
}

.navigator-profile-footer .btn {
  width: 100%;
  justify-content: center;
}

/* Admin misc */
.admin-empty-text {
  margin: 0;
}

.admin-metric-value {
  margin-top: 6px;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.admin-metric-value-large {
  font-size: 2.2rem;
}

.admin-section-actions {
  margin-top: 12px;
}

.admin-users-summary {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.admin-users-summary-copy {
  min-width: 160px;
}

.admin-users-summary-chart {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.admin-chart-label {
  opacity: 0.9;
}

.admin-section-gap {
  margin-top: 16px;
}

.admin-meta-gap {
  margin-top: 6px;
}

.admin-help-text {
  margin-top: 6px;
}

/* Dashboard widgets */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
}

.dashboard-widget-slot {
  min-width: 0;
}

.dashboard-widget--full {
  grid-column: span 12;
}

.dashboard-widget--half {
  grid-column: span 6;
}

.dashboard-widget--third {
  grid-column: span 4;
}

/* Responsive */
@media (max-width: 1100px) {
  .admin-dashboard-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .admin-dashboard-side {
    grid-template-columns: 1fr;
  }

  .admin-dashboard-panel-wide {
    grid-column: auto;
  }
}

@media (max-width: 960px) {
  .dashboard-widget--half,
  .dashboard-widget--third {
    grid-column: span 12;
  }
}

@media (max-width: 860px) {
  .nav-btn {
    display: inline-flex;
  }

  .header-inner {
    padding: 0 16px;
  }

  .app-nav {
    position: absolute;
    top: calc(100% + 8px);
    left: 16px;
    right: 16px;
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.35);
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top center;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
    z-index: 1102;
  }

  .app-header.nav-is-open .app-nav {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }

  .app-nav a,
  .app-nav form,
  .nav-text-link {
    width: 100%;
  }

  .nav-backdrop {
    position: fixed;
    inset: 0;
    display: block;
    z-index: 1001;
    background: rgba(2, 6, 23, 0.28);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .app-header.nav-is-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .container,
  .container-wide {
    width: min(100% - 20px, var(--max-width));
    margin: 20px auto;
  }

  .card {
    padding: 18px;
  }

  table {
    min-width: 620px;
  }
}

@media (max-width: 768px) {
  .app-header {
    position: relative;
    z-index: 1000;
  }

  .app-nav {
    position: fixed;
    top: 64px;
    left: 12px;
    right: 12px;
    z-index: 1002;
  }
}

@media (max-width: 700px) {
  .admin-dashboard-layout,
  .admin-dashboard-side {
    grid-template-columns: 1fr;
  }

  .admin-todo-body {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-todo-actions-wrap {
    justify-content: stretch;
  }

  .admin-todo-actions-wrap .btn {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .messages-toolbar {
    align-items: stretch;
  }

  .message-card-top {
    flex-direction: row;
    align-items: flex-start;
  }

  .message-card-avatar,
  .message-card-avatar-fallback {
    width: 72px;
    height: 72px;
  }

  .message-card-title-row {
    gap: 6px;
  }

  .message-card-heading {
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 4px;
  }

  .message-card-action-stack {
    flex: 0 0 auto;
    min-width: 64px;
    width: auto;
    align-items: flex-end;
    justify-content: flex-start;
    margin-left: auto;
  }

  .message-card-action-stack .btn {
    width: auto;
    min-width: 64px;
  }

  .btn-compact {
    padding: 4px 9px;
    font-size: 0.76rem;
    min-height: 28px;
    min-width: 62px;
  }

  .thread-previous-list {
    padding-left: 0;
  }

  .message-sender-avatar,
  .message-sender-avatar-fallback {
    width: 116px;
    height: 116px;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 15px;
  }

  .header-inner {
    gap: 10px;
  }

  .brand {
    font-size: 0.96rem;
  }

  .btn {
    width: 100%;
  }

  .actions {
    flex-direction: column;
  }

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

  .avatar-circle {
    width: 84px;
    height: 84px;
    flex-basis: 84px;
  }

  .avatar-placeholder {
    font-size: 1.7rem;
  }

  .profile-avatar-row {
    gap: 12px;
  }
}
