/* ============================================================
   SYSLIBRERÍA MAMÁ — Design System
   Font: Inter (Google Fonts)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Root Variables ──────────────────────────────────────── */
:root {
  --primary:        #2563EB;
  --primary-hover:  #1D4ED8;
  --primary-light:  #EFF6FF;
  --primary-dark:   #1e40af;

  --success:        #10B981;
  --success-light:  #ECFDF5;
  --warning:        #F59E0B;
  --warning-light:  #FFFBEB;
  --error:          #EF4444;
  --error-light:    #FEF2F2;
  --info:           #3B82F6;
  --info-light:     #EFF6FF;

  --bg-main:        #F3F4F6;
  --bg-surface:     #FFFFFF;
  --bg-sidebar:     #1E293B;
  --bg-sidebar-hover: #334155;
  --bg-sidebar-active: #2563EB;

  --border:         #E5E7EB;
  --border-focus:   #2563EB;

  --text-main:      #111827;
  --text-muted:     #6B7280;
  --text-light:     #9CA3AF;
  --text-sidebar:   #CBD5E1;
  --text-sidebar-active: #FFFFFF;

  --shadow-sm:  0 1px 2px rgba(0,0,0,.05);
  --shadow:     0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg:  0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);

  --radius-sm:  4px;
  --radius:     6px;
  --radius-md:  8px;
  --radius-lg:  12px;

  --sidebar-w:       220px;
  --sidebar-collapsed: 60px;
  --header-h:        52px;
  --transition:      all .18s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-main);
  background: var(--bg-main);
  -webkit-font-smoothing: antialiased;
}

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

/* ── Typography ──────────────────────────────────────────── */
h1 { font-size: 20px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
h4 { font-size: 13px; font-weight: 600; }
h5 { font-size: 12px; font-weight: 600; }

.text-muted  { color: var(--text-muted) !important; }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.fw-500      { font-weight: 500; }
.fw-600      { font-weight: 600; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

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

.btn-success   { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #059669; color:#fff; }

.btn-warning   { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #D97706; color:#fff; }

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

.btn-secondary { background: #fff; color: var(--text-main); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-main); color: var(--text-main); }

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

.btn-sm  { height: 26px; padding: 0 10px; font-size: 12px; }
.btn-lg  { height: 40px; padding: 0 20px; font-size: 14px; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--radius-sm); }
.btn-icon.btn-sm { width: 26px; height: 26px; }

/* ── Form Controls ───────────────────────────────────────── */
.form-control {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  color: var(--text-main);
  background: #fff;
  transition: var(--transition);
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  outline: none;
}
.form-control::placeholder { color: var(--text-light); }
.form-control:disabled { background: var(--bg-main); cursor: not-allowed; }

.form-select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  color: var(--text-main);
  background: #fff;
  cursor: pointer;
  transition: var(--transition);
  appearance: auto;
}
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  outline: none;
}

textarea.form-control {
  height: 80px;
  padding: 8px 10px;
  resize: vertical;
}

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}

.form-group { margin-bottom: 14px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 15px; height: 15px;
  accent-color: var(--primary);
}

.invalid-feedback { font-size: 11px; color: var(--error); margin-top: 3px; }
.form-control.is-invalid { border-color: var(--error); }

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

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: width .22s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-logo {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-logo-text span { display: block; font-weight: 400; font-size: 10px; color: var(--text-sidebar); }
.sidebar.collapsed .sidebar-logo-text { display: none; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.sidebar-section {
  padding: 12px 14px 4px;
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar.collapsed .sidebar-section { opacity: 0; }

.nav-item { position: relative; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 36px;
  color: var(--text-sidebar);
  font-size: 13px;
  font-weight: 400;
  transition: var(--transition);
  white-space: nowrap;
  border-radius: 0;
  text-decoration: none;
}
.nav-link:hover { background: var(--bg-sidebar-hover); color: #fff; }
.nav-link.active {
  background: var(--bg-sidebar-active);
  color: #fff;
  font-weight: 500;
}

.nav-link i {
  font-size: 15px;
  width: 20px;
  flex-shrink: 0;
  text-align: center;
}

.nav-link-text {
  overflow: hidden;
  white-space: nowrap;
}
.sidebar.collapsed .nav-link-text { display: none; }

/* Sidebar accordion */
.sidebar-accordion-header {
  user-select: none;
}
.sidebar-accordion-header:hover {
  color: #fff;
}
.sidebar.collapsed .sidebar-accordion-header .sidebar-accordion-icon,
.sidebar.collapsed .sidebar-accordion-header span {
  display: none;
}
.sidebar-accordion-body {
  overflow: hidden;
  max-height: 500px;
  transition: max-height .25s ease, opacity .2s ease;
  opacity: 1;
}
.sidebar-accordion-body.collapsed {
  max-height: 0;
  opacity: 0;
}
.sidebar.collapsed .sidebar-accordion-body {
  max-height: 0;
  opacity: 0;
}

/* Tooltip on collapsed */
.sidebar.collapsed .nav-link:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-collapsed) + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: #1E293B;
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: nowrap;
  z-index: 200;
  pointer-events: none;
}

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

/* ── Main Content ────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .22s ease;
}
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

/* ── Header ──────────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-toggle {
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
  flex-shrink: 0;
}
.header-toggle:hover { background: var(--bg-main); color: var(--text-main); }

.header-title {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  color: var(--text-main);
}

.header-search {
  position: relative;
}
.header-search input {
  width: 200px;
  padding-left: 30px;
  background: var(--bg-main);
  border-color: var(--bg-main);
}
.header-search input:focus { background: #fff; border-color: var(--primary); width: 260px; }
.header-search i {
  position: absolute;
  left: 9px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 13px;
}

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

.header-notif {
  position: relative;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
  border: none; background: transparent;
}
.header-notif:hover { background: var(--bg-main); color: var(--text-main); }
.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--error);
  border-radius: 50%;
  border: 1.5px solid #fff;
}

.header-user {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: var(--transition);
  border: none; background: transparent;
}
.header-user:hover { background: var(--bg-main); }

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-info { text-align: left; }
.user-info-name { font-size: 12px; font-weight: 600; line-height: 1.2; }
.user-info-role { font-size: 10px; color: var(--text-muted); }

/* ── Page Body ───────────────────────────────────────────── */
.page-body {
  flex: 1;
  padding: 20px;
  overflow-x: hidden;
}

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

.page-header-left h1 { font-size: 18px; }
.page-header-left p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.page-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-header h2, .card-header h3 { font-size: 13px; margin: 0; }

.card-body  { padding: 16px; }
.card-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-main);
}

/* ── KPI Stats Grid ──────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red    { background: var(--error-light); color: var(--error); }
.stat-icon.gray   { background: #F3F4F6; color: var(--text-muted); }

.stat-info-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
.stat-info-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Tables ──────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  position: sticky;
  top: 0;
  background: var(--bg-main);
  z-index: 1;
}

thead th {
  height: 36px;
  padding: 0 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  height: 40px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #F8FAFC; }

tbody td {
  padding: 0 12px;
  vertical-align: middle;
  color: var(--text-main);
}

.td-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  height: 20px;
}
.badge-primary  { background: var(--primary-light); color: var(--primary-dark); }
.badge-success  { background: var(--success-light); color: #065f46; }
.badge-warning  { background: var(--warning-light); color: #92400e; }
.badge-danger   { background: var(--error-light); color: #991b1b; }
.badge-info     { background: var(--info-light); color: #1e40af; }
.badge-secondary{ background: #F3F4F6; color: var(--text-muted); }

/* ── Status dots ──────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 5px;
}
.status-dot.green  { background: var(--success); }
.status-dot.yellow { background: var(--warning); }
.status-dot.red    { background: var(--error); }
.status-dot.blue   { background: var(--primary); }
.status-dot.gray   { background: var(--text-light); }

/* ── Modals ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: scale(.95) translateY(10px);
  transition: transform .18s;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-lg { max-width: 940px; }
.modal-sm { max-width: 480px; }

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 14px; margin: 0; }

.modal-close {
  width: 28px; height: 28px;
  border: none; background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 16px;
  transition: var(--transition);
}
.modal-close:hover { background: var(--bg-main); color: var(--text-main); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Alerts/Messages ─────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}
.alert-success  { background: var(--success-light); color: #065f46; border: 1px solid #A7F3D0; }
.alert-warning  { background: var(--warning-light); color: #92400e; border: 1px solid #FDE68A; }
.alert-danger   { background: var(--error-light); color: #991b1b; border: 1px solid #FECACA; }
.alert-info     { background: var(--info-light); color: #1e40af; border: 1px solid #BFDBFE; }

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.page-item .page-link {
  height: 30px;
  min-width: 30px;
  padding: 0 8px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-main);
  transition: var(--transition);
  text-decoration: none;
}
.page-item .page-link:hover { background: var(--bg-main); }
.page-item.active .page-link,
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-item.disabled .page-link { opacity: .4; pointer-events: none; }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab-btn {
  height: 36px;
  padding: 0 16px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}
.tab-btn:hover { color: var(--text-main); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Folder Grid (Google Drive style) ────────────────────── */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.folder-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-main);
  transition: var(--transition);
  cursor: pointer;
}
.folder-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  color: var(--text-main);
}
.folder-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
}
.folder-card-icon {
  font-size: 28px;
  line-height: 1;
}
.folder-card-name {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  word-break: break-word;
}
.folder-card-count {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── File List (compact rows) ────────────────────────────── */
.file-list {
  display: flex;
  flex-direction: column;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: #F8FAFC; }
.file-row-icon { flex-shrink: 0; }
.file-row-info { flex: 1; min-width: 0; }
.file-row-title {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-row-title:hover { color: var(--primary); }
.file-row-meta {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-row-date {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  display: none;
}
.file-row-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
@media (min-width: 480px) {
  .file-row-date { display: block; }
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 40px; margin-bottom: 12px; opacity: .4; }
.empty-state h3 { font-size: 15px; margin-bottom: 6px; color: var(--text-main); }
.empty-state p { font-size: 13px; }

/* ── Upload Zone ─────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-main);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-zone i { font-size: 30px; color: var(--text-light); margin-bottom: 8px; }
.upload-zone p { font-size: 13px; color: var(--text-muted); }
.upload-zone span { color: var(--primary); font-weight: 500; }

/* ── File type icons ─────────────────────────────────────── */
.file-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 700;
  font-size: 10px;
  flex-shrink: 0;
}
.file-icon.pdf   { background: #FEE2E2; color: #DC2626; }
.file-icon.word  { background: #DBEAFE; color: #2563EB; }
.file-icon.excel { background: #D1FAE5; color: #059669; }
.file-icon.image { background: #FEF3C7; color: #D97706; }
.file-icon.other { background: #F3F4F6; color: var(--text-muted); }

/* ── Dropdown ────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  right: 0; top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 200;
  overflow: hidden;
  display: none;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  text-decoration: none;
}
.dropdown-item:hover { background: var(--bg-main); }
.dropdown-item.danger { color: var(--error); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { opacity: .4; }
.breadcrumb .current { color: var(--text-main); font-weight: 500; }

/* ── Mobile sidebar overlay ─────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}
.sidebar-backdrop.show { display: block; }

/* ── Order Cards (mobile) ───────────────────────────────── */
.order-cards-mobile {
  display: none;
}
.order-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin: 0 12px 12px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.order-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-main);
  border-bottom: 1px solid var(--border);
}
.order-card-id {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .03em;
  color: var(--primary);
  text-decoration: none;
}
.order-card-body {
  padding: 8px 14px;
}
.order-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}
.order-card-row:last-child { border-bottom: none; }
.order-card-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  flex-shrink: 0;
}
.order-card-value {
  text-align: right;
  font-weight: 500;
  margin-left: 12px;
}
.order-card-actions {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-main);
}

/* Desktop table: horizontal scroll only when needed */
.table-responsive-lg {
  overflow-x: auto;
}

@media (max-width: 768px) {
  .order-table-desktop { display: none; }
  .order-cards-mobile { display: block; }
  .table-responsive-lg { overflow-x: visible; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px !important;
    z-index: 100;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.mobile-open .nav-link-text,
  .sidebar.mobile-open .sidebar-logo-text,
  .sidebar.mobile-open .sidebar-section { display: flex !important; }
  .main-content { margin-left: 0 !important; }
  .header-search { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-body { padding: 12px; overflow-x: hidden; }
  .form-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header-actions { justify-content: stretch; }
  .page-header-actions .btn { flex: 1; text-align: center; }

  /* Single column on mobile */
  .docs-layout,
  .dashboard-grid { grid-template-columns: 1fr !important; }
  .docs-folders { order: 2; }
  .docs-folders .card-header { cursor: pointer; }

  /* Cards on mobile */
  .table-card-wrap,
  .table-card-wrap table,
  .table-card-wrap thead,
  .table-card-wrap tbody,
  .table-card-wrap th,
  .table-card-wrap td,
  .table-card-wrap tr {
    display: block;
  }
  .table-card-wrap thead { display: none; }
  .table-card-wrap { border: none !important; overflow: visible !important; }
  .table-card-wrap tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    padding: 12px;
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
    height: auto;
    position: relative;
  }
  .table-card-wrap tr:last-child { margin-bottom: 0; }
  .table-card-wrap tr:hover { background: #fff; }
  .table-card-wrap td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border: none;
    height: auto;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
  }
  .table-card-wrap td:last-child { border-bottom: none; }
  .table-card-wrap td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .03em;
    flex-shrink: 0;
    margin-right: 10px;
  }
  .table-card-wrap .td-actions { justify-content: flex-end; gap: 6px; }
  .table-card-wrap .td-actions .btn { font-size: 12px; height: 30px; padding: 0 10px; }
  .table-card-wrap td .status-pill,
  .table-card-wrap td .badge {
    font-size: 11px;
    padding: 2px 8px;
  }
  .table-card-wrap td .truncate { max-width: 50vw !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 17px; }
  .page-body { padding: 10px; }
  .header-user .user-info { display: none; }
}

/* ── Utilities ───────────────────────────────────────────── */
.d-flex    { display: flex; }
.d-grid    { display: grid; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-0 { padding: 0 !important; }
.w-100 { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Scrollbar global ────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }
