:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Colors */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --primary-text: #ffffff;

  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fee2e2;

  --success: #10b981;
  --success-light: #d1fae5;

  --warning: #f59e0b;
  --warning-light: #fef3c7;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.08);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  font-family: inherit;
}

/* Utilities */
.mono-text { font-family: var(--font-mono); font-size: 0.82rem; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger) !important; }
.text-primary { color: var(--primary); }
.text-red-500 { color: #ef4444; }
.text-amber-500 { color: #f59e0b; }
.text-emerald-500 { color: #10b981; }
.text-white { color: #ffffff; }
.text-right { text-align: right; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.mr-1 { margin-right: 0.25rem; }
.mr-1\.5 { margin-right: 0.375rem; }
.mr-2 { margin-right: 0.5rem; }
.ml-1 { margin-left: 0.25rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.w-3 { width: 0.75rem; height: 0.75rem; }
.w-3\.5 { width: 0.875rem; height: 0.875rem; }
.w-4 { width: 1rem; height: 1rem; }
.w-5 { width: 1.25rem; height: 1.25rem; }
.w-6 { width: 1.5rem; height: 1.5rem; }
.w-8 { width: 2rem; height: 2rem; }
.w-10 { width: 2.5rem; height: 2.5rem; }
.w-12 { width: 3rem; height: 3rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  line-height: 1.2;
}

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

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

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

.btn-icon {
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
}
.btn-icon.btn-active {
  background-color: var(--primary-light);
  color: var(--primary);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

/* Toast */
.toast-notification {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.25s ease-out;
}
.toast-success {
  background-color: #064e3b;
  color: #a7f3d0;
  border: 1px solid #059669;
}
.toast-error {
  background-color: #7f1d1d;
  color: #fecaca;
  border: 1px solid #b91c1c;
}
@keyframes slideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Auth View */
.auth-overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  padding: 2.5rem 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
}

.auth-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-logo-badge {
  display: inline-flex;
  padding: 0.85rem;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

.auth-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.25rem;
}


.auth-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s;
}

.auth-tab.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.auth-form .form-group {
  margin-bottom: 1.1rem;
}

.auth-form label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0.75rem;
  width: 1rem;
  height: 1rem;
  color: var(--text-dim);
  pointer-events: none;
}

.input-with-icon input,
.form-group input {
  width: 100%;
  padding: 0.6rem 0.75rem 0.6rem 2.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: #fff;
  color: var(--text-main);
  transition: border-color 0.15s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

.submit-btn {
  width: 100%;
  padding: 0.7rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.15s;
  margin-top: 0.5rem;
}
.submit-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}
.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error-alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--danger-light);
  border: 1px solid #fca5a5;
  color: #b91c1c;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  margin-bottom: 1.25rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Navbar */
.navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon-wrapper {
  background: var(--primary-light);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-main);
  display: block;
}

.brand-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.navbar-search {
  flex: 1;
  max-width: 440px;
}

.search-input {
  width: 100%;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  background: #f8fafc;
  transition: all 0.15s;
}

.search-input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stats-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border-color);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.2;
}

.user-handle {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Main Content */
.main-content {
  padding: 2rem 1.5rem;
}

.content-container {
  max-width: 1320px;
  margin: 0 auto;
}

/* Document Section Toolbar */
.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.results-count {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sort-wrapper {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
}

.sort-select {
  border: none;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  outline: none;
}

.view-toggle {
  display: flex;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-btn {
  background: transparent;
  border: none;
  padding: 0.4rem 0.6rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
}

.view-btn.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* Document Grid Cards */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.doc-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.doc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.doc-thumbnail {
  height: 140px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
}

.thumbnail-hover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.doc-thumbnail:hover .thumbnail-hover-overlay {
  opacity: 1;
}

.doc-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.doc-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
}
.doc-title:hover {
  color: var(--primary);
}

.rename-trigger {
  opacity: 0.5;
  padding: 0.2rem;
}
.rename-trigger:hover {
  opacity: 1;
}

.doc-meta-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.meta-row {
  display: flex;
  align-items: center;
}

.doc-actions {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.rename-box {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  margin-bottom: 0.5rem;
}

.rename-input {
  flex: 1;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
}

/* Document Table View */
.table-wrapper {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

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

.doc-table th {
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
}

.doc-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

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

.table-title-cell {
  display: flex;
  align-items: center;
}

.table-title-link {
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
}
.table-title-link:hover {
  color: var(--primary);
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

/* Empty State */
.empty-state-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-color);
  padding: 4rem 2rem;
  text-align: center;
  max-width: 540px;
  margin: 3rem auto;
}

.empty-icon-wrap {
  width: 64px;
  height: 64px;
  background: #f1f5f9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.empty-state-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.empty-state-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Modal System */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  overflow: hidden;
  animation: popIn 0.2s ease-out;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.modal-card.modal-sm {
  max-width: 440px;
  padding: 0;
}

.modal-card.modal-md {
  max-width: 540px;
  padding: 0;
}

.modal-card.modal-lg {
  max-width: 680px;
  padding: 0;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
  flex-shrink: 0;
}

.modal-title-group h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.modal-title-group p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  line-height: 1.4;
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  max-height: calc(85vh - 140px);
  overflow-y: auto;
}

.upload-form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  max-height: calc(85vh - 140px);
  overflow-y: auto;
}

.hidden-file-input {
  display: none;
}

.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #f8fafc;
}

.dropzone:hover,
.dropzone.dropzone-active {
  border-color: var(--primary);
  background: #eef2ff;
}

.dropzone-icon {
  margin-bottom: 0.85rem;
}

.dropzone h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

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

.selected-file-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.file-info-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.file-icon-badge {
  background: #fee2e2;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-details {
  flex: 1;
  overflow: hidden;
}

.file-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem 1.25rem 1.5rem;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* Modal actions inside a modal-body or form */
.modal-body .modal-actions,
form .modal-actions,
.upload-form .modal-actions {
  padding: 0;
  border-top: none;
  background: transparent;
  margin-top: 1.5rem;
}

/* PDF Viewer Full Modal */
.pdf-viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.pdf-viewer-modal {
  width: 95vw;
  max-width: 1400px;
  height: 90vh;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer-fullscreen .pdf-viewer-modal {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  border-radius: 0;
}
.viewer-fullscreen {
  padding: 0;
}

.pdf-viewer-header {
  padding: 0.75rem 1.25rem;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.pdf-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}

.pdf-header-icon {
  background: #fee2e2;
  padding: 0.45rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pdf-title-container {
  overflow: hidden;
}

.pdf-viewer-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.pdf-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.close-btn {
  margin-left: 0.5rem;
  border-left: 1px solid var(--border-color);
  padding-left: 0.8rem;
  border-radius: 0;
}

.pdf-viewer-body {
  flex: 1;
  display: flex;
  background: #334155;
  position: relative;
  overflow: hidden;
}

.pdf-frame-wrapper {
  flex: 1;
  height: 100%;
}

.pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #525659;
}

.pdf-details-panel {
  width: 320px;
  background: #ffffff;
  border-left: 1px solid var(--border-color);
  padding: 1.25rem;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideLeft 0.2s ease-out;
}

.details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.details-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.details-list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.detail-label {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-value {
  font-size: 0.85rem;
  color: var(--text-main);
  word-break: break-all;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideLeft {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* Spinner */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(79, 70, 229, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

.full-screen-loader {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ==========================================
   USER MANAGEMENT & NAVIGATION STYLES
   ========================================== */

.navbar-left-group {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.navbar-nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link-btn {
  display: flex;
  align-items: center;
  background: transparent;
  border: none;
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-link-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.nav-link-btn.active {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-admin-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #7c3aed;
  color: #fff;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  margin-left: 0.4rem;
  letter-spacing: 0.03em;
}

.user-name-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.user-role-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: #e0e7ff;
  color: var(--primary);
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  text-transform: uppercase;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header-text h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.page-header-text p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.2rem;
}

/* Stats Cards */
.stats-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bg-indigo-50 { background-color: #eef2ff; }
.bg-emerald-50 { background-color: #ecfdf5; }
.bg-purple-50 { background-color: #f5f3ff; }
.bg-blue-50 { background-color: #eff6ff; }

.text-emerald-600 { color: #059669; }
.text-purple-600 { color: #7c3aed; }
.text-blue-600 { color: #2563eb; }

.stat-card-content {
  display: flex;
  flex-direction: column;
}

.stat-card-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

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

/* User Search */
.search-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  width: 320px;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  color: var(--text-dim);
  pointer-events: none;
}

.user-search-input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  background: #ffffff;
  transition: all 0.15s;
}

.user-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

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

/* Table User Details */
.table-user-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.table-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #475569;
  position: relative;
  font-size: 0.85rem;
}

.status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid #ffffff;
}

.status-dot-active {
  background-color: #10b981;
}

.status-dot-disabled {
  background-color: #94a3b8;
}

.table-user-info {
  display: flex;
  flex-direction: column;
}

.table-user-name {
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.self-tag {
  font-size: 0.65rem;
  font-weight: 600;
  background: #dbeafe;
  color: #1d4ed8;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
}

.table-user-handle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.badge-admin {
  background-color: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #e9d5ff;
}

.badge-user {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.badge-active {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-disabled {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.badge-2fa-enabled {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-2fa-disabled {
  background-color: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.row-disabled td {
  opacity: 0.65;
}

.role-select-box {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: #ffffff;
  color: var(--text-main);
}

/* ==========================================
   BACKGROUND UPLOAD QUEUE & MULTI-FILE STYLES
   ========================================== */

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

/* Staged Files Section */
.staged-files-section {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #f8fafc;
  overflow: hidden;
}

.staged-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border-color);
}

.staged-count-badge {
  display: flex;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.staged-list-container {
  max-height: 220px;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.staged-item-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #ffffff;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.staged-index-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 20px;
  text-align: center;
}

.staged-details-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.staged-title-input {
  width: 100%;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.staged-file-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.staged-title-input:focus {
  outline: none;
  border-color: var(--primary);
}

.staged-file-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-left: 0.25rem;
}

/* Floating Minimized Pill */
.upload-queue-pill {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1500;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 0.5rem 0.9rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  animation: slideIn 0.2s ease-out;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.upload-queue-pill:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.pill-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pill-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

.pill-mini-bar {
  width: 60px;
  height: 5px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.pill-mini-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 9999px;
  transition: width 0.15s ease;
}

.pill-actions {
  display: flex;
  align-items: center;
}

/* Floating Expanded Panel */
.upload-queue-panel {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 380px;
  max-width: calc(100vw - 2rem);
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popIn 0.2s ease-out;
}

.queue-header {
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: #f8fafc;
}

.queue-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.queue-header-icon {
  background: var(--primary-light);
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.queue-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.queue-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
}

.queue-header-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Active Upload Progress Banner */
.queue-active-banner {
  padding: 0.65rem 1rem;
  background: #eef2ff;
  border-bottom: 1px solid #e0e7ff;
}

.banner-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.35rem;
}

.banner-filename {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.queue-progress-track {
  height: 6px;
  background: #cbd5e1;
  border-radius: 9999px;
  overflow: hidden;
}

.queue-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 9999px;
  transition: width 0.15s ease;
}

/* Queue Items List */
.queue-items-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
  transition: background 0.15s ease;
}

.queue-item-uploading {
  border-color: var(--primary);
  background: #f8fafc;
}

.queue-item-completed {
  background: #fcfdfc;
}

.queue-item-icon {
  color: #ef4444;
  flex-shrink: 0;
}

.queue-item-details {
  flex: 1;
  overflow: hidden;
}

.item-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.item-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-size {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.item-status-row {
  margin-top: 0.2rem;
}

.status-pill {
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  display: inline-flex;
  align-items: center;
}

.status-queued {
  background: #f1f5f9;
  color: #475569;
}

.status-uploading {
  background: #e0e7ff;
  color: #4338ca;
}

.status-completed {
  background: #ecfdf5;
  color: #065f46;
}

.status-error {
  background: #fee2e2;
  color: #991b1b;
}

.status-cancelled {
  background: #f1f5f9;
  color: #94a3b8;
}

.uploading-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.item-micro-bar {
  flex: 1;
  height: 4px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.item-micro-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.15s ease;
}

.queue-item-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Queue Footer */
.queue-footer {
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.queue-footer-summary {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-upload-pulse {
  animation: subtlePulse 2s infinite ease-in-out;
}

@keyframes subtlePulse {
  0%, 100% { border-color: var(--primary); }
  50% { border-color: transparent; }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* ==========================================
   SHARING & OWNERSHIP BADGE STYLES
   ========================================== */

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

.share-header-title {
  display: flex;
  align-items: center;
}

.share-filename-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 400px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.2rem;
}

.share-modal-body {
  padding: 1.25rem 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.share-option-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
}

.share-option-card:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.share-option-card.option-selected {
  border-color: var(--primary);
  background: #f5f3ff;
}

.share-option-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.share-option-info {
  flex: 1;
}

.share-option-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.share-option-desc {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 0.15rem;
}

.share-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.share-users-section {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
  overflow: hidden;
}

.share-users-header {
  padding: 0.6rem 0.85rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
}

.section-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.share-users-list {
  max-height: 180px;
  overflow-y: auto;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.share-user-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.share-user-row:hover {
  background: #f1f5f9;
}

.share-user-row.user-row-selected {
  background: #eef2ff;
}

.share-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
}

.share-user-text {
  display: flex;
  flex-direction: column;
}

.share-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.share-user-handle {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.share-link-input-group {
  display: flex;
  gap: 0.4rem;
}

.share-link-input {
  flex: 1;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  background: #f8fafc;
  color: var(--text-muted);
}

.share-link-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #ffffff;
}

/* Document Badges Overlay */
.doc-badges-overlay {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  z-index: 10;
}

.card-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.badge-owner {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.badge-shared {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.badge-shared-all {
  background-color: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #e9d5ff;
}

.btn-active-share {
  background-color: #ede9fe;
  color: #7c3aed;
}

/* ==========================================
   BATCH SELECTION, DELETE & MULTI-SHARE STYLES
   ========================================== */

/* Table Checkboxes */
.th-checkbox,
.td-checkbox {
  width: 44px;
  text-align: center;
  padding-left: 0.75rem !important;
  padding-right: 0.25rem !important;
}

.checkbox-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.checkbox-wrapper:hover {
  background: #e2e8f0;
}

.table-row-selected td {
  background-color: #f5f3ff !important;
}

/* Card Checkbox */
.card-select-checkbox {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 20;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: all 0.15s ease;
}

.card-select-checkbox:hover {
  transform: scale(1.1);
  background: #ffffff;
}

.doc-card-selected {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px var(--primary-light), var(--shadow-md) !important;
}

.select-all-group {
  display: flex;
  align-items: center;
}

.select-all-btn {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Floating Batch Actions Bar */
.batch-actions-bar {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1400;
  background: #0f172a;
  color: #ffffff;
  border-radius: 9999px;
  padding: 0.65rem 1.25rem;
  box-shadow: 0 10px 25px -3px rgba(15, 23, 42, 0.35), 0 4px 6px -4px rgba(15, 23, 42, 0.2);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.batch-actions-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-right: 1px solid #334155;
  padding-right: 1rem;
}

.batch-count-badge {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: #f8fafc;
}

.batch-actions-bar .btn-ghost {
  color: #94a3b8;
  padding: 0.25rem 0.5rem;
}

.batch-actions-bar .btn-ghost:hover {
  color: #ffffff;
  background: #1e293b;
}

.batch-actions-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* Batch Share Modal Chips */
.batch-share-files-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.batch-share-files-header {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
}

.batch-share-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-height: 110px;
  overflow-y: auto;
}

.batch-chip {
  font-size: 0.75rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Batch Delete Modal Items */
.warning-notice {
  display: flex;
  align-items: center;
  padding: 0.6rem 0.85rem;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  color: #92400e;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.batch-delete-items-scroll {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.batch-delete-item-row {
  display: flex;
  align-items: center;
  padding: 0.35rem 0.5rem;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-size: 0.82rem;
}

.batch-item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
  font-weight: 600;
}

.batch-item-size {
  font-size: 0.75rem;
}

/* ==========================================
   FOLDER MANAGEMENT STYLES
   ========================================== */

.folder-bar-container {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.folder-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.folder-bar-title-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.folder-breadcrumb {
  display: flex;
  align-items: center;
}

.folder-breadcrumb-clear {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.folder-add-btn {
  display: inline-flex;
  align-items: center;
  font-weight: 500;
  border-color: #cbd5e1;
}

.folder-add-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.folder-pills-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.folder-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: #f8fafc;
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  white-space: nowrap;
  flex-shrink: 0;
}

.folder-pill:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.folder-pill.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.folder-pill-count {
  margin-left: 0.45rem;
  font-size: 0.72rem;
  background: #e2e8f0;
  color: var(--text-muted);
  padding: 1px 7px;
  border-radius: 9999px;
  font-weight: 600;
}

.folder-pill.active .folder-pill-count {
  background: var(--primary);
  color: #ffffff;
}

.folder-shared-badge {
  margin-left: 0.35rem;
  display: inline-flex;
  align-items: center;
}

.folder-pill-actions {
  display: inline-flex;
  align-items: center;
  margin-left: 0.25rem;
  gap: 2px;
}

.folder-pill-remove-btn {
  border: none;
  background: transparent;
  padding: 2px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.folder-pill-remove-btn:hover {
  background: #fee2e2;
  color: #dc2626 !important;
}

.folder-pill-remove-btn:hover svg {
  color: #dc2626 !important;
}

.folder-pill-menu-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.folder-menu-trigger {
  border: none;
  background: transparent;
  padding: 2px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.folder-menu-trigger:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.folder-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-sm);
  min-width: 175px;
  z-index: 1000;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
}

.folder-dropdown-item {
  border: none;
  background: transparent;
  padding: 0.5rem 0.85rem;
  text-align: left;
  font-size: 0.82rem;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background 0.12s ease;
  width: 100%;
}

.folder-dropdown-item:hover {
  background: #f1f5f9;
}

.folder-color-picker {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.color-swatch:hover {
  transform: scale(1.08);
}

.color-swatch.active {
  border-color: #0f172a;
  transform: scale(1.12);
}

.folder-cell-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  background: #f1f5f9;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.12s ease;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-cell-tag:hover {
  background: #e2e8f0;
  color: var(--primary);
}

.card-folder-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.12s ease;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-folder-tag:hover {
  color: var(--primary);
}

.select-input {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: #ffffff;
  color: var(--text-main);
}

.select-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ==========================================
   2FA TOTP STYLES
   ========================================== */

.auth-logo-2fa {
  background: #ecfdf5 !important;
}

.twofa-login-input {
  letter-spacing: 0.25em !important;
}

.twofa-active-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
}

.twofa-active-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.twofa-active-text h4 {
  margin: 0;
  font-size: 0.95rem;
  color: #166534;
}

.twofa-active-text p {
  margin: 0.25rem 0 0 0;
  line-height: 1.35;
}

.twofa-info-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  line-height: 1.4;
}

.twofa-step-badge {
  display: flex;
  align-items: center;
}

.twofa-qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.twofa-qr-wrapper {
  background: #ffffff;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
}

.twofa-qr-image {
  width: 200px;
  height: 200px;
  display: block;
}

.twofa-tip-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
}

.twofa-qr-placeholder {
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e2e8f0;
  border-radius: var(--radius-sm);
}

.twofa-secret-box {
  width: 100%;
  text-align: center;
}

.twofa-secret-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.twofa-secret-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
  font-weight: 600;
  background: #ffffff;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--primary);
  letter-spacing: 0.08em;
  user-select: all;
}

.twofa-code-input {
  letter-spacing: 0.25em !important;
}

/* Folder Removal Choices */
.folder-delete-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: var(--radius-sm);
}

.folder-delete-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.folder-delete-option-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.folder-delete-option-card input[type="radio"] {
  margin-top: 0.2rem;
  cursor: pointer;
}

.folder-delete-option-card:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.folder-delete-option-card.selected {
  background: #f0fdf4;
  border-color: #86efac;
}

.folder-delete-option-card.selected-danger {
  background: #fef2f2;
  border-color: #fca5a5;
}

.folder-delete-option-text {
  flex: 1;
}

.folder-delete-confirm-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
}

/* ==========================================
   RESPONSIVE & MOBILE-FRIENDLY SYSTEM
   ========================================== */

/* Universal mobile touch enhancements */
@media (max-width: 768px) {
  /* Prevent iOS Safari auto-zoom on input focus by ensuring >= 16px font-size */
  input[type="text"],
  input[type="password"],
  input[type="search"],
  input[type="number"],
  select,
  textarea,
  .search-input,
  .user-search-input,
  .select-input,
  .sort-select,
  .form-control {
    font-size: 16px !important;
  }

  /* Tap target improvements */
  button,
  .btn,
  .nav-link-btn,
  .folder-pill,
  .view-btn {
    -webkit-tap-highlight-color: rgba(79, 70, 229, 0.12);
  }

  /* Main layout */
  .main-content {
    padding: 0.85rem 0.75rem 5.5rem 0.75rem;
  }

  .content-container {
    max-width: 100%;
  }

  /* Toast Notification */
  .toast-notification {
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    max-width: calc(100% - 1.5rem);
    justify-content: center;
    font-size: 0.82rem;
    padding: 0.6rem 1rem;
    text-align: center;
  }

  /* ================= Navbar ================= */
  .navbar-container {
    padding: 0.5rem 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .navbar-left-group {
    display: contents;
  }

  .navbar-brand {
    order: 1;
    gap: 0.5rem;
  }

  .brand-icon-wrapper {
    padding: 0.35rem;
  }

  .brand-title {
    font-size: 1rem;
  }

  .navbar-actions {
    order: 2;
    gap: 0.4rem;
    margin-left: auto;
  }

  .stats-badge {
    display: none !important;
  }

  .user-info {
    display: none !important;
  }

  .user-profile {
    border-left: none;
    padding-left: 0.15rem;
    gap: 0.35rem;
  }

  .navbar-nav-links {
    order: 3;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: #f1f5f9;
    padding: 3px;
    border-radius: var(--radius-sm);
  }

  .nav-link-btn {
    flex: 1;
    justify-content: center;
    padding: 0.45rem 0.5rem;
    font-size: 0.85rem;
    border-radius: calc(var(--radius-sm) - 2px);
  }

  .nav-link-btn.active {
    background: #ffffff;
    box-shadow: var(--shadow-sm);
  }

  .navbar-search {
    order: 4;
    width: 100%;
    max-width: 100%;
    margin-top: 0.15rem;
  }

  .search-input {
    padding: 0.55rem 0.85rem;
  }

  /* ================= FolderBar ================= */
  .folder-bar-container {
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.85rem;
  }

  .folder-bar-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .folder-bar-title-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .folder-bar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.4rem;
  }

  .folder-selected-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
  }

  .folder-add-btn {
    margin-left: auto;
  }

  .folder-pills-strip {
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    margin-bottom: -2px;
  }

  .folder-pill {
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
  }

  /* ================= Document Toolbar ================= */
  .list-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
  }

  .toolbar-left {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .toolbar-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.5rem;
  }

  .sort-wrapper {
    flex: 1;
  }

  .sort-select {
    width: 100%;
  }

  .view-toggle {
    flex-shrink: 0;
  }

  /* ================= Document Grid & Table ================= */
  .doc-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
  }

  .doc-table {
    min-width: 620px;
  }

  .doc-table th,
  .doc-table td {
    padding: 0.65rem 0.75rem;
  }

  .table-actions .btn {
    padding: 0.4rem;
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* ================= Floating Widgets ================= */
  .batch-actions-bar {
    bottom: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    transform: none;
    width: auto;
    max-width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    border-radius: var(--radius-md);
    padding: 0.75rem 0.85rem;
    animation: slideUpMobile 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }

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

  .batch-actions-left {
    border-right: none;
    border-bottom: 1px solid #334155;
    padding-right: 0;
    padding-bottom: 0.4rem;
    justify-content: space-between;
    width: 100%;
  }

  .batch-actions-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
  }

  .batch-actions-right .btn,
  .batch-actions-right .select-input {
    flex: 1 1 calc(50% - 0.4rem);
    min-width: 110px;
    justify-content: center;
    text-align: center;
  }

  .upload-queue-panel {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    width: auto;
    max-width: 100%;
    border-radius: var(--radius-md);
    max-height: 80vh;
  }

  .upload-queue-pill {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    max-width: 100%;
    justify-content: space-between;
  }

  /* ================= Modal Dialogs ================= */
  .modal-overlay {
    padding: 0.5rem;
    align-items: flex-end;
  }

  .modal-card,
  .modal-card.modal-sm,
  .modal-card.modal-md,
  .modal-card.modal-lg {
    max-width: 100%;
    width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-md);
    margin: 0;
  }

  .modal-header {
    padding: 0.85rem 1rem;
  }

  .modal-body,
  .upload-form,
  .share-modal-body {
    padding: 1rem 0.85rem;
    max-height: calc(85vh - 120px);
    -webkit-overflow-scrolling: touch;
  }

  .modal-actions {
    padding: 0.75rem 0.85rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .modal-actions .btn {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 110px;
    justify-content: center;
    padding: 0.6rem 0.75rem;
  }

  .dropzone {
    padding: 1.5rem 1rem;
  }

  .dropzone-icon svg {
    width: 2.25rem;
    height: 2.25rem;
  }

  .staged-item-card {
    padding: 0.5rem;
    gap: 0.5rem;
  }

  /* ================= PDF Viewer Modal ================= */
  .pdf-viewer-overlay {
    padding: 0 !important;
  }

  .pdf-viewer-modal {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
  }

  .pdf-viewer-header {
    padding: 0.45rem 0.6rem;
    gap: 0.35rem;
  }

  .pdf-header-left {
    gap: 0.4rem;
    min-width: 0;
  }

  .pdf-header-icon {
    padding: 0.35rem;
  }

  .pdf-viewer-title {
    font-size: 0.82rem;
    max-width: 110px;
  }

  .pdf-viewer-meta {
    display: none !important;
  }

  .pdf-header-actions {
    gap: 0.25rem;
    flex-shrink: 0;
  }

  .pdf-header-actions .btn {
    padding: 0.35rem 0.45rem;
    min-width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }

  .pdf-btn-text {
    display: none !important;
  }

  .pdf-btn-icon {
    margin-right: 0 !important;
  }

  .pdf-details-sidebar {
    position: absolute;
    right: 0;
    top: 48px;
    bottom: 0;
    width: 100%;
    max-width: 300px;
    z-index: 50;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.2);
  }

  /* ================= User Management ================= */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .page-header .btn {
    width: 100%;
    justify-content: center;
  }

  .stats-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
    margin-bottom: 1rem;
  }

  .stat-card {
    padding: 0.75rem 0.85rem;
    gap: 0.65rem;
  }

  .stat-card-icon {
    width: 36px;
    height: 36px;
  }

  .stat-card-value {
    font-size: 1.25rem;
  }

  .stat-card-label {
    font-size: 0.72rem;
  }

  .search-with-icon {
    width: 100%;
  }
}

/* Specific micro-phone screens (< 480px) */
@media (max-width: 480px) {
  .hidden-mobile,
  .brand-tag {
    display: none !important;
  }

  .nav-upload-text {
    display: none !important;
  }

  .nav-upload-icon {
    margin-right: 0 !important;
  }

  .nav-upload-btn {
    padding: 0.45rem 0.65rem;
  }

  .nav-queue-text {
    font-size: 0.75rem;
  }

  .auth-overlay {
    padding: 0.75rem;
  }

  .auth-card {
    padding: 1.5rem 1.1rem;
    border-radius: var(--radius-md);
  }

  .auth-header h2 {
    font-size: 1.35rem;
  }

  .twofa-secret-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  .twofa-secret-code {
    text-align: center;
    font-size: 0.8rem;
    word-break: break-all;
  }

  .twofa-qr-wrapper img,
  .twofa-qr-placeholder {
    width: 150px;
    height: 150px;
    margin: 0 auto;
  }

  .empty-state-card {
    padding: 2.5rem 1rem;
    margin: 1.5rem auto;
  }

  .folder-action-text {
    font-size: 0.75rem;
  }
}
