:root {
    color-scheme: light;
    --ink: #17332d;
    --muted: #6d7e78;
    --line: #e1e9e5;
    --surface: #ffffff;
    --background: #f4f8f6;
    --green: #16745b;
    --green-dark: #105b47;
    --green-soft: #e7f3ee;
    --red: #a93232;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--background);
    font-size: 15px;
}

a {
    color: inherit;
    text-decoration: none;
}

.site-header {
    min-height: 68px;
    padding: 0 max(24px, calc((100vw - 1560px) / 2));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.brand {
    font-size: 20px;
    font-weight: 750;
    letter-spacing: -.5px;
}

.brand span {
    color: var(--green);
}

nav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 14px;
}

nav a:hover {
    color: var(--green);
}

.container {
    width: min(1560px, calc(100% - 40px));
    margin: 0 auto;
    padding: 36px 0 64px;
}

.narrow-container {
    width: min(760px, calc(100% - 40px));
}

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.page-heading h1,
.page-heading h2 {
    margin: 5px 0 8px;
    font-size: clamp(25px, 3vw, 32px);
    letter-spacing: -.8px;
}

.page-heading h2 {
    font-size: 24px;
}

.eyebrow {
    margin: 0;
    color: var(--green);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 1.2px;
}

.muted,
.metric-note {
    color: var(--muted);
}

.muted {
    margin: 0;
    line-height: 1.55;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.metric-card,
.content-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 5px 18px rgba(25, 64, 49, .035);
}

.metric-card {
    min-height: 142px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
}

.metric-card-accent {
    background: var(--green-soft);
    border-color: #d5e9df;
}

.metric-label {
    color: var(--muted);
    font-size: 13px;
}

.metric-value {
    font-size: 34px;
    line-height: 1.1;
    letter-spacing: -.7px;
}

.metric-note {
    font-size: 12px;
}

.welcome-card {
    padding: 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
}

.welcome-card h2 {
    margin: 8px 0;
    font-size: 19px;
}

.quick-links,
.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.button {
    min-height: 42px;
    padding: 0 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 9px;
    font: inherit;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

.button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.button-primary {
    color: white;
    background: var(--green);
}

.button-primary:hover:not(:disabled) {
    background: var(--green-dark);
}

.button-secondary {
    color: var(--green-dark);
    background: var(--green-soft);
}

.button-quiet {
    color: var(--muted);
    background: white;
    border-color: var(--line);
}

.form-card {
    padding: 26px;
}

.field {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field label {
    font-size: 13px;
    font-weight: 650;
}

input,
select {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #d6e0db;
    border-radius: 8px;
    font: inherit;
}

input:focus,
select:focus {
    outline: 3px solid rgba(22, 116, 91, .13);
    border-color: var(--green);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.field-error {
    color: var(--red);
}

.form-hint {
    margin: 20px 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.form-actions {
    justify-content: flex-end;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.alert {
    padding: 13px 16px;
    margin-bottom: 18px;
    border-radius: 9px;
    font-size: 14px;
}

.alert-success {
    color: #175c43;
    background: #e8f5ed;
    border: 1px solid #cbe8d5;
}

.alert-error {
    color: #8e2929;
    background: #fff0ef;
    border: 1px solid #f2d0cd;
}

.filter-card {
    padding: 20px;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(180px, .8fr) auto;
    align-items: end;
    gap: 16px;
}

.result-section {
    margin-top: 32px;
}

.result-heading {
    margin-bottom: 18px;
}

.total-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    color: var(--muted);
    font-size: 13px;
}

.total-box strong {
    color: var(--ink);
    font-size: 25px;
}

.compact-metrics {
    grid-template-columns: minmax(220px, 1fr) 2fr;
}

.compact-metrics .metric-card {
    min-height: 105px;
}

.table-card {
    padding: 22px;
}

.table-card h3 {
    margin: 0 0 15px;
    font-size: 16px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th,
td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

td {
    font-size: 13.5px;
}

.empty-state {
    color: var(--muted);
    text-align: center;
}

.button-danger {
    color: #fff;
    background: #b23a3a;
    border: 1px solid #b23a3a;
}

.button-danger:hover {
    background: #8e2929;
}

td.row-actions,
.row-actions {
    display: table-cell;
    vertical-align: middle;
    white-space: nowrap;
}

.row-actions form {
    display: inline-block;
    margin: 0;
    vertical-align: middle;
}

.row-actions > .button,
.row-actions > form > .button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12.5px;
    border-radius: 7px;
    white-space: nowrap;
    vertical-align: middle;
}

.row-actions > *:not(:last-child) {
    margin-right: 5px;
}

.days-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 220px;
}

.days-badges .badge {
    padding: 2px 7px;
    font-size: 11px;
}

.legajo-panel {
    margin-top: 20px;
}

.legajo-titulo {
    margin: 0 0 8px;
    font-size: 18px;
}

.legajo-zona {
    margin-top: 12px;
    padding: 26px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border: 2px dashed #b9cfc7;
    border-radius: 12px;
    background: var(--green-soft);
    color: var(--green-dark);
    text-align: center;
    cursor: pointer;
}

.legajo-zona:hover,
.legajo-zona:focus-visible,
.legajo-zona.arrastrando {
    border-color: var(--green);
    background: #d7ece3;
    outline: none;
}

.legajo-zona.subiendo {
    opacity: 0.6;
    pointer-events: none;
}

.legajo-estado {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
}

.legajo-estado[hidden] {
    display: none;
}

.legajo-estado-ok {
    background: var(--green-soft);
    color: var(--green-dark);
}

.legajo-estado-error {
    background: #fbeaea;
    color: var(--red);
}

.legajo-filas {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.legajo-fila {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

.legajo-fila-nombre {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--green-dark);
    text-decoration: underline;
}

.legajo-ventana {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: min(920px, 94vw);
    height: min(640px, 82vh);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(23, 51, 45, 0.28);
    overflow: hidden;
}

.legajo-ventana[hidden] {
    display: none;
}

.legajo-ventana-cabecera {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--green-soft);
    border-bottom: 1px solid var(--line);
    cursor: move;
    touch-action: none;
    user-select: none;
}

.legajo-cerrar {
    border: 0;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--ink);
}

.legajo-ventana-cuerpo {
    flex: 1;
    min-height: 0;
    display: flex;
}

.legajo-lista {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 240px;
    flex-shrink: 0;
    overflow-y: auto;
    border-right: 1px solid var(--line);
}

.legajo-item.activo {
    background: var(--green-soft);
}

.legajo-item-boton {
    width: 100%;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.legajo-item-nombre {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.legajo-item-detalle {
    color: var(--muted);
}

.legajo-visor {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.legajo-visor-acciones {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
}

.legajo-pdf {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: 0;
}

.legajo-imagen {
    flex: 1;
    min-height: 0;
    object-fit: contain;
    padding: 8px;
}

.legajo-vacio {
    margin: 0;
    padding: 24px;
    color: var(--muted);
}

@media (max-width: 640px) {
    .legajo-ventana-cuerpo {
        flex-direction: column;
    }

    .legajo-lista {
        width: 100%;
        max-height: 30%;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
}

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    background: #eef2f7;
    font-size: 12px;
}

.field-error {
    display: block;
    color: #8e2929;
}

.calendar-detail {
    margin-top: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.calendar-detail[hidden] {
    display: none;
}

.step-title {
    margin: 0 0 12px;
    font-size: 17px;
}

.step-card {
    margin-top: 18px;
}

.calendar-detail .form-grid {
    margin-bottom: 12px;
}

.calendar-detail .form-actions {
    margin-top: 14px;
}

@media (max-width: 720px) {
    .site-header {
        padding: 14px 20px;
        flex-wrap: wrap;
    }

    nav {
        width: 100%;
        justify-content: space-between;
        gap: 12px;
    }

    .container,
    .narrow-container {
        width: calc(100% - 32px);
        padding-top: 28px;
    }

    .page-heading,
    .welcome-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .metrics {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .metric-card {
        min-height: 120px;
    }

    .form-grid,
    .filter-card {
        grid-template-columns: 1fr;
    }

    .filter-card .button {
        width: 100%;
    }

    .quick-links {
        width: 100%;
    }

    .quick-links .button {
        flex: 1;
    }
}

.field-spaced {
    margin-top: 20px;
}

.export-button {
    margin-top: 18px;
}

.year-filter {
    display: flex;
    align-items: center;
    gap: 9px;
}

.year-filter label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.year-filter input {
    width: 110px;
}

.statistics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.table-card h2 {
    margin: 0 0 16px;
    font-size: 18px;
}

.demand-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.demand-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.demand-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.demand-heading span,
.bar-caption {
    color: var(--muted);
    font-size: 12px;
}

.error-card {
    padding: 30px;
}

.error-card h1 {
    margin: 8px 0 12px;
    font-size: clamp(25px, 3vw, 32px);
}

.error-actions {
    margin-top: 24px;
}

.calendar-section {
    padding: 24px;
    margin-bottom: 24px;
}

.calendar-heading,
.calendar-controls,
.calendar-navigation,
.calendar-period-row,
.availability-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.calendar-heading {
    align-items: flex-start;
}

.calendar-heading h2 {
    margin: 7px 0 6px;
    font-size: 21px;
}

.calendar-controls {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.calendar-controls input,
.calendar-controls select {
    width: auto;
    min-width: 140px;
    min-height: 40px;
}

.calendar-navigation {
    gap: 6px;
}

.button-icon {
    min-width: 40px;
    padding: 0 10px;
    font-size: 21px;
}

.calendar-period-row {
    margin: 22px 0 12px;
}

.calendar-period-row h3 {
    margin: 0;
    font-size: 16px;
    text-transform: capitalize;
}

.calendar-legend {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
}

.calendar-legend i {
    width: 10px;
    height: 10px;
    background: var(--green);
    border-radius: 3px;
}

.calendar-scroll {
    max-height: 640px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: white;
}

.timeline-grid {
    --hour-height: 56px;
    min-width: calc(60px + var(--day-count) * 105px);
    display: grid;
    grid-template-columns: 60px repeat(var(--day-count), minmax(105px, 1fr));
    grid-template-rows: 44px repeat(24, var(--hour-height));
    position: relative;
    isolation: isolate;
}

.timeline-corner,
.timeline-day-heading,
.timeline-hour {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.timeline-day-column {
    min-width: 0;
    position: relative;
    border-right: 1px solid var(--line);
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent calc(var(--hour-height) - 1px),
        var(--line) calc(var(--hour-height) - 1px),
        var(--line) var(--hour-height));
}

.timeline-day-column.is-today {
    background-color: #f7fbf9;
}

.timeline-corner,
.timeline-day-heading {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #f8fbf9;
}

.timeline-corner {
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 11px;
}

.timeline-day-heading {
    padding: 0 8px;
    color: var(--ink);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-transform: capitalize;
}

.timeline-day-heading.is-today {
    color: var(--green-dark);
    background: var(--green-soft);
}

.timeline-hour {
    position: sticky;
    left: 0;
    z-index: 3;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 5px;
    color: var(--muted);
    background: #fbfcfb;
    font-size: 10px;
}

.calendar-event {
    z-index: 2;
    min-width: 0;
    position: absolute;
    padding: 5px 7px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    overflow: hidden;
    color: #124d3d;
    background: #e5f3eb;
    border: 1px solid #c6e4d2;
    border-left: 3px solid var(--green);
    border-radius: 6px;
    text-align: left;
    font: inherit;
    font-size: 10px;
    cursor: pointer;
}

.calendar-event:hover,
.month-event:hover {
    background: #d6ecdf;
}

.calendar-event strong,
.calendar-event span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event strong {
    font-size: 10px;
}

.calendar-event-meta,
.calendar-event-address {
    color: #45685b;
}

.month-grid {
    min-width: 740px;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.month-weekday {
    padding: 10px 5px;
    color: var(--muted);
    background: #f8fbf9;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    text-align: center;
    font-size: 11px;
    font-weight: 700;
}

.month-day {
    min-width: 0;
    min-height: 120px;
    padding: 6px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}

.month-day.is-today {
    background: #f1f8f4;
}

.month-day-number {
    width: 27px;
    height: 27px;
    margin-bottom: 4px;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 50%;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.month-day.is-today .month-day-number {
    color: white;
    background: var(--green);
}

.month-event {
    width: 100%;
    margin: 2px 0;
    padding: 4px 5px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #124d3d;
    background: #e5f3eb;
    border: 0;
    border-left: 2px solid var(--green);
    border-radius: 4px;
    text-align: left;
    font: inherit;
    font-size: 9px;
}

.month-event strong,
.month-event span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.month-more {
    color: var(--muted);
    font-size: 10px;
}

.calendar-loading,
.calendar-error {
    padding: 22px;
    color: var(--muted);
    font-size: 13px;
}

.calendar-error {
    margin-bottom: 10px;
    color: #8e2929;
    background: #fff0ef;
    border: 1px solid #f2d0cd;
    border-radius: 8px;
}

.availability-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.availability-card {
    min-width: 0;
    padding: 16px;
    background: #f9fbfa;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.availability-heading {
    align-items: flex-start;
}

.availability-heading h3 {
    margin: 0 0 4px;
    font-size: 14px;
}

.availability-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.availability-heading > strong {
    min-width: 28px;
    padding: 4px 8px;
    color: var(--green-dark);
    background: var(--green-soft);
    border-radius: 20px;
    text-align: center;
    font-size: 12px;
}

.availability-list {
    max-height: 150px;
    margin: 12px 0 0;
    padding: 0;
    overflow: auto;
    list-style: none;
}

.availability-list li {
    padding: 8px 0;
    border-top: 1px solid var(--line);
    font-size: 12px;
}

.availability-list .availability-empty {
    color: var(--muted);
}

.visually-hidden {
    width: 1px;
    height: 1px;
    padding: 0;
    position: absolute;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.bar-track {
    height: 10px;
    overflow: hidden;
    background: var(--green-soft);
    border-radius: 10px;
}

.bar-fill {
    height: 100%;
    min-width: 0;
    background: var(--green);
    border-radius: inherit;
}

.stats-filter {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.tipo-nuevo {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 18px;
}

.tipo-nuevo .field {
    flex: 1;
}

.tipo-renombrar {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tipo-renombrar input {
    min-width: 200px;
}

.stats-filter select {
    width: auto;
}

.stats-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats-metrics .metric-card {
    min-height: 124px;
}

.metric-money {
    font-size: 26px;
}

.stats-block,
.chart-card {
    margin-bottom: 18px;
}

.statistics-grid.stats-block {
    margin-bottom: 18px;
}

.delta-up {
    color: var(--green-dark);
    font-weight: 650;
}

.delta-down {
    color: var(--red);
    font-weight: 650;
}

.chart-card {
    padding: 22px;
}

.chart-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 18px;
    margin-bottom: 14px;
}

.chart-heading h2 {
    margin: 0;
    font-size: 18px;
}

.chart-legend {
    color: var(--muted);
    font-size: 12px;
}

.chart-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin: 0 4px 0 12px;
    border-radius: 3px;
}

.legend-current {
    background: var(--green);
}

.legend-previous {
    background: #b9d6ca;
}

.chart-columns {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.chart-col {
    flex: 1 0 44px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 4px 2px;
    border-radius: 8px;
    text-align: center;
}

.chart-col-active {
    background: var(--green-soft);
}

.chart-bars {
    height: 170px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
}

.chart-bar {
    flex: 1;
    max-width: 22px;
    min-height: 2px;
    background: var(--green);
    border-radius: 4px 4px 0 0;
}

.chart-bar-prev {
    background: #b9d6ca;
}

.chart-value,
.chart-label {
    color: var(--muted);
    font-size: 12px;
}

.chart-label {
    font-weight: 650;
}

.chart-compact .chart-col {
    flex: 1 0 17px;
    padding: 2px 0;
}

.chart-compact .chart-bar {
    max-width: 14px;
}

.chart-compact .chart-label {
    font-size: 10px;
}

.stats-table th,
.stats-table td {
    white-space: nowrap;
}

.stats-table .heat-head {
    text-align: center;
    padding-inline: 6px;
}

.heat {
    min-width: 34px;
    padding-inline: 6px;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

.heat-1 {
    background: #e7f3ee;
    color: var(--ink);
}

.heat-2 {
    background: #c3e3d4;
    color: var(--ink);
}

.heat-3 {
    background: #7fc1a5;
    color: var(--ink);
}

.heat-4 {
    background: var(--green);
    color: #fff;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.chip-list li {
    padding: 6px 12px;
    background: var(--green-soft);
    border-radius: 999px;
    font-size: 13px;
}

@media (max-width: 720px) {
    nav {
        justify-content: flex-start;
        column-gap: 16px;
        row-gap: 10px;
    }

    .statistics-grid,
    .stats-metrics {
        grid-template-columns: 1fr;
    }

    .year-filter {
        width: 100%;
    }

    .year-filter input {
        flex: 1;
    }

    .calendar-section {
        padding: 16px;
    }

    .calendar-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .calendar-controls input,
    .calendar-controls select {
        flex: 1;
        min-width: 120px;
    }

    .calendar-period-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .availability-panels {
        grid-template-columns: 1fr;
    }
}


.repeat-box { border: 1px solid var(--line, #d9e2dd); border-radius: 10px; padding: 14px 16px; margin: 14px 0 4px; }
.repeat-box legend { font-weight: 700; padding: 0 6px; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; }
.days-row { display: flex; flex-wrap: wrap; gap: 4px 0; }
.label-text { display: block; font-weight: 600; margin-bottom: 4px; }

/* Selector de socios personalizado con advertencia de turno en el mismo día */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.custom-dropdown-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.custom-dropdown-toggle {
    width: 100%;
    min-height: 42px;
    padding: 9px 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.custom-dropdown-toggle:hover:not(:disabled) {
    border-color: #b8c9c2;
}

.custom-dropdown-toggle:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(22, 116, 91, .15);
}

.custom-dropdown-toggle[aria-invalid="true"] {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(169, 50, 50, .15);
}

.custom-dropdown-toggle:disabled {
    opacity: .6;
    cursor: not-allowed;
    background: #f8faf9;
}

.custom-dropdown-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-dropdown-arrow {
    flex: 0 0 auto;
    font-size: 11px;
    color: var(--muted);
    transition: transform .15s ease;
}

.custom-dropdown-toggle[aria-expanded="true"] .custom-dropdown-arrow {
    transform: rotate(180deg);
}

.custom-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    box-shadow: 0 8px 24px rgba(23, 51, 45, .12);
    max-height: 250px;
    overflow-y: auto;
}

.custom-dropdown-menu[hidden] {
    display: none;
}

.custom-dropdown-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid var(--line);
    transition: background .12s ease;
}

.custom-dropdown-item:last-child {
    border-bottom: none;
}

.custom-dropdown-item:hover,
.custom-dropdown-item.is-active {
    background: var(--background);
}

.custom-dropdown-item.is-selected {
    background: var(--green-soft);
    font-weight: 600;
}

.custom-dropdown-item.is-selected:hover,
.custom-dropdown-item.is-selected.is-active {
    background: #d1fae5;
}

.custom-dropdown-item-text {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--ink);
    word-break: break-word;
}

.warning-badge-day,
.partner-warning-badge {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 11.5px;
    font-weight: 600;
    color: #c2410c;
    background-color: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    padding: 2px 8px;
    white-space: nowrap;
}


/* Colores diferenciados en previsualización de turno y paneles del inicio */
:root {
    --socio-color: #0f766e;
    --socio-bg: #f0fdfa;
    --socio-border: #99f6e4;
    --socio-accent: #0d9488;

    --domicilio-color: #1d4ed8;
    --domicilio-bg: #eff6ff;
    --domicilio-border: #bfdbfe;
    --domicilio-accent: #2563eb;

    --servicio-color: #6d28d9;
    --servicio-bg: #f5f3ff;
    --servicio-border: #ddd6fe;
    --servicio-accent: #7c3aed;

    --horario-color: #b45309;
    --horario-bg: #fffbeb;
    --horario-border: #fde68a;
    --horario-accent: #d97706;
}

.detail-title {
    margin: 0 0 12px;
    font-size: 18px;
    color: var(--ink);
}

.detail-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.detail-item {
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    border-left-width: 4px;
    font-size: 13.5px;
    line-height: 1.45;
}

.detail-item-label {
    font-weight: 700;
}

.detail-item-socio {
    color: var(--socio-color);
    background: var(--socio-bg);
    border-color: var(--socio-border);
    border-left-color: var(--socio-accent);
}

.detail-item-domicilio {
    color: var(--domicilio-color);
    background: var(--domicilio-bg);
    border-color: var(--domicilio-border);
    border-left-color: var(--domicilio-accent);
}

.detail-item-servicio {
    color: var(--servicio-color);
    background: var(--servicio-bg);
    border-color: var(--servicio-border);
    border-left-color: var(--servicio-accent);
}

.detail-item-horario {
    color: var(--horario-color);
    background: var(--horario-bg);
    border-color: var(--horario-border);
    border-left-color: var(--horario-accent);
}

.availability-card-socio {
    border-color: var(--socio-border);
    border-top: 3px solid var(--socio-accent);
    background: #fbfffe;
}

.availability-card-socio .availability-heading h3 {
    color: var(--socio-color);
}

.availability-card-socio .availability-heading > strong {
    color: var(--socio-color);
    background: var(--socio-bg);
    border: 1px solid var(--socio-border);
}

.availability-card-domicilio {
    border-color: var(--domicilio-border);
    border-top: 3px solid var(--domicilio-accent);
    background: #fcfdff;
}

.availability-card-domicilio .availability-heading h3 {
    color: var(--domicilio-color);
}

.availability-card-domicilio .availability-heading > strong {
    color: var(--domicilio-color);
    background: var(--domicilio-bg);
    border: 1px solid var(--domicilio-border);
}

.availability-list li.availability-item-socio,
.availability-list li.availability-item-domicilio {
    margin: 6px 0;
    padding: 8px 10px;
    border-radius: 7px;
    border: 1px solid transparent;
    border-left-width: 3px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.availability-list li.availability-item-socio {
    color: var(--socio-color);
    background: var(--socio-bg);
    border-color: var(--socio-border);
    border-left-color: var(--socio-accent);
}

.availability-list li.availability-item-domicilio {
    color: var(--domicilio-color);
    background: var(--domicilio-bg);
    border-color: var(--domicilio-border);
    border-left-color: var(--domicilio-accent);
}

.availability-text-socio {
    color: var(--socio-color);
    font-weight: 700;
}

.availability-tag-servicio {
    color: var(--servicio-color);
    background: var(--servicio-bg);
    border: 1px solid var(--servicio-border);
    padding: 1px 7px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 11px;
}

.availability-text-paciente {
    color: var(--ink);
    font-weight: 700;
}

.availability-text-domicilio {
    color: var(--domicilio-color);
    font-weight: 600;
}

.availability-sep {
    color: var(--muted);
}

@media (max-width: 720px) {
    .detail-items {
        grid-template-columns: 1fr;
    }
}


/* Login, sesión y gestión de cuentas y roles */
.header-session {
    display: flex;
    align-items: center;
    gap: 10px;
}

.session-badge {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--green-dark);
    background: var(--green-soft);
    padding: 5px 11px;
    border-radius: 999px;
    white-space: nowrap;
}

.logout-form {
    margin: 0;
}

.button-sm {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-wrapper {
    width: 100%;
    max-width: 430px;
}

.login-card {
    padding: 32px;
}

.login-brand {
    margin-bottom: 22px;
}

.login-brand .brand {
    display: inline-block;
    margin-bottom: 14px;
    font-size: 23px;
}

.login-brand h1 {
    margin: 6px 0 8px;
    font-size: 26px;
    letter-spacing: -0.6px;
}

.login-actions {
    justify-content: stretch;
}

.login-submit {
    width: 100%;
}

.badge-ok {
    background: var(--green-soft);
    color: var(--green-dark);
    font-weight: 600;
}

.role-create-card {
    margin-bottom: 24px;
}

.roles-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.role-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.role-card-header div {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.role-card-header .step-title {
    margin: 0;
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
    margin-top: 6px;
}

.permission-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
}

.permission-item:hover {
    border-color: var(--green);
    background: var(--green-soft);
}

.permission-item input[type="checkbox"],
.check-inline input[type="checkbox"] {
    width: 17px;
    height: 17px;
    min-height: 17px;
    margin: 2px 0 0;
    padding: 0;
    accent-color: var(--green);
    flex-shrink: 0;
}

@media (max-width: 720px) {
    .permissions-grid {
        grid-template-columns: 1fr;
    }

    .header-session {
        width: 100%;
        justify-content: space-between;
    }
}

.alert-info {
    color: #1c4e63;
    background: #eef7fb;
    border: 1px solid #c7e2ee;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.alert-info[hidden] {
    display: none !important;
}

.calendar-period-row {
    min-height: 28px;
}

.calendar-period-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.calendar-empty-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #1c4e63;
    background: #eef7fb;
    border: 1px solid #c7e2ee;
}

.calendar-empty-pill[hidden] {
    display: none !important;
}

.calendar-scroll {
    height: 640px;
    min-height: 640px;
    max-height: 640px;
    position: relative;
    scrollbar-gutter: stable;
    transition: opacity 0.14s ease;
}

.calendar-scroll.is-fetching {
    opacity: 0.68;
    pointer-events: none;
}

.month-grid {
    height: 100%;
    min-height: 620px;
    grid-template-rows: 36px repeat(6, minmax(96px, 1fr));
}

.month-day {
    min-height: 0;
    transition: background-color 0.12s ease;
}

.month-day.is-outside-month {
    background: #fafcfb;
}

.month-day.is-outside-month .month-day-number {
    color: #96aaa2;
}

.availability-list {
    min-height: 124px;
    max-height: 124px;
}

@keyframes calendarEnterNext {
    from {
        opacity: 0.35;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes calendarEnterPrev {
    from {
        opacity: 0.35;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes calendarEnterFade {
    from {
        opacity: 0.4;
        transform: scale(0.996);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.calendar-enter-next {
    animation: calendarEnterNext 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.calendar-enter-prev {
    animation: calendarEnterPrev 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.calendar-enter-fade {
    animation: calendarEnterFade 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
    .calendar-enter-next,
    .calendar-enter-prev,
    .calendar-enter-fade {
        animation: none;
    }
}


/* Marcación de entrada, salida y aclaraciones en turnos */
.today-shifts-card {
    padding: 24px 26px;
    margin-bottom: 24px;
    border-color: #c7dfd5;
    background: linear-gradient(180deg, #f9fcfa 0%, #ffffff 100%);
}

.today-shifts-header h2 {
    margin: 5px 0 6px;
    font-size: 20px;
}

.today-shifts-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 16px;
}

.today-shift-item {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.today-shift-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.today-shift-patient {
    font-size: 16px;
    color: var(--ink);
}

.today-shift-meta {
    font-size: 13.5px;
    color: var(--muted);
}

.marcacion-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.marcacion-pill {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 650;
}

.marcacion-pill[hidden],
.today-shift-item .button[hidden],
.marcacion-inline-msg[hidden] {
    display: none !important;
}

.marcacion-pill.is-ok {
    color: var(--green-dark);
    background: var(--green-soft);
    border: 1px solid #c3dfd3;
}

.marcacion-textarea {
    width: 100%;
    padding: 10px 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #d6e0db;
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
    resize: vertical;
}

.marcacion-textarea:focus {
    outline: 3px solid rgba(22, 116, 91, .13);
    border-color: var(--green);
}

.today-shift-note-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.marcacion-inline-msg {
    font-size: 13px;
    font-weight: 600;
    color: var(--green-dark);
}

.marcacion-inline-msg.is-error {
    color: var(--red);
}

.detail-item-aclaracion {
    grid-column: 1 / -1;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff9eb;
    border: 1px solid #f0dfa8;
}

.calendar-event-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.event-attendance-pill {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.35;
}

.event-attendance-pill.is-complete {
    background: rgba(255, 255, 255, 0.9);
    color: #0f5a46;
}

.event-attendance-pill.is-in-progress {
    background: #e6f4ff;
    color: #0f4c81;
}

.event-attendance-pill.is-note {
    background: #fff4d6;
    color: #8a5600;
}

.event-attendance-pill.is-holiday {
    background: #ede9fe;
    color: #5b21b6;
}

.tariff-matrix-table th,
.tariff-matrix-table td {
    vertical-align: middle;
}

.tariff-matrix-table input[type="number"] {
    width: 100%;
    min-width: 150px;
}

.tariff-mini-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 13px;
    line-height: 1.35;
}

.tariff-mini-label {
    color: var(--muted);
    margin-right: 4px;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.nav-dropdown-toggle {
    appearance: none;
    background: transparent;
    border: none;
    padding: 6px 4px;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 6px;
    transition: color 0.15s ease;
}

.nav-dropdown-toggle:hover,
.nav-dropdown.is-open .nav-dropdown-toggle {
    color: var(--green);
}

.nav-dropdown-caret {
    font-size: 11px;
    line-height: 1;
    transition: transform 0.15s ease;
}

.nav-dropdown:hover .nav-dropdown-caret,
.nav-dropdown.is-open .nav-dropdown-caret {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 195px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 10px 26px rgba(17, 45, 36, 0.12);
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 1000;
}

.nav-dropdown::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 8px;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.is-open .nav-dropdown-menu {
    display: flex;
}

.nav-dropdown-menu a {
    display: block;
    padding: 8px 12px;
    border-radius: 7px;
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
}

.nav-dropdown-menu a:hover {
    background: var(--green-soft);
    color: var(--green-dark);
}

/* Buscador indexado de Socios y Clientes */
.search-index-card {
    padding: 18px 20px;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.search-index-bar {
    display: grid;
    grid-template-columns: minmax(240px, 2fr) minmax(170px, 1fr) minmax(170px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.search-index-bar-clientes {
    grid-template-columns: minmax(260px, 1fr) auto;
}

.search-index-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.az-index-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.az-index-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.az-index-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
}

.az-pill {
    appearance: none;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--muted);
    border-radius: 6px;
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.14s ease;
}

.az-pill.has-items {
    color: var(--ink);
    border-color: #bfd8cc;
    background: #f6fbf8;
}

.az-pill:hover {
    border-color: var(--green);
    color: var(--green-dark);
}

.az-pill.is-active {
    background: var(--green);
    border-color: var(--green);
    color: #ffffff;
}

.search-index-counter {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.searchable-select-box {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.searchable-select-input {
    width: 100%;
    min-height: 34px !important;
    padding: 6px 86px 6px 10px !important;
    font-size: 13px !important;
    border: 1px dashed #9fc5b4 !important;
    border-radius: 7px !important;
    background: #f9fcfa !important;
}

.searchable-select-input:focus {
    border-style: solid !important;
    border-color: var(--green) !important;
    background: #ffffff !important;
}

.searchable-select-count {
    position: absolute;
    right: 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    pointer-events: none;
}

.table-card-header-search {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.table-card-header-search h3 {
    margin: 0;
}

.quick-table-search {
    max-width: 320px;
    min-height: 36px;
    padding: 6px 12px;
    font-size: 13px;
}

@media (max-width: 900px) {
    .search-index-bar,
    .search-index-bar-clientes {
        grid-template-columns: 1fr;
    }
    .quick-table-search {
        max-width: 100%;
    }
}

/* Módulo de Histórico de Asistencias */
.historico-mode-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 10px;
}

.historico-mode-tab {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 14px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: #fbfcfb;
    cursor: pointer;
    transition: all 0.15s ease;
}

.historico-mode-tab input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.historico-mode-tab span {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
}

.historico-mode-tab small {
    font-size: 11.5px;
    color: var(--muted);
}

.historico-mode-tab:hover {
    border-color: #9fc5b4;
    background: #f5fbf8;
}

.historico-mode-tab.is-active {
    border-color: var(--green);
    background: var(--green-soft);
    box-shadow: 0 2px 8px rgba(17, 94, 73, 0.08);
}

.historico-mode-tab.is-active span {
    color: var(--green-dark);
}

.historico-periodo-box {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcfb;
}

.historico-alcance-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.historico-alcance-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.14s ease;
}

.historico-alcance-option input[type="radio"] {
    width: auto;
    min-height: auto;
    margin: 0;
}

.historico-alcance-option.is-selected {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green-dark);
}
