:root {
  --navy-950: #071d2c;
  --navy-900: #0b2638;
  --navy-800: #123b50;
  --blue-600: #1771a6;
  --teal-500: #17a398;
  --teal-100: #dff6f2;
  --amber-500: #ef9f28;
  --amber-100: #fff1d6;
  --ink: #152b3a;
  --muted: #6e7f8a;
  --line: #dfe7eb;
  --surface: #ffffff;
  --canvas: #f3f6f7;
  --danger: #c44949;
  --radius: 16px;
  --shadow: 0 14px 40px rgba(25, 49, 65, .08);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 20; width: 258px; display: flex; flex-direction: column;
  padding: 28px 18px 20px; color: #eaf4f6;
  background: radial-gradient(circle at 15% 5%, #1b5263 0, transparent 30%), linear-gradient(180deg, var(--navy-900), var(--navy-950));
}
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; padding: 0 9px 28px; }
.brand-mark { width: 43px; height: 43px; border-radius: 13px; display: grid; place-items: center; font-size: 22px; font-weight: 800; color: var(--navy-950); background: linear-gradient(145deg, #f8b63f, #ef8f23); box-shadow: 0 8px 22px #061a27; }
.brand strong { display: block; letter-spacing: .1em; }
.brand small, .sidebar-footer small { display: block; margin-top: 2px; color: #91aab5; font-size: 11px; }
.main-nav { display: grid; gap: 4px; }
.nav-caption { margin: 21px 12px 8px; color: #698692; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 13px; border: 0; border-radius: 11px; color: #a9bec6; background: transparent; text-align: left; font-weight: 600; transition: .2s ease; }
.nav-item span { width: 22px; font-size: 17px; text-align: center; }
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.is-active { color: white; background: rgba(31, 169, 155, .18); box-shadow: inset 3px 0 var(--teal-500); }
.sidebar-footer { margin-top: auto; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 17px 10px 0; border-top: 1px solid rgba(255,255,255,.09); font-size: 12px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--navy-950); background: var(--amber-500); font-weight: 800; }
.online-dot, .status-dot { width: 8px; height: 8px; border-radius: 50%; background: #48cf88; box-shadow: 0 0 0 4px rgba(72,207,136,.15); }

.app-main { min-height: 100vh; margin-left: 258px; }
.topbar { height: 92px; padding: 0 38px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: rgba(255,255,255,.93); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 15; backdrop-filter: blur(12px); }
.topbar h1 { margin: 2px 0 0; font-size: 22px; letter-spacing: -.025em; }
.eyebrow { margin: 0; color: var(--teal-500); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.cycle-pill { display: flex; gap: 12px; align-items: center; padding: 10px 16px; border: 1px solid var(--line); border-radius: 12px; background: #f9fbfb; }
.cycle-pill small, .cycle-pill strong { display: block; }
.cycle-pill small { color: var(--muted); font-size: 10px; }
.cycle-pill strong { margin-top: 2px; font-size: 12px; }
.view { display: none; padding: 32px 38px 48px; animation: rise .22s ease; }
.view.is-visible { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }

.hero-panel { min-height: 252px; padding: 42px 48px; display: flex; align-items: center; justify-content: space-between; overflow: hidden; position: relative; color: white; border-radius: 22px; background: linear-gradient(125deg, #0b3247 0%, #0e5263 58%, #147d7c 100%); box-shadow: var(--shadow); }
.hero-panel::before { content: ""; position: absolute; inset: 0; opacity: .24; background-image: linear-gradient(30deg, transparent 48%, rgba(255,255,255,.12) 49%, transparent 50%); background-size: 26px 26px; }
.hero-panel > * { position: relative; z-index: 1; }
.hero-label { font-size: 10px; font-weight: 800; letter-spacing: .18em; color: #76d9ce; }
.hero-panel h2 { margin: 10px 0 8px; font-family: Georgia, serif; font-size: clamp(34px, 4vw, 52px); font-weight: 500; line-height: .98; letter-spacing: -.035em; }
.hero-panel h2 em { color: #f4ad3d; font-weight: 500; }
.hero-panel p { max-width: 520px; margin: 14px 0 22px; color: #c1d8de; font-size: 14px; }
.transformation-list { display: flex; flex-wrap: wrap; gap: 8px; margin: -7px 0 22px; }
.transformation-list span { padding: 7px 10px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; color: #d9ecef; background: rgba(255,255,255,.07); font-size: 10px; font-weight: 750; }
.primary-button, .secondary-button { border: 0; border-radius: 10px; padding: 12px 17px; font-weight: 750; }
.primary-button { color: #132e3d; background: var(--amber-500); box-shadow: 0 8px 20px rgba(190, 112, 7, .2); }
.primary-button:hover { background: #f6ae3d; transform: translateY(-1px); }
.secondary-button { color: var(--ink); background: #edf2f3; }
.full-width { width: 100%; }
.cycle-orbit { width: 260px; height: 200px; display: grid; place-items: center; position: relative; }
.orbit-ring { width: 170px; height: 170px; display: grid; place-content: center; text-align: center; border-radius: 50%; border: 1px solid rgba(255,255,255,.28); box-shadow: 0 0 0 22px rgba(255,255,255,.035), 0 0 0 48px rgba(255,255,255,.025); }
.orbit-ring span { font-family: Georgia, serif; color: #ffc45e; font-size: 62px; line-height: .8; }
.orbit-ring small { margin-top: 8px; color: #bbd1d6; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.orbit-badge { position: absolute; right: 4px; bottom: 15px; padding: 10px 12px; border-radius: 12px; color: var(--navy-950); background: #7dd8cb; font-size: 10px; font-weight: 800; text-align: center; text-transform: uppercase; transform: rotate(5deg); }

.section-heading, .page-intro, .panel-heading, .table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.section-heading { margin: 30px 0 15px; }
.section-heading h2, .page-intro h2 { margin: 4px 0 0; font-family: Georgia, serif; font-size: 27px; font-weight: 500; }
.page-intro { margin-bottom: 21px; }
.page-intro p:not(.eyebrow) { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.metric-card { min-height: 125px; padding: 21px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 25px rgba(25,49,65,.04); }
.metric-top { display: flex; justify-content: space-between; align-items: start; }
.metric-card small { color: var(--muted); font-weight: 650; }
.metric-card strong { display: block; margin-top: 14px; font-family: Georgia, serif; font-size: 30px; font-weight: 600; }
.metric-card strong span { font-family: inherit; color: var(--muted); font-size: 15px; }
.metric-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--teal-100); color: var(--teal-500); font-weight: 800; }
.skeleton { background: linear-gradient(100deg, #fff 25%, #f0f4f5 36%, #fff 47%); background-size: 300% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position-x: -150%; } }
.dashboard-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; margin-top: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 25px rgba(25,49,65,.04); }
.quick-panel, .cycle-detail, .form-panel { padding: 23px; }
.panel-heading h3 { margin: 4px 0 0; font-size: 17px; }
.quick-actions { display: grid; margin-top: 15px; }
.quick-actions button { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 13px 0; border: 0; border-top: 1px solid #edf1f2; background: transparent; text-align: left; color: var(--ink); }
.quick-actions button:hover b { transform: translateX(4px); }
.quick-actions small { display: block; margin-top: 2px; color: var(--muted); }
.quick-actions b { transition: .2s; }
.quick-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; }
.quick-icon.amber { background: var(--amber-100); color: #bf7410; }
.quick-icon.teal { background: var(--teal-100); color: var(--teal-500); }
.quick-icon.blue { background: #e2f0f8; color: var(--blue-600); }
.status-badge { padding: 6px 9px; border-radius: 20px; color: #157769; background: var(--teal-100); font-size: 10px; font-weight: 800; }
.cycle-calendar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 25px 0 18px; }
.cycle-calendar div { padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.cycle-calendar small, .cycle-calendar strong { display: block; }
.cycle-calendar small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.cycle-calendar strong { margin-top: 4px; font-size: 14px; }
.progress-track { height: 7px; overflow: hidden; border-radius: 5px; background: #e8eff1; }
.progress-track span { display: block; width: 72%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal-500), #5dcebd); }

.legend { display: flex; gap: 15px; color: var(--muted); font-size: 11px; }
.legend span { display: flex; gap: 6px; align-items: center; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; border: 1px solid var(--line); }
.legend-dot.recorded { background: var(--amber-100); border-color: #efc06d; }
.table-panel { overflow: hidden; }
.table-toolbar { min-height: 70px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.table-toolbar strong, .table-toolbar small { display: block; }
.table-toolbar small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.search-field { min-width: 230px; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafb; }
.search-field.large { min-width: 300px; }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 12px; }
.table-scroll { overflow: auto; max-height: calc(100vh - 265px); }
.minute-table, .data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 11px; }
.minute-table th, .minute-table td, .data-table th, .data-table td { padding: 10px; border-bottom: 1px solid #e8edef; white-space: nowrap; text-align: left; }
.minute-table thead th, .data-table thead th { position: sticky; top: 0; z-index: 3; background: #f6f9fa; color: #607582; font-size: 9px; letter-spacing: .05em; text-transform: uppercase; }
.minute-table .sticky-code { position: sticky; left: 0; z-index: 4; background: inherit; text-align: center; }
.minute-table .sticky-member { position: sticky; left: 54px; z-index: 4; min-width: 190px; background: inherit; box-shadow: 6px 0 12px rgba(18, 42, 57, .04); }
.minute-table tbody tr { background: white; }
.minute-table tbody tr:hover { background: #f9fbfb; }
.minute-table input { width: 42px; padding: 7px 3px; border: 1px solid #dce5e8; border-radius: 7px; text-align: center; background: #fbfcfc; outline: none; }
.minute-table input.has-value { background: var(--amber-100); border-color: #efc477; color: #8c570d; font-weight: 800; }
.minute-table input:focus { border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(23,163,152,.12); }
.member-cell strong, .member-cell small { display: block; }
.member-cell small { margin-top: 2px; color: var(--muted); }
.row-total { font-weight: 800; color: var(--navy-800); }
.date-head { min-width: 53px; text-align: center !important; }
.date-head span, .date-head small { display: block; }
.date-head small { margin-top: 2px; color: #8da0aa; }
.loading-block { min-height: 180px; display: grid; place-items: center; color: var(--muted); }

.date-control { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.date-control input, .form-panel input, .form-panel select, .form-panel textarea { min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; outline: none; }
.responsive-table { overflow-x: auto; }
.attendance-actions { display: inline-flex; gap: 5px; }
.attendance-button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: white; font-size: 10px; font-weight: 800; }
.attendance-button.present.is-active { color: #117567; background: var(--teal-100); border-color: #8ed6cc; }
.attendance-button.absent.is-active { color: #a73d3d; background: #fee8e8; border-color: #efb1b1; }
.code-badge { display: inline-grid; min-width: 31px; height: 27px; place-items: center; border-radius: 8px; color: white; background: var(--navy-800); font-weight: 800; }
.meal-toolbar { align-items: flex-end; }
.meal-controls { display: flex; align-items: flex-end; gap: 9px; }
.meal-controls > label:not(.search-field) { display: grid; gap: 5px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.meal-controls select { min-width: 155px; min-height: 37px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; }
.meal-summary-bar { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 9px 20px; border-bottom: 1px solid var(--line); color: var(--muted); background: #fbfcfc; font-size: 10px; }
.meal-week-table .meal-day-head { min-width: 96px; text-align: center; border-left: 1px solid var(--line); }
.meal-day-head span, .meal-day-head small { display: block; }
.meal-type-head { min-width: 48px; text-align: center !important; border-left: 1px solid #edf1f2; }
.meal-week-table td { text-align: center; }
.meal-week-table td.is-outside, .meal-week-table th.is-outside { background: #edf1f2; color: #98a7ae; }
.meal-week-table input:disabled { cursor: not-allowed; border-color: transparent; background: transparent; }
.meals-layout { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
.form-panel { display: grid; gap: 14px; }
.form-panel label { display: grid; gap: 6px; color: #526975; font-size: 11px; font-weight: 750; }
.form-row { display: grid; grid-template-columns: 1.2fr .8fr; gap: 10px; }
.amount-chip { padding: 8px 11px; border-radius: 9px; color: #0c7469; background: var(--teal-100); font-weight: 800; }
.type-chip { padding: 5px 8px; border-radius: 20px; color: #836019; background: var(--amber-100); font-size: 9px; font-weight: 800; }
.filter-pills { display: flex; gap: 4px; padding: 3px; border-radius: 9px; background: #edf2f3; }
.filter-pills button { border: 0; padding: 6px 10px; border-radius: 7px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 700; }
.filter-pills button.is-active { color: var(--ink); background: white; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.member-type { padding: 5px 8px; border-radius: 20px; font-size: 9px; font-weight: 800; }
.member-type.socio { color: #126b95; background: #e3f2fa; }
.member-type.inquilino { color: #895a10; background: var(--amber-100); }

dialog { max-width: 430px; border: 0; border-radius: 18px; padding: 0; box-shadow: 0 25px 80px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(5, 23, 34, .66); backdrop-filter: blur(3px); }
.dialog-card { padding: 28px; }
.dialog-card h3 { margin: 13px 0 7px; }
.dialog-card p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.dialog-card label { display: grid; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 700; }
.dialog-card textarea { padding: 10px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; }
.dialog-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: #9a6113; background: var(--amber-100); font-weight: 900; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast { position: fixed; right: 25px; bottom: 25px; z-index: 50; max-width: 360px; padding: 13px 17px; border-radius: 11px; color: white; background: var(--navy-900); box-shadow: 0 15px 40px rgba(0,0,0,.2); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .22s; font-size: 12px; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: #9e3e3e; }
.empty-state { padding: 50px 20px; color: var(--muted); text-align: center; }
.icon-button { border: 0; background: transparent; font-size: 22px; }
.mobile-only { display: none; }
.institutional-footer { display: flex; justify-content: space-between; gap: 20px; margin: 0 38px 28px; padding: 18px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.institutional-footer strong { color: var(--ink); }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid, .meals-layout { grid-template-columns: 1fr; }
  .form-panel { grid-template-columns: repeat(2, 1fr); }
  .form-panel .panel-heading, .form-panel .full-width { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: .25s; }
  body.menu-open .sidebar { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .institutional-footer { margin: 0 16px 24px; flex-direction: column; gap: 5px; }
  .topbar { height: 76px; padding: 0 18px; }
  .topbar .eyebrow, .cycle-pill small { display: none; }
  .topbar h1 { font-size: 17px; }
  .mobile-only { display: block; }
  .view { padding: 22px 16px 35px; }
  .hero-panel { padding: 31px 25px; }
  .cycle-orbit { display: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { padding: 16px; min-height: 110px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .page-intro { align-items: flex-start; flex-direction: column; }
  .search-field, .search-field.large { width: 100%; min-width: 0; }
  .form-panel { grid-template-columns: 1fr; }
  .form-panel .panel-heading, .form-panel .full-width { grid-column: auto; }
  .table-toolbar { align-items: flex-start; flex-direction: column; }
  .meal-controls { width: 100%; flex-wrap: wrap; }
  .meal-controls > label:not(.search-field) { flex: 1; }
  .meal-controls select { width: 100%; min-width: 130px; }
  .filter-pills { width: 100%; }
  .filter-pills button { flex: 1; }
}
@media (max-width: 430px) {
  .metric-grid { grid-template-columns: 1fr; }
  .cycle-pill { padding: 8px 10px; }
  .cycle-pill strong { font-size: 10px; }
}
