/* ==================================================================
   DIGITAL SCJ · Portal de Proyectos
   Sistema de diseño basado en digitalscj.com
   ================================================================== */
:root {
    --primary: #00509e;
    --primary-600: #003f7d;
    --primary-50: #eaf3fc;
    --secondary: #00b4d8;
    --secondary-50: #e6f8fc;
    --grad: linear-gradient(135deg, #00509e 0%, #00b4d8 100%);
    --grad-soft: linear-gradient(135deg, rgba(0,80,158,.08), rgba(0,180,216,.08));

    --ink: #0f172a;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e9f0;
    --bg: #f4f7fb;
    --card: #ffffff;

    --success: #10b981; --success-50: #ecfdf5;
    --warning: #f59e0b; --warning-50: #fffbeb;
    --danger: #ef4444;  --danger-50: #fef2f2;
    --purple: #8b5cf6;

    --r-sm: 10px; --r: 14px; --r-lg: 20px; --r-xl: 28px;
    --sh-sm: 0 1px 2px rgba(15,23,42,.05);
    --sh: 0 4px 20px -4px rgba(0,80,158,.10), 0 2px 6px -2px rgba(15,23,42,.05);
    --sh-lg: 0 20px 50px -12px rgba(0,80,158,.25);
    --ease: cubic-bezier(.2,.8,.2,1);
    --sidebar: 268px;
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--secondary); }
h1, h2, h3 { color: var(--ink); letter-spacing: -.02em; line-height: 1.2; margin: 0; }
p { margin: 0; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }
::selection { background: rgba(0,180,216,.25); }

/* ------------------------------ Iconos ----------------------------- */
.ic { width: 20px; height: 20px; flex-shrink: 0; }
.ic-sm { width: 16px; height: 16px; flex-shrink: 0; }
.ic-xs { width: 13px; height: 13px; flex-shrink: 0; vertical-align: -2px; }

/* ------------------------------ Botones ---------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 22px; border-radius: 999px; border: 0; cursor: pointer;
    font: 600 14px/1 inherit; font-family: inherit; white-space: nowrap;
    transition: transform .2s var(--ease), box-shadow .2s, background .2s, color .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px -6px rgba(0,80,158,.5); }
.btn-primary:hover { background: var(--secondary); color: #fff; box-shadow: 0 10px 24px -6px rgba(0,180,216,.6); transform: translateY(-1px); }
.btn-ghost { background: #fff; color: var(--primary); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-block { width: 100%; padding: 14px; font-size: 15px; }
.btn-round { width: 46px; height: 46px; padding: 0; border-radius: 50%; }
.btn[disabled] { opacity: .6; pointer-events: none; }

.icon-btn {
    display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
    background: transparent; border: 0; color: var(--muted); cursor: pointer; transition: all .2s; position: relative;
}
.icon-btn:hover { background: var(--primary-50); color: var(--primary); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn.danger:hover { background: var(--danger-50); color: var(--danger); }
.link-btn { background: none; border: 0; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.link-btn:hover { color: var(--secondary); }
.link-arrow { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 14px; }
.link-arrow:hover .ic-sm { transform: translateX(3px); }
.link-arrow .ic-sm { transition: transform .2s; }

/* ------------------------------ Formularios ------------------------ */
.form { display: flex; flex-direction: column; gap: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.col-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 13px; font-weight: 600; color: #374151; display: flex; justify-content: space-between; }
.field-link { font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=date], input[type=search], input:not([type]), select, textarea {
    width: 100%; padding: 12px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line);
    background: #fff; color: var(--text); font: 15px/1.4 inherit; font-family: inherit; transition: border .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 44px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(0,80,158,.12); }
.input-icon { position: relative; }
.input-icon .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #9ca3af; pointer-events: none; }
.input-icon input { padding-left: 44px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: #374151; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); margin-top: 1px; flex-shrink: 0; }
input[type=range] { width: 100%; accent-color: var(--primary); }
.select-sm { width: auto; padding: 7px 30px 7px 12px; font-size: 13px; border-radius: 999px; font-weight: 500; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }

/* ------------------------------ Alertas ---------------------------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 13px 16px; border-radius: var(--r-sm); font-size: 14px; margin-bottom: 16px; border: 1px solid; animation: slideDown .35s var(--ease); }
.alert .ic { width: 18px; height: 18px; margin-top: 1px; }
.alert-success { background: var(--success-50); border-color: #a7f3d0; color: #065f46; }
.alert-error { background: var(--danger-50); border-color: #fecaca; color: #991b1b; }
.alert-info { background: var(--primary-50); border-color: #bfdbfe; color: var(--primary-600); }
.alert span { word-break: break-word; }

/* ================================================================
   AUTH
   ================================================================ */
body.auth { background: #fff; }
.auth-grid { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-hero { position: relative; overflow: hidden; background: var(--grad); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; }
.auth-hero::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.12) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(to bottom, #000, transparent 85%); }
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero-body { margin: auto 0; max-width: 480px; padding: 40px 0; }
.auth-hero h2 { color: #fff; font-size: clamp(30px, 3.4vw, 46px); font-weight: 800; margin-bottom: 18px; }
.auth-hero p { color: rgba(255,255,255,.85); font-size: 17px; margin-bottom: 30px; }
.grad-text-light { background: linear-gradient(90deg, #fff, #b8f1ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.auth-features li { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.auth-features .ic { width: 36px; height: 36px; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.15); backdrop-filter: blur(6px); }
.auth-mock { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(14px); border-radius: var(--r-lg); padding: 20px; display: grid; gap: 14px; max-width: 380px; animation: float 6s ease-in-out infinite; }
.mock-row { display: flex; gap: 8px; align-items: center; }
.mock-dot { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.5); }
.mock-line { height: 10px; border-radius: 6px; background: rgba(255,255,255,.4); }
.w60 { width: 60%; }
.mock-bar { height: 8px; border-radius: 6px; background: rgba(255,255,255,.2); overflow: hidden; }
.mock-bar span { display: block; height: 100%; background: #fff; border-radius: 6px; animation: grow 2.5s var(--ease); }
.mock-chip { font-size: 11px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.15); }
.mock-chip.active { background: #fff; color: var(--primary); }

.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; background: linear-gradient(180deg, #fff, #f7f9fc); }
.auth-card { width: 100%; max-width: 420px; animation: fadeUp .5s var(--ease); }
.eyebrow { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--secondary); margin-bottom: 10px; }
.eyebrow.light { color: rgba(255,255,255,.8); }
.auth-title { font-size: 32px; font-weight: 800; margin-bottom: 8px; }
.auth-sub { color: var(--muted); margin-bottom: 28px; }
.auth-note { margin-top: 24px; text-align: center; color: var(--muted); font-size: 14px; }
.auth-foot { margin-top: 40px; font-size: 13px; color: #9ca3af; }

.blob { position: absolute; width: 340px; height: 340px; border-radius: 50%; filter: blur(60px); opacity: .45; animation: blob 12s infinite ease-in-out; z-index: 0 !important; }
.blob.b1 { background: #00b4d8; top: -80px; right: -60px; }
.blob.b2 { background: #7c3aed; bottom: -120px; left: -80px; opacity: .3; animation-delay: -4s; }
.blob.b3 { background: #38bdf8; top: 40%; right: 20%; width: 220px; height: 220px; animation-delay: -8s; }

/* ------------------------------ Marca ------------------------------ */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 44px; height: 44px; border-radius: 12px; box-shadow: var(--sh); transition: transform .3s var(--ease); object-fit: cover; background: #fff; }
.brand:hover .brand-logo { transform: scale(1.06) rotate(-3deg); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-text strong { font-size: 19px; font-weight: 800; color: var(--primary); letter-spacing: -.03em; transition: color .2s; }
.brand:hover .brand-text strong { color: var(--secondary); }
.brand-text small { font-size: 9.5px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--secondary); margin-top: 5px; }
.brand-light .brand-text strong, .brand-light:hover .brand-text strong { color: #fff; }
.brand-light .brand-text small { color: rgba(255,255,255,.8); }

/* ================================================================
   APP LAYOUT
   ================================================================ */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: #fff; border-right: 1px solid var(--line);
    display: flex; flex-direction: column; padding: 22px 16px; z-index: 50; transition: transform .3s var(--ease);
}
.sidebar .brand { padding: 4px 8px 26px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-link {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
    color: #4b5563; font-weight: 500; position: relative; transition: all .2s;
}
.side-link:hover { background: var(--bg); color: var(--primary); }
.side-link.is-active { background: var(--grad-soft); color: var(--primary); font-weight: 600; }
.side-link.is-active::before { content: ''; position: absolute; left: -16px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--grad); }
.side-link.is-active .ic { color: var(--primary); }
.pill-count { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--secondary); color: #fff; display: inline-grid; place-items: center; }
.pill-count.warn { background: var(--warning); }
.pill-count.muted { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.tab .pill-count { margin-left: 6px; }

.side-card { margin-top: auto; position: relative; overflow: hidden; border-radius: var(--r); padding: 18px; background: var(--grad); color: #fff; }
.side-card-glow { position: absolute; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.2); right: -40px; top: -40px; filter: blur(10px); }
.side-card-title { font-weight: 700; margin-bottom: 4px; position: relative; }
.side-card-text { font-size: 13px; opacity: .9; position: relative; }
.side-card a { color: #fff; text-decoration: underline; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 16px 6px 0; margin-top: 16px; border-top: 1px solid var(--line); }
.side-user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side-user-info strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.side-user-info small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .icon-btn { width: 34px; height: 34px; }

.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px;
    padding: 16px 36px; background: rgba(244,247,251,.82); backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid transparent; transition: border .2s, box-shadow .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); box-shadow: var(--sh-sm); }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 24px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.content { padding: 12px 36px 40px; flex: 1; width: 100%; max-width: 1440px; }
.app-footer { padding: 20px 36px; font-size: 13px; color: #9ca3af; }
.only-mobile { display: none; }
.sidebar-backdrop { display: none; }

/* Notificaciones (dropdown) */
.notif-wrap { position: relative; }
.notif-btn .dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg); animation: pulse 2s infinite; }
.notif-panel {
    position: absolute; right: 0; top: calc(100% + 10px); width: 360px; background: #fff; border-radius: var(--r);
    box-shadow: var(--sh-lg); border: 1px solid var(--line); opacity: 0; visibility: hidden; transform: translateY(8px);
    transition: all .25s var(--ease); overflow: hidden;
}
.notif-panel.open { opacity: 1; visibility: visible; transform: none; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.notif-head .link-btn { font-size: 12px; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #f3f4f6; color: var(--text); font-size: 13.5px; transition: background .15s; }
.notif-item:hover { background: var(--bg); color: var(--text); }
.notif-item.unread { background: #f5faff; }
.notif-item.unread::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--secondary); flex-shrink: 0; margin-top: 6px; }
.notif-item small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.notif-item > div { flex: 1; }
.notif-foot { display: block; text-align: center; padding: 12px; font-size: 13px; font-weight: 600; background: #fafbfc; }

/* ------------------------------ Avatar ----------------------------- */
.avatar {
    --h: 210; width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: inline-grid; place-items: center;
    font-size: 14px; font-weight: 700; color: #fff; letter-spacing: .02em;
    background: linear-gradient(135deg, hsl(var(--h) 75% 45%), hsl(calc(var(--h) + 40) 80% 55%));
    box-shadow: 0 0 0 3px #fff, var(--sh-sm);
}
.avatar.sm { width: 32px; height: 32px; font-size: 12px; box-shadow: 0 0 0 2px #fff; }
.avatar.xl { width: 72px; height: 72px; font-size: 24px; }

/* ------------------------------ Tarjetas --------------------------- */
.card { background: var(--card); border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: var(--sh-sm); padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.card-head h3 { font-size: 16px; font-weight: 700; }
.card-head.mt { margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.narrow { max-width: 820px; }
.muted-sm { color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
.text-danger { color: var(--danger) !important; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 16px; }
.section-head h2 { font-size: 18px; font-weight: 700; }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 24px; align-items: start; }

/* Hero del dashboard */
.hero-card { position: relative; overflow: hidden; border-radius: var(--r-xl); background: var(--grad); color: #fff; padding: 34px 38px; margin-bottom: 22px; box-shadow: var(--sh-lg); }
.hero-card .blob { width: 260px; height: 260px; }
.hero-card-body { position: relative; z-index: 1; max-width: 680px; }
.hero-card h2 { color: #fff; font-size: 30px; font-weight: 800; margin-bottom: 8px; }
.hero-card p { color: rgba(255,255,255,.88); font-size: 16px; }
.hero-card strong { color: #fff; }

/* Estadísticas */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 28px; }
.stat { display: flex; align-items: center; gap: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; transition: transform .25s var(--ease), box-shadow .25s; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--sh); }
.stat strong { display: block; font-size: 28px; font-weight: 800; color: var(--ink); line-height: 1; letter-spacing: -.03em; }
.stat span { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-ic { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; }
.stat-ic .ic { width: 24px; height: 24px; }
.stat-ic.c1 { background: var(--primary-50); color: var(--primary); }
.stat-ic.c2 { background: var(--secondary-50); color: #0891b2; }
.stat-ic.c3 { background: var(--warning-50); color: #d97706; }
.stat-ic.c4 { background: #f3e8ff; color: var(--purple); }

/* Tarjetas de proyecto */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.project-grid.wide { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
.project-card {
    display: flex; flex-direction: column; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 22px; color: var(--text); position: relative; overflow: hidden; transition: transform .3s var(--ease), box-shadow .3s, border-color .3s;
    animation: fadeUp .5s var(--ease) both;
}
.project-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: var(--grad); transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease); }
.project-card:hover { transform: translateY(-4px); box-shadow: var(--sh-lg); border-color: transparent; color: var(--text); }
.project-card:hover::before { transform: scaleX(1); }
.pc-top { display: flex; justify-content: space-between; align-items: center; }
.pc-title { font-size: 17px; font-weight: 700; transition: color .2s; }
.project-card:hover .pc-title { color: var(--primary); }
.pc-client { font-size: 13px; color: var(--muted); margin-top: -8px; }
.pc-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: auto; padding-top: 4px; }
.pc-meta span { display: inline-flex; align-items: center; gap: 5px; }
.msg-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: #fff; background: var(--secondary); padding: 3px 9px; border-radius: 999px; animation: pulse 2s infinite; }

.phase-badge { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700; padding: 5px 11px; border-radius: 999px; background: var(--bg); color: var(--muted); letter-spacing: .01em; }
.phase-briefing { background: #f3e8ff; color: #7c3aed; }
.phase-design { background: #fce7f3; color: #db2777; }
.phase-develop { background: var(--primary-50); color: var(--primary); }
.phase-review { background: var(--warning-50); color: #b45309; }
.phase-published { background: var(--success-50); color: #047857; }

.phase-steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.phase-steps span { height: 5px; border-radius: 4px; background: #e9edf3; }
.phase-steps span.done { background: var(--primary); }
.phase-steps span.current { background: var(--grad); background-size: 200% 100%; animation: shimmer 2.5s linear infinite; }

.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row strong { font-size: 13px; color: var(--ink); min-width: 36px; text-align: right; }
.progress { flex: 1; height: 8px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--grad); border-radius: 999px; animation: grow 1.2s var(--ease); }

/* Listas pequeñas y timeline */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list a { display: flex; gap: 12px; align-items: flex-start; padding: 10px; margin: 0 -10px; border-radius: 10px; color: var(--text); transition: background .15s; }
.mini-list a:hover { background: var(--bg); }
.mini-list strong { display: block; font-size: 14px; font-weight: 600; }
.mini-list small { color: var(--muted); font-size: 12.5px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: #cbd5e1; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { display: flex; gap: 12px; padding: 9px 0; position: relative; font-size: 13.5px; }
.timeline li:not(:last-child)::before { content: ''; position: absolute; left: 15px; top: 44px; bottom: -6px; width: 2px; background: var(--line); }
.timeline small { color: var(--muted); font-size: 12px; }
.timeline.big li { padding: 12px 0; font-size: 14.5px; }
.empty-sm { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 24px; color: var(--muted); font-size: 14px; text-align: center; }
.empty-sm .ic { color: var(--success); }
.empty { text-align: center; padding: 56px 24px; background: #fff; border: 2px dashed var(--line); border-radius: var(--r-lg); }
.empty-ic { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 18px; background: var(--grad-soft); color: var(--primary); display: grid; place-items: center; }
.empty-ic .ic { width: 30px; height: 30px; }
.empty h3 { font-size: 18px; margin-bottom: 6px; }
.empty p { color: var(--muted); margin-bottom: 18px; }

/* Toolbar / filtros */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 22px; }
.search { position: relative; flex: 1; min-width: 240px; max-width: 380px; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #9ca3af; }
.search input { padding-left: 42px; border-radius: 999px; background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); background: #fff; border: 1px solid var(--line); transition: all .2s; }
.chip:hover { color: var(--primary); border-color: var(--primary); }
.chip.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ================================================================
   PROYECTO
   ================================================================ */
.project-hero { display: grid; grid-template-columns: 1fr auto; gap: 30px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-xl); padding: 28px; margin-bottom: 20px; position: relative; overflow: hidden; }
.project-hero::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--grad); }
.ph-badges { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ph-desc { color: #4b5563; max-width: 720px; margin-bottom: 22px; }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); counter-reset: s; }
.stepper li { display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; text-align: center; }
.stepper li:not(:first-child)::before { content: ''; position: absolute; top: 17px; right: 50%; width: 100%; height: 3px; background: #e9edf3; z-index: 0; }
.stepper li.done::before, .stepper li.current::before { background: var(--grad); }
.step-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid #e2e8f0; font-size: 13px; font-weight: 700; color: #94a3b8; z-index: 1; transition: all .3s; }
.stepper .done .step-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.stepper .current .step-dot { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 0 0 6px rgba(0,180,216,.18); animation: ring 2s infinite; }
.step-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stepper .current .step-label { color: var(--primary); }
.ph-side { display: flex; align-items: center; gap: 24px; padding-left: 28px; border-left: 1px solid var(--line); }
.ring { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring-bg { stroke: #eef2f7; }
.ring-fg { stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: calc(326.7 - 326.7 * var(--p) / 100); animation: ringIn 1.4s var(--ease); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label strong { font-size: 26px; font-weight: 800; color: var(--ink); line-height: 1; }
.ring-label small { font-size: 11px; color: var(--muted); }
.ph-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; min-width: 210px; }
.ph-facts li { display: grid; grid-template-columns: 18px 70px 1fr; align-items: center; gap: 8px; font-size: 13.5px; }
.ph-facts li > .ic-sm { color: var(--secondary); }
.ph-facts span { color: var(--muted); }
.ph-facts a, .ph-facts strong { font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

.tabs { display: flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px; margin-bottom: 20px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; transition: all .2s; }
.tab:hover { color: var(--primary); background: var(--bg); }
.tab.is-active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -6px rgba(0,80,158,.6); }
.tab-panel { display: none; animation: fadeUp .35s var(--ease); }
.tab-panel.is-active { display: block; }

/* ------------------------------ Chat ------------------------------- */
.chat { padding: 0; display: flex; flex-direction: column; height: calc(100vh - 230px); min-height: 520px; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.chat-head strong { display: block; font-size: 15px; color: var(--ink); }
.chat-head small { color: var(--muted); font-size: 12.5px; }
.presence { position: relative; }
.presence-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: #cbd5e1; border: 2px solid #fff; }
.presence-dot.on { background: var(--success); }
.chat-body { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 4px; background:
    radial-gradient(circle at 20% 0%, rgba(0,180,216,.05), transparent 40%), radial-gradient(circle at 100% 100%, rgba(0,80,158,.05), transparent 40%), #fbfcfe; scroll-behavior: smooth; }
.chat-empty { margin: auto; text-align: center; color: var(--muted); }
.chat-empty .ic { width: 48px; height: 48px; color: #cbd5e1; margin: 0 auto 10px; }
.day-sep { text-align: center; margin: 14px 0 8px; }
.day-sep span { font-size: 11.5px; font-weight: 600; color: var(--muted); background: #fff; border: 1px solid var(--line); padding: 4px 12px; border-radius: 999px; }
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 76%; animation: msgIn .3s var(--ease); margin-top: 6px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-bubble-wrap { display: flex; flex-direction: column; min-width: 0; }
.msg.mine .msg-bubble-wrap { align-items: flex-end; }
.msg-author { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 4px 4px; display: flex; gap: 6px; align-items: center; }
.role-tag { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--primary-50); color: var(--primary); }
.msg-bubble { padding: 11px 15px; border-radius: 18px; background: #fff; border: 1px solid var(--line); box-shadow: var(--sh-sm); border-bottom-left-radius: 6px; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.mine .msg-bubble { background: var(--grad); color: #fff; border: 0; border-bottom-left-radius: 18px; border-bottom-right-radius: 6px; box-shadow: 0 6px 16px -8px rgba(0,80,158,.6); }
.msg.mine .msg-bubble a { color: #fff; text-decoration: underline; }
.msg time { font-size: 11px; color: #9ca3af; margin: 4px 6px 0; }
.msg.pending { opacity: .6; }
.msg-image { display: block; margin-top: 6px; border-radius: 12px; overflow: hidden; max-width: 280px; }
.msg-image img { transition: transform .3s; }
.msg-image:hover img { transform: scale(1.03); }
.msg-text + .msg-file, .msg-text + .msg-image { margin-top: 8px; }
.msg-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--bg); color: var(--text); min-width: 220px; }
.msg.mine .msg-file { background: rgba(255,255,255,.18); color: #fff; text-decoration: none !important; }
.msg-file span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.msg-file strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-file small { font-size: 11.5px; opacity: .75; }
.file-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: #fff; color: var(--primary); }
.composer { border-top: 1px solid var(--line); padding: 12px 16px; background: #fff; }
.composer-row { display: flex; align-items: flex-end; gap: 10px; }
.composer textarea { flex: 1; resize: none; max-height: 160px; border-radius: 22px; padding: 12px 18px; background: var(--bg); border-color: transparent; }
.composer textarea:focus { background: #fff; }
.composer-file { display: inline-flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; margin-bottom: 10px; background: var(--primary-50); color: var(--primary); border-radius: 999px; font-size: 13px; font-weight: 600; }
.composer .icon-btn { width: 46px; height: 46px; }

/* ------------------------------ Tareas ----------------------------- */
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.task { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); transition: all .2s; background: #fff; }
.task:hover { border-color: #cfd8e3; box-shadow: var(--sh-sm); }
.task.is-review { border-color: #fcd34d; background: linear-gradient(90deg, #fffbeb, #fff 60%); }
.task-check { width: 24px; height: 24px; border-radius: 8px; border: 2px solid #cbd5e1; display: grid; place-items: center; flex-shrink: 0; color: #fff; margin-top: 1px; }
.task.is-done .task-check { background: var(--success); border-color: var(--success); }
.task.is-done .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: #cbd5e1; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-desc { font-size: 13.5px; color: #4b5563; margin-top: 4px; }
.task-feedback { font-size: 13px; color: #92400e; background: var(--warning-50); border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
.task-meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.task-meta span { display: inline-flex; align-items: center; gap: 4px; }
.task-admin { display: flex; gap: 6px; align-items: flex-start; }
.tag-approval { font-size: 10.5px; font-weight: 700; color: var(--purple); background: #f3e8ff; padding: 2px 8px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; }
.status-pill { font-size: 11.5px !important; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--bg); }
.st-pending { background: #f1f5f9; color: #64748b; } .status-dot.st-pending { background: #94a3b8; }
.st-in_progress { background: var(--primary-50); color: var(--primary); } .status-dot.st-in_progress { background: var(--primary); }
.st-review { background: var(--warning-50); color: #b45309; } .status-dot.st-review { background: var(--warning); }
.st-approved, .st-done { background: var(--success-50); color: #047857; } .status-dot.st-approved, .status-dot.st-done { background: var(--success); }
.st-changes { background: var(--danger-50); color: #b91c1c; } .status-dot.st-changes { background: var(--danger); }
.approve-box { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.approve-box textarea { font-size: 14px; }
.approve-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ------------------------------ Archivos --------------------------- */
.dropzone { border: 2px dashed #c7d4e4; border-radius: var(--r-lg); padding: 34px; text-align: center; background: #fff; margin-bottom: 22px; transition: all .25s; cursor: pointer; }
.dropzone:hover, .dropzone.drag { border-color: var(--secondary); background: var(--secondary-50); }
.dropzone.drag { transform: scale(1.01); }
.dropzone.uploading { opacity: .6; pointer-events: none; }
.dz-ic { width: 54px; height: 54px; border-radius: 16px; background: var(--grad); color: #fff; display: grid; place-items: center; margin: 0 auto 12px; box-shadow: var(--sh); }
.dropzone small { color: var(--muted); font-size: 12.5px; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.file-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; transition: all .25s var(--ease); position: relative; }
.file-card:hover { transform: translateY(-3px); box-shadow: var(--sh); }
.file-thumb { height: 130px; display: grid; place-items: center; background: var(--grad-soft); color: var(--primary); position: relative; overflow: hidden; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb .ic { width: 40px; height: 40px; opacity: .7; }
.file-ext { position: absolute; bottom: 10px; font-size: 11px; font-weight: 800; letter-spacing: .05em; background: #fff; padding: 2px 8px; border-radius: 6px; }
.fi-pdf { background: linear-gradient(135deg, #fef2f2, #fee2e2); color: #dc2626; }
.fi-zip { background: linear-gradient(135deg, #fffbeb, #fef3c7); color: #d97706; }
.fi-xls { background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #059669; }
.fi-vid { background: linear-gradient(135deg, #f5f3ff, #ede9fe); color: #7c3aed; }
.file-info { padding: 12px 14px 4px; }
.file-info strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.file-info small { font-size: 12px; color: var(--muted); }
.file-actions { display: flex; justify-content: flex-end; gap: 4px; padding: 4px 8px 8px; }

/* ------------------------------ Formularios páginas ---------------- */
.form-page { max-width: 860px; display: flex; flex-direction: column; gap: 20px; }
.form-page .card { padding: 28px; }
.danger-zone, .inline-card { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.danger-zone { border: 1px solid #fecaca; background: var(--danger-50); border-radius: var(--r-lg); padding: 20px 24px; }
.danger-zone strong { color: #991b1b; }
.danger-zone p { font-size: 13.5px; color: #b91c1c; }
.profile-head { display: flex; align-items: center; gap: 20px; background: var(--grad-soft) !important; }
.profile-head h2 { font-size: 22px; }

/* ------------------------------ Tabla ------------------------------ */
.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 14px 20px; background: #fafbfc; border-bottom: 1px solid var(--line); }
.table td { padding: 14px 20px; border-bottom: 1px solid #f1f4f8; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: #fafcff; }
.table tr.is-muted { opacity: .55; }
.cell-user { display: flex; align-items: center; gap: 12px; }
.cell-user strong { display: block; color: var(--ink); }
.cell-user small { color: var(--muted); font-size: 12.5px; }
.t-right { text-align: right; white-space: nowrap; }

/* Página notificaciones */
.notif-full { list-style: none; margin: 0; padding: 0; }
.notif-full a { display: flex; gap: 14px; align-items: flex-start; padding: 14px 10px; border-bottom: 1px solid #f1f4f8; color: var(--text); border-radius: 10px; transition: background .15s; }
.notif-full a:hover { background: var(--bg); }
.notif-full .unread a { background: #f5faff; }
.notif-full .unread p { font-weight: 600; }
.notif-full small { color: var(--muted); font-size: 12.5px; }
.n-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--primary-50); color: var(--primary); }
.n-approved, .n-task { background: var(--success-50); color: var(--success); }
.n-review { background: var(--warning-50); color: #d97706; }
.n-changes { background: var(--danger-50); color: var(--danger); }
.n-file { background: var(--secondary-50); color: #0891b2; }
.n-phase, .n-project { background: #f3e8ff; color: var(--purple); }

/* Toasts */
.toast-stack { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast { display: flex; align-items: center; gap: 12px; background: var(--ink); color: #fff; padding: 13px 18px; border-radius: 14px; box-shadow: var(--sh-lg); font-size: 14px; max-width: 360px; animation: toastIn .35s var(--ease); }
.toast.error { background: #991b1b; }
.toast.out { animation: toastOut .3s var(--ease) forwards; }

/* ------------------------------ Animaciones ------------------------ */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes grow { from { width: 0; } }
@keyframes ringIn { from { stroke-dashoffset: 326.7; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(0,180,216,.45); } 50% { box-shadow: 0 0 0 6px rgba(0,180,216,0); } }
@keyframes ring { 0%,100% { box-shadow: 0 0 0 4px rgba(0,180,216,.2); } 50% { box-shadow: 0 0 0 9px rgba(0,180,216,.08); } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes blob { 0%,100% { transform: translate(0,0) scale(1); } 33% { transform: translate(30px,-40px) scale(1.1); } 66% { transform: translate(-20px,20px) scale(.92); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
.project-grid > :nth-child(2) { animation-delay: .05s; } .project-grid > :nth-child(3) { animation-delay: .1s; }
.project-grid > :nth-child(4) { animation-delay: .15s; } .project-grid > :nth-child(5) { animation-delay: .2s; } .project-grid > :nth-child(6) { animation-delay: .25s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------ Responsive ------------------------- */
@media (max-width: 1200px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .grid-2-1 { grid-template-columns: 1fr; }
    .project-hero { grid-template-columns: 1fr; }
    .ph-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 22px; }
}
@media (max-width: 900px) {
    .auth-grid { grid-template-columns: 1fr; }
    .auth-hero { padding: 28px; min-height: auto; }
    .auth-hero-body { padding: 24px 0 8px; }
    .auth-hero h2 { font-size: 28px; }
    .auth-features, .auth-mock { display: none; }
    .sidebar { transform: translateX(-100%); box-shadow: var(--sh-lg); }
    .sidebar.open { transform: none; }
    .sidebar-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 45; backdrop-filter: blur(2px); }
    .main { margin-left: 0; }
    .only-mobile { display: inline-grid; }
    .topbar { padding: 12px 16px; }
    .topbar-title h1 { font-size: 19px; }
    .topbar .btn span { display: none; }
    .topbar .btn { padding: 9px; border-radius: 12px; }
    .content { padding: 8px 16px 32px; }
    .app-footer { padding: 16px; }
    .notif-panel { position: fixed; left: 12px; right: 12px; width: auto; top: 64px; }
}
@media (max-width: 640px) {
    .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; }
    .stat strong { font-size: 24px; }
    .hero-card { padding: 24px; }
    .hero-card h2 { font-size: 23px; }
    .form-grid { grid-template-columns: 1fr; }
    .ph-side { flex-direction: column; align-items: stretch; }
    .ring { margin: 0 auto; }
    .step-label { font-size: 10.5px; }
    .step-dot { width: 30px; height: 30px; }
    .stepper li:not(:first-child)::before { top: 14px; }
    .msg { max-width: 90%; }
    .chat { height: calc(100vh - 190px); }
    .task { flex-wrap: wrap; }
    .task-admin { width: 100%; justify-content: flex-end; }
    .danger-zone, .inline-card { flex-direction: column; align-items: stretch; }
    .project-hero { padding: 20px; }
}
