:root {
  color-scheme: light;
  --navy: #0d2f55;
  --navy-2: #155493;
  --blue: #1467aa;
  --blue-soft: #eef7ff;
  --yellow: #f2bd19;
  --yellow-soft: #fff9e8;
  --teal: #138763;
  --teal-soft: #eefaf5;
  --red: #c2414d;
  --red-soft: #fff0f1;
  --ink: #132238;
  --muted: #607087;
  --line: #d5e3ef;
  --surface: #ffffff;
  --canvas: #f5f9fc;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 4%, rgba(28, 130, 205, .07), transparent 30rem),
    var(--canvas);
  font-size: 16px;
  line-height: 1.45;
}

button, input, select { font: inherit; }
button, summary, select { cursor: pointer; }

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  height: 80px;
  border-bottom: 1px solid rgba(220,230,239,.9);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(16px);
}
.header-inner {
  width: min(1200px, calc(100% - 48px));
  height: 100%;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 36px;
}
.brand-link { display: flex; align-items: center; }
.brand-link img { width: 188px; height: 56px; object-fit: contain; object-position: left center; }
.desktop-nav { display: flex; align-items: center; gap: 30px; margin-left: auto; }
.desktop-nav a { color: #3c536a; font-size: 14px; font-weight: 600; text-decoration: none; transition: color .2s ease; }
.desktop-nav a:hover { color: #13408a; }
.nav-dropdown { position: relative; display: flex; align-items: center; }
.nav-dropdown-trigger { display: inline-flex; align-items: center; gap: 5px; }
.nav-dropdown-trigger span { color: #7890a5; font-size: 13px; transform: translateY(-1px); transition: transform .2s ease; }
.tools-menu { position: absolute; top: calc(100% + 18px); left: 50%; z-index: 80; width: 250px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 18px 42px rgba(8,44,76,.16); opacity: 0; visibility: hidden; transform: translate(-50%, -7px); transition: opacity .18s ease, transform .18s ease, visibility .18s ease; }
.tools-menu::before { content: ""; position: absolute; top: -19px; left: 0; width: 100%; height: 20px; }
.nav-dropdown:hover .tools-menu, .nav-dropdown:focus-within .tools-menu { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.nav-dropdown:hover .nav-dropdown-trigger span, .nav-dropdown:focus-within .nav-dropdown-trigger span { transform: rotate(180deg); }
.desktop-nav .tools-menu a { display: flex; flex-direction: column; gap: 2px; padding: 11px 12px; border-radius: 8px; }
.desktop-nav .tools-menu a:hover { background: #e7f3fc; }
.desktop-nav .tools-menu strong { color: #003b5c; font-size: 13px; }
.desktop-nav .tools-menu small { display: block; margin: 0; color: var(--muted); font-size: 10px; font-weight: 500; }
.header-portal { display: flex; align-items: center; gap: 17px; min-height: 48px; padding: 7px 12px 7px 16px; border-radius: 9px; color: white; background: #003b5c; text-decoration: none; }
.portal-copy { display: flex; flex-direction: column; font-size: 12px; font-weight: 600; line-height: 1.2; }
.header-arrow { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: rgba(255,255,255,.12); }
.law-version { display: flex; align-items: center; gap: 9px; font-size: .78rem; color: #607087; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #35d3a3; box-shadow: 0 0 0 4px rgba(53,211,163,.14); }

.app-shell { min-height: calc(100vh - 80px); display: grid; grid-template-columns: 390px minmax(0, 1fr); gap: 28px; padding: 30px clamp(18px, 3vw, 46px) 46px; }

.config-panel {
  align-self: start;
  padding: 27px 28px 32px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(31, 74, 112, .055);
}

.panel-heading { margin-bottom: 24px; }
.panel-heading h2, .workspace-title h1, .sequence-card h2 { margin: 3px 0 6px; color: var(--navy); font-family: Raleway, sans-serif; line-height: 1.08; }
.panel-heading h2 { font-size: 1.45rem; }
.panel-heading p { margin: 0; color: var(--muted); font-size: .92rem; }
.eyebrow { color: var(--blue); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

fieldset { margin: 0 0 18px; padding: 0 0 18px; border: 0; border-bottom: 1px solid var(--line); }
legend { margin-bottom: 11px; padding: 0; font-weight: 750; color: var(--navy); font-size: .94rem; }
.dotacion-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.number-field { display: grid; gap: 7px; font-size: .76rem; font-weight: 700; color: var(--muted); }
.number-field > span { display: grid; grid-template-columns: 27px 1fr 27px; align-items: center; overflow: hidden; border: 1px solid #bdd5e9; border-radius: 11px; background: white; }
.number-field button { height: 38px; border: 0; color: var(--blue); background: #f1f8fd; }
.number-field input { min-width: 0; height: 38px; padding: 0; border: 0; text-align: center; font-weight: 850; color: var(--navy); background: white; appearance: textfield; }
.number-field input::-webkit-inner-spin-button { appearance: none; }
.number-field.morning > span { border-bottom: 3px solid var(--yellow); }
.number-field.afternoon > span { border-bottom: 3px solid #ff8a3d; }
.number-field.night > span { border-bottom: 3px solid #5e72c9; }

.shift-row { display: grid; grid-template-columns: 34px 1fr 1fr; gap: 8px; align-items: end; margin-bottom: 9px; }
.shift-row label { display: grid; gap: 3px; color: var(--muted); font-size: .68rem; font-weight: 700; }
.shift-row input, .field-label input, .field-label select { width: 100%; min-width: 0; height: 42px; padding: 0 10px; border: 1px solid #bcd2e6; border-radius: 10px; color: var(--ink); background: #fbfdff; outline: none; }
.shift-row input:focus, .field-label input:focus, .field-label select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(19,103,209,.1); }
.shift-code { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; font-weight: 850; }
.shift-code.m, .code-M { color: #735500; background: #ffe48a; }
.shift-code.t, .code-T { color: #8e3f08; background: #ffd0ad; }
.shift-code.n, .code-N { color: #fff; background: #425a9b; }
.code-S { color: #40556f; background: #dbe6ef; }
.code-O { color: #607087; background: #e8edf2; }
.code-P { color: #006b53; background: #c9f0e5; }

.field-label { display: grid; gap: 6px; margin-top: 10px; font-size: .78rem; font-weight: 700; color: var(--muted); }
#sequence { letter-spacing: .18em; font-weight: 800; text-transform: uppercase; }
#sequence[readonly] { color: var(--blue); background: var(--blue-soft); border-color: #b8d8f1; cursor: default; }
small { display: block; margin-top: 5px; color: var(--muted); font-size: .72rem; }

.switch-row { display: flex; align-items: center; gap: 9px; margin-top: 11px; color: var(--ink); font-size: .79rem; font-weight: 620; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 36px; height: 21px; flex: 0 0 auto; border-radius: 99px; background: #b8c4d0; transition: .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .2s; }
.switch-row input:checked + .switch { background: var(--teal); }
.switch-row input:checked + .switch::after { transform: translateX(15px); }
.switch-row input:focus-visible + .switch { outline: 3px solid rgba(19,103,209,.22); }

.evidence-box { margin: 0 0 18px; border: 1px solid var(--line); border-radius: 12px; background: #f8fbfd; }
.evidence-box summary { padding: 11px 12px; color: var(--navy); font-size: .8rem; font-weight: 750; }
.evidence-box label { display: flex; gap: 8px; padding: 6px 12px; font-size: .76rem; color: var(--muted); }
.evidence-box label:last-child { padding-bottom: 12px; }
.evidence-box input { accent-color: var(--teal); }

.primary-button { width: 100%; min-height: 48px; display: flex; justify-content: center; align-items: center; gap: 10px; border: 0; border-radius: 10px; color: white; background: linear-gradient(90deg, #164d82, #1477bd); font-weight: 850; box-shadow: 0 8px 20px rgba(20,103,170,.16); }
.primary-button:hover { background: linear-gradient(90deg, #123f6c, #126ba9); transform: translateY(-1px); }

.workspace { min-width: 0; padding: 1px 0 0; }
.workspace-title { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.workspace-title h1 { font-size: clamp(2rem, 4vw, 3.25rem); letter-spacing: -.045em; }
.workspace-title p strong { color: var(--blue); }
.workspace-title p { margin: 0; color: var(--muted); }
.workspace-status { display: flex; align-items: flex-end; flex-direction: column; gap: 10px; }
.overall-badge { padding: 9px 13px; border-radius: 999px; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.overall-badge.ok { color: #08745b; background: var(--teal-soft); border: 1px solid #a8decf; }
.overall-badge.warning { color: #8a5400; background: var(--yellow-soft); border: 1px solid #ead48a; }
.overall-badge.fail { color: #a62d39; background: var(--red-soft); border: 1px solid #f0bdc1; }
.overall-badge.pending { color: var(--muted); background: #e7edf3; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
.metric-card { position: relative; min-height: 126px; padding: 17px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 9px 24px rgba(31,74,112,.045); }
.metric-card::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: var(--blue); }
.metric-card.accent::before { background: var(--yellow); }
.metric-card.teal::before { background: var(--teal); }
.metric-card.violet::before { background: #596cc6; }
.metric-label { color: var(--muted); font-size: .74rem; font-weight: 720; text-transform: uppercase; letter-spacing: .06em; }
.metric-value { margin-top: 9px; color: var(--navy); font-size: 2rem; font-weight: 880; line-height: 1; letter-spacing: -.04em; }
.metric-note { margin-top: 8px; color: var(--muted); font-size: .76rem; }

.sequence-card { display: grid; grid-template-columns: minmax(120px,.55fr) 1.7fr minmax(150px,.7fr); gap: 22px; align-items: center; margin-bottom: 20px; padding: 18px 20px; border: 1px solid #bcdaf0; border-radius: var(--radius); color: var(--ink); background: linear-gradient(120deg, #f4faff, #eef7ff); box-shadow: 0 9px 24px rgba(31,74,112,.045); }
.sequence-card h2 { color: var(--navy); font-size: 1.25rem; }
.sequence-card .eyebrow { color: var(--blue); }
.sequence-visual { display: flex; flex-wrap: wrap; gap: 7px; }
.sequence-chip { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; font-size: .83rem; font-weight: 850; box-shadow: inset 0 0 0 1px rgba(255,255,255,.55); }
.sequence-facts { color: var(--muted); font-size: .77rem; }
.sequence-facts strong { display: block; margin-bottom: 3px; color: var(--navy); font-size: 1.02rem; }

.tabs { display: flex; gap: 5px; margin-bottom: 14px; padding: 5px; overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.75); }
.tab { min-height: 38px; padding: 0 14px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: .82rem; font-weight: 760; white-space: nowrap; }
.tab.active { color: var(--blue); background: #eaf5ff; box-shadow: inset 0 0 0 1px #c7e0f2; }
.tab-legal-count { display: inline-grid; min-width: 24px; min-height: 24px; margin-left: 5px; padding: 2px 7px; place-items: center; border-radius: 999px; font-weight: 850; line-height: 1; }
.tab-legal-count.pass,
.tab.active .tab-legal-count.pass { color: #08745b; background: var(--teal-soft); }
.tab-legal-count.fail,
.tab.active .tab-legal-count.fail { color: var(--red); background: var(--red-soft); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.verdict { display: grid; grid-template-columns: auto 1fr; gap: 15px; align-items: start; margin-bottom: 14px; padding: 18px; border: 1px solid #a8decf; border-radius: var(--radius); background: linear-gradient(135deg, #eefaf6, #fff); }
.verdict.warning { border-color: #ead48a; background: linear-gradient(135deg, #fff8df, #fff); }
.verdict.fail { border-color: #f0bdc1; background: linear-gradient(135deg, #fff1f2, #fff); }
.verdict-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: white; background: var(--teal); font-size: 1.25rem; font-weight: 900; }
.verdict.warning .verdict-icon { color: var(--navy); background: var(--yellow); }
.verdict.fail .verdict-icon { background: var(--red); }
.verdict h3 { margin: 0 0 4px; color: var(--navy); font-size: 1rem; }
.verdict p { margin: 0; color: var(--muted); font-size: .84rem; }

.content-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 14px; }
.content-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 8px 22px rgba(7,26,47,.035); }
.content-card h3 { margin: 0 0 3px; color: var(--navy); font-size: 1rem; }
.content-card > p { margin: 0 0 14px; color: var(--muted); font-size: .8rem; }
.staff-stack { display: flex; height: 24px; overflow: hidden; border-radius: 8px; background: #e6ebf0; }
.staff-stack span { display: grid; place-items: center; min-width: 0; color: white; font-size: .67rem; font-weight: 850; }
.stack-ft { background: var(--blue); }
.stack-pt { background: var(--teal); }
.stack-off { background: #aab6c3; }
.legend { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 10px; color: var(--muted); font-size: .72rem; }
.legend i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 2px; }
.math-list { display: grid; gap: 9px; }
.math-row { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 9px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.math-row:last-child { padding: 0; border: 0; }
.math-row strong { color: var(--navy); text-align: right; }
.callout { margin-top: 14px; padding: 12px; border-left: 3px solid var(--yellow); border-radius: 0 10px 10px 0; color: var(--muted); background: #fffaf0; font-size: .78rem; }

.table-card { border: 1px solid var(--line); border-radius: var(--radius); background: white; overflow: hidden; }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.table-toolbar h3 { margin: 0; color: var(--navy); font-size: 1rem; }
.table-toolbar p { margin: 2px 0 0; color: var(--muted); font-size: .76rem; }
.table-scroll { overflow: auto; max-width: 100%; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .74rem; }
th, td { padding: 9px 8px; border-right: 1px solid #e8edf2; border-bottom: 1px solid #e8edf2; text-align: center; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 2; color: #607087; background: #f5f8fb; font-weight: 780; }
th:first-child, td:first-child { position: sticky; left: 0; z-index: 3; min-width: 114px; text-align: left; color: var(--navy); background: white; font-weight: 780; }
th:first-child { z-index: 4; background: #f5f8fb; }
.sunday-head { color: var(--red); background: #fff4f4; }
.holiday-head { color: #8a5400; background: #fff7dd; }
.calendar-code { width: 25px; height: 25px; display: inline-grid; place-items: center; border-radius: 7px; font-weight: 850; }
.relief-code { outline: 2px solid var(--teal); outline-offset: 1px; }
.coverage-ok { color: var(--teal); font-weight: 850; }
.coverage-bad { color: var(--red); font-weight: 850; }
.table-note { padding: 11px 18px; color: var(--muted); background: #f8fafc; font-size: .72rem; }

.legal-summary { display: grid; grid-template-columns: 160px 1fr; gap: 20px; align-items: center; margin-bottom: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.score-ring { --score: 0; width: 126px; height: 126px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--teal) calc(var(--score) * 1%), #e6ebf0 0); }
.score-ring::before { content: ""; grid-area: 1/1; width: 96px; height: 96px; border-radius: 50%; background: white; }
.score-ring span { z-index: 1; grid-area: 1/1; color: var(--navy); font-size: 1.45rem; font-weight: 880; }
.legal-summary h3 { margin: 0 0 5px; color: var(--navy); }
.legal-summary p { margin: 0; color: var(--muted); font-size: .8rem; }
.checklist { display: grid; gap: 9px; }
.check-item { display: grid; grid-template-columns: 31px minmax(0,1fr) auto; gap: 11px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.check-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: white; font-weight: 900; }
.check-item.pass .check-icon { background: var(--teal); }
.check-item.fail .check-icon { background: var(--red); }
.check-item h4 { margin: 1px 0 3px; color: var(--navy); font-size: .87rem; }
.check-item p { margin: 0; color: var(--muted); font-size: .74rem; }
.check-law { padding: 4px 8px; border-radius: 7px; color: var(--blue); background: #edf5ff; font-size: .66rem; font-weight: 780; white-space: nowrap; }
.sources { margin-top: 14px; padding: 18px; border: 1px solid #c7ddec; border-radius: var(--radius); color: var(--muted); background: #f3f9fd; }
.sources h3 { margin: 0 0 10px; color: var(--navy); font-size: .95rem; }
.source-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 7px 18px; }
.sources a { color: var(--blue); font-size: .74rem; text-decoration: none; }
.sources a:hover { text-decoration: underline; }

.error-box { padding: 18px; border: 1px solid #f0bdc1; border-radius: var(--radius); color: #8c2630; background: var(--red-soft); }
footer { margin-top: 22px; padding: 20px 18px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); background: rgba(255,255,255,.72); font-size: .72rem; text-align: center; }
footer strong { font-family: Raleway, sans-serif; color: var(--blue); letter-spacing: .12em; }
footer p { margin: 7px auto; max-width: 760px; }
footer a { color: var(--blue); text-decoration: none; }

@media (max-width: 1120px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .sequence-card { grid-template-columns: 1fr; gap: 10px; }
}

@media (max-width: 950px) {
  .desktop-nav { display: none; }
  .header-portal { margin-left: auto; }
}

@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; gap: 22px; padding: 22px 18px 34px; }
  .config-panel { border: 1px solid var(--line); }
  .workspace { padding-top: 26px; }
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .header-inner { width: min(100% - 28px, 1200px); }
  .site-header { height: 70px; }
  .brand-link img { width: 150px; height: 46px; }
  .header-portal { min-height: 40px; padding: 5px 8px 5px 11px; }
  .header-arrow { display: none; }
  .portal-copy { font-size: 10px; }
  .workspace-title { align-items: start; flex-direction: column; }
  .workspace-status { align-items: flex-start; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { min-height: 112px; padding: 14px; }
  .metric-value { font-size: 1.65rem; }
  .legal-summary { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .check-item { grid-template-columns: 31px 1fr; }
  .check-law { grid-column: 2; justify-self: start; }
  .source-grid { grid-template-columns: 1fr; }
}
