/* ============================================================
   DotNetCloud UI - Base Styles
   ============================================================ */

/* --- CSS Custom Properties (Theme) --- */
:root {
  --color-bg: #f5f7fa;
  --color-surface: #ffffff;
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;
  --color-warning: #f59e0b;
  --color-success: #10b981;
  --color-muted: #94a3b8;
  --color-text: #1e293b;
  --color-text-secondary: #64748b;
  --color-border: #e2e8f0;
  --color-sidebar-bg: #1e293b;
  --color-sidebar-text: #cbd5e1;
  --color-sidebar-hover: #334155;
  --color-sidebar-active: #3b82f6;
  --color-selected-bg: #eff6ff;
  --color-selected-text: #1e293b;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 96px;
  --topbar-height: 56px;
  --transition: 200ms ease;
}

.dark-mode {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-text: #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-border: #334155;
  --color-sidebar-bg: #0f172a;
  --color-sidebar-hover: #1e293b;
  --color-selected-bg: #1e3a5f;
  --color-selected-text: #f1f5f9;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1e293b; /* Always dark — Blazor's Shadow DOM reconnect UI inherits from body */
  background: var(--color-bg);
}

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

/* --- App Layout --- */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
  color: var(--color-text);
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  color: var(--color-sidebar-text);
  display: flex;
  flex-direction: column;
  transition: width var(--transition);
  flex-shrink: 0;
  overflow: hidden;
}

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

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  min-height: 88px;
}

.brand {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  min-width: 0;
}
.brand:hover {
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 68px;
  height: 68px;
  border-radius: 10px;
  flex-shrink: 0;
}

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

.sidebar.collapsed .brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 8px;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--color-sidebar-text);
  cursor: pointer;
  padding: 4px 8px;
  margin-left: auto;
  flex-shrink: 0;
  border-radius: 4px;
  font-size: 12px;
}
.sidebar-toggle:hover {
  background: var(--color-sidebar-hover);
}

.sidebar.collapsed .sidebar-toggle {
  padding-inline: 4px;
}

/* --- Nav Menu --- */
.nav-menu {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.nav-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 8px 16px;
}

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

.nav-item {
  margin: 2px 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--color-sidebar-text);
  text-decoration: none;
  transition: background var(--transition);
  white-space: nowrap;
}
.nav-link:hover {
  background: var(--color-sidebar-hover);
  text-decoration: none;
  color: #fff;
}
.nav-link.active {
  background: var(--color-sidebar-active);
  color: #fff;
}

.nav-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.nav-text {
  font-size: 14px;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: var(--topbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
}
.topbar-center {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: center;
  padding: 0 24px;
}
.page-title {
  font-size: 18px;
  font-weight: 600;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--color-text);
  background: var(--color-surface);
}

.dark-mode .theme-toggle {
  color: #facc15;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-name {
  color: var(--color-text-secondary);
  font-size: 13px;
}
.user-name-link {
  color: var(--color-text-secondary);
  font-size: 13px;
  text-decoration: none;
  transition: color 0.15s ease;
}
.user-name-link:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* --- Page Content --- */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.content-area {
  max-width: 1400px;
  margin: 0 auto;
}

/* --- Full-bleed module pages (chat, etc.) --- */
/* Remove page padding and let the module fill the full content area.
   Use :has() to target only pages that contain the chat layout. */
.page-content:has(.chat-layout) {
  padding: 0;
  overflow: hidden;
}

.page-content:has(.chat-layout) .content-area {
  max-width: none;
  margin: 0;
  height: 100%;
}

/* --- Page Header --- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 24px;
  font-weight: 700;
}
.header-actions {
  display: flex;
  gap: 8px;
}

/* --- Toolbar --- */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}
.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: var(--color-danger-hover);
}
.btn-warning {
  background: var(--color-warning);
  color: #fff;
}
.btn-success {
  background: var(--color-success);
  color: #fff;
}
.btn-outline {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-outline:hover:not(:disabled) {
  background: var(--color-bg);
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}
.btn-full {
  width: 100%;
}

/* --- Form Elements --- */
.input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition);
}
.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.input-code {
  text-align: center;
  font-size: 24px;
  letter-spacing: 8px;
}

textarea.input {
  resize: vertical;
  min-height: 60px;
}

.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--color-text-secondary);
}
.form-actions {
  margin-top: 20px;
  display: flex;
  gap: 8px;
}
.form-container {
  max-width: 500px;
  background: var(--color-surface);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* --- Tables --- */
.table-container {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.data-table th {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  background: var(--color-bg);
}
.data-table td a {
  font-weight: 500;
}
.data-table td small {
  display: block;
  color: var(--color-muted);
  font-size: 12px;
}
.data-table .actions {
  white-space: nowrap;
  display: flex;
  gap: 4px;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
}
.pagination-info {
  color: var(--color-text-secondary);
  font-size: 13px;
}

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success {
  background: #d1fae5;
  color: #065f46;
}
.badge-warning {
  background: #fef3c7;
  color: #92400e;
}
.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}
.badge-muted {
  background: #f1f5f9;
  color: #64748b;
}

.dark-mode .badge-success {
  background: #065f46;
  color: #d1fae5;
}
.dark-mode .badge-warning {
  background: #92400e;
  color: #fef3c7;
}
.dark-mode .badge-danger {
  background: #991b1b;
  color: #fee2e2;
}
.dark-mode .badge-muted {
  background: #334155;
  color: #94a3b8;
}

/* --- Dashboard --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.dashboard-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-left: 4px solid var(--color-primary);
}
.dashboard-card.card-healthy {
  border-left-color: var(--color-success);
}
.dashboard-card.card-degraded {
  border-left-color: var(--color-warning);
}
.dashboard-card.card-unhealthy {
  border-left-color: var(--color-danger);
}

.card-icon {
  font-size: 28px;
}
.card-content h3 {
  font-size: 13px;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.card-value {
  font-size: 28px;
  font-weight: 700;
}
.card-link {
  font-size: 13px;
  color: var(--color-primary);
}
.card-value-small {
  font-size: 20px;
  line-height: 1.3;
}

/* ── Dashboard v2 (stat cards, user table, panels) ───────────────────── */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.dash-stat-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.dash-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dash-stat-icon svg {
  width: 22px;
  height: 22px;
}
.dash-stat-icon--users {
  background: #dbeafe;
  color: #2563eb;
}
.dash-stat-icon--orgs {
  background: #dcfce7;
  color: #16a34a;
}
.dash-stat-icon--storage {
  background: #e0f2fe;
  color: #0284c7;
}
.dash-stat-icon--modules {
  background: #fef3c7;
  color: #d97706;
}
.dark-mode .dash-stat-icon--users {
  background: #1e3a5f;
  color: #60a5fa;
}
.dark-mode .dash-stat-icon--orgs {
  background: #14532d;
  color: #4ade80;
}
.dark-mode .dash-stat-icon--storage {
  background: #0c4a6e;
  color: #38bdf8;
}
.dark-mode .dash-stat-icon--modules {
  background: #451a03;
  color: #fbbf24;
}

.dash-stat-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.dash-stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  line-height: 1;
}
.dash-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
  margin-top: 4px;
}
.dash-stat-sub {
  font-size: 14px;
  font-weight: 400;
  color: var(--color-text-secondary);
}
.dash-stat-bar {
  width: 100%;
  max-width: 140px;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.dash-stat-bar-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* -- Section -- */
.dash-section {
  margin-bottom: 28px;
}
.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.dash-section-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}
.dash-section-link {
  font-size: 13px;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}
.dash-section-link:hover {
  text-decoration: underline;
}

/* -- User cell in table -- */
.dash-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.dash-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.dash-user-name {
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
}
.dash-user-name:hover {
  text-decoration: underline;
}
.dash-storage-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dash-storage-text {
  font-size: 13px;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

/* -- Bottom panels -- */
.dash-panels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}
.dash-panel {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dash-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.dash-panel-header h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}
.dash-panel-body {
  padding: 12px 20px 16px;
}
.dash-panel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}
.dash-panel-row + .dash-panel-row {
  border-top: 1px solid var(--color-border);
}
.dash-panel-row-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}
.dash-panel-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.dash-panel-row-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-panel-row-detail {
  font-size: 12px;
  color: var(--color-text-secondary);
}

/* -- Quota rows in panel -- */
.dash-quota-row {
  padding: 8px 0;
}
.dash-quota-row + .dash-quota-row {
  border-top: 1px solid var(--color-border);
}
.dash-quota-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 4px;
  display: block;
}
.dash-quota-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-quota-bar-wrapper .quota-bar {
  flex: 1;
  width: auto;
  display: block;
}
.dash-quota-text {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-secondary);
  white-space: nowrap;
  min-width: 100px;
  text-align: right;
}

/* -- Health indicators -- */
.dash-health-overall {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 12px;
}
.dash-health-status {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}
.dash-health-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-health-dot--sm {
  width: 8px;
  height: 8px;
}
.dash-health-dot--healthy {
  background: var(--color-success);
}
.dash-health-dot--degraded {
  background: var(--color-warning);
}
.dash-health-dot--unhealthy {
  background: var(--color-danger);
}
.dash-health-dot--unknown {
  background: var(--color-muted);
}

/* Responsive: dashboard v2 */
@media (max-width: 1100px) {
  .dash-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-panels {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .dash-stats {
    grid-template-columns: 1fr;
  }
}

.dashboard-header {
  margin-bottom: 20px;
}

.role-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.module-home-section {
  margin-top: 24px;
}

/* --- Sync Devices Status --- */
.sync-summary {
  margin-bottom: 24px;
}
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text);
}
.stat-label {
  font-size: 12px;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.module-home-section h2 {
  margin-bottom: 12px;
  font-size: 18px;
}

.module-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.module-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  text-decoration: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.file-name-link {
  background: none;
  border: none;
  color: var(--color-text);
  padding: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.file-name-link:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.module-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  text-decoration: none;
}

.module-card-icon {
  font-size: 20px;
}

.module-card-label {
  flex: 1;
  font-weight: 600;
}

.module-card-action {
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* --- Detail View --- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.detail-section {
  background: var(--color-surface);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.detail-section h2 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--color-text);
}

.detail-list {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
}
.detail-list dt {
  font-weight: 500;
  color: var(--color-text-secondary);
}
.detail-list dd {
  color: var(--color-text);
}

.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
}
.tag {
  padding: 4px 10px;
  background: var(--color-bg);
  border-radius: 12px;
  font-size: 12px;
  color: var(--color-text-secondary);
}
.tag-granted {
  background: #d1fae5;
  color: #065f46;
}
.tag-event {
  background: #dbeafe;
  color: #1e40af;
}

/* --- Health --- */
.health-overview {
  margin-bottom: 20px;
}
.health-status {
  padding: 16px 24px;
  border-radius: var(--radius);
  text-align: center;
}
.health-status h2 {
  font-size: 20px;
}
.health-healthy {
  background: #d1fae5;
  color: #065f46;
}
.health-degraded {
  background: #fef3c7;
  color: #92400e;
}
.health-unhealthy {
  background: #fee2e2;
  color: #991b1b;
}

/* --- Alerts --- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 14px;
}
.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}
.alert-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}
.alert-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}
.alert-dismissible {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.alert-dismissible .alert-close {
  flex-shrink: 0;
  font-size: 14px;
  opacity: 0.7;
}
.alert-dismissible .alert-close:hover {
  opacity: 1;
}

/* --- Dialog / Modal --- */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.dialog {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 400px;
  max-width: 90vw;
}
.dialog-wide {
  width: 560px;
}
.dialog-xwide {
  width: 800px;
}
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.dialog-header h3 {
  font-size: 16px;
}
.dialog-body {
  padding: 20px;
  max-height: 80vh;
  overflow-y: auto;
}
.dialog-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* --- Files Module --- */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-icon:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-bg);
}

.btn-icon.btn-xs {
  width: 22px;
  height: 22px;
  font-size: 12px;
}

.file-upload-overlay {
  margin-top: 10px;
}

/* --- Files Page Layout (Sidebar + Main) --- */
.files-page-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
  min-height: calc(100vh - 120px);
}

.files-page-main {
  min-width: 0;
  overflow: hidden;
}

/* --- Files Sidebar Navigation --- */
.files-sidebar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px 0;
  box-shadow: var(--shadow-sm);
  height: fit-content;
  position: sticky;
  top: 80px;
}

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

.sidebar-nav-item {
  margin: 0;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--color-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-nav-link:hover {
  background: var(--color-bg);
  color: var(--color-primary);
}

.sidebar-nav-item--active .sidebar-nav-link,
.sidebar-nav-item--active > .sidebar-nav-link--expandable {
  background: #eff6ff;
  color: var(--color-primary);
  border-left-color: var(--color-primary);
  font-weight: 600;
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  overflow: hidden;
  line-height: 1;
}

.nav-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--color-danger);
  border-radius: 999px;
  flex-shrink: 0;
}

.nav-chevron {
  font-size: 10px;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.sidebar-nav-link--expandable {
  font: inherit;
}

/* Tags sub-list */
.sidebar-tag-list {
  list-style: none;
  margin: 0;
  padding: 4px 0 4px 30px;
}

.sidebar-tag-item {
  margin: 0;
}

.sidebar-tag-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px 6px 12px;
  color: var(--color-text);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  transition: background var(--transition);
}

.sidebar-tag-link:hover {
  background: var(--color-bg);
}

.tag-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tag-dot-lg {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

.tag-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-count {
  font-size: 11px;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.sidebar-tag-empty {
  padding: 6px 16px 6px 12px;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-style: italic;
}

/* Sidebar quota */
.sidebar-quota {
  padding: 12px 16px 4px;
  border-top: 1px solid var(--color-border);
  margin-top: 8px;
}
.sidebar-storage-summary {
  font-size: 0.82rem;
}
.storage-line {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  color: var(--color-text-secondary, #6b7280);
}
.storage-label {
  font-weight: 500;
}
.storage-value {
  font-variant-numeric: tabular-nums;
}

/* Quota progress bar (admin user detail) */
.quota-bar {
  display: inline-block;
  width: 120px;
  height: 8px;
  background: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 8px;
}
.quota-bar-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.quota-bar-fill.quota-warning {
  background: var(--color-warning, #f59e0b);
}
.quota-bar-fill.quota-critical {
  background: var(--color-danger, #ef4444);
}
.quota-bar.quota-bar-sm {
  width: 100%;
  max-width: 160px;
  height: 6px;
  margin: 4px 0 2px;
}
.text-sm {
  font-size: 0.8rem;
  display: block;
}

/* --- Trash Bin Page --- */
.trash-bin-page {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.trash-bin-page .page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.trash-bin-page .page-header h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  white-space: nowrap;
}

.trash-size-info {
  color: var(--color-text-secondary);
  font-size: 14px;
}

.trash-bin-page .page-header .btn {
  margin-left: auto;
}

.trash-confirm-dialog {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  background: #fef2f2;
  color: #7f1d1d;
}

.trash-confirm-content p {
  margin: 0 0 8px;
}

.trash-confirm-content p strong {
  color: #7f1d1d;
}

.trash-confirm-dialog .text-muted {
  color: #9f1239;
}

.trash-confirm-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

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

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
}

.trash-list {
  display: flex;
  flex-direction: column;
}

.trash-list-header,
.trash-item {
  display: grid;
  grid-template-columns:
    32px 28px minmax(120px, 1fr) minmax(100px, 140px)
    minmax(60px, 80px) auto;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
}

.trash-list-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--color-border);
}

.trash-item {
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition);
}

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

.trash-item:hover {
  background: var(--color-bg);
}

.trash-item.selected {
  background: var(--color-selected-bg, #eff6ff);
  color: var(--color-selected-text, #1e293b);
}

.col-name.file-info {
  overflow: hidden;
  min-width: 0;
}

.col-name.file-info .file-name {
  display: block;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
}

.trash-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.trash-actions .btn {
  white-space: nowrap;
  font-size: 12px;
  padding: 4px 8px;
}

.sort-header {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.sort-header:hover {
  color: var(--color-primary);
}

.sort-header--active {
  color: var(--color-text);
}

/* --- Responsive: Collapse sidebar on small screens --- */
@media (max-width: 900px) {
  .files-page-layout {
    grid-template-columns: 1fr;
  }

  .files-sidebar {
    position: static;
  }

  .trash-list-header {
    display: none;
  }

  .trash-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 10px;
  }

  .trash-item .col-check {
    flex: 0 0 auto;
  }

  .trash-item .col-icon {
    flex: 0 0 auto;
  }

  .trash-item .col-name {
    flex: 1 1 100%;
    min-width: 0;
    order: -1;
    padding-left: 38px; /* align with checkbox + icon width */
  }

  .trash-item .col-date {
    font-size: 12px;
    color: var(--color-text-secondary);
  }

  .trash-item .col-size {
    font-size: 12px;
    color: var(--color-text-secondary);
  }

  .trash-item .col-actions {
    margin-left: auto;
  }
}

.files-browser {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.files-browser--drag-over {
  border-color: var(--color-primary);
}

.browser-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 2px dashed var(--color-primary);
  background: rgba(239, 246, 255, 0.92);
}

.browser-drop-message {
  text-align: center;
  pointer-events: none;
}

.browser-drop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: #dbeafe;
  color: var(--color-primary);
  font-size: 22px;
}

.browser-drop-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: copy;
}

.browser-drop-capture-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.files-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.files-header h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.1;
}

.files-breadcrumbs {
  margin-bottom: 12px;
}

.files-breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.files-breadcrumbs .separator {
  color: var(--color-text-secondary);
}

.files-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.selection-info {
  color: var(--color-text-secondary);
  font-size: 12px;
  margin-left: 4px;
}

.create-folder-dialog {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
}

.create-folder-dialog input {
  min-width: 240px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text);
}

/* New file dialog — two-row layout */
.create-file-dialog {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
}

.create-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.create-file-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  min-width: 72px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.create-file-row input {
  min-width: 200px;
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.9rem;
}

.create-file-row select {
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.9rem;
}

.create-file-actions {
  display: flex;
  justify-content: flex-end;
}

.custom-extension-input {
  display: flex;
  align-items: center;
  gap: 2px;
}

.custom-extension-input .extension-dot {
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 1rem;
}

.custom-extension-input .ext-input {
  min-width: 70px;
  max-width: 100px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text);
}

.files-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}

.file-item.selected {
  border-color: var(--color-primary);
  background: var(--color-selected-bg, #eff6ff);
  color: var(--color-selected-text, #1e293b);
}

.file-item:hover {
  border-color: #cbd5e1;
}

.file-icon {
  font-size: 18px;
  line-height: 1;
}

.file-info {
  min-width: 0;
  overflow: hidden;
}

.file-name {
  font-weight: 600;
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  color: var(--color-text-secondary);
  font-size: 12px;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* --- Selection Mode --- */
.btn-active {
  background: var(--color-primary) !important;
  color: #fff !important;
  border-color: var(--color-primary) !important;
}

.file-item.selection-mode {
  cursor: pointer;
  grid-template-columns: 28px 28px 1fr auto;
}

.file-item.selection-mode .col-check {
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-item.selection-mode .col-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.bulk-actions-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.selection-info {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
}

/* --- Folder Picker Dialog --- */
.folder-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.folder-picker-dialog {
  background: var(--color-surface);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 420px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.folder-picker-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.folder-picker-header h3 {
  margin: 0;
  font-size: 16px;
}

.folder-picker-breadcrumbs {
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 13px;
  border-bottom: 1px solid var(--color-border);
}

.folder-picker-breadcrumbs .separator {
  color: var(--color-text-secondary);
}

.folder-picker-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  min-height: 120px;
  max-height: 300px;
}

.folder-picker-current-path {
  padding: 4px 18px;
  font-size: 12px;
  color: var(--color-text-secondary, #888);
}

.folder-picker-current-path .path-label {
  font-weight: 600;
}

.folder-picker-empty {
  padding: 20px 18px;
  text-align: center;
  font-size: 13px;
}

.folder-picker-item {
  display: block;
  width: 100%;
  padding: 8px 18px;
  border: none;
  background: none;
  text-align: left;
  font-size: 14px;
  cursor: pointer;
  color: var(--color-text);
  transition: background var(--transition);
}

.folder-picker-item:hover {
  background: var(--color-bg);
}

.folder-picker-actions {
  padding: 12px 18px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Input + Browse button layout for directory pickers */
.input-with-browse {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-with-browse .input {
  flex: 1;
  min-width: 0;
}

.file-upload-dialog {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  max-width: 720px;
}

.file-upload-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.file-upload-header h3 {
  margin: 0;
  font-size: 22px;
}

.file-upload-dropzone {
  position: relative;
  overflow: hidden;
  border: 2px dashed var(--color-border);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  background: var(--color-bg);
  transition:
    border-color var(--transition),
    background var(--transition);
}

.file-upload-dropzone.dragging {
  border-color: var(--color-primary);
  background: #eff6ff;
}

.file-upload-input-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.file-upload-dropzone > *:not(.file-upload-input-overlay) {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.dropzone-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #dbeafe;
  color: var(--color-primary);
  font-size: 20px;
  margin-bottom: 8px;
}

.text-xs {
  font-size: 12px;
}

.file-upload-list {
  margin-top: 12px;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.upload-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
}

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

.upload-item--cancelled {
  opacity: 0.6;
}

.upload-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-size {
  color: var(--color-text-secondary);
  font-size: 12px;
}

.file-upload-footer {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Version history panel ────────────────────────────────── */

.version-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.version-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.version-panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
}

.version-panel-filename {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.version-panel-loading,
.version-panel-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--color-text-muted);
}

.version-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
}

.version-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.version-item--current {
  background: var(--color-selected-bg, #eff6ff);
}

.version-number {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.version-badge-current {
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--color-primary, #3b82f6);
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
}

.version-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.version-label {
  font-style: italic;
  color: var(--color-text);
}

.version-label-input {
  font-size: 0.8rem;
  padding: 2px 6px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  width: 120px;
}

.version-add-label {
  font-size: 0.75rem;
  color: var(--color-primary, #3b82f6);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.version-date,
.version-author,
.version-size {
  white-space: nowrap;
}

.version-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.upload-panel {
  margin-top: 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.upload-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
}

.upload-panel-title {
  font-weight: 600;
}

.upload-panel-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.upload-panel-percent-summary {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.upload-panel-overall {
  padding: 10px;
}

.upload-panel-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 10px 10px;
}

.upload-panel-file {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px;
}

.upload-panel-file--error {
  border-color: #fca5a5;
  background: #fef2f2;
}

.upload-file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.upload-file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.upload-file-controls {
  display: flex;
  gap: 4px;
}

.upload-file-progress {
  margin-top: 6px;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-track--sm {
  height: 6px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--color-primary);
}

.progress-bar-fill--success {
  background: var(--color-success);
}

.progress-bar-fill--error {
  background: var(--color-danger);
}

.progress-bar-fill--paused {
  background: var(--color-warning);
}

.upload-file-status-label {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-text-secondary);
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}
.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: toast-in 200ms ease;
  color: #fff;
}
.toast-info {
  background: var(--color-primary);
}
.toast-success {
  background: var(--color-success);
}
.toast-warning {
  background: var(--color-warning);
  color: #1e293b;
}
.toast-error {
  background: var(--color-danger);
}

.toast-close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 18px;
  opacity: 0.8;
}
.toast-close:hover {
  opacity: 1;
}

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

/* --- Loading Indicator --- */
.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 12px;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-message {
  color: var(--color-text-secondary);
  font-size: 14px;
}

/* --- Error Display --- */
.error-display {
  text-align: center;
  padding: 40px;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.error-display h2 {
  color: var(--color-danger);
  margin-bottom: 8px;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--color-text-secondary);
}

.file-name-link {
  background: none;
  border: none;
  color: var(--color-text);
  padding: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.file-name-link:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.file-item.selected .file-name-link {
  color: var(--color-selected-text, #1e293b);
}

.comment-indicator {
  margin-left: 6px;
  font-size: 0.85em;
  opacity: 0.8;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 1;
}

.comment-indicator:hover {
  opacity: 1;
}

.meta-sep {
  margin: 0 4px;
  opacity: 0.5;
}

/* --- Auth Layout --- */
.auth-layout {
  min-height: 100vh;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}
.auth-container {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}
.auth-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 32px;
}
.auth-header {
  text-align: center;
  margin-bottom: 24px;
}
.auth-header .brand-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 8px;
}
.auth-header .auth-logo {
  width: 72px;
  height: 72px;
  margin-bottom: 12px;
}
.auth-header h1 {
  font-size: 24px;
  margin-bottom: 4px;
}
.auth-header p {
  color: var(--color-text-secondary);
}
.auth-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  font-size: 13px;
  color: var(--color-text-secondary);
}
.auth-footer .separator {
  margin: 0 8px;
}

/* --- MFA Setup Page --- */
.mfa-setup-loading {
  text-align: center;
  padding: 40px 0;
  color: var(--color-text-secondary);
}
.mfa-setup-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: mfa-spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes mfa-spin {
  to {
    transform: rotate(360deg);
  }
}

.mfa-setup-steps {
  margin-top: 8px;
}

.setup-step {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: flex-start;
}
.setup-step .step-number {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  margin-top: 1px;
}
.setup-step .step-content {
  flex: 1;
}
.setup-step .step-content strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}
.setup-step .step-content p {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.mfa-qr-container {
  display: flex;
  justify-content: center;
  margin: 20px 0;
  padding: 16px;
  background: #fff;
  border-radius: var(--radius);
  border: 2px solid var(--color-border);
}
.mfa-qr-container canvas,
.mfa-qr-container img,
.mfa-qr-container svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.mfa-manual-key {
  margin-bottom: 20px;
}
.mfa-manual-key details {
  cursor: pointer;
}
.mfa-manual-key summary {
  font-size: 13px;
  color: var(--color-primary);
  margin-bottom: 8px;
}
.manual-key-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--color-bg);
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}
.manual-key-box code {
  flex: 1;
  font-size: 13px;
  letter-spacing: 2px;
  word-break: break-all;
  background: none;
  padding: 0;
}

.mfa-setup-success {
  text-align: center;
  padding: 20px 0;
}
.mfa-setup-success .success-icon {
  width: 56px;
  height: 56px;
  background: var(--color-success, #22c55e);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  margin: 0 auto 16px;
}
.mfa-setup-success h2 {
  font-size: 20px;
  margin-bottom: 8px;
}
.mfa-setup-success p {
  color: var(--color-text-secondary);
  margin-bottom: 20px;
}

.backup-codes-section {
  text-align: left;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.backup-codes-section h3 {
  font-size: 14px;
  margin-bottom: 4px;
}
.backup-codes-section p {
  font-size: 12px;
  margin-bottom: 12px;
}
.backup-codes-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}
.backup-code {
  font-family: monospace;
  font-size: 13px;
  padding: 4px 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  text-align: center;
  letter-spacing: 1px;
}

.mfa-setup-error {
  padding: 20px 0;
}

/* --- Utility --- */
.text-center {
  text-align: center;
}
.text-muted {
  color: var(--color-muted);
}
code {
  background: var(--color-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

/* --- Validation --- */
.validation-message {
  color: var(--color-danger);
  font-size: 12px;
  margin-top: 4px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    z-index: 100;
    height: 100vh;
  }
  .sidebar.collapsed {
    width: 0;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .dash-stats {
    grid-template-columns: 1fr;
  }
  .dash-panels {
    grid-template-columns: 1fr;
  }
  .module-cards {
    grid-template-columns: 1fr;
  }
  .detail-list {
    grid-template-columns: 1fr;
  }
}

/* ── Context Menu ──────────────────────────────────────────────────────── */

.file-context-menu {
  position: fixed;
  z-index: 1000;
  min-width: 180px;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 4px 0;
  animation: context-menu-in 0.12s ease-out;
}

@keyframes context-menu-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: none;
  color: var(--color-text);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
}

.context-menu-item:hover,
.context-menu-item:focus-visible {
  background: var(--color-primary);
  color: #fff;
  outline: none;
}

.context-menu-item:focus-visible .context-menu-icon {
  filter: brightness(10);
}

.context-menu-item--danger:hover,
.context-menu-item--danger:focus-visible {
  background: var(--color-danger);
  color: #fff;
}

.context-menu-icon {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.context-menu-separator {
  height: 1px;
  background: var(--color-border);
  margin: 4px 8px;
}

/* ── Drag-Move Visual Feedback ─────────────────────────────────────────── */

.file-item[draggable="true"] {
  cursor: grab;
}

.file-item[draggable="true"]:active {
  cursor: grabbing;
}

.file-item.drag-over-target {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
  background: rgba(59, 130, 246, 0.08);
}

.file-item.dragging {
  opacity: 0.5;
}

/* ============================================================
   Missing Utility Button & Form Classes
   ============================================================ */

.btn-secondary {
  background: var(--color-text-secondary);
  color: #fff;
  border-color: var(--color-text-secondary);
}
.btn-secondary:hover:not(:disabled) {
  background: #475569;
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-primary);
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn-link:hover {
  text-decoration: underline;
}

.btn-outline-primary {
  background: transparent;
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
}
.btn-outline-primary:hover:not(:disabled) {
  background: var(--color-primary);
  color: #fff;
}

.btn-outline-secondary {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}
.btn-outline-secondary:hover:not(:disabled) {
  background: var(--color-bg);
  color: var(--color-text);
}

.btn-outline-danger {
  background: transparent;
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
}
.btn-outline-danger:hover:not(:disabled) {
  background: var(--color-danger);
  color: #fff;
}

.btn-outline-success {
  background: transparent;
  border: 1px solid var(--color-success);
  color: var(--color-success);
}
.btn-outline-success:hover:not(:disabled) {
  background: var(--color-success);
  color: #fff;
}

.btn-outline-warning {
  background: transparent;
  border: 1px solid var(--color-warning);
  color: var(--color-warning);
}
.btn-outline-warning:hover:not(:disabled) {
  background: var(--color-warning);
  color: #fff;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition);
  font-family: inherit;
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.form-control-sm {
  padding: 6px 10px;
  font-size: 13px;
}

textarea.form-control {
  resize: vertical;
  min-height: 60px;
}

.form-select {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  font-family: inherit;
}
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.form-select-sm {
  padding: 6px 10px;
  font-size: 13px;
}

.p-0 {
  padding: 0 !important;
}
.text-start {
  text-align: left !important;
}

.dark-mode .form-control {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
.dark-mode .form-select {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

/* ============================================================
   Calendar Module Styles
   ============================================================ */

.calendar-page-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  min-height: calc(100vh - 120px);
}

/* --- Calendar Sidebar --- */
.calendar-sidebar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  height: fit-content;
  position: sticky;
  top: 80px;
  overflow: hidden;
}

.calendar-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--color-border);
}

.calendar-sidebar-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}

.calendar-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 8px 4px;
}

.calendar-nav-item {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition);
  border: none;
  background: none;
  text-decoration: none;
  text-align: left;
}
.calendar-nav-item:hover {
  background: var(--color-bg);
  color: var(--color-primary);
  text-decoration: none;
}
.calendar-nav-item.active {
  background: #eff6ff;
  color: var(--color-primary);
  font-weight: 600;
}
.dark-mode .calendar-nav-item.active {
  background: rgba(59, 130, 246, 0.15);
}

.calendar-list-heading {
  padding: 12px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
}

.calendar-list {
  display: flex;
  flex-direction: column;
  padding: 4px 8px 8px;
  gap: 2px;
}

.calendar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background var(--transition);
}
.calendar-item:hover {
  background: var(--color-bg);
}
.calendar-item.selected {
  background: #eff6ff;
  color: var(--color-primary);
  font-weight: 600;
}
.dark-mode .calendar-item.selected {
  background: rgba(59, 130, 246, 0.15);
}

.calendar-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.calendar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 12px;
  border-top: 1px solid var(--color-border);
  margin-top: 4px;
}

.calendar-actions .btn {
  font-size: 12px;
}

/* --- Calendar Share Panel --- */
.calendar-share-panel {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--color-border);
}

.calendar-share-panel h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  margin: 0 0 8px;
}

.calendar-share-panel p {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin: 0;
}

.share-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--color-text);
}

.share-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

/* --- Share Dialog --- */
.share-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.share-dialog {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--color-text);
}

.share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.share-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}

.share-body {
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.share-body h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-text-secondary);
}

.share-search-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.share-search-wrapper {
  flex: 1;
  position: relative;
}

.share-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition);
}

.share-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.share-search-spinner {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted);
  font-size: 12px;
}

.share-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  list-style: none;
  margin: 4px 0 0;
  padding: 4px 0;
  z-index: 10;
  max-height: 200px;
  overflow-y: auto;
}

.share-search-result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  transition: background var(--transition);
}

.share-search-result-item:hover,
.share-search-result-item.selected {
  background: var(--color-selected-bg);
}

.result-type-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-user {
  background: #dbeafe;
  color: #1d4ed8;
}
.badge-team {
  background: #dcfce7;
  color: #15803d;
}
.badge-group {
  background: #fef3c7;
  color: #92400e;
}
.dark-mode .badge-user {
  background: #1e3a5f;
  color: #93c5fd;
}
.dark-mode .badge-team {
  background: #14532d;
  color: #86efac;
}
.dark-mode .badge-group {
  background: #451a03;
  color: #fcd34d;
}

.result-name {
  font-weight: 500;
}

.result-secondary {
  color: var(--color-text-secondary);
  font-size: 12px;
  margin-left: auto;
}

.share-permission-select {
  width: 130px;
  flex-shrink: 0;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--color-surface);
  color: var(--color-text);
}

.share-selected-recipient {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--color-selected-bg);
  border-radius: var(--radius);
  font-size: 13px;
  margin-top: 6px;
}

.share-selected-recipient .btn-icon {
  margin-left: auto;
}

.share-new-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.form-group-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.form-group-inline label {
  color: var(--color-text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.form-control-sm {
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
}

.share-error {
  margin-top: 6px;
  font-size: 13px;
}

/* Public link section */
.share-public-link-section {
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
}

.share-public-link-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.share-public-link-header h4 {
  margin: 0;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: 22px;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
}

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

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

.link-copy-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.link-copy-row input {
  flex: 1;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: monospace;
}

.share-public-link-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-link-stats {
  font-size: 12px;
  margin: 4px 0 0;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted, #8b949e);
}

/* Existing shares list */
.share-existing-section {
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
}

.share-existing-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.share-existing-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius);
  transition: background var(--transition);
}

.share-existing-item:hover {
  background: var(--color-bg);
}

.share-existing-item.share-expired {
  opacity: 0.6;
}

.share-existing-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  min-width: 0;
}

.share-recipient-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-note-indicator {
  font-size: 12px;
  cursor: help;
}

.share-existing-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.share-inline-permission {
  width: 110px;
  padding: 3px 6px;
  font-size: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
}

.badge-danger {
  background: #fef2f2;
  color: var(--color-danger);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.dark-mode .badge-danger {
  background: #450a0a;
}

.share-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--color-border);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
}

.btn-outline.btn-danger {
  color: var(--color-danger);
  border-color: var(--color-danger);
  background: transparent;
}

.btn-outline.btn-danger:hover:not(:disabled) {
  background: var(--color-danger);
  color: #fff;
}

/* --- Calendar Import Panel --- */
.calendar-import-panel {
  padding: 8px 16px 16px;
  border-top: 1px solid var(--color-border);
}

/* --- Calendar Main Area --- */
.calendar-main {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  padding: 20px;
  min-width: 0;
}

.calendar-inline-error {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  font-size: 13px;
  font-weight: 600;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

.calendar-toolbar strong {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  min-width: 180px;
  text-align: center;
}

/* --- Calendar Forms --- */
.calendar-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.calendar-form-grid .form-control:only-child,
.calendar-form-grid .form-control:first-child:nth-last-child(1) {
  grid-column: 1 / -1;
}

.calendar-form-actions {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
}

/* --- Calendar Events --- */
.calendar-events-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calendar-events-panel > p {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.calendar-event-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.calendar-event-row:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.calendar-event-row .btn-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  text-decoration: none;
}

.calendar-event-row .btn-link strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.calendar-event-row .btn-link span {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.calendar-event-row .btn-link:hover strong {
  color: var(--color-primary);
}

.calendar-rsvp-buttons {
  display: flex;
  gap: 6px;
  padding-top: 4px;
}

/* --- Calendar Month Grid --- */
.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}

.calendar-day-header {
  padding: 10px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.calendar-day-cell {
  min-height: 100px;
  padding: 6px;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background var(--transition);
  overflow: hidden;
}

.calendar-day-cell:nth-child(7n + 7) {
  border-right: none;
}

/* Remove bottom border on last row */
.calendar-month-grid .calendar-day-cell:nth-last-child(-n + 7) {
  border-bottom: none;
}

.calendar-day-cell:hover {
  background: rgba(59, 130, 246, 0.04);
}

.calendar-day-cell.other-month {
  background: var(--color-bg);
}

.calendar-day-cell.other-month .calendar-day-number {
  opacity: 0.35;
}

.calendar-day-cell.today {
  background: rgba(59, 130, 246, 0.06);
}

.calendar-day-number {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
  line-height: 1;
}

.calendar-day-cell.today .calendar-day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 12px;
}

.calendar-day-event {
  padding: 2px 6px;
  margin-bottom: 2px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text);
  transition: filter var(--transition);
}

.calendar-day-event:hover {
  filter: brightness(0.92);
}

.dark-mode .calendar-day-event:hover {
  filter: brightness(1.2);
}

.calendar-event-time {
  font-size: 10px;
  font-weight: 600;
  margin-right: 4px;
  opacity: 0.7;
}

/* --- Calendar Week Grid --- */
.calendar-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  min-height: 400px;
}

.calendar-week-col {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--color-border);
}

.calendar-week-col:last-child {
  border-right: none;
}

.calendar-week-col-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.calendar-week-col-header.today {
  background: rgba(59, 130, 246, 0.08);
}

.calendar-week-day-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
}

.calendar-week-day-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

.calendar-week-col-header.today .calendar-week-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 16px;
}

.calendar-week-col-body {
  flex: 1;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  min-height: 300px;
}

.calendar-week-col-body:hover {
  background: rgba(59, 130, 246, 0.03);
}

.calendar-week-empty {
  visibility: hidden;
}

/* --- Calendar Day View --- */
.calendar-day-view {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}

.calendar-hour-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  min-height: 48px;
  border-bottom: 1px solid var(--color-border);
}

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

.calendar-hour-row.current-hour {
  background: rgba(59, 130, 246, 0.06);
}

.calendar-hour-label {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 6px 10px 6px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  border-right: 1px solid var(--color-border);
  user-select: none;
}

.calendar-hour-content {
  padding: 4px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 48px;
}

.calendar-hour-content:hover {
  background: rgba(59, 130, 246, 0.04);
}

.calendar-hour-content .calendar-day-event {
  white-space: normal;
}

/* --- Calendar Responsive --- */
@media (max-width: 900px) {
  .calendar-page-layout {
    grid-template-columns: 1fr;
  }
  .calendar-sidebar {
    position: static;
  }
  .calendar-day-cell {
    min-height: 60px;
    padding: 4px;
  }
  .calendar-day-header {
    font-size: 10px;
    padding: 6px 2px;
  }
  .calendar-day-number {
    font-size: 11px;
  }
  .calendar-day-event {
    font-size: 10px;
    padding: 1px 4px;
  }
  .calendar-week-grid {
    min-height: 200px;
  }
  .calendar-week-col-body {
    min-height: 150px;
  }
}

/* ============================================================
   Notes Module Styles
   ============================================================ */

.notes-page-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  min-height: calc(100vh - 120px);
}

/* --- Notes Sidebar --- */
.notes-sidebar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  height: fit-content;
  position: sticky;
  top: 80px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 120px);
}

.notes-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.notes-sidebar-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}

.notes-search {
  padding: 8px 12px;
  flex-shrink: 0;
}

.notes-nav {
  display: flex;
  flex-direction: column;
  padding: 4px 8px;
  flex-shrink: 0;
}

.notes-nav-item {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition);
  border: none;
  background: none;
  text-decoration: none;
  text-align: left;
}
.notes-nav-item:hover {
  background: var(--color-bg);
  color: var(--color-primary);
  text-decoration: none;
}
.notes-nav-item.active {
  background: #eff6ff;
  color: var(--color-primary);
  font-weight: 600;
}
.dark-mode .notes-nav-item.active {
  background: rgba(59, 130, 246, 0.15);
}

/* --- Notes Folders --- */
.notes-folders {
  padding: 4px 12px 8px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.notes-folder-item-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.notes-folder-item {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background var(--transition);
}
.notes-folder-item:hover {
  background: var(--color-bg);
}
.notes-folder-item.selected {
  background: #eff6ff;
  color: var(--color-primary);
  font-weight: 600;
}
.dark-mode .notes-folder-item.selected {
  background: rgba(59, 130, 246, 0.15);
}

/* --- Notes List --- */
.notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notes-list p {
  text-align: center;
  padding: 20px 12px;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.notes-list-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 6px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: background var(--transition);
}
.notes-list-item:hover {
  background: var(--color-bg);
}
.notes-list-item.selected {
  background: #eff6ff;
}
.dark-mode .notes-list-item.selected {
  background: rgba(59, 130, 246, 0.15);
}

.notes-list-item strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-list-item span {
  font-size: 12px;
  color: var(--color-text-secondary);
}

/* --- Notes Main Area --- */
.notes-main {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  padding: 24px;
  min-width: 0;
}

.notes-placeholder {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-secondary);
}

.notes-placeholder p {
  font-size: 15px;
}

/* --- Notes Form --- */
.notes-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.notes-form-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

/* --- Notes Detail View --- */
.notes-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notes-detail h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 4px;
}

.notes-detail p {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.6;
}

.notes-detail p strong {
  color: var(--color-text);
  font-weight: 600;
}

.notes-detail-actions {
  display: flex;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 12px;
}

/* --- Notes Share Panel --- */
.notes-share-panel {
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  margin-bottom: 16px;
}

.notes-share-panel h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  margin: 0 0 8px;
}

.notes-share-panel p {
  font-size: 13px;
}

/* --- Notes Version Panel --- */
.notes-version-panel {
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  margin-bottom: 16px;
}

.notes-version-panel h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  margin: 0 0 8px;
}

.notes-version-panel p {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.version-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}

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

/* --- Notes Responsive --- */
@media (max-width: 900px) {
  .notes-page-layout {
    grid-template-columns: 1fr;
  }
  .notes-sidebar {
    position: static;
    max-height: 400px;
  }
}

.notes-cross-module-links {
  margin-bottom: 16px;
}

.notes-folder-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.notes-folder-form {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
}

/* ============================================================
   Contacts Module Styles
   ============================================================ */

.contacts-page-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  min-height: calc(100vh - 120px);
}

/* --- Contacts Sidebar --- */
.contacts-sidebar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  height: fit-content;
  position: sticky;
  top: 80px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 120px);
}

.contacts-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.contacts-sidebar-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}

.contacts-search {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  flex-shrink: 0;
}

.contacts-search .form-control {
  flex: 1;
  min-width: 0;
}

.contacts-nav {
  display: flex;
  flex-direction: column;
  padding: 4px 8px;
  flex-shrink: 0;
}

.contacts-nav-item {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition);
  border: none;
  background: none;
  text-decoration: none;
  text-align: left;
}
.contacts-nav-item:hover {
  background: var(--color-bg);
  color: var(--color-primary);
  text-decoration: none;
}
.contacts-nav-item.active {
  background: #eff6ff;
  color: var(--color-primary);
  font-weight: 600;
}
.dark-mode .contacts-nav-item.active {
  background: rgba(59, 130, 246, 0.15);
}

/* --- Contacts Group List --- */
.contacts-group-list {
  padding: 4px 12px 8px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.contacts-group-item {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--transition);
}
.contacts-group-item:hover {
  background: var(--color-bg);
}

.contacts-group-item-row {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--color-text);
  transition: background var(--transition);
}
.contacts-group-item-row:hover {
  background: var(--color-bg);
}

/* --- Contacts List --- */
.contacts-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contacts-list p {
  text-align: center;
  padding: 20px 12px;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.contacts-list-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 6px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: background var(--transition);
}
.contacts-list-item:hover {
  background: var(--color-bg);
}
.contacts-list-item.selected {
  background: #eff6ff;
}
.dark-mode .contacts-list-item.selected {
  background: rgba(59, 130, 246, 0.15);
}

.contacts-list-item strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contacts-list-item span {
  font-size: 12px;
  color: var(--color-text-secondary);
}

/* --- Contacts Main Area --- */
.contacts-main {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  padding: 24px;
  min-width: 0;
}

.contacts-placeholder {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-secondary);
}

.contacts-placeholder p {
  font-size: 15px;
}

/* --- Contacts Form --- */
.contacts-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.contacts-form-actions {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

/* --- Contacts Detail View --- */
.contacts-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contacts-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--color-border);
  margin-bottom: 12px;
}

.contacts-detail h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 8px;
}

.contacts-detail p {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.8;
}

.contacts-detail p strong {
  color: var(--color-text);
  font-weight: 600;
  display: inline-block;
  min-width: 100px;
}

.contacts-detail-actions {
  display: flex;
  gap: 8px;
  padding: 16px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  margin: 12px 0;
}

/* --- Contacts Related Entities --- */
.contacts-related {
  padding: 12px 0;
}

.contacts-related h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  margin: 16px 0 8px;
}

.contacts-related h4:first-child {
  margin-top: 0;
}

.contacts-related p {
  font-size: 13px;
}

/* --- Contacts Share Panel --- */
.contacts-share-panel {
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  margin-top: 12px;
}

.contacts-share-panel h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  margin: 0 0 8px;
}

.contacts-share-panel p {
  font-size: 13px;
}

/* --- Contacts Responsive --- */
@media (max-width: 900px) {
  .contacts-page-layout {
    grid-template-columns: 1fr;
  }
  .contacts-sidebar {
    position: static;
    max-height: 400px;
  }
}

/* ============================================================
   Shared Views — Shared With Me / Shared By Me
   ============================================================ */

/* --- Container & Header --- */
.shared-view {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
}

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

.shared-view-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

.shared-view-actions {
  flex-shrink: 0;
}

.shared-view-actions select {
  min-width: 160px;
}

/* --- Group Headers --- */
.shared-group {
  margin-bottom: 24px;
}

.shared-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-secondary);
  padding: 8px 12px;
  margin-bottom: 6px;
  background: var(--color-bg);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.shared-group-icon {
  font-size: 16px;
  opacity: 0.65;
}

.shared-group-count {
  font-weight: 400;
  color: var(--color-muted);
  font-size: 13px;
}

/* --- Item List --- */
.shared-items-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  margin: 0;
}

/* --- Individual Item Row --- */
.shared-item {
  display: grid;
  grid-template-columns: 32px 1fr auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.shared-item:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.shared-item--expired {
  opacity: 0.55;
}

.shared-item--expired:hover {
  opacity: 0.75;
}

/* --- Item Icon --- */
.shared-item-icon {
  font-size: 20px;
  line-height: 1;
  text-align: center;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  width: 36px;
}

/* --- Item Info (Name + Meta line) --- */
.shared-item-info {
  min-width: 0;
  overflow: hidden;
}

.shared-item-name {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shared-item-meta {
  display: block;
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Permission Badge --- */
.shared-item-permission {
  flex-shrink: 0;
}

.badge-permission {
  white-space: nowrap;
}

.badge-read {
  background: #dbeafe;
  color: #1e40af;
}

.badge-readwrite {
  background: #d1fae5;
  color: #065f46;
}

.badge-full {
  background: #fef3c7;
  color: #92400e;
}

.dark-mode .badge-read {
  background: #1e3a5f;
  color: #93c5fd;
}

.dark-mode .badge-readwrite {
  background: #065f46;
  color: #6ee7b7;
}

.dark-mode .badge-full {
  background: #78350f;
  color: #fcd34d;
}

/* --- Expiry --- */
.shared-item-expiry {
  flex-shrink: 0;
  font-size: 12px;
  white-space: nowrap;
}

/* --- Actions (Open / Decline / Manage / Revoke) --- */
.shared-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* --- Shared By Me — Sort Bar --- */
.shared-by-me-sort-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 6px;
}

.sort-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius);
  transition:
    color var(--transition),
    background var(--transition);
}

.sort-btn:hover {
  color: var(--color-primary);
  background: var(--color-bg);
}

.sort-btn.sort-active {
  color: var(--color-primary);
}

/* Shared by me items — 3-column: icon | content | actions */
.shared-by-me-items .shared-item {
  grid-template-columns: 36px 1fr auto;
  align-items: start;
  padding: 12px 14px;
}

/* --- Two-line content area --- */
.shared-item-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shared-item-top-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.shared-item-top-row .shared-item-name {
  display: inline;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text);
}

.shared-item-bottom-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
}

/* --- Recipient Column --- */
.shared-item-recipient {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.recipient-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

.badge-user {
  background: #dbeafe;
  color: #1e40af;
}
.badge-team {
  background: #ede9fe;
  color: #5b21b6;
}
.badge-group {
  background: #fce7f3;
  color: #9d174d;
}
.badge-publiclink {
  background: #fef3c7;
  color: #92400e;
}

.dark-mode .badge-user {
  background: #1e3a5f;
  color: #93c5fd;
}
.dark-mode .badge-team {
  background: #3b0764;
  color: #c4b5fd;
}
.dark-mode .badge-group {
  background: #831843;
  color: #f9a8d4;
}
.dark-mode .badge-publiclink {
  background: #78350f;
  color: #fcd34d;
}

/* --- Inline Permission Select (Shared By Me) --- */
.share-inline-permission {
  width: auto;
  max-width: 130px;
}

/* --- File Size Label --- */
.shared-item-size {
  font-size: 12px;
  flex-shrink: 0;
}

/* --- Date Column --- */
.shared-item-date {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  white-space: nowrap;
}

/* --- Icon Button Utility --- */
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
  transition: background var(--transition);
}

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

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

.btn-icon.btn-danger:hover {
  background: #fee2e2;
}

.dark-mode .btn-icon.btn-danger:hover {
  background: #991b1b33;
}

/* --- Loading Skeleton --- */
.loading-state {
  padding: 16px 0;
}

.loading-skeleton {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-row {
  display: grid;
  grid-template-columns: 32px 1fr 100px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.skeleton-icon,
.skeleton-name,
.skeleton-meta {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--color-border) 25%,
    var(--color-bg) 50%,
    var(--color-border) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.skeleton-name {
  width: 65%;
}

.skeleton-meta {
  width: 80px;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* --- Empty State Subtitles --- */
.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.empty-state-hint {
  font-size: 13px;
  margin: 0;
}

/* --- Shared View Responsive --- */
@media (max-width: 768px) {
  .shared-view {
    padding: 16px 10px;
  }

  .shared-view-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .shared-item {
    grid-template-columns: 28px 1fr;
    gap: 8px;
    padding: 10px;
  }

  .shared-item-permission,
  .shared-item-expiry {
    grid-column: 2;
  }

  .shared-item-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 6px;
    border-top: 1px solid var(--color-border);
    margin-top: 4px;
  }

  .shared-by-me-sort-bar {
    padding: 6px 10px;
  }

  .shared-by-me-items .shared-item {
    grid-template-columns: 28px 1fr;
  }

  .shared-by-me-items .shared-item-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 6px;
    border-top: 1px solid var(--color-border);
    margin-top: 4px;
  }

  .shared-item-bottom-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .shared-item-recipient,
  .shared-item-date {
    grid-column: 2;
  }
}

/* ── File Preview ───────────────────────────────────────────────────────────── */

.file-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.file-preview-dialog {
  display: flex;
  flex-direction: column;
  width: 96vw;
  height: 94vh;
  max-width: 1400px;
  background: var(--surface, #1e1e2e);
  border-radius: 12px;
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border, #333);
  min-height: 56px;
}

.preview-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.preview-title h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-file-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.preview-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.preview-image-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: auto;
}

.preview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.15s ease;
}

.preview-video-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-video {
  max-width: 100%;
  max-height: 100%;
}

.preview-audio-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.preview-audio-art {
  text-align: center;
}

.preview-audio-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 12px;
}

.preview-audio-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.preview-audio {
  width: min(400px, 90vw);
}

.preview-pdf-container {
  width: 100%;
  height: 100%;
}

.preview-pdf-frame {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 4px;
}

/* ── Text preview (native) ─────────────────────────────────────────────────── */

.preview-text-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-text-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--surface-alt, #252535);
  border-bottom: 1px solid var(--border, #333);
  flex-shrink: 0;
}

.preview-text-lang {
  font-size: 0.8rem;
  color: var(--text-muted, #888);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.preview-text-edit-btn {
  font-size: 0.8rem;
  padding: 4px 12px;
}

.preview-text-loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #888);
  font-size: 0.95rem;
}

.preview-text-content {
  flex: 1;
  overflow: auto;
  margin: 0;
  padding: 0;
  font-family:
    "Cascadia Code", "Fira Code", "Source Code Pro", "Consolas", monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text, #ddd);
  background: var(--surface, #1e1e2e);
  white-space: pre-wrap;
  word-wrap: break-word;
  tab-size: 4;
}

.preview-text-content code {
  display: block;
  padding: 20px 24px;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* Override highlight.js theme background to match our surface */
.preview-text-content code.hljs {
  background: var(--surface, #1e1e2e);
}

.preview-text-editor {
  flex: 1;
  overflow: auto;
  margin: 0;
  padding: 20px 24px;
  font-family:
    "Cascadia Code", "Fira Code", "Source Code Pro", "Consolas", monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text, #ddd);
  background: var(--surface-alt, #252535);
  border: none;
  outline: none;
  resize: none;
  tab-size: 4;
  width: 100%;
}

.preview-text-editor:focus {
  background: var(--surface, #1e1e2e);
}

/* ── Document / unsupported fallback ───────────────────────────────────────── */

.preview-document,
.preview-unsupported {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.preview-doc-icon,
.preview-unsupported-icon {
  font-size: 4rem;
}

.preview-doc-name,
.preview-unsupported-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #888);
}

/* ── Footer / navigation ──────────────────────────────────────────────────── */

.preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-top: 1px solid var(--border, #333);
  min-height: 48px;
}

.preview-nav-area {
  width: 60px;
  display: flex;
}

.preview-nav-area--left {
  justify-content: flex-start;
}

.preview-nav-area--right {
  justify-content: flex-end;
}

.preview-nav-btn {
  font-size: 1.3rem;
  padding: 4px 12px;
}

.preview-metadata {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.file-meta-chip {
  font-size: 0.78rem;
  color: var(--text-muted, #888);
}

.file-meta-sep {
  color: var(--text-muted, #555);
  font-size: 0.7rem;
}

/* ── Public Share Page ───────────────────────────────────────────────── */

.public-share-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: var(--bg-primary, #0d1117);
}

.public-share-card {
  background: var(--panel-bg, #161b22);
  border: 1px solid var(--border-color, #30363d);
  border-radius: 12px;
  padding: 2.5rem;
  text-align: center;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.public-share-icon {
  color: var(--accent, #58a6ff);
  margin-bottom: 1rem;
}

.public-share-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary, #e6edf3);
  word-break: break-word;
}

.public-share-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted, #8b949e);
}

.meta-separator {
  font-size: 0.75rem;
}

.public-share-download {
  display: inline-block;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
}

.public-share-error {
  color: var(--text-secondary, #c9d1d9);
}

.share-icon-error {
  color: var(--danger, #f85149);
  margin-bottom: 0.75rem;
}

.public-share-error h2 {
  color: var(--danger, #f85149);
}

.public-share-expiry {
  margin-top: 1rem;
  font-size: 0.8rem;
}

.public-share-branding {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--text-muted, #8b949e);
}

/* ── Tag Badges & Input ─────────────────────────────────────────────────── */

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  line-height: 1.4;
  background: color-mix(in srgb, var(--tag-color, #6b7280) 15%, transparent);
  color: var(--tag-color, #6b7280);
  border: 1px solid
    color-mix(in srgb, var(--tag-color, #6b7280) 30%, transparent);
  white-space: nowrap;
}

.tag-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tag-color, #6b7280);
  flex-shrink: 0;
}

.tag-badge-name {
  font-weight: 500;
}

.tag-badge-remove {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0 2px;
  font-size: 13px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.tag-badge-remove:hover {
  opacity: 1;
}

.tag-badge--removable {
  padding-right: 4px;
}

.file-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

/* Tag input component */
.tag-input-container {
  position: relative;
}

.tag-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tag-input-field {
  flex: 1;
  min-width: 120px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 13px;
}

.tag-input-field:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.tag-color-picker {
  width: 32px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  cursor: pointer;
}

.tag-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  margin-top: 4px;
  padding: 4px 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
}

.tag-suggestion-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s;
}

.tag-suggestion-item:hover {
  background: var(--color-bg);
}

.tag-suggestion-name {
  flex: 1;
}

.tag-suggestion-count {
  font-size: 11px;
  color: var(--color-text-secondary);
}

/* Bulk tag dialog */
.bulk-tag-dialog {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
}

/* Tag dialog (modal) extras */
.tag-dialog-existing {
  margin-top: 16px;
}

.tag-dialog-existing-label {
  display: block;
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.tag-dialog-existing-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Tag filter view header */
.tag-filter-header {
  gap: 12px;
}

.tag-filter-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tag-filter-label {
  font-size: 16px;
  color: var(--color-text-secondary);
  font-weight: 400;
}

.tag-badge--lg {
  font-size: 15px;
  padding: 4px 14px;
  border-radius: 16px;
}

.tag-badge--lg .tag-badge-dot {
  width: 9px;
  height: 9px;
}

.tag-badge--lg .tag-badge-name {
  font-weight: 600;
}

/* ============================================================
   Comments Panel
   ============================================================ */

.comments-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  height: 100vh;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.comments-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.comments-panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
}

.comments-panel-filename {
  font-size: 0.85rem;
  color: var(--color-text-muted, var(--color-text-secondary));
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comments-panel-compose {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.comments-compose-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius, 8px);
  font-size: 0.875rem;
  font-family: inherit;
  resize: vertical;
  min-height: 44px;
  max-height: 120px;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition);
}

.comments-compose-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.comments-compose-input::placeholder {
  color: var(--color-muted);
}

.comments-compose-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.comments-panel-loading,
.comments-panel-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--color-text-muted, var(--color-text-secondary));
}

.comments-panel-empty p:first-child {
  font-weight: 500;
  margin-bottom: 4px;
}

.comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.comment-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

.comment-reply {
  margin-left: 24px;
  padding-left: 12px;
  border-left: 2px solid var(--color-border);
  border-bottom: none;
}

.comment-reply:last-child {
  margin-bottom: 4px;
}

.comment-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.comment-author {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text);
}

.comment-date {
  font-size: 0.75rem;
  color: var(--color-muted);
  white-space: nowrap;
}

.comment-edited {
  font-size: 0.7rem;
  color: var(--color-muted);
  font-style: italic;
}

.comment-body {
  font-size: 13px;
  line-height: 1.4;
  color: var(--color-text);
  word-break: break-word;
}

.comment-body p {
  margin: 0 0 0.35em;
}

.comment-body p:last-child {
  margin-bottom: 0;
}

.comment-body ul,
.comment-body ol {
  margin: 0.25em 0;
  padding-left: 1.5em;
}

.comment-body li {
  margin-bottom: 0.15em;
}

.comment-body blockquote {
  margin: 0.35em 0;
  padding: 0.2em 0.75em;
  border-left: 3px solid var(--color-border);
  color: var(--color-muted);
}

.comment-body code {
  font-size: 12px;
  padding: 0.15em 0.35em;
  background: var(--color-bg);
  border-radius: 3px;
}

.comment-body pre {
  margin: 0.35em 0;
  padding: 0.5em;
  background: var(--color-bg);
  border-radius: var(--radius);
  overflow-x: auto;
}

.comment-body pre code {
  padding: 0;
  background: none;
}

.comment-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

.comment-action-btn {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  transition: color var(--transition);
}

.comment-action-btn:hover {
  color: var(--color-primary);
}

.comment-action-btn--danger:hover {
  color: var(--color-danger);
}

.comment-edit-form,
.comment-reply-form {
  margin-top: 8px;
}

.comment-edit-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

/* Responsive: collapse panel to full-width on narrow screens */
@media (max-width: 600px) {
  .comments-panel {
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   User Profile Page
   ═══════════════════════════════════════════════════════════════════════════ */

.profile-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 680px;
}

.profile-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.profile-card h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

/* ── Avatar ── */

.profile-avatar-section {
  text-align: center;
}

.avatar-display {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.avatar-image {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--color-border);
}

.avatar-initials {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 600;
  letter-spacing: 1px;
  user-select: none;
  border: 3px solid var(--color-border);
}

.avatar-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.avatar-upload-label {
  cursor: pointer;
}

/* ── Profile Details (dl) ── */

.profile-details {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  margin: 0;
}

.profile-details dt {
  color: var(--color-text-secondary);
  font-weight: 500;
  font-size: 13px;
  padding: 4px 0;
}

.profile-details dd {
  margin: 0;
  padding: 4px 0;
  font-size: 14px;
  color: var(--color-text);
}

.monospace {
  font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", monospace;
  font-size: 12px;
  background: var(--color-bg);
  padding: 2px 6px;
  border-radius: 4px;
  word-break: break-all;
}

.text-danger {
  color: #dc2626;
}

@media (max-width: 600px) {
  .profile-details {
    grid-template-columns: 1fr;
  }
  .profile-details dt {
    padding-bottom: 0;
  }
  .profile-details dd {
    padding-top: 0;
    margin-bottom: 8px;
  }
}

/* ── Media Library Settings ── */

.media-scan-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.scan-result {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.module-settings-section {
  padding: 24px;
  max-width: 600px;
}

.settings-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.settings-card h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--color-text);
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.scan-result-banner {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--color-surface-raised, #f5f5f5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* ═══════════════════════════════════════════════════════════
   Global Music Playbar (gmp-*)
   Persistent playbar rendered in MainLayout, survives navigation.
   ═══════════════════════════════════════════════════════════ */

.global-music-playbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  height: 80px;
  background: var(--color-surface, #ffffff);
  border-top: 1px solid var(--color-border, #e2e8f0);
  z-index: 100;
}

/* ── When global playbar is active, add bottom padding to page ── */
.has-global-player .page-content {
  padding-bottom: 80px;
}

/* ── Track info (left) ── */
.gmp-track-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.gmp-art {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--color-border, #e2e8f0);
}

.gmp-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gmp-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.gmp-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text, #1e293b);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition, 200ms ease);
}

.gmp-title:hover {
  color: var(--color-primary, #6366f1);
  text-decoration: underline;
}

.gmp-artist-album {
  font-size: 0.8125rem;
  color: var(--color-text-secondary, #64748b);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gmp-artist-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.gmp-artist-link:hover {
  color: var(--color-primary, #6366f1);
  text-decoration: underline;
}

.gmp-separator {
  color: var(--color-muted, #94a3b8);
}

.gmp-playlist {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--color-primary, #6366f1);
  cursor: pointer;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--transition, 200ms ease);
  margin-top: 1px;
}

.gmp-playlist:hover {
  color: var(--color-primary-hover, #4f46e5);
  text-decoration: underline;
}

.gmp-playlist-icon {
  font-size: 0.7rem;
  flex-shrink: 0;
}

.gmp-star {
  background: none;
  border: none;
  font-size: 1.125rem;
  cursor: pointer;
  color: var(--color-muted, #94a3b8);
  transition: color var(--transition, 200ms ease);
  padding: 4px;
  flex-shrink: 0;
}

.gmp-star:hover {
  color: #f59e0b;
}

/* ── Controls (center) ── */
.gmp-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.gmp-buttons {
  display: flex;
  align-items: center;
  gap: 16px;
}

.gmp-repeat-label {
  font-size: 0.625rem;
  color: var(--color-text-secondary, #64748b);
  min-width: 20px;
  margin-left: -10px;
  user-select: none;
}

.gmp-btn {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--color-text-secondary, #64748b);
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition, 200ms ease);
  line-height: 1;
}

.gmp-btn:hover {
  color: var(--color-text, #1e293b);
}

.gmp-play-pause {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary, #3b82f6);
  color: #fff;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gmp-play-pause:hover {
  background: #2563eb;
  color: #fff;
}

.global-music-playbar .active-control {
  color: var(--color-primary, #3b82f6) !important;
}

/* ── Progress bar ── */
.gmp-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 600px;
}

.gmp-time {
  font-size: 0.6875rem;
  color: var(--color-muted, #94a3b8);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: center;
}

.gmp-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--color-border, #e2e8f0);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.gmp-progress-bar:hover {
  height: 6px;
}

.gmp-progress-fill {
  height: 100%;
  background: var(--color-primary, #3b82f6);
  border-radius: 2px;
  transition: width 1s linear;
}

/* ── Extras (right) ── */
.gmp-extras {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.gmp-volume {
  display: flex;
  align-items: center;
  gap: 4px;
}

.gmp-volume-slider {
  width: 80px;
  height: 4px;
  accent-color: var(--color-primary, #3b82f6);
  cursor: pointer;
}

.gmp-close-btn:hover {
  color: #ef4444 !important;
}

/* ═══════════════════════════════════════════════════════════
   Global Music Playbar — Queue Panel
   ═══════════════════════════════════════════════════════════ */

.gmp-queue-panel {
  position: fixed;
  right: 0;
  bottom: 80px;
  width: 320px;
  max-height: 60vh;
  background: var(--color-surface, #ffffff);
  border-left: 1px solid var(--color-border, #e2e8f0);
  border-top: 1px solid var(--color-border, #e2e8f0);
  border-top-left-radius: var(--radius, 8px);
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.12));
  z-index: 90;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gmp-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border, #e2e8f0);
}

.gmp-panel-header h4 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.gmp-queue-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gmp-queue-save-wrapper {
  position: relative;
}

.gmp-queue-save-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius, 8px);
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.12));
  z-index: 100;
  min-width: 200px;
  padding: 4px;
}

.gmp-queue-save-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 0.8125rem;
  border-radius: 4px;
  cursor: pointer;
  color: var(--color-text, #1e293b);
  transition: background var(--transition, 200ms ease);
}

.gmp-queue-save-dropdown button:hover {
  background: var(--color-bg, #f5f7fa);
}

.gmp-queue-save-divider {
  height: 1px;
  background: var(--color-border, #e2e8f0);
  margin: 4px 8px;
}

.gmp-btn-sm {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
}

.gmp-queue-item-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  position: relative;
  opacity: 0;
  transition: opacity var(--transition, 200ms ease);
}

.gmp-queue-item:hover .gmp-queue-item-actions {
  opacity: 1;
}

.gmp-queue-item-menu-btn {
  background: none;
  border: none;
  color: var(--color-muted, #94a3b8);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all var(--transition, 200ms ease);
  line-height: 1;
}

.gmp-queue-item-menu-btn:hover {
  color: var(--color-text, #1e293b);
  background: var(--color-bg, #f5f7fa);
}

.gmp-queue-item-dropdown {
  position: absolute;
  top: 100%;
  right: 24px;
  margin-top: 2px;
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius, 8px);
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.12));
  z-index: 100;
  min-width: 180px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
}

.gmp-queue-item-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 6px 10px;
  font-size: 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  color: var(--color-text, #1e293b);
  transition: background var(--transition, 200ms ease);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gmp-queue-item-dropdown button:hover {
  background: var(--color-bg, #f5f7fa);
}

.gmp-queue-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background var(--transition, 200ms ease);
}

.gmp-queue-list {
  overflow-y: auto;
  flex: 1;
  padding: 4px;
}

.gmp-queue-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--color-muted, #94a3b8);
  font-size: 0.875rem;
}

.gmp-queue-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background var(--transition, 200ms ease);
}

.gmp-queue-item:hover {
  background: var(--color-bg, #f5f7fa);
}

.gmp-queue-item.playing {
  background: rgba(59, 130, 246, 0.08);
}

.gmp-queue-num {
  font-size: 0.75rem;
  color: var(--color-muted, #94a3b8);
  text-align: center;
}

.gmp-queue-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.gmp-queue-info span {
  font-size: 0.8125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gmp-queue-artist {
  color: var(--color-text-secondary, #64748b);
  font-size: 0.75rem !important;
}

.gmp-queue-remove {
  background: none;
  border: none;
  color: var(--color-muted, #94a3b8);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all var(--transition, 200ms ease);
}

.gmp-queue-remove:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

/* ═══════════════════════════════════════════════════════════
   Global Music Playbar — Equalizer Panel
   ═══════════════════════════════════════════════════════════ */

.gmp-eq-panel {
  position: fixed;
  right: 0;
  bottom: 80px;
  width: 360px;
  background: var(--color-surface, #ffffff);
  border-left: 1px solid var(--color-border, #e2e8f0);
  border-top: 1px solid var(--color-border, #e2e8f0);
  border-top-left-radius: var(--radius, 8px);
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.12));
  z-index: 90;
  display: flex;
  flex-direction: column;
  padding-bottom: 16px;
}

.gmp-eq-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gmp-eq-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px;
}

.gmp-eq-preset-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px 3px 12px;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 999px;
  background: var(--color-surface, #ffffff);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary, #64748b);
  transition: all var(--transition, 200ms ease);
}

.gmp-eq-preset-btn:hover {
  border-color: var(--color-primary, #3b82f6);
  color: var(--color-primary, #3b82f6);
}

.gmp-eq-preset-btn.active {
  background: var(--color-primary, #3b82f6);
  color: #fff;
  border-color: var(--color-primary, #3b82f6);
}

.gmp-eq-preset-name {
  padding: 2px 2px;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.gmp-eq-preset-default,
.gmp-eq-preset-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  font-size: 0.7rem;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
  transition:
    opacity var(--transition, 200ms ease),
    background var(--transition, 200ms ease);
}

.gmp-eq-preset-btn:hover .gmp-eq-preset-default,
.gmp-eq-preset-btn:hover .gmp-eq-preset-delete {
  opacity: 1;
}

.gmp-eq-preset-default:hover,
.gmp-eq-preset-delete:hover {
  opacity: 1 !important;
  background: rgb(0 0 0 / 10%);
}

.gmp-eq-preset-btn.active .gmp-eq-preset-default:hover,
.gmp-eq-preset-btn.active .gmp-eq-preset-delete:hover {
  background: rgb(255 255 255 / 20%);
}

.gmp-eq-bands {
  display: flex;
  justify-content: space-around;
  padding: 12px 16px 0;
  gap: 4px;
}

.gmp-eq-band {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.gmp-eq-slider {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 4px;
  height: 100px;
  accent-color: var(--color-primary, #3b82f6);
  cursor: pointer;
  appearance: slider-vertical;
}

.gmp-eq-label {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--color-muted, #94a3b8);
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════
   Global Music Playbar — Save Preset Dialog
   ═══════════════════════════════════════════════════════════ */

.gmp-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.gmp-dialog-panel {
  background: var(--color-surface, #ffffff);
  border-radius: 12px;
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.12));
  padding: 24px;
  width: 90%;
  max-width: 420px;
}

.gmp-dialog-panel h4 {
  margin: 0 0 16px;
  font-size: 1.125rem;
  font-weight: 600;
}

.gmp-dialog-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gmp-dialog-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary, #64748b);
}

.gmp-dialog-form input[type="text"] {
  padding: 8px 12px;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius, 8px);
  font-size: 0.875rem;
  color: var(--color-text, #1e293b);
  background: var(--color-bg, #f5f7fa);
  transition: border-color var(--transition, 200ms ease);
}

.gmp-dialog-form input[type="text"]:focus {
  outline: none;
  border-color: var(--color-primary, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.gmp-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.gmp-dialog-checkbox {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}

.gmp-dialog-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.gmp-dialog-hint {
  font-size: 0.75rem;
  color: var(--color-muted, #94a3b8);
  margin: 0;
}

.gmp-dialog-preset-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 4px;
}

.gmp-dialog-preset-list-label {
  font-size: 0.75rem;
  color: var(--color-text-tertiary, #94a3b8);
  margin-bottom: 2px;
}

.gmp-dialog-preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius, 8px);
  cursor: pointer;
  transition: background var(--transition, 200ms ease);
  user-select: none;
}

.gmp-dialog-preset-item:hover {
  background: var(--color-bg, #f5f7fa);
}

.gmp-dialog-preset-item.selected {
  background: var(--color-primary-light, rgba(59, 130, 246, 0.1));
  color: var(--color-primary, #3b82f6);
  font-weight: 600;
}

.gmp-dialog-preset-name {
  font-size: 0.8125rem;
}

.gmp-dialog-preset-check {
  font-size: 0.75rem;
  color: var(--color-primary, #3b82f6);
}

/* ── Responsive — Global music playbar ── */

@media (max-width: 768px) {
  .global-music-playbar {
    grid-template-columns: 1fr auto;
    height: 64px;
    gap: 8px;
  }

  .gmp-extras {
    display: none;
  }

  .gmp-controls {
    display: none;
  }

  .gmp-track-info {
    grid-column: 1;
  }

  .gmp-queue-panel,
  .gmp-eq-panel {
    width: 100%;
  }
}

/* ── Dark mode — Global music playbar ── */

.dark-mode .gmp-play-pause {
  background: #f1f5f9;
  color: #0f172a;
}

.dark-mode .gmp-play-pause:hover {
  background: #e2e8f0;
}

/* ============================================================
   Module Help Content Styles (global — used by child content components)
   ============================================================ */

.help-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.help-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.help-section:hover {
  box-shadow: var(--shadow);
}

.help-section-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-section > p {
  margin: 0 0 10px;
  color: var(--color-text-secondary);
  line-height: 1.7;
  font-size: 14px;
}

.help-section > p:last-child {
  margin-bottom: 0;
}

.help-section ul,
.help-section ol {
  margin: 8px 0 8px 0;
  padding-left: 20px;
  color: var(--color-text-secondary);
  font-size: 14px;
  line-height: 1.7;
}

.help-section li {
  margin-bottom: 6px;
}

.help-section li:last-child {
  margin-bottom: 0;
}

/* ── Step-by-step instructions ── */
.help-steps {
  list-style: none;
  counter-reset: help-step;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.help-steps li {
  counter-increment: help-step;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--color-bg);
  border-radius: var(--radius);
  color: var(--color-text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.help-steps li::before {
  content: counter(help-step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

/* ── Tips list ── */
.help-tips {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-tips li {
  padding: 10px 14px 10px 36px;
  position: relative;
  color: var(--color-text-secondary);
  font-size: 14px;
  line-height: 1.6;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
}

.dark-mode .help-tips li {
  background: #052e16;
  border-color: #166534;
}

.help-tips li::before {
  content: "💡";
  position: absolute;
  left: 10px;
  top: 10px;
  font-size: 14px;
}

/* ── FAQ ── */
.help-faq {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.help-faq dt {
  font-weight: 600;
  color: var(--color-text);
  padding: 14px 16px 4px;
  font-size: 14px;
}

.help-faq dd {
  color: var(--color-text-secondary);
  margin: 0;
  padding: 0 16px 14px;
  font-size: 14px;
  line-height: 1.7;
  border-bottom: 1px solid var(--color-border);
}

.help-faq dt:first-of-type {
  padding-top: 0;
}

.help-faq dd:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

/* ── Inline code ── */
.help-content code {
  background: var(--color-bg);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-family:
    "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  color: #e11d48;
  border: 1px solid var(--color-border);
}

.dark-mode .help-content code {
  color: #fda4af;
}

.help-content strong {
  color: var(--color-text);
  font-weight: 600;
}

/* ── Keyboard shortcuts ── */
.help-content kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--color-border);
  line-height: 1.6;
}

/* ── Horizontal rule inside sections ── */
.help-section hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 16px 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .help-section {
    padding: 20px;
  }
}
