/* Gestion Documental - estilo violeta organizaria */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f8fafc;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.45;
}
a { color: #6366f1; text-decoration: none; }
a:hover { text-decoration: underline; }

.demo-bar {
  background: #fef3c7;
  color: #78350f;
  border-bottom: 1px solid #fcd34d;
  padding: 6px 14px;
  font-size: 12px;
  text-align: center;
  font-weight: 600;
}

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
  color: #e0e7ff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, #818cf8, #6366f1);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 8px rgba(99,102,241,0.35);
  letter-spacing: -0.5px;
}
.brand-title { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.1; }
.brand-sub { font-size: 11px; opacity: .65; }

.nav { padding: 12px 8px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 13.5px;
  margin-bottom: 2px;
  font-weight: 500;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(99,102,241,0.25); color: #fff; }
.nav-ico { width: 16px; height: 16px; opacity: .85; display: flex; }
.nav-ico svg { width: 16px; height: 16px; }

.sb-storage {
  margin: 8px 10px;
  padding: 10px 11px;
  background: rgba(255,255,255,0.05);
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.06);
}
.sb-storage-head { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #cbd5e1; margin-bottom: 6px; }
.sb-storage-pct { margin-left: auto; font-weight: 600; color: #c7d2fe; }
.sb-storage-bar { height: 5px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; }
.sb-storage-fill { height: 100%; background: linear-gradient(90deg, #818cf8, #6366f1); }
.sb-storage-vals { font-size: 10.5px; color: #94a3b8; margin-top: 4px; }

.sb-user {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sb-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #818cf8, #6366f1);
  color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name { font-size: 12.5px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-creds { font-size: 11px; color: #a5b4fc; }
.sb-user-logout { color: #c7d2fe; display: flex; padding: 6px; border-radius: 6px; }
.sb-user-logout:hover { background: rgba(255,255,255,0.06); }

/* ===== Content ===== */
.content { padding: 24px 32px; max-width: 1400px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 22px; flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 22px; font-weight: 700; color: #0f172a; margin: 0; }
.page-sub { font-size: 13px; color: #64748b; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: #fff;
  color: #334155;
  border-color: #e2e8f0;
  transition: all .12s ease;
  text-decoration: none;
}
.btn:hover { background: #f8fafc; text-decoration: none; }
.btn-primary { background: #6366f1; color: #fff; border-color: #6366f1; }
.btn-primary:hover { background: #4f46e5; color: #fff; }
.btn-danger { background: #fff; color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 5px 9px; font-size: 12px; }

.card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.card-pad { padding: 18px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; align-items: center; }
.card-title { font-size: 14px; font-weight: 600; margin: 0; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: #fff;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}
.kpi-label { font-size: 11.5px; color: #64748b; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi-value { font-size: 28px; font-weight: 700; color: #0f172a; margin-top: 4px; }
.kpi-sub { font-size: 11.5px; color: #94a3b8; margin-top: 2px; }
.kpi-accent { background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; border: 0; }
.kpi-accent .kpi-label, .kpi-accent .kpi-value, .kpi-accent .kpi-sub { color: #fff; }
.kpi-accent .kpi-label { opacity: .85; }
.kpi-accent .kpi-sub { opacity: .75; }
.kpi-warn { border-left: 4px solid #f59e0b; }
.kpi-danger { border-left: 4px solid #ef4444; }
.kpi-ok { border-left: 4px solid #10b981; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 920px) { .grid-2 { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
th { font-weight: 600; color: #475569; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; background: #f8fafc; }
tbody tr:hover { background: #fafbff; }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  padding: 8px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 4px; }
.field { margin-bottom: 13px; }
.field-row { display: grid; gap: 12px; }
.field-row.cols-2 { grid-template-columns: 1fr 1fr; }
.field-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.field-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
@media (max-width: 700px) { .field-row.cols-2, .field-row.cols-3, .field-row.cols-4 { grid-template-columns: 1fr; } }

.category-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}
.tag-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
}

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=text], .toolbar select { max-width: 240px; }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 90;
}
.modal-overlay.active { display: flex; }
.modal {
  background: #fff;
  width: min(560px, 92vw);
  border-radius: 14px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
  max-height: 88vh;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex; justify-content: space-between; align-items: center;
}
.modal-title { font-size: 16px; font-weight: 700; margin: 0; }
.modal-x { cursor: pointer; padding: 4px; color: #64748b; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid #f1f5f9;
  display: flex; justify-content: flex-end; gap: 8px;
  background: #f8fafc;
}

.empty {
  text-align: center;
  padding: 40px 20px;
  color: #64748b;
  font-size: 13px;
}
.empty-icon { font-size: 36px; opacity: .35; margin-bottom: 6px; }

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 18px;
  gap: 2px;
  overflow-x: auto;
}
.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active { color: #4f46e5; border-bottom-color: #6366f1; }
.tab:hover { color: #0f172a; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Login */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 30px 20px;
  background: linear-gradient(135deg, #ede9fe 0%, #f3f4f6 100%);
}
.login-card {
  background: #fff;
  width: min(420px, 100%);
  padding: 32px;
  border-radius: 16px;
  box-shadow: 0 20px 40px -12px rgba(99,102,241,.20);
  border: 1px solid #e2e8f0;
}
.login-brand {
  text-align: center; margin-bottom: 22px;
}
.login-brand .mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #818cf8, #6366f1);
  color: #fff; font-weight: 800; font-size: 20px;
  margin-bottom: 12px;
  box-shadow: 0 8px 16px rgba(99,102,241,.30);
}
.login-brand h1 { font-size: 19px; margin: 0; color: #0f172a; font-weight: 700; }
.login-brand .sub { font-size: 12.5px; color: #64748b; margin-top: 2px; }
.login-creds {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 12px;
  color: #475569;
  margin-top: 14px;
  text-align: center;
}
.login-creds code { background: #fff; padding: 1px 6px; border-radius: 4px; border: 1px solid #e2e8f0; }

.error-box {
  background: #fee2e2; color: #991b1b; padding: 9px 12px; border-radius: 7px;
  font-size: 12.5px; margin-bottom: 12px; border: 1px solid #fecaca;
}
.success-box {
  background: #dcfce7; color: #166534; padding: 9px 12px; border-radius: 7px;
  font-size: 12.5px; margin-bottom: 12px; border: 1px solid #bbf7d0;
}

/* Doc row */
.doc-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #f1f5f9; }
.doc-row:hover { background: #fafbff; }
.doc-ico {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: #ede9fe;
  color: #6366f1;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-weight: 600; font-size: 13px; color: #0f172a; }
.doc-meta { font-size: 11.5px; color: #64748b; margin-top: 2px; }
.doc-actions { display: flex; gap: 6px; }

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid #c7d2fe; border-top-color: #4f46e5; border-radius: 50%; animation: spin .8s linear infinite; }
