:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #111827;
  --primary-soft: #eef2ff;
  --accent: #5b67f1;
  --success: #15803d;
  --success-soft: #ecfdf3;
  --warning: #b45309;
  --warning-soft: #fff7ed;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --shadow: 0 12px 30px rgba(15, 23, 42, .06);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; background: #111827; color: #d1d5db; display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; gap: 12px; align-items: center; padding: 26px 22px; color: #fff; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 13px; background: linear-gradient(145deg,#6475ff,#8b5cf6); color: #fff; font-weight: 800; box-shadow: 0 8px 20px rgba(99,102,241,.35); }
.brand-mark.large { width: 58px; height: 58px; font-size: 24px; margin: 0 auto; }
.brand strong { display:block; letter-spacing:.13em; font-size:14px; }
.brand span { display:block; color:#8f99a8; font-size:11px; margin-top:3px; }
.nav-list { display:flex; flex-direction:column; gap:5px; padding:8px 14px; overflow:auto; }
.nav-label { padding:22px 12px 6px; color:#667085; text-transform:uppercase; font-size:10px; letter-spacing:.13em; font-weight:700; }
.nav-item { display:flex; align-items:center; gap:12px; min-height:45px; padding:0 13px; border-radius:12px; color:#aeb7c5; font-weight:600; font-size:14px; transition:.2s ease; }
.nav-item span { width:21px; text-align:center; font-size:18px; }
.nav-item:hover { color:#fff; background:rgba(255,255,255,.06); }
.nav-item.active { color:#fff; background:rgba(99,102,241,.24); box-shadow:inset 3px 0 #818cf8; }
.sidebar-user { margin-top:auto; padding:17px; border-top:1px solid rgba(255,255,255,.08); display:grid; grid-template-columns:38px 1fr 30px; gap:10px; align-items:center; }
.sidebar-user .avatar, .top-avatar { width:38px; height:38px; border-radius:50%; background:#303a4b; color:#fff; display:grid; place-items:center; font-weight:800; }
.sidebar-user strong { display:block; color:#fff; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sidebar-user span { color:#7f8a99; font-size:11px; text-transform:capitalize; }
.logout-link { color:#8792a1; font-size:20px; text-align:center; }

.main-content { margin-left:250px; min-height:100vh; }
.topbar { height:76px; position:sticky; top:0; z-index:20; padding:0 30px; background:rgba(244,246,248,.9); backdrop-filter:blur(14px); display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid rgba(229,231,235,.75); }
.topbar-title { font-weight:750; font-size:18px; }
.topbar-actions { display:flex; gap:12px; align-items:center; }
.page-content { padding:28px 30px 50px; max-width:1600px; margin:auto; }

.page-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-bottom:24px; }
.page-heading h1 { margin:0 0 5px; font-size:28px; letter-spacing:-.035em; }
.page-heading p { margin:0; color:var(--muted); }
.heading-actions { display:flex; gap:10px; flex-wrap:wrap; }

.button { min-height:42px; padding:0 16px; border:1px solid transparent; border-radius:12px; display:inline-flex; align-items:center; justify-content:center; gap:8px; font-weight:700; font-size:14px; transition:.18s ease; background:var(--surface); color:var(--text); }
.button:hover { transform:translateY(-1px); box-shadow:0 7px 18px rgba(15,23,42,.08); }
.button-primary { background:var(--primary); color:#fff; }
.button-secondary { border-color:var(--line); }
.button-soft { background:var(--primary-soft); color:#4338ca; }
.button-danger { background:var(--danger-soft); color:var(--danger); }
.button-small { min-height:36px; padding:0 12px; font-size:12px; border-radius:10px; }
.button-block { width:100%; }
.icon-button { width:39px; height:39px; border:1px solid var(--line); border-radius:11px; background:#fff; display:grid; place-items:center; color:var(--text); }
.icon-button.danger { color:var(--danger); background:var(--danger-soft); border-color:#fecaca; }

.alert { display:flex; justify-content:space-between; gap:14px; align-items:center; padding:13px 16px; border-radius:13px; margin-bottom:18px; border:1px solid; transition:.3s ease; }
.alert button { border:0; background:transparent; font-size:20px; }
.alert-success { background:var(--success-soft); border-color:#bbf7d0; color:#166534; }
.alert-error { background:var(--danger-soft); border-color:#fecaca; color:#991b1b; }
.alert-warning { background:var(--warning-soft); border-color:#fed7aa; color:#9a3412; }
.alert-info { background:#eff6ff; border-color:#bfdbfe; color:#1d4ed8; }
.alert-hide { opacity:0; transform:translateY(-8px); pointer-events:none; }

.stats-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; margin-bottom:24px; }
.stat-card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:20px; box-shadow:var(--shadow); }
.stat-card .stat-top { display:flex; justify-content:space-between; color:var(--muted); font-size:13px; }
.stat-card strong { display:block; margin-top:12px; font-size:30px; letter-spacing:-.04em; }
.stat-card small { display:block; margin-top:4px; color:var(--muted); }
.stat-icon { width:38px; height:38px; border-radius:12px; display:grid; place-items:center; background:var(--surface-soft); font-size:18px; }

.card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); }
.card-header { padding:19px 20px; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; gap:14px; }
.card-header h2, .card-header h3 { margin:0; font-size:16px; }
.card-body { padding:20px; }
.card-footer { padding:15px 20px; border-top:1px solid var(--line); background:var(--surface-soft); border-radius:0 0 var(--radius) var(--radius); }

.board { display:grid; grid-template-columns:repeat(3,minmax(290px,1fr)); gap:18px; align-items:start; }
.board-column { min-width:0; }
.board-column-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:11px; padding:0 3px; }
.board-column-head h2 { margin:0; font-size:14px; }
.board-count { min-width:26px; height:26px; border-radius:9px; background:#e5e7eb; display:grid; place-items:center; font-size:12px; font-weight:800; }
.board-list { display:flex; flex-direction:column; gap:12px; min-height:120px; }
.project-card { background:var(--surface); border:1px solid var(--line); border-radius:16px; padding:16px; box-shadow:0 7px 18px rgba(15,23,42,.04); transition:.2s ease; position:relative; overflow:hidden; }
.project-card:before { content:""; position:absolute; inset:0 auto 0 0; width:3px; background:#cbd5e1; }
.project-card[data-priority="alta"]:before { background:#f59e0b; }
.project-card[data-priority="urgente"]:before { background:#ef4444; }
.project-card:hover { transform:translateY(-2px); border-color:#cbd5e1; box-shadow:0 13px 28px rgba(15,23,42,.08); }
.project-card-top { display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.category-chip { display:inline-flex; gap:6px; align-items:center; color:#667085; font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; }
.project-card h3 { margin:10px 0 3px; font-size:16px; line-height:1.3; }
.project-card .client { color:var(--muted); font-size:13px; }
.project-meta { display:grid; gap:7px; margin-top:14px; font-size:12px; color:#596273; }
.project-meta-row { display:flex; justify-content:space-between; gap:12px; }
.project-meta-row strong { color:#374151; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.progress-track { height:6px; background:#edf0f4; border-radius:99px; overflow:hidden; margin-top:15px; }
.progress-bar { height:100%; background:linear-gradient(90deg,#6366f1,#8b5cf6); border-radius:99px; transition:.25s ease; }
.project-card-footer { display:flex; justify-content:space-between; align-items:center; margin-top:10px; color:var(--muted); font-size:11px; }
.assignee-dots { display:flex; align-items:center; }
.assignee-dot { width:25px; height:25px; border-radius:50%; border:2px solid #fff; background:#e0e7ff; display:grid; place-items:center; margin-left:-5px; font-size:9px; font-weight:800; color:#4338ca; }

.status, .priority { display:inline-flex; align-items:center; min-height:25px; padding:0 9px; border-radius:99px; font-size:11px; font-weight:800; }
.status-start { color:#475569; background:#f1f5f9; }
.status-process { color:#92400e; background:#fef3c7; }
.status-done { color:#166534; background:#dcfce7; }
.priority-normal { color:#475569; background:#f1f5f9; }
.priority-baja { color:#0369a1; background:#e0f2fe; }
.priority-alta { color:#9a3412; background:#ffedd5; }
.priority-urgente { color:#991b1b; background:#fee2e2; }

.filters { background:var(--surface); border:1px solid var(--line); border-radius:16px; padding:14px; display:grid; grid-template-columns:minmax(220px,2fr) repeat(3,minmax(140px,1fr)) auto; gap:10px; margin-bottom:20px; }
.search-input { position:relative; }
.search-input input { padding-left:39px; }
.search-input:before { content:'⌕'; position:absolute; left:14px; top:50%; transform:translateY(-52%); color:var(--muted); font-size:19px; }

.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:17px; }
.form-grid.cols-3 { grid-template-columns:repeat(3,minmax(0,1fr)); }
.field { min-width:0; }
.field.full { grid-column:1/-1; }
.field label { display:block; font-size:12px; font-weight:800; color:#4b5563; margin:0 0 7px; }
.field small { display:block; color:var(--muted); margin-top:6px; font-size:11px; }
input, select, textarea { width:100%; border:1px solid #dce1e8; border-radius:11px; background:#fff; color:var(--text); min-height:43px; padding:9px 12px; outline:none; transition:.18s ease; }
textarea { min-height:105px; resize:vertical; }
input:focus, select:focus, textarea:focus { border-color:#818cf8; box-shadow:0 0 0 4px rgba(99,102,241,.11); }
.form-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }
.checkbox-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.checkbox-card { border:1px solid var(--line); border-radius:12px; padding:11px; display:flex; align-items:center; gap:9px; }
.checkbox-card input { width:17px; min-height:auto; }
.file-drop { border:1.5px dashed #cbd5e1; border-radius:14px; padding:18px; background:#fafcff; text-align:center; position:relative; transition:.2s ease; }
.file-drop.dragging { border-color:#6366f1; background:#eef2ff; }
.file-drop input { position:absolute; inset:0; opacity:0; cursor:pointer; }
.file-drop strong { display:block; margin-bottom:3px; }
.file-drop span { color:var(--muted); font-size:12px; }

.detail-grid { display:grid; grid-template-columns:minmax(0,1.7fr) minmax(310px,.8fr); gap:20px; align-items:start; }
.project-hero { padding:23px; }
.hero-top { display:flex; justify-content:space-between; gap:20px; align-items:flex-start; }
.hero-title h1 { margin:7px 0 4px; font-size:27px; letter-spacing:-.035em; }
.hero-title p { margin:0; color:var(--muted); }
.hero-badges { display:flex; gap:7px; flex-wrap:wrap; margin-top:13px; }
.hero-actions { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.info-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-top:21px; }
.info-item { padding:12px; border-radius:12px; background:var(--surface-soft); min-width:0; }
.info-item span { display:block; font-size:10px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); font-weight:800; }
.info-item strong, .info-item a { display:block; margin-top:5px; font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.process-list { display:flex; flex-direction:column; gap:10px; }
.process-step { border:1px solid var(--line); border-radius:14px; padding:14px; display:grid; grid-template-columns:30px 1fr auto; gap:12px; align-items:center; transition:.2s ease; }
.process-step.completed { background:#f7fdf9; border-color:#bbf7d0; }
.process-step.loading { opacity:.65; }
.step-check { width:24px; height:24px; min-height:auto; accent-color:#16a34a; }
.step-copy strong { display:block; font-size:13px; }
.step-copy span { display:block; margin-top:3px; color:var(--muted); font-size:11px; }
.step-user { text-align:right; font-size:10px; color:var(--muted); max-width:130px; }

.timeline { position:relative; display:flex; flex-direction:column; gap:16px; }
.timeline:before { content:""; position:absolute; left:9px; top:7px; bottom:7px; width:1px; background:var(--line); }
.timeline-item { display:grid; grid-template-columns:20px 1fr; gap:12px; position:relative; }
.timeline-dot { width:19px; height:19px; border:5px solid #eef2ff; border-radius:50%; background:#6366f1; z-index:1; }
.timeline-copy strong { font-size:12px; }
.timeline-copy p { margin:4px 0; font-size:12px; color:#4b5563; line-height:1.5; white-space:pre-wrap; }
.timeline-copy small { color:var(--muted); font-size:10px; }

.note { padding:13px; border:1px solid var(--line); border-radius:13px; background:#fff; }
.note + .note { margin-top:9px; }
.note-head { display:flex; justify-content:space-between; gap:12px; color:var(--muted); font-size:10px; }
.note p { margin:8px 0 0; white-space:pre-wrap; font-size:13px; line-height:1.5; }

.table-wrap { overflow:auto; }
table { width:100%; border-collapse:collapse; }
th, td { padding:13px 14px; border-bottom:1px solid var(--line); text-align:left; font-size:12px; white-space:nowrap; }
th { color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:.07em; background:#fafafa; }
tbody tr:hover { background:#fafbfc; }
.table-actions { display:flex; gap:6px; justify-content:flex-end; }
.empty-state { text-align:center; padding:42px 20px; color:var(--muted); }
.empty-state .empty-icon { width:52px; height:52px; margin:0 auto 12px; border-radius:16px; background:#f1f5f9; display:grid; place-items:center; font-size:22px; }
.empty-state h3 { color:var(--text); margin:0 0 6px; }
.empty-state p { margin:0 0 18px; }
.pagination { display:flex; justify-content:center; gap:7px; margin-top:20px; }
.page-link { min-width:38px; height:38px; display:grid; place-items:center; border:1px solid var(--line); background:#fff; border-radius:11px; font-size:12px; font-weight:800; }
.page-link.active { background:var(--primary); color:#fff; border-color:var(--primary); }

.split { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.stack { display:flex; flex-direction:column; gap:16px; }
.inline-form { display:flex; gap:9px; align-items:end; }
.inline-form > .field { flex:1; }
.muted { color:var(--muted); }
.text-danger { color:var(--danger); }
.text-success { color:var(--success); }
.text-small { font-size:12px; }
.divider { height:1px; background:var(--line); margin:18px 0; }

.step-editor-row { display:grid; grid-template-columns:24px minmax(150px,1fr) minmax(170px,1.4fr) minmax(140px,.7fr) 100px 116px; gap:9px; align-items:end; padding:12px; border:1px solid var(--line); border-radius:14px; background:#fff; }
.step-editor-row + .step-editor-row { margin-top:9px; }
.drag-handle { color:#9ca3af; align-self:center; }
.step-row-actions { display:flex; gap:4px; align-items:center; }
.step-row-actions .icon-button { width:34px; height:34px; }
.switch-field { min-height:43px; display:flex; align-items:center; gap:7px; font-size:11px; font-weight:700; }
.switch-field input { width:17px; min-height:auto; }
.grow { min-width:0; }

.auth-body { min-height:100vh; display:grid; place-items:center; background:radial-gradient(circle at 20% 20%,#eef2ff,transparent 35%),radial-gradient(circle at 80% 80%,#f3e8ff,transparent 35%),#f8fafc; padding:20px; }
.auth-card { width:min(430px,100%); background:#fff; border:1px solid var(--line); border-radius:24px; box-shadow:0 25px 70px rgba(15,23,42,.11); padding:31px; }
.auth-brand { text-align:center; margin-bottom:27px; }
.auth-brand .brand-mark { margin:0 auto 13px; }
.auth-brand h1 { margin:0; font-size:22px; letter-spacing:.12em; }
.auth-brand p { margin:6px 0 0; color:var(--muted); font-size:12px; }
.auth-card .field + .field { margin-top:14px; }
.auth-footer { margin-top:18px; text-align:center; color:var(--muted); font-size:11px; }
.error-card { width:min(470px,100%); text-align:center; background:#fff; border:1px solid var(--line); border-radius:24px; padding:34px; box-shadow:var(--shadow); }
.error-code { font-size:12px; color:var(--muted); margin-top:16px; }
.error-card h1 { margin:6px 0; }
.error-card p { color:var(--muted); margin:0 0 20px; }

.install-shell { width:min(900px,100%); margin:40px auto; padding:20px; }
.install-hero { text-align:center; margin-bottom:25px; }
.install-steps { display:grid; grid-template-columns:repeat(3,1fr); gap:13px; margin-bottom:20px; }
.install-step { padding:15px; border:1px solid var(--line); border-radius:14px; background:#fff; }
.install-step strong { display:block; font-size:12px; }
.install-step span { color:var(--muted); font-size:11px; }

.mobile-only { display:none; }
.sidebar-overlay { display:none; }
@media (max-width: 1180px) {
  .stats-grid { grid-template-columns:repeat(2,1fr); }
  .board { grid-template-columns:1fr; }
  .board-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .detail-grid { grid-template-columns:1fr; }
  .filters { grid-template-columns:1fr 1fr 1fr; }
  .filters .search-input { grid-column:1/-1; }
  .step-editor-row { grid-template-columns:20px 1fr 1fr; }
  .step-editor-row > :nth-child(n+5) { grid-column:auto; }
}
@media (max-width: 820px) {
  .mobile-only { display:grid; }
  .sidebar { transform:translateX(-105%); transition:.25s ease; box-shadow:20px 0 45px rgba(15,23,42,.2); }
  .sidebar-open .sidebar { transform:translateX(0); }
  .sidebar-overlay { position:fixed; inset:0; background:rgba(15,23,42,.45); z-index:25; }
  .sidebar-open .sidebar-overlay { display:block; }
  .main-content { margin-left:0; }
  .topbar { padding:0 17px; height:66px; }
  .topbar-title { display:none; }
  .topbar-actions .button { display:none; }
  .page-content { padding:20px 15px 40px; }
  .page-heading { align-items:flex-start; flex-direction:column; }
  .page-heading h1 { font-size:24px; }
  .stats-grid { grid-template-columns:1fr 1fr; gap:10px; }
  .stat-card { padding:15px; }
  .stat-card strong { font-size:24px; }
  .board-list { grid-template-columns:1fr; }
  .filters { grid-template-columns:1fr; }
  .filters .search-input { grid-column:auto; }
  .form-grid, .form-grid.cols-3, .split { grid-template-columns:1fr; }
  .checkbox-grid { grid-template-columns:1fr 1fr; }
  .info-grid { grid-template-columns:1fr 1fr; }
  .hero-top { flex-direction:column; }
  .hero-actions { justify-content:flex-start; }
  .step-editor-row { grid-template-columns:1fr; }
  .drag-handle { display:none; }
  .install-steps { grid-template-columns:1fr; }
}
@media (max-width: 500px) {
  .stats-grid { grid-template-columns:1fr; }
  .checkbox-grid, .info-grid { grid-template-columns:1fr; }
  .auth-card { padding:24px 20px; }
  .process-step { grid-template-columns:28px 1fr; }
  .step-user { grid-column:2; text-align:left; max-width:none; }
}
