:root {
    --bg: #f6f3ed;
    --panel: #ffffff;
    --ink: #1f2933;
    --muted: #667085;
    --line: #d8d0c2;
    --brand: #2f6f73;
    --brand-dark: #234f52;
    --warn: #b7791f;
    --danger: #b42318;
    --ok: #027a48;
    --blue: #2563eb;
    --rose: #b84f70;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: var(--bg);
}
.top {
    background: #1f2933;
    color: #fff;
    padding: 16px 22px;
}
.top-inner {
    width: min(1240px, calc(100% - 24px));
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.brand { font-weight: 800; letter-spacing: 0; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav a {
    color: #fff;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 8px;
    padding: 9px 12px;
    font-weight: 700;
}
.nav a.active, .nav a:hover { background: var(--brand); border-color: var(--brand); }
.page { width: min(1240px, calc(100% - 24px)); margin: 0 auto; padding: 24px 0 42px; }
.hero {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-end;
    border-bottom: 1px solid var(--line);
    padding-bottom: 18px;
    margin-bottom: 18px;
}
h1, h2, h3 { margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); }
h2 { font-size: 1.2rem; margin-bottom: 14px; }
h3 { font-size: 1rem; }
.lead { margin: 8px 0 0; color: var(--muted); line-height: 1.45; max-width: 760px; }
.actions, .filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn, button {
    border: 0;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    padding: 10px 14px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
}
.btn.secondary, button.secondary { background: #e2e8f0; color: var(--ink); }
.btn.danger, button.danger { background: var(--danger); }
.btn.small, button.small { padding: 7px 10px; min-height: 32px; font-size: 13px; }
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 6px 18px rgba(31,41,51,.07);
}
.grid-2 { display: grid; grid-template-columns: minmax(310px, 420px) 1fr; gap: 18px; align-items: start; }
.calendar-layout {
    grid-template-columns: minmax(720px, 1fr) minmax(260px, 320px);
    align-items: start;
}
.calendar-layout > section:first-child {
    min-width: 0;
}
.calendar-layout aside {
    font-size: 14px;
}
.calendar-layout aside .row {
    grid-template-columns: 1fr;
}
.calendar-layout aside textarea {
    min-height: 62px;
}
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.stat strong { display: block; font-size: 1.6rem; margin-top: 6px; }
.muted { color: var(--muted); }
.msg { padding: 11px 13px; border-radius: 8px; margin-bottom: 14px; font-weight: 800; }
.msg.ok { background: #ecfdf3; color: var(--ok); border: 1px solid #abefc6; }
.msg.err { background: #fef3f2; color: var(--danger); border: 1px solid #fecdca; }
label { display: block; margin: 12px 0 5px; color: #344054; font-size: 13px; font-weight: 800; }
input, select, textarea, button { font: inherit; }
input[type="text"], input[type="number"], input[type="date"], input[type="month"], input[type="search"], select, textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    padding: 9px 10px;
    background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.drop {
    border: 2px dashed #9db1c5;
    background: #f8fafc;
    border-radius: 8px;
    padding: 18px;
    text-align: center;
    transition: border-color .15s ease, background .15s ease;
}
.drop.drag { border-color: var(--brand); background: #ecfdf5; }
.drop .file-name { margin-top: 8px; font-weight: 800; color: var(--brand-dark); overflow-wrap: anywhere; }
.drop input { margin-top: 10px; width: 100%; }
.current-file {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #d8e0e8;
    text-align: left;
}
.current-file-title {
    margin-bottom: 8px;
    color: #344054;
    font-size: 13px;
    font-weight: 800;
}
.current-file img,
.current-file-preview {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
}
.current-file.missing {
    color: var(--danger);
    font-weight: 800;
}
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; min-width: 820px; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 9px; text-align: left; vertical-align: top; font-size: 14px; }
th { background: #f8fafc; color: #344054; position: sticky; top: 0; }
.pill { display: inline-block; padding: 4px 8px; border-radius: 999px; background: #e2e8f0; font-size: 12px; font-weight: 800; }
.pill.pagado { background: #dcfce7; color: #166534; }
.pill.pendiente { background: #fef3c7; color: #92400e; }
.pill.revisar { background: #fee2e2; color: #991b1b; }
.file-link { color: var(--brand-dark); font-weight: 800; text-decoration: none; }
.calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}
.dow { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; padding: 0 6px 3px; }
.day {
    min-height: 136px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px;
}
.day.other { opacity: .45; }
.day.today { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(47,111,115,.18); }
.date { font-weight: 800; margin-bottom: 7px; }
.event {
    display: block;
    border-left: 4px solid var(--brand);
    background: #f8fafc;
    border-radius: 7px;
    padding: 7px 8px;
    margin: 6px 0;
    color: inherit;
    text-decoration: none;
    font-size: 13px;
}
.event.charge { border-left-color: var(--rose); }
.event .amount { display: block; color: var(--muted); margin-top: 2px; }
.charts { display: grid; grid-template-columns: 1.35fr .9fr; gap: 18px; align-items: stretch; }
canvas { width: 100%; height: 340px; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
@media (max-width: 900px) {
    .hero { align-items: flex-start; flex-direction: column; }
    .grid-2, .grid-3, .charts, .row, .calendar-layout { grid-template-columns: 1fr; }
    .calendar { grid-template-columns: 1fr; }
    .dow { display: none; }
    .day { min-height: auto; }
    canvas { height: 280px; }
}
