/* ═══════════════════════════════════════════════════════════════════════════
   Document Tab — UX/UI Redesign v3 (2026-06-19)
   Color Theory: Teal + Indigo palette, glass-morphism, luyenthi-style patterns
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties (scoped via :root cascade) ─────────────────── */
:root {
  /* Document accent — Teal (triadic with Indigo primary) */
  --doc-accent: #14b8a6;
  --doc-accent-hover: #2dd4bf;
  --doc-accent-glow: rgba(20, 184, 166, 0.18);
  --doc-accent-gradient: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
  --doc-accent-surface: rgba(20, 184, 166, 0.08);

  /* Grant accent — Amber (warm contrast to teal) */
  --grant-accent: #f59e0b;
  --grant-accent-glow: rgba(245, 158, 11, 0.16);
  --grant-accent-surface: rgba(245, 158, 11, 0.07);

  /* Security accent — Rose (danger variant, distinct from --danger) */
  --sec-accent: #f43f5e;
  --sec-accent-glow: rgba(244, 63, 94, 0.16);
  --sec-accent-surface: rgba(244, 63, 94, 0.06);

  /* Card surface (slightly translucent for depth) */
  --card-bg: rgba(50, 47, 61, 0.85);
  --card-border: rgba(255, 255, 255, 0.04);
  --card-hover-bg: rgba(61, 57, 74, 0.9);
  --card-hover-border: rgba(20, 184, 166, 0.15);
}

/* ── Tab bar — Glass morphism pill bar ─────────────────────────────────── */
.doc-tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  background: rgba(30, 28, 41, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  margin-bottom: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.doc-tabs-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.doc-tab-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.doc-tab-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.doc-tab-btn:hover {
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.05);
}

.doc-tab-btn.active {
  color: #ffffff;
  background: var(--primary);
  font-weight: 600;
}

.doc-tab-btn.active svg { stroke: #ffffff; }

.doc-tab-btn:active { transform: scale(0.97); }

.doc-tab-icon { flex-shrink: 0; }

/* Tab count badge */
.doc-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-bright);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.doc-tab-btn.active .doc-tab-count {
  background: rgba(255, 255, 255, 0.25);
}

/* ── Tab panels ────────────────────────────────────────────────────────── */
.doc-tab-panel {
  display: none;
}

.doc-tab-panel.active {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: docTabSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes docTabSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.doc-tab-intro {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 0;
}

/* ── Quick Stats Bar ───────────────────────────────────────────────────── */
.doc-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.doc-stat-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.doc-stat-card:hover {
  background: var(--card-hover-bg);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: rgba(255, 255, 255, 0.08);
}

.doc-stat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.doc-stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.doc-stat-card:hover .doc-stat-icon {
  transform: scale(1.05);
}

.doc-stat-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

/* Accent icon coloring with smooth glow backgrounds */
.doc-stat-card:nth-child(1) .doc-stat-icon {
  color: var(--primary);
  background: transparent;
}
.doc-stat-card:nth-child(2) .doc-stat-icon {
  color: var(--success);
  background: transparent;
}
.doc-stat-card:nth-child(3) .doc-stat-icon {
  color: var(--warning);
  background: transparent;
}
.doc-stat-card:nth-child(4) .doc-stat-icon {
  color: #a78bfa; /* Violet */
  background: transparent;
}

.doc-stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-bright);
  line-height: 1;
}

.doc-stat-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.01em;
}
/* ── Card Grid (Kho tài liệu) ──────────────────────────────────────────── */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.doc-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.doc-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  border: 1px solid transparent;
  transition: border-color 0.25s ease;
  pointer-events: none;
}

.doc-card:hover {
  background: var(--card-hover-bg);
  border-color: var(--card-hover-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.doc-card:hover::after {
  border-color: var(--border);
}

.doc-card:active {
  transform: translateY(-1px) scale(0.99);
}

.doc-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.doc-card-type-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.doc-card-type-icon svg {
  width: 26px;
  height: 26px;
  stroke-width: 2;
}

/* Icon màu thuần primary xanh — đồng bộ carbon tối giản */
.doc-card-type-icon { color: var(--primary); }

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

.doc-card-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.doc-card-badge.active {
  background: rgba(20, 184, 166, 0.15);
  color: var(--doc-accent);
}

.doc-card-badge.inactive {
  background: rgba(139, 138, 150, 0.15);
  color: var(--muted);
}

.doc-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doc-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.doc-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.doc-card-meta-item svg {
  width: 13px;
  height: 13px;
  stroke-width: 2;
}

.doc-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.doc-card-grant-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.doc-card-actions {
  display: flex;
  gap: 6px;
}

/* Grid/List toggle */
.doc-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 3px;
  border-radius: 10px;
  background: rgba(20, 18, 26, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.doc-view-toggle-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.doc-view-toggle-btn:hover { color: var(--text-bright); }

.doc-view-toggle-btn.active {
  background: rgba(109, 124, 255, 0.2);
  color: var(--primary);
}

/* List mode override: hide grid, show table */
.doc-tab-panel[data-doc-view="list"] .doc-grid { display: none; }
.doc-tab-panel[data-doc-view="list"] .doc-list-table-wrap { display: block; }
.doc-tab-panel[data-doc-view="grid"] .doc-grid { display: grid; }
.doc-tab-panel[data-doc-view="grid"] .doc-list-table-wrap { display: none; }

/* ── Sub-tabs (inside detail view) — Carbon underline slider ────────────── */
/* Tối giản: tab bar trong suốt + 1 đường border mảnh. Active có 1 line trượt
   dưới chân màu primary. KHÔNG glow, KHÔNG box, mọi tab dùng cùng accent xanh. */
.doc-subtabs-nav {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0;
  margin-bottom: 18px;
  position: relative;
}

.doc-subtab-btn {
  position: relative;
  padding: 11px 16px 13px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  line-height: 1;
}

.doc-subtab-btn svg {
  display: block;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
}

/* Underline trượt dưới chân — màu primary xanh, không glow */
.doc-subtab-btn::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 2px 2px 0 0;
}

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

.doc-subtab-btn:hover::after {
  transform: scaleX(0.7);
  opacity: 0.4;
}

.doc-subtab-btn.active {
  color: var(--text-bright);
  font-weight: 600;
}

.doc-subtab-btn.active::after {
  transform: scaleX(1);
  opacity: 1;
}

/* Count — badge inline nhỏ, không đổi màu nền khi active (fix bug full đen) */
.doc-subtab-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  transition: background 0.18s ease, color 0.18s ease;
}

.doc-subtab-btn.active .doc-subtab-count {
  background: var(--primary);
  color: #ffffff;
}

.doc-subtab-btn:hover:not(.active) .doc-subtab-count {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

.doc-subtab-panel { display: none; }
.doc-subtab-panel.active {
  display: block;
  animation: docTabSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Document Detail View ──────────────────────────────────────────────── */
#docDetailView {
  animation: docDetailReveal 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes docDetailReveal {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.doc-detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Empty States ──────────────────────────────────────────────────────── */
.doc-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.01);
  border: 2px dashed rgba(255, 255, 255, 0.05);
  border-radius: 16px;
}

.doc-empty-state svg {
  width: 56px;
  height: 56px;
  opacity: 0.25;
  stroke: var(--muted);
}

.doc-empty-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-bright);
}

.doc-empty-desc {
  font-size: 13px;
  color: var(--muted);
  max-width: 360px;
  line-height: 1.5;
}

/* ── Loading Skeleton ──────────────────────────────────────────────────── */
.doc-skeleton {
  animation: docSkeletonPulse 1.6s ease-in-out infinite;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.03) 75%
  );
  background-size: 200% 100%;
}

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

.doc-skeleton-card {
  height: 180px;
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.doc-skeleton-line { height: 14px; }
.doc-skeleton-line.short { width: 60%; }
.doc-skeleton-line.medium { width: 80%; }

/* ── Grants list (grade-picker style, enhanced) ───────────────────────── */
.doc-grant-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  cursor: default;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.015);
  transition: all 0.15s ease;
}

.doc-grant-item:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.05);
}

.doc-grant-item + .doc-grant-item { margin-top: 4px; }

.doc-grant-status {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.doc-grant-status.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-bright);
}

.doc-grant-status.expired {
  background: rgba(139, 138, 150, 0.18);
  color: var(--muted);
}

.doc-grant-status.revoked {
  background: rgba(139, 138, 150, 0.18);
  color: var(--muted);
}

/* ── Task cards ────────────────────────────────────────────────────────── */
.doc-task-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.15s ease;
}

.doc-task-card:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}

.doc-task-card + .doc-task-card { margin-top: 6px; }

.doc-task-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  padding: 3px 10px;
  background: rgba(109, 124, 255, 0.08);
  border-radius: 6px;
  white-space: nowrap;
}

/* ── Security panel ────────────────────────────────────────────────────── */
.doc-sec-panel {
  border: 1px solid rgba(244, 63, 94, 0.2);
  border-radius: 14px;
  overflow: hidden;
}

.doc-sec-panel-head {
  background: rgba(244, 63, 94, 0.06);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.doc-sec-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sec-accent);
  animation: docSecPulse 2s ease-in-out infinite;
}

@keyframes docSecPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.5); }
  50%      { box-shadow: 0 0 0 8px rgba(244, 63, 94, 0); }
}

/* ── Event type chips — Carbon tối giản ─────────────────────────────────── */
.doc-event-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.doc-event-chip.security { color: var(--sec-accent); background: rgba(244, 63, 94, 0.1); }
.doc-event-chip.admin    { color: var(--primary-hover); background: rgba(109, 124, 255, 0.12); }

/* ── Filter chips ──────────────────────────────────────────────────────── */
.doc-filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.doc-filter-chip {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.doc-filter-chip:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-bright);
}

.doc-filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
}

/* ── Document settings warning ─────────────────────────────────────────── */
.doc-settings-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(251, 191, 36, 0.07);
  border: 1px solid rgba(251, 191, 36, 0.18);
  border-radius: 12px;
  color: var(--warning);
  font-size: 13px;
  font-weight: 600;
}

/* ── SBD tag inline (sub-line của user list) ───────────────────────────── */
.doc-sbd-tag {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  background: rgba(109, 124, 255, 0.1);
  color: var(--primary-hover);
  font-size: 11px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}

/* ── Modal: gọn + responsive + carbon ─────────────────────────────────── */
.doc-modal {
  width: min(480px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
}

.doc-modal-sm { width: min(420px, 100%); }

.modal-body {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.modal-body .field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.modal-body .field { gap: 5px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.field-label .req {
  color: var(--danger);
  font-style: normal;
  margin-left: 2px;
}

.field-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.field-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Modal responsive: mobile full-width, h-padding thu nhỏ */
@media (max-width: 600px) {
  .doc-modal,
  .doc-modal-sm {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 14px 14px 0 0;
    align-self: flex-end;
  }
  .modal-body { padding: 12px 14px; gap: 10px; }
  .field-grid-2 { grid-template-columns: 1fr; }
  .modal-body-grid { grid-template-columns: 1fr; }
  .modal-head h3 { font-size: 14px; }
}

/* ── Modal Edit: wide + 2-column + accent head + dropzone + toggle ────── */
.doc-modal-wide { width: min(620px, 100%); }

.modal-head-accent {
  position: relative;
  border-bottom: none;
}
.modal-head-accent::after {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary) 0%, transparent 100%);
  border-radius: 2px;
}

.modal-body-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px 18px;
}

.modal-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.modal-status { grid-column: 1 / -1; min-height: 14px; }

/* Drop zone */
/* Premium fields and inputs within Document Modals */
.doc-modal .field {
  margin-bottom: 12px;
}

.doc-modal .field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: none !important;
  letter-spacing: normal !important;
  margin-bottom: 6px;
  display: inline-block;
}

.doc-modal input[type="text"],
.doc-modal input[type="number"],
.doc-modal select,
.doc-modal textarea {
  border-radius: 10px !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  background: rgba(255, 255, 255, 0.02) !important;
  padding: 10px 14px !important;
  font-size: 13px !important;
  transition: all 0.22s ease !important;
  height: auto !important;
  min-height: 40px !important;
  box-shadow: none !important;
  color: var(--text-bright) !important;
}

.doc-modal input[type="text"]:focus,
.doc-modal input[type="number"]:focus,
.doc-modal select:focus,
.doc-modal textarea:focus {
  border-color: var(--primary) !important;
  background: rgba(255, 255, 255, 0.04) !important;
  box-shadow: 0 0 0 3px rgba(109, 124, 255, 0.15) !important;
  outline: none !important;
}

.doc-modal select {
  padding-right: 42px !important;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.72) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.72) 50%, transparent 50%) !important;
  background-position:
    calc(100% - 21px) 50%,
    calc(100% - 15px) 50% !important;
  background-size: 6px 6px, 6px 6px !important;
  background-repeat: no-repeat !important;
  cursor: pointer !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

/* Premium Dropzone */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 20px;
  border: 2px dashed rgba(109, 124, 255, 0.2);
  border-radius: 16px;
  background: rgba(109, 124, 255, 0.01);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  min-height: 180px;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--primary);
  background: rgba(109, 124, 255, 0.03);
  box-shadow: 0 0 20px rgba(109, 124, 255, 0.08);
  outline: none;
}

.dropzone.dragover {
  border-color: var(--primary-hover);
  background: rgba(109, 124, 255, 0.08);
  box-shadow: 0 0 30px rgba(109, 124, 255, 0.15);
  transform: scale(1.02);
}

.dropzone.has-file {
  border-style: solid;
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.02);
}

.dropzone.has-file:hover {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.04);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.08);
}

.dropzone-icon {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.25s ease;
}

.dropzone:hover .dropzone-icon,
.dropzone.dragover .dropzone-icon {
  color: var(--primary);
  background: rgba(109, 124, 255, 0.1);
  border-color: rgba(109, 124, 255, 0.2);
  transform: translateY(-4px);
}

.dropzone.has-file .dropzone-icon { display: none; }

.dropzone-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
  line-height: 1.3;
}

.dropzone-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.dropzone.has-file .dropzone-sub { display: none; }

.dropzone-link {
  color: var(--primary-hover);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dropzone-meta {
  font-size: 10px;
  color: var(--muted);
  margin-top: 6px;
  opacity: 0.8;
}
.dropzone.has-file .dropzone-meta { display: none; }

.dropzone-file {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.15);
  width: 100%;
  max-width: 90%;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  animation: fadeIn 0.2s ease-in-out;
}
.dropzone.has-file .dropzone-file { display: flex; }

.dropzone-filename {
  flex: 1;
  font-weight: 600;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropzone-filesize {
  color: var(--muted);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
}

.dropzone-clear {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}
.dropzone-clear:hover { background: rgba(244, 63, 94, 0.15); color: var(--sec-accent); }

/* Premium Toggle Card */
.toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.toggle-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.toggle-card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.toggle-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
}

.toggle-card-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}

/* Custom switch toggle styled inside */
.toggle-switch {
  position: relative;
  flex-shrink: 0;
}

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

.toggle-switch .toggle-track {
  position: relative;
  display: block;
  width: 38px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.2s ease;
}

.toggle-switch .toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s ease;
}

.toggle-switch input:checked + .toggle-track {
  background: var(--success);
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
  background: #ffffff;
}


/* ── Grade picker badge overrides for document context — carbon ────────── */
.grade-picker-badge.active  { background: rgba(255, 255, 255, 0.08); color: var(--text-bright); }
.grade-picker-badge.revoked { background: rgba(139, 138, 150, 0.18); color: var(--muted); }
.grade-picker-badge.expired { background: rgba(139, 138, 150, 0.18); color: var(--muted); }

/* ── Tooltip for detail header ────────────────────────────────────────── */
.doc-tooltip {
  position: relative;
}

.doc-tooltip-trigger {
  cursor: help;
  border-bottom: 1px dashed currentColor;
}

.doc-tooltip-content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 11px;
  white-space: nowrap;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 50;
}

.doc-tooltip:hover .doc-tooltip-content {
  opacity: 1;
}

/* ── Modal enhancements ────────────────────────────────────────────────── */
#docEditForm input[type="file"] {
  padding: 10px 14px;
  border: 2px dashed rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

#docEditForm input[type="file"]:hover {
  border-color: rgba(20, 184, 166, 0.25);
  background: rgba(20, 184, 166, 0.04);
}

#docEditForm input[type="file"]:focus-within {
  border-color: var(--doc-accent);
  box-shadow: 0 0 0 3px var(--doc-accent-glow);
}

/* ── Accessibility ─────────────────────────────────────────────────────── */
.doc-tab-btn:focus-visible,
.doc-subtab-btn:focus-visible,
.doc-filter-chip:focus-visible,
.doc-view-toggle-btn:focus-visible {
  outline: 2px solid var(--doc-accent);
  outline-offset: 2px;
}

/* ── Mobile ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .doc-tabs-nav { gap: 2px; }

  .doc-tab-btn {
    flex: 1;
    justify-content: center;
    padding: 10px 8px;
    font-size: 12px;
  }

  .doc-tab-btn span { display: none; }

  .doc-grid {
    grid-template-columns: 1fr;
  }

  .doc-stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  .doc-subtabs-nav {
    flex-wrap: wrap;
  }

  .doc-subtab-btn {
    font-size: 11px;
    padding: 6px 10px;
  }
}

/* Autocomplete search dropdown */
.search-select-container {
  position: relative;
  width: 100%;
}

.autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  max-height: 250px;
  overflow-y: auto;
  background: var(--surface-1, #18181a);
  border: 1px solid var(--line, #2d2d30);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  margin-top: 6px;
}

.autocomplete-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line, #2d2d30);
  transition: background 0.2s ease;
}

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

.autocomplete-item:hover {
  background: var(--surface-2, #242427);
}

.autocomplete-item .student-details {
  font-size: 11px;
  color: var(--muted, #8e8e93);
  text-align: right;
  margin-left: auto;
}

/* Suspicious Log Cards grid layout -> Horizontal Rows */
.doc-suspicious-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-suspicious-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--danger, #ef4444);
  border-radius: var(--radius-sm, 8px);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.doc-suspicious-row:hover {
  border-color: rgba(239, 68, 68, 0.25);
  background: var(--surface-hover);
  transform: translateX(2px);
}

.doc-suspicious-col-event {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  flex-shrink: 0;
}

.doc-suspicious-time {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
}

.doc-suspicious-col-student {
  display: flex;
  align-items: center;
  min-width: 160px;
  flex-shrink: 0;
}

.doc-suspicious-col-doc {
  flex-grow: 1;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.doc-col-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 600;
}

.doc-col-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.doc-suspicious-col-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 150px;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--muted);
}

.doc-suspicious-col-meta code {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text-bright);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
}

.doc-suspicious-col-meta .event-code {
  color: var(--danger, #ef4444);
  background: transparent;
  border: none;
  padding: 0;
}

.doc-suspicious-col-action {
  min-width: 110px;
  text-align: right;
  flex-shrink: 0;
}

.doc-suspicious-col-action button {
  white-space: nowrap;
}

/* Responsive adjustment for row layout */
@media (max-width: 992px) {
  .doc-suspicious-row {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px;
  }
  .doc-suspicious-col-event {
    min-width: 120px;
  }
  .doc-suspicious-col-student {
    min-width: 180px;
  }
  .doc-suspicious-col-doc {
    flex-grow: 1;
    min-width: 160px;
  }
  .doc-suspicious-col-meta {
    min-width: 160px;
  }
  .doc-suspicious-col-action {
    flex-grow: 1;
    text-align: right;
  }
}

@media (max-width: 768px) {
  .doc-suspicious-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .doc-suspicious-col-event,
  .doc-suspicious-col-student,
  .doc-suspicious-col-doc,
  .doc-suspicious-col-meta,
  .doc-suspicious-col-action {
    width: 100% !important;
    min-width: 0 !important;
    text-align: left !important;
  }
  .doc-suspicious-col-action {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Shop Item Modal — type cards, inline upload, progress bar
   ═══════════════════════════════════════════════════════════════════════════ */

/* Loại vật phẩm — radio cards */
.shop-type-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.shop-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}
.shop-type-card:hover {
  border-color: rgba(109, 124, 255, 0.4);
  background: rgba(109, 124, 255, 0.04);
}
.shop-type-card.selected {
  border-color: var(--primary);
  background: rgba(109, 124, 255, 0.1);
  box-shadow: 0 0 0 2px rgba(109, 124, 255, 0.15);
}
.shop-type-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.shop-type-emoji svg {
  color: var(--text-bright);
}
.shop-type-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}
.shop-type-card.selected .shop-type-name {
  color: var(--text-bright);
}

/* Toggle compact trong shop modal */
.toggle-card.compact {
  padding: 8px 12px;
  gap: 10px;
}
.toggle-card.compact .toggle-card-title {
  font-size: 13px;
}

/* Hàng select + nút Upload */
.shop-doc-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.shop-doc-row select {
  flex: 1;
  min-width: 0;
}

/* Progress bar upload (shop modal + doc edit modal) */
.upload-progress {
  margin-top: 8px;
}
.upload-progress-bar {
  height: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.upload-progress-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 100%);
  transition: width 0.2s ease;
}
.upload-progress-text {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
}

/* Status hint trong shop modal */
.modal-status.ok { color: var(--success, #34d399); }
.modal-status.error { color: var(--danger, #f87171); }

/* Mobile: type cards thành 1 cột */
@media (max-width: 600px) {
  .shop-type-cards { grid-template-columns: 1fr; }
  .shop-doc-row { flex-direction: column; }
}
