/* Contact Manager — single stylesheet */
:root {
  --bg: #f1f5f9;
  --bg-muted: #e8eef4;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #cbd5e1;
  --accent: #15803d;
  --accent-hover: #166534;
  --accent-soft: rgba(21, 128, 61, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --warning: #d97706;
  --success: #15803d;
  --sidebar-width: 16rem;
  --sidebar-collapsed: 4.5rem;
  --radius: 0.75rem;
  --shadow: 0 1px 3px rgb(15 23 42 / 0.06);
}

.dark {
  --bg: #000000;
  --bg-muted: #000000;
  --surface: #0a0a0a;
  --text: #f5f5f5;
  --text-muted: #a3a3a3;
  --border: #262626;
  --accent: #16a34a;
  --accent-hover: #15803d;
  --accent-soft: rgba(22, 163, 74, 0.18);
  --danger-soft: rgba(220, 38, 38, 0.2);
  --shadow: 0 1px 3px rgb(0 0 0 / 0.4);
}

html.sidebar-collapsed {
  --sidebar-width: var(--sidebar-collapsed);
}

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

html,
body {
  height: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

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

/* Layout utilities (fallback if Tailwind CDN fails) */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-1 { flex: 1 1 0%; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.grid { display: grid; }
.block { display: block; }
.hidden { display: none !important; }
.min-w-0 { min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.animate-spin {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.overflow-x-auto { overflow-x: auto; }
.overflow-hidden { overflow: hidden; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }
.mb-4 { margin-bottom: 1rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.w-14 { width: 3.5rem; }
.h-4 { height: 1rem; }
.w-4 { width: 1rem; }
.h-5 { height: 1.25rem; }
.w-5 { width: 1.25rem; }
.h-7 { height: 1.75rem; }
.w-7 { width: 1.75rem; }
.h-full { height: 100%; }
.w-full { width: 100%; }
.object-cover { object-fit: cover; }
.max-w-lg { max-width: 32rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

.groups-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .groups-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:table-cell,
  td.hidden.sm\:table-cell,
  th.hidden.sm\:table-cell {
    display: table-cell !important;
  }
}

@media (min-width: 768px) {
  .md\:table-cell,
  td.hidden.md\:table-cell,
  th.hidden.md\:table-cell {
    display: table-cell !important;
  }
}

@media (min-width: 1024px) {
  .groups-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .lg\:hidden { display: none !important; }
  .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:table-cell,
  td.hidden.lg\:table-cell,
  th.hidden.lg\:table-cell {
    display: table-cell !important;
  }
}

.theme-icon-light { display: none; }
.theme-icon-dark { display: inline-flex; }
.dark .theme-icon-light { display: inline-flex; }
.dark .theme-icon-dark { display: none; }

/* Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar-panel {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-width);
  border-right: 1px solid var(--border);
  background: var(--bg-muted);
  transition: width 0.25s ease, transform 0.25s ease;
}

.sidebar-inner {
  display: flex;
  height: 100%;
  flex-direction: column;
  padding: 1rem 0.75rem;
}

.sidebar-brand,
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.5rem 1rem;
}

.sidebar-user {
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
}

.sidebar-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.5rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s ease, color 0.2s ease, padding 0.25s ease, gap 0.25s ease;
}

.sidebar-nav-item svg {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
}

.sidebar-nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 58%;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  transition: height 0.25s ease, width 0.25s ease;
}

.sidebar-nav-item:hover,
.sidebar-nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-label {
  white-space: nowrap;
  transition: opacity 0.2s ease, width 0.25s ease;
}

.sidebar-chevron {
  display: inline-flex;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

html.sidebar-collapsed .sidebar-chevron {
  transform: rotate(180deg);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 0.5rem;
}

html.sidebar-collapsed .sidebar-footer .sidebar-nav-item {
  padding: 0.625rem 0;
  gap: 0;
}

html.sidebar-collapsed .sidebar-footer .sidebar-label {
  opacity: 1;
  width: auto;
  overflow: visible;
  pointer-events: auto;
}

html.sidebar-collapsed .sidebar-footer .sidebar-chevron {
  margin: 0;
  transition: transform 0.25s ease;
}

html.sidebar-collapsed .sidebar-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}

html.sidebar-collapsed .sidebar-brand,
html.sidebar-collapsed .sidebar-user {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

html.sidebar-collapsed .sidebar-user .sidebar-label {
  display: none;
}

html.sidebar-collapsed .sidebar-nav-item {
  justify-content: center;
  gap: 0;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

html.sidebar-collapsed .sidebar-nav-item.is-active::before {
  height: 36%;
  width: 2px;
  left: 0.2rem;
}

html.sidebar-collapsed .sidebar-nav-item:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 0.5rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  white-space: nowrap;
  padding: 0.35rem 0.6rem;
  border-radius: 0.375rem;
  background: var(--text);
  color: var(--bg);
  font-size: 0.75rem;
  box-shadow: var(--shadow);
}

.main-area {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.25s ease, width 0.25s ease;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  padding: 1rem;
}

@media (min-width: 640px) {
  .app-header {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .app-header {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

.app-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.app-header__title-wrap {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.75rem;
}

.app-header__titles {
  min-width: 0;
}

.app-header__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .app-header__title {
    font-size: 1.25rem;
  }
}

.app-header__subtitle {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header__actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.5rem;
  overflow: visible;
}

.sidebar-mobile-toggle {
  display: inline-flex;
}

@media (min-width: 1024px) {
  .sidebar-mobile-toggle {
    display: none !important;
  }
}

.page-content {
  flex: 1;
  width: 100%;
  color: var(--text);
  padding: 1.5rem 1rem;
}

@media (min-width: 640px) {
  .page-content {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .page-content {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

.dashboard-panels {
  display: grid;
  gap: 1.5rem;
  margin-top: 2rem;
}

@media (min-width: 1024px) {
  .dashboard-panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.page-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Cards & stats */
.card-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.stats-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card .stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-card .stat-value {
  margin-top: 0.35rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Forms */
.form-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-input,
.form-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg-muted);
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-input.is-error {
  border-color: var(--danger);
}

.form-hint {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-hint--error {
  color: var(--danger);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.form-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .form-grid--2 {
    grid-template-columns: 1fr 1fr;
  }
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.filter-field {
  flex: 1;
  min-width: 10rem;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: none;
  border-radius: 0.5rem;
  background: var(--accent);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-secondary:hover {
  background: var(--bg-muted);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-btn--danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Alerts */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}

.alert--success {
  border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.alert--error {
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge--sent {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge--queued {
  background: color-mix(in srgb, var(--warning) 18%, transparent);
  color: var(--warning);
}

.badge--failed {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge--active {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge--revoked,
.badge--expired {
  background: var(--bg-muted);
  color: var(--text-muted);
}

/* Data table */
.data-table-wrap {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.data-table thead {
  background: var(--bg-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.data-table .cell-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.data-table .cell-mono {
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.25rem;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-state__title {
  font-size: 1rem;
  font-weight: 600;
}

.empty-state__text {
  margin-top: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 24rem;
}

/* Pagination */
.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgb(0 0 0 / 0.55);
  backdrop-filter: blur(4px);
}

.modal-overlay.open,
.modal-overlay.is-open {
  display: flex;
}

.modal-panel {
  width: 100%;
  max-width: 28rem;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 20px 40px rgb(0 0 0 / 0.15);
}

.modal-panel--wide {
  max-width: 36rem;
}

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

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.tabs__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 0.65rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: -1px;
}

.tabs__btn.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.tab-panel__title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

/* Profile page — editorial identity layout */
.profile-page {
  --profile-display: "Fraunces", Georgia, "Times New Roman", serif;
  --profile-body: "DM Sans", system-ui, sans-serif;
  font-family: var(--profile-body);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  animation: profile-page-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes profile-page-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.profile-header-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.profile-header-cta:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.profile-header-cta__icon {
  width: 1.1rem;
  height: 1.1rem;
}

.profile-flash {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
}

.profile-flash svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.profile-flash--success {
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.profile-flash--error {
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

.profile-identity {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.profile-identity__mesh {
  position: absolute;
  inset: 0;
  pointer-events: none;
 
  opacity: 1;
}

.profile-identity__mesh::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.dark .profile-identity__mesh {
  background:
    radial-gradient(ellipse 70% 55% at 8% 15%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 50%),
    radial-gradient(ellipse 45% 70% at 92% 85%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 45%),
    linear-gradient(160deg, #0a0a0a 0%, #111 40%, #000 100%);
}

.profile-identity__inner {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1.5rem;
  padding: 1.75rem 1.5rem;
}

@media (min-width: 768px) {
  .profile-identity__inner {
    grid-template-columns: 1fr minmax(12rem, 16rem);
    align-items: end;
    padding: 2rem 2rem 1.75rem;
  }
}

.profile-identity__main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 540px) {
  .profile-identity__main {
    flex-direction: row;
    align-items: flex-start;
    gap: 1.5rem;
  }
}

.profile-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.profile-avatar-ring {
  display: flex;
  width: 6.5rem;
  height: 6.5rem;
  padding: 3px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 40%, var(--border)));
  box-shadow: 0 8px 28px color-mix(in srgb, var(--accent) 25%, transparent);
}

.profile-avatar-ring > * {
  flex: 1;
  width: 100%;
  min-height: 0;
  border-radius: 999px;
}

.profile-avatar-media,
.profile-avatar-fallback {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  font-family: var(--profile-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

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

.profile-avatar-form__label {
  display: inline-flex;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.profile-avatar-form__label:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.profile-identity__copy {
  min-width: 0;
}

.profile-identity__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.profile-identity__name {
  margin: 0;
  font-family: var(--profile-display);
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: var(--text);
}

.profile-identity__email {
  margin: 0.4rem 0 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.profile-identity__bio {
  margin: 0.75rem 0 0;
  max-width: 36rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.profile-identity__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.profile-chip {
  display: inline-flex;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.profile-identity__card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface));
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.profile-identity__card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 18%, transparent);
}

.profile-identity__card-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.profile-identity__card-title {
  font-family: var(--profile-display);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.profile-identity__card-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.profile-identity__card-arrow {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.5rem;
  color: var(--accent);
}

.profile-workspace {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 900px) {
  .profile-workspace {
    grid-template-columns: minmax(11rem, 14rem) 1fr;
    gap: 1.75rem;
    align-items: start;
  }
}

.profile-rail {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: thin;
}

@media (min-width: 900px) {
  .profile-rail {
    flex-direction: column;
    overflow: visible;
    position: sticky;
    top: 5.5rem;
    padding-bottom: 0;
  }
}

.profile-rail__btn {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 10.5rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.profile-rail__btn:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.profile-rail__btn.is-active {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.profile-rail__btn.is-active .profile-rail__icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.profile-rail__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: 0.5rem;
  background: var(--bg-muted);
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.profile-rail__icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.profile-rail__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.profile-rail__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: inherit;
}

.profile-rail__desc {
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.profile-rail__btn.is-active .profile-rail__desc {
  color: color-mix(in srgb, var(--text-muted) 80%, var(--accent));
}

.profile-panels {
  min-width: 0;
}

.profile-panel {
  display: none;
  padding: 1.5rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: profile-panel-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.profile-panel.is-active {
  display: block;
}

@keyframes profile-panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.profile-panel__head {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.profile-panel__title {
  margin: 0;
  font-family: var(--profile-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.profile-panel__lead {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 32rem;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.profile-form--narrow {
  max-width: 28rem;
}

.profile-form__grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .profile-form__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.profile-field--full {
  grid-column: 1 / -1;
}

.profile-field__label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.profile-field__hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.profile-field__input--locked {
  opacity: 0.72;
  cursor: not-allowed;
}

.profile-field__textarea {
  min-height: 6rem;
  resize: vertical;
  line-height: 1.5;
}

.profile-form__foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.profile-form__submit {
  min-width: 9rem;
}

.profile-theme-picker {
  margin: 0;
  padding: 0;
  border: none;
}

.profile-theme-picker__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
  max-width: 16.5rem;
}

.profile-theme-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 4.75rem;
  padding: 0.4rem 0.35rem 0.35rem;
  border: 1.5px solid var(--border);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.profile-theme-card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.profile-theme-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.profile-theme-card__preview {
  width: 100%;
  height: 1.65rem;
  border-radius: 0.3rem;
  border: 1px solid var(--border);
}

.profile-theme-card__preview--light {
  background: linear-gradient(145deg, #f8fafc 40%, #e2e8f0);
}

.profile-theme-card__preview--dark {
  background: linear-gradient(145deg, #171717 30%, #000);
}

.profile-theme-card__preview--auto {
  background: linear-gradient(90deg, #f1f5f9 50%, #0a0a0a 50%);
}

.profile-theme-card__name {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  text-align: center;
}

.profile-lang-toggle {
  display: inline-flex;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-muted);
  gap: 0.15rem;
}

.profile-lang-option {
  cursor: pointer;
}

.profile-lang-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.profile-lang-option span {
  display: block;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.profile-lang-option:has(input:checked) span {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow);
}

.profile-field--lang {
  margin-top: 0.5rem;
}

/* Legacy avatar class used by profile.js preview */
.profile-avatar {
  width: 4rem;
  height: 4rem;
  border-radius: 9999px;
  overflow: hidden;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent);
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.token-reveal {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  padding: 1rem;
}

.token-reveal__code {
  display: block;
  margin-top: 0.5rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: var(--surface);
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  word-break: break-all;
}

/* Notifications */
.notification-bell {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 9999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.notification-badge.is-visible {
  display: flex;
}

.notification-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  width: min(20rem, calc(100vw - 2rem));
  max-height: min(24rem, 70vh);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.15);
  z-index: 50;
}

.notification-dropdown.is-open {
  display: block;
  animation: notification-dropdown-in 0.18s ease-out both;
}

@keyframes notification-dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notification-dropdown__inner {
  padding: 0.75rem;
}

.notification-dropdown__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.notification-dropdown__title {
  font-size: 0.875rem;
  font-weight: 600;
}

#notificationList {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 16rem;
  overflow-y: auto;
}

.notification-dropdown .notification-item {
  padding: 0.6rem 0.65rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
}

.notification-dropdown .notification-item.unread {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}

.notification-dropdown .notification-item.read {
  opacity: 0.85;
}

.notification-item-message {
  line-height: 1.4;
  color: var(--text);
}

.notification-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.notification-item-time {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.notification-link-btn {
  border: none;
  background: none;
  padding: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}

.notification-link-btn:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.notification-empty {
  padding: 1rem 0.5rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.notification-dropdown__footer {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
}

.notification-list-page {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.notification-item {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  padding: 0.85rem 1rem;
}

.notification-item.is-unread {
  border-left: 3px solid var(--accent);
}

.notification-item__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.link-btn {
  border: none;
  background: none;
  padding: 0;
  font-size: inherit;
  color: var(--accent);
  cursor: pointer;
}

/* Mail log preview */
.log-preview {
  margin-top: 0.5rem;
  padding: 0.65rem;
  border-radius: 0.5rem;
  background: var(--bg-muted);
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: pre-wrap;
}

.log-error {
  margin-top: 0.5rem;
  padding: 0.65rem;
  border-radius: 0.5rem;
  background: var(--danger-soft);
  font-size: 0.8125rem;
  color: var(--danger);
}

/* HTMX & toast */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline;
}

.contact-row.htmx-swapping {
  opacity: 0;
  transition: opacity 0.3s;
}

.toast-root {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast-item {
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 0.5rem;
  background: var(--surface);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  box-shadow: var(--shadow);
  animation: toast-in 0.3s ease;
}

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

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgb(0 0 0 / 0.65);
}

.sidebar-backdrop:not(.hidden) {
  display: block;
}

/* Auth (standalone) */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 28rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.auth-card h1,
.auth-card h2 {
  margin: 0;
}

.auth-brand {
  text-align: center;
  margin-bottom: 2rem;
}

/* Theme utilities */
.text-muted {
  color: var(--text-muted);
}

.text-accent {
  color: var(--accent);
}

.link-accent {
  color: var(--accent);
  text-decoration: none;
}

.link-accent:hover {
  color: var(--accent-hover);
}

.section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

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

.avatar-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: var(--accent-soft);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
}

.avatar-circle--sm {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.75rem;
}

.avatar-circle--lg {
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1rem;
}

.tag-pill {
  display: inline-flex;
  border-radius: 9999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--bg-muted);
  color: var(--text-muted);
}

.tag-pill--accent {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.row-link {
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

.row-link:hover {
  color: var(--accent);
}

.row-link-avatar {
  display: inline-flex;
  text-decoration: none;
}

.card-panel--hover {
  transition: border-color 0.15s ease;
}

.card-panel--hover:hover {
  border-color: var(--accent);
}

.list-toolbar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .list-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.search-field {
  position: relative;
  flex: 1;
  max-width: 28rem;
  width: 100%;
}

.search-field .form-input {
  padding-left: 2.75rem;
  padding-right: 2.25rem;
}

.search-field__icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  width: 1rem;
  height: 1rem;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-field__indicator {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recent-list__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}

.recent-list__item:last-child {
  border-bottom: none;
}

.recent-list__item:hover {
  color: var(--accent);
}

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

.category-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: var(--bg-muted);
}

/* Contact detail — flat, optimized */
.icon-20 {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
}

.form-select--compact {
  min-width: 8.5rem;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
  font-size: 0.8125rem;
}

.form-input--file {
  font-size: 0.8125rem;
  padding: 0.45rem 0.65rem;
}

.avatar-circle--xl {
  width: 4rem;
  height: 4rem;
  font-size: 1.125rem;
  flex-shrink: 0;
}

/* Contact detail — thread / inbox layout */
.thread-view {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
}

.thread-view__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.thread-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.thread-back:hover {
  color: var(--accent);
}

.thread-view__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.thread-tool-form {
  display: flex;
  align-items: center;
}

.thread-participant {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 0.25rem;
}

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

.thread-participant__name {
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.thread-participant__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  margin-top: 0.25rem;
  font-size: 0.875rem;
}

.thread-participant__links a {
  color: var(--text-muted);
  text-decoration: none;
}

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

.thread-dot {
  color: var(--text-muted);
  opacity: 0.6;
}

.thread-participant__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-top: 0.65rem;
}

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

.thread-timeline {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.thread-item {
  padding: 0 0 0 1rem;
  border-left: 3px solid var(--accent);
}

.thread-item--outbound {
  border-left-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.thread-item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.5rem;
}

.thread-item__who {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.thread-item__time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.thread-item__subject {
  margin: 0 0 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.thread-item__body {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text);
}

.thread-attachments {
  font-size: 0.875rem;
}

.thread-attachments__label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.thread-attachments ul {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.thread-attachments a {
  font-weight: 500;
}

.thread-compose {
  padding-top: 1.5rem;
  margin-top: 0.25rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}

.thread-compose__title {
  margin: 0 0 1rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.thread-compose__form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.thread-compose__row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 640px) {
  .thread-compose__row {
    flex-direction: row;
    align-items: flex-end;
  }
}

.thread-compose__field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.thread-compose__field--grow {
  flex: 1;
}

.thread-compose__actions {
  display: flex;
  justify-content: flex-end;
}

/* Token page & shared */
.page-lead {
  margin: 0 0 0.25rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.inline-code {
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  background: color-mix(in srgb, var(--text-muted) 12%, var(--bg));
  color: var(--text);
}

.modal-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.btn-danger-outline {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}

.btn-danger-outline:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

@media (max-width: 1023px) {
  .sidebar-panel {
    transform: translateX(-100%);
  }

  .sidebar-panel.mobile-open {
    transform: translateX(0);
  }

  .main-area,
  html.sidebar-collapsed .main-area {
    width: 100%;
    margin-left: 0;
  }
}
