:root {
  --navy: #002d72;
  --navy-2: #063e8c;
  --blue: #0096db;
  --red: #f3002f;
  --ink: #18263a;
  --muted: #66758a;
  --line: #e4e9ef;
  --paper: #f4f6f8;
  --white: #fff;
  --green: #17845b;
  --green-soft: #e8f6f0;
  --amber: #aa6910;
  --amber-soft: #fff4dc;
  --red-soft: #fff0f2;
  --shadow: 0 14px 45px rgba(21, 46, 80, .09);
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; color: var(--ink); font-family: "DM Sans", sans-serif; background: radial-gradient(circle at 85% -10%, rgba(0,150,219,.12), transparent 30rem), var(--paper); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.topbar { height: 72px; padding: 0 max(24px, calc((100vw - 1240px)/2)); display: flex; align-items: center; justify-content: space-between; background: linear-gradient(125deg, var(--navy), var(--navy-2)); color: white; box-shadow: 0 4px 18px rgba(0,25,69,.2); position: sticky; top: 0; z-index: 20; }
.topbar::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .08; background-image: linear-gradient(90deg, transparent 97%, white 98%), linear-gradient(0deg, transparent 97%, white 98%); background-size: 28px 28px; }
.brand, .top-actions { z-index: 1; }
.brand { display: flex; align-items: center; gap: 11px; color: white; text-decoration: none; }
.brand > span:last-child { display: flex; align-items: baseline; gap: 9px; }
.brand b { font-family: Manrope, sans-serif; font-size: 26px; letter-spacing: -1.8px; }
.brand small { font: 700 10px Manrope, sans-serif; letter-spacing: 2.4px; opacity: .72; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.3); }
.brand-mark { width: 28px; height: 28px; position: relative; display: inline-block; }
.brand-mark i { position: absolute; border: 2px solid white; border-radius: 50%; inset: 1px; opacity: .28; }
.brand-mark i:nth-child(2) { inset: 7px; opacity: .58; }
.brand-mark i:nth-child(3) { inset: 12px; opacity: 1; background: var(--red); border: 0; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.demo-badge { font-size: 10px; font-weight: 800; letter-spacing: 1.2px; padding: 5px 8px; border-radius: 6px; background: rgba(255,255,255,.12); color: rgba(255,255,255,.72); }
.icon-button, .avatar { border: 1px solid rgba(255,255,255,.24); color: white; background: rgba(255,255,255,.08); display: grid; place-items: center; }
.icon-button { width: 34px; height: 34px; border-radius: 9px; font-size: 20px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; font-size: 11px; font-weight: 800; }
.main-content { max-width: 1240px; margin: 0 auto; padding: 38px 24px 70px; }
.eyebrow { color: var(--blue); font: 800 10px Manrope, sans-serif; letter-spacing: 1.7px; }
h1, h2, h3 { font-family: Manrope, sans-serif; margin: 0; letter-spacing: -.03em; }
h1 { font-size: clamp(29px, 4vw, 42px); line-height: 1.08; }
h2 { font-size: 25px; }
h3 { font-size: 16px; }
.muted { color: var(--muted); }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-heading p { margin: 10px 0 0; color: var(--muted); }
.button { border: 0; border-radius: 11px; padding: 11px 17px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--blue); color: white; box-shadow: 0 8px 22px rgba(0,150,219,.22); }
.button.dark { background: var(--navy); color: white; }
.button.ghost { background: #edf1f5; color: var(--ink); }
.button.small { padding: 8px 11px; border-radius: 8px; font-size: 12px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 25px; }
.kpi { background: white; border: 1px solid var(--line); border-radius: 15px; padding: 17px 19px; box-shadow: 0 7px 20px rgba(21,46,80,.04); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; width: 4px; inset: 0 auto 0 0; background: var(--blue); }
.kpi.warn::before { background: #f5a623; }.kpi.danger::before { background: var(--red); }.kpi.ok::before { background: var(--green); }
.kpi span { display: block; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.kpi strong { display: block; margin-top: 5px; font: 800 25px Manrope, sans-serif; color: var(--navy); }
.project-table { width: 100%; border-collapse: collapse; background: white; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.project-table th { text-align: left; padding: 12px 16px; color: var(--muted); background: #f9fafb; font-size: 10px; text-transform: uppercase; letter-spacing: .7px; border-bottom: 1px solid var(--line); }
.project-table td { padding: 17px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
.project-table tr:last-child td { border: 0; }.project-table tbody tr:hover { background: #fbfdff; }
.project-name { display: flex; align-items: center; gap: 12px; }
.project-initial { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: #eaf5fb; color: var(--navy); font-weight: 800; }
.project-name b { display: block; }.project-name small { display: block; margin-top: 3px; color: var(--muted); }
.mini-progress { width: 110px; height: 7px; border-radius: 5px; background: #edf0f4; display: inline-block; overflow: hidden; margin-right: 8px; }
.mini-progress i { display: block; height: 100%; background: var(--blue); border-radius: inherit; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 20px; padding: 5px 9px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.pill.active { color: #1477a3; background: #e8f5fb; }.pill.risk { color: var(--amber); background: var(--amber-soft); }.pill.done { color: var(--green); background: var(--green-soft); }
.empty-card { padding: 50px; background: white; border: 1px dashed #cbd4de; border-radius: 16px; text-align: center; color: var(--muted); }

/* Cuaderno */
.notebook-header { border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); margin-bottom: 22px; background: white; }
.notebook-cover { padding: 29px 32px; background: linear-gradient(125deg, #032d6d, #0751a0); color: white; display: grid; grid-template-columns: 1fr auto; gap: 24px; position: relative; }
.notebook-cover::after { content: ""; position: absolute; width: 170px; height: 170px; right: 15%; top: -70%; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 35px rgba(255,255,255,.03), 0 0 0 70px rgba(255,255,255,.025); }
.notebook-cover .eyebrow { color: #7ed3f5; }.notebook-cover h1 { margin: 5px 0 8px; }.notebook-cover p { margin: 0; opacity: .72; font-size: 13px; }
.opening-date { text-align: right; align-self: center; position: relative; z-index: 2; }.opening-date span { display: block; font-size: 10px; letter-spacing: 1px; opacity: .65; }.opening-date strong { font: 700 17px Manrope, sans-serif; }
.progress-panel { padding: 20px 32px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; }
.progress-panel strong { font: 800 26px Manrope, sans-serif; color: var(--navy); }.progress-panel small { display: block; color: var(--muted); font-size: 11px; }
.progress-track { height: 10px; border-radius: 20px; background: #edf1f5; overflow: hidden; }.progress-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #48c2e8); transition: width .4s ease; }
.notebook-layout { display: grid; grid-template-columns: 255px minmax(0, 1fr); gap: 22px; align-items: start; }
.stage-nav { position: sticky; top: 94px; background: white; border: 1px solid var(--line); border-radius: 16px; padding: 9px; box-shadow: 0 10px 28px rgba(21,46,80,.05); }
.stage-button { width: 100%; border: 0; background: transparent; padding: 12px; border-radius: 10px; display: grid; grid-template-columns: 27px 1fr auto; gap: 9px; align-items: center; text-align: left; color: var(--muted); }
.stage-button:hover { background: #f5f8fa; }.stage-button.active { background: #eaf6fb; color: var(--navy); }
.stage-num { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; background: #edf1f5; font-weight: 800; font-size: 11px; }.stage-button.active .stage-num { background: var(--blue); color: white; }
.stage-button b { font-size: 12px; }.stage-button small { font-size: 10px; }
.filter-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 5px 0 13px; }.filter-row h2 small { font: 500 12px DM Sans, sans-serif; color: var(--muted); margin-left: 8px; }
.task-list { display: grid; gap: 10px; }
.task-card { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 16px 17px; display: grid; grid-template-columns: 34px 1fr auto; gap: 13px; align-items: start; transition: .18s ease; }
.task-card:hover { transform: translateY(-1px); box-shadow: 0 10px 25px rgba(21,46,80,.07); border-color: #cbdbe8; }
.status-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: #eef1f4; color: #8b96a4; }
.task-card.aprobado .status-icon { color: white; background: var(--green); }.task-card.enviado .status-icon { color: #1477a3; background: #def2fa; }.task-card.observado .status-icon { color: var(--red); background: var(--red-soft); }
.task-content h3 { margin: 1px 0 5px; }.task-content p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }.task-note { margin-top: 8px !important; color: var(--ink) !important; border-left: 2px solid #d9e0e7; padding-left: 9px; }
.task-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }.tag { font-size: 10px; font-weight: 700; padding: 4px 7px; border-radius: 5px; background: #f0f3f6; color: var(--muted); }.tag.blocker { color: var(--red); background: var(--red-soft); }
.task-action { border: 0; padding: 7px 10px; border-radius: 8px; color: var(--navy); background: #edf6fa; font-size: 11px; font-weight: 800; white-space: nowrap; }

/* Modales */
.modal { border: 0; border-radius: 20px; padding: 0; width: min(650px, calc(100% - 28px)); box-shadow: 0 30px 90px rgba(7,31,64,.25); }.modal::backdrop { background: rgba(5,24,48,.55); backdrop-filter: blur(3px); }.modal form { padding: 26px; }.modal-head { display: flex; justify-content: space-between; gap: 20px; align-items: start; }.modal-head h2 { margin-top: 3px; }.close-button { border: 0; background: #eef1f4; color: var(--muted); width: 31px; height: 31px; border-radius: 9px; font-size: 21px; }.modal-copy { color: var(--muted); font-size: 13px; line-height: 1.5; }.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }.field { display: grid; gap: 6px; }.field-wide { grid-column: 1/-1; }.field span { font-size: 11px; font-weight: 800; color: #4e5c6d; }.field input, .field select, .field textarea { width: 100%; border: 1px solid #d8dfe7; border-radius: 10px; padding: 11px 12px; background: white; color: var(--ink); outline: none; }.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,150,219,.1); }.field textarea { resize: vertical; }.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }.task-meta { display: flex; gap: 7px; margin: 14px 0 20px; }.task-modal .field { margin-top: 13px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; background: #15283d; color: white; padding: 12px 16px; border-radius: 10px; font-size: 12px; box-shadow: 0 14px 35px rgba(0,0,0,.2); transform: translateY(90px); opacity: 0; transition: .25s ease; }.toast.show { transform: translateY(0); opacity: 1; }
.loading { padding: 80px; text-align: center; color: var(--muted); }.loading::before { content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 15px; border: 3px solid #dce4ea; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 850px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }.project-table th:nth-child(3), .project-table td:nth-child(3), .project-table th:nth-child(5), .project-table td:nth-child(5) { display: none; }
  .notebook-layout { grid-template-columns: 1fr; }.stage-nav { position: static; display: flex; overflow-x: auto; }.stage-button { flex: 0 0 170px; }.notebook-cover { grid-template-columns: 1fr; }.opening-date { text-align: left; }
}
@media (max-width: 560px) {
  .topbar { height: 62px; padding: 0 15px; }.brand small, .demo-badge { display: none; }.main-content { padding: 25px 14px 50px; }.page-heading { align-items: stretch; flex-direction: column; }.page-heading .button { width: 100%; }.kpi-grid { grid-template-columns: 1fr 1fr; gap: 9px; }.kpi { padding: 14px; }.kpi strong { font-size: 21px; }
  .project-table { display: block; background: transparent; box-shadow: none; }.project-table thead { display: none; }.project-table tbody { display: grid; gap: 10px; }.project-table tr { display: grid; grid-template-columns: 1fr auto; background: white; border-radius: 13px; box-shadow: 0 7px 20px rgba(21,46,80,.06); padding: 12px; }.project-table td { display: block !important; border: 0; padding: 5px; }.project-table td:nth-child(2), .project-table td:nth-child(3), .project-table td:nth-child(5) { display: none !important; }.project-table td:nth-child(4) { grid-column: 1; }.project-table td:last-child { grid-column: 2; grid-row: 1; }
  .notebook-cover, .progress-panel { padding: 22px 19px; }.progress-panel { grid-template-columns: auto 1fr; }.progress-panel > span:last-child { grid-column: 1/-1; }.task-card { grid-template-columns: 31px 1fr; padding: 14px; }.task-action { grid-column: 2; justify-self: start; }.form-grid { grid-template-columns: 1fr; }.field { grid-column: 1; }.modal form { padding: 21px; }.modal-actions .button { flex: 1; }
}
