/*
 * GOASS Components (gc-) — HTML + CSS puro, sin librerías.
 *
 * Tamaños: sm | md (por defecto) | lg.
 *   - Global:        <html data-gc-size="sm">  (o GC.size.set('sm'))
 *   - Por bloque:    <div data-gc-size="lg"> ... </div>
 *   - Por componente: prop `size` en Blade (agrega data-gc-size al root).
 */

/* ==========================================================================
   Tokens: colores, sombras y curvas viven en tokens.css (compartidos con el layout)
   ========================================================================== */

/* Escala de tamaño: md por defecto */
:root,
[data-gc-size="md"] {
    --gc-h: 38px;
    --gc-fs: 14px;
    --gc-fs-sm: 12.5px;
    --gc-px: 14px;
    --gc-gap: 8px;
    --gc-icon: 16px;
    --gc-radius: 8px;
    --gc-cell-py: 9px;
    --gc-cell-px: 12px;
}

[data-gc-size="sm"] {
    --gc-h: 30px;
    --gc-fs: 12.5px;
    --gc-fs-sm: 11.5px;
    --gc-px: 10px;
    --gc-gap: 6px;
    --gc-icon: 14px;
    --gc-radius: 6px;
    --gc-cell-py: 5px;
    --gc-cell-px: 9px;
}

[data-gc-size="lg"] {
    --gc-h: 46px;
    --gc-fs: 16px;
    --gc-fs-sm: 13.5px;
    --gc-px: 18px;
    --gc-gap: 10px;
    --gc-icon: 18px;
    --gc-radius: 10px;
    --gc-cell-py: 13px;
    --gc-cell-px: 16px;
}

/* ==========================================================================
   Base / utilidades
   ========================================================================== */
[class^="gc-"],
[class*=" gc-"],
[class^="gc-"]::before,
[class^="gc-"]::after,
[class*=" gc-"]::before,
[class*=" gc-"]::after {
    box-sizing: border-box;
}

/* `hidden` siempre gana sobre el display de los componentes */
[class^="gc-"][hidden],
[class*=" gc-"][hidden] {
    display: none !important;
}

.gc-sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.gc-icon {
    width: var(--gc-icon);
    height: var(--gc-icon);
    flex: none;
    display: inline-block;
    vertical-align: middle;
}

.gc-spinner {
    width: 1em;
    height: 1em;
    flex: none;
    display: inline-block;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: gc-spin 0.7s linear infinite;
}

@keyframes gc-spin { to { transform: rotate(360deg); } }
@keyframes gc-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes gc-rise-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes gc-pop { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes gc-shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-3px); }
    40%, 60% { transform: translateX(3px); }
}
@keyframes gc-ripple { to { transform: scale(1); opacity: 0; } }
@keyframes gc-shine { from { transform: translateX(-120%) skewX(-20deg); } to { transform: translateX(260%) skewX(-20deg); } }

/* ==========================================================================
   Botones
   ========================================================================== */
.gc-btn {
    /* Color (primary por defecto); las variantes sólo cambian estos tokens */
    --c: var(--gc-primary);
    --c-strong: var(--gc-primary-strong);
    --c-soft: var(--gc-primary-soft);
    --c-ink: var(--gc-primary-strong);
    --c-on: #fff;

    /* Relleno solid por defecto */
    --b: var(--c);
    --b-strong: var(--c-strong);
    --f: var(--c-on);
    --bd: transparent;

    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--gc-gap);
    height: var(--gc-h);
    padding: 0 var(--gc-px);
    margin: 0;
    border: 1px solid var(--bd);
    border-radius: var(--gc-radius);
    background: var(--b);
    color: var(--f);
    font-family: var(--gc-font);
    font-size: var(--gc-fs);
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.01em;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    vertical-align: middle;
    box-shadow: var(--gc-shadow-sm);
    transition: background-color 0.18s var(--gc-ease), border-color 0.18s var(--gc-ease),
        box-shadow 0.18s var(--gc-ease), transform 0.12s var(--gc-ease), color 0.18s var(--gc-ease);
}

/* Brillo superior (volumen) */
.gc-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 60%);
    pointer-events: none;
}

/* Barrido de luz al pasar el mouse */
.gc-btn::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 40%;
    z-index: -1;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
    transform: translateX(-120%) skewX(-20deg);
    pointer-events: none;
}

.gc-btn:hover {
    background: var(--b-strong);
    color: var(--f);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--gc-shadow-md);
}

.gc-btn:hover::after { animation: gc-shine 0.7s var(--gc-ease); }
.gc-btn:active { transform: translateY(0) scale(0.97); box-shadow: var(--gc-shadow-sm); }
.gc-btn:focus { outline: none; color: var(--f); text-decoration: none; }
.gc-btn:focus-visible { box-shadow: var(--gc-focus-ring), var(--gc-shadow-sm); }

.gc-btn[disabled],
.gc-btn.is-disabled,
.gc-btn.is-loading {
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.gc-btn[disabled]:not(.is-loading),
.gc-btn.is-disabled { opacity: 0.55; }
.gc-btn.is-loading { pointer-events: none; }
.gc-btn[disabled]::after,
.gc-btn.is-loading::after { animation: none; }

.gc-btn__spinner { display: none; }
.gc-btn.is-loading .gc-btn__spinner { display: inline-block; }
.gc-btn.is-loading .gc-btn__icon { display: none; }

.gc-btn__icon { display: inline-flex; }
.gc-btn__icon svg { width: var(--gc-icon); height: var(--gc-icon); }
.gc-btn--icon-end .gc-btn__icon { order: 2; }
.gc-btn--icon-only { width: var(--gc-h); padding: 0; }
.gc-btn--block { display: flex; width: 100%; }

.gc-ripple {
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.28;
    transform: scale(0);
    pointer-events: none;
    animation: gc-ripple 0.6s var(--gc-ease) forwards;
}

/*
 * Variante (color): primary (por defecto) o un color por nombre; cada una define sus tokens --c-*.
 *   --c / --c-strong: fondo sólido y hover · --c-on: texto sobre sólido
 *   --c-soft: fondo hover en outline/ghost · --c-ink: texto en outline/ghost · --c-line: borde outline
 */
.gc-btn--green { --c: var(--gc-green); --c-strong: var(--gc-green-strong); --c-soft: var(--gc-green-soft); --c-ink: var(--gc-green-strong); }
.gc-btn--blue { --c: var(--gc-blue); --c-strong: var(--gc-blue-strong); --c-soft: var(--gc-blue-soft); --c-ink: var(--gc-blue-strong); }
.gc-btn--lightblue { --c: var(--gc-lightblue); --c-strong: var(--gc-lightblue-strong); --c-soft: var(--gc-lightblue-soft); --c-ink: var(--gc-lightblue-strong); }
.gc-btn--red { --c: var(--gc-red); --c-strong: var(--gc-red-strong); --c-soft: var(--gc-red-soft); --c-ink: var(--gc-red-strong); }
.gc-btn--orange { --c: var(--gc-orange); --c-strong: var(--gc-orange-strong); --c-soft: var(--gc-orange-soft); --c-ink: #9a6200; --c-on: var(--gc-orange-ink); }
.gc-btn--black { --c: var(--gc-black); --c-strong: var(--gc-black-strong); --c-soft: var(--gc-surface-3); --c-ink: var(--gc-black); }

.gc-btn--white {
    --c: var(--gc-surface);
    --c-strong: var(--gc-surface-2);
    --c-soft: var(--gc-surface-3);
    --c-ink: var(--gc-text);
    --c-on: var(--gc-text);
    --c-line: var(--gc-border-strong);
    --bd: var(--gc-border);
}

/* Relleno (fill): solid es el por defecto; outline y ghost reutilizan los tokens del color */
.gc-btn--outline,
.gc-btn--ghost {
    --b: transparent;
    --b-strong: var(--c-soft);
    --f: var(--c-ink);
    box-shadow: none;
}

.gc-btn--outline { --bd: var(--c-line, var(--c)); }
.gc-btn--ghost { --bd: transparent; }

.gc-btn--outline::before,
.gc-btn--ghost::before,
.gc-btn--outline::after,
.gc-btn--ghost::after { display: none; }

.gc-btn--outline:hover,
.gc-btn--ghost:hover { box-shadow: none; }

/* ==========================================================================
   Campos de formulario
   ========================================================================== */
.gc-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    margin: 0 0 calc(var(--gc-gap) * 2);
    padding: 0;
    border: 0;
    font-family: var(--gc-font);
    font-size: var(--gc-fs);
    color: var(--gc-text);
}

.gc-field__label {
    display: block;
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    font-size: var(--gc-fs-sm);
    font-weight: 600;
    line-height: 1.3;
    color: var(--gc-text);
}

.gc-field__required { margin-left: 2px; color: var(--gc-red); }

.gc-field__help,
.gc-field__error {
    margin: 0;
    font-size: var(--gc-fs-sm);
    line-height: 1.35;
}

.gc-field__help { color: var(--gc-muted); }

.gc-field__error {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--gc-red-strong);
    animation: gc-rise-in 0.25s var(--gc-ease);
}

.gc-field__error svg { width: calc(var(--gc-icon) - 2px); height: calc(var(--gc-icon) - 2px); flex: none; }

.gc-control {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
    height: var(--gc-h);
    border: 1px solid var(--gc-border);
    border-radius: var(--gc-radius);
    background: var(--gc-surface);
    box-shadow: inset 0 1px 1px rgba(16, 32, 40, 0.03);
    transition: border-color 0.18s var(--gc-ease), box-shadow 0.18s var(--gc-ease), background-color 0.18s var(--gc-ease);
}

/* Línea animada al enfocar */
.gc-control::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: var(--gc-primary);
    transform: scaleX(0);
    transition: transform 0.3s var(--gc-ease);
    pointer-events: none;
}

.gc-control:hover { border-color: var(--gc-border-strong); }
.gc-control:focus-within { border-color: var(--gc-primary); box-shadow: var(--gc-focus-ring); }
.gc-control:focus-within::after { transform: scaleX(1); }

.gc-control__input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0 var(--gc-px);
    border: 0;
    border-radius: inherit;
    outline: 0;
    background: transparent;
    box-shadow: none;
    color: var(--gc-text);
    font-family: inherit;
    font-size: var(--gc-fs);
    line-height: normal;
}

.gc-control__input::placeholder { color: #9aa8af; opacity: 1; }
.gc-control__input[type="number"] { -moz-appearance: textfield; }

.gc-control__input[type="file"] {
    padding: 0 var(--gc-px) 0 4px;
    line-height: calc(var(--gc-h) - 2px);
    cursor: pointer;
}
.gc-control__input[type="file"]:focus { outline: 0; }
.gc-control__input[type="file"]::file-selector-button {
    height: calc(var(--gc-h) - 10px);
    margin-right: 10px;
    padding: 0 12px;
    border: 1px solid var(--gc-border);
    border-radius: calc(var(--gc-radius) - 2px);
    background: var(--gc-surface);
    color: var(--gc-text);
    font-family: inherit;
    font-size: var(--gc-fs);
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.18s var(--gc-ease), background-color 0.18s var(--gc-ease);
}
.gc-control__input[type="file"]:hover::file-selector-button { border-color: var(--gc-border-strong); }

select.gc-control__input {
    appearance: none;
    -webkit-appearance: none;
    padding-right: calc(var(--gc-px) + 22px);
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2366767f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right calc(var(--gc-px) - 2px) center;
    background-size: calc(var(--gc-icon) + 2px);
}

.gc-control__addon {
    display: inline-flex;
    align-items: center;
    flex: none;
    height: 100%;
    padding: 0 var(--gc-px);
    color: var(--gc-muted);
    font-size: var(--gc-fs);
    white-space: nowrap;
}

.gc-control__addon--start { padding-right: 0; }
.gc-control__addon--end { padding-left: 0; }
.gc-control__addon svg { width: var(--gc-icon); height: var(--gc-icon); }

.gc-control__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: calc(var(--gc-h) - 8px);
    height: calc(var(--gc-h) - 8px);
    margin-right: 4px;
    padding: 0;
    border: 0;
    border-radius: calc(var(--gc-radius) - 2px);
    background: transparent;
    color: var(--gc-muted);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, transform 0.15s;
}

.gc-control__button:hover { background: var(--gc-primary-soft); color: var(--gc-primary-strong); }
.gc-control__button:active { transform: scale(0.92); }
.gc-control__button:focus-visible { outline: 2px solid var(--gc-primary); outline-offset: 1px; }
.gc-control__button svg { width: var(--gc-icon); height: var(--gc-icon); }

.gc-control--number .gc-control__input { text-align: right; font-variant-numeric: tabular-nums; }

/* Estados */
.gc-field--invalid .gc-control { border-color: var(--gc-red); animation: gc-shake 0.4s; }
.gc-field--invalid .gc-control::after { background: var(--gc-red); }
.gc-field--invalid .gc-control:focus-within { box-shadow: 0 0 0 3px rgba(217, 68, 63, 0.2); }

.gc-control.is-disabled,
.gc-control:has(.gc-control__input:disabled) {
    background: var(--gc-surface-2);
    cursor: not-allowed;
    opacity: 0.7;
}

.gc-control__input:disabled { cursor: not-allowed; }
.gc-control:has(.gc-control__input[readonly]) { background: var(--gc-surface-2); }

/* Selector de fecha nativo oculto (se abre con showPicker) */
.gc-date__native {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    border: 0;
    padding: 0;
}

/* ==========================================================================
   Select buscable (combobox)
   ========================================================================== */
.gc-combo { position: relative; min-width: 0; }
.gc-combo__native { display: none !important; }

.gc-combo__toggle svg { transition: transform 0.2s var(--gc-ease); }
.gc-combo.is-open .gc-combo__toggle svg { transform: rotate(180deg); }

.gc-combo__list {
    position: absolute;
    z-index: 1060;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 264px;
    margin: 0;
    padding: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
    border: 1px solid var(--gc-border);
    border-radius: var(--gc-radius);
    background: var(--gc-surface);
    box-shadow: var(--gc-shadow-md);
    font-family: var(--gc-font);
    font-size: var(--gc-fs);
    transform-origin: top center;
    animation: gc-combo-in 0.16s var(--gc-ease);
}

.gc-combo--up .gc-combo__list { top: auto; bottom: calc(100% + 4px); transform-origin: bottom center; }

@keyframes gc-combo-in { from { opacity: 0; transform: translateY(-4px) scaleY(0.96); } }

.gc-combo__option {
    display: flex;
    align-items: center;
    gap: var(--gc-gap);
    min-height: calc(var(--gc-h) - 6px);
    padding: 4px calc(var(--gc-px) - 4px);
    border-radius: calc(var(--gc-radius) - 3px);
    color: var(--gc-text);
    cursor: pointer;
    transition: background-color 0.12s;
}

.gc-combo__option mark { padding: 0; background: rgba(240, 163, 38, 0.3); color: inherit; border-radius: 2px; }
.gc-combo__option.is-active { background: var(--gc-primary-soft); }
.gc-combo__option[aria-selected="true"] { font-weight: 600; color: var(--gc-primary-strong); }
.gc-combo__option[aria-disabled="true"] { color: #a5b1b7; cursor: not-allowed; }

.gc-combo__check { width: var(--gc-icon); height: var(--gc-icon); flex: none; margin-left: auto; opacity: 0; }
.gc-combo__option[aria-selected="true"] .gc-combo__check { opacity: 1; animation: gc-pop 0.25s; }

.gc-combo__empty,
.gc-combo__more {
    padding: 10px calc(var(--gc-px) - 4px);
    color: var(--gc-muted);
    font-size: var(--gc-fs-sm);
    text-align: center;
    cursor: default;
}

.gc-combo__more { border-top: 1px dashed var(--gc-border); }

/* ==========================================================================
   Radios, checks y switches
   ========================================================================== */
.gc-choices {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    gap: calc(var(--gc-gap) / 2) calc(var(--gc-gap) * 2.5);
    min-height: var(--gc-h);
}

.gc-choices--vertical { flex-direction: column; align-items: flex-start; min-height: 0; }

.gc-choice {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--gc-gap);
    margin: 0;
    padding: 2px 0;
    font-size: var(--gc-fs);
    font-weight: 400;
    line-height: 1.3;
    color: var(--gc-text);
    cursor: pointer;
    user-select: none;
}

.gc-choice__input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

.gc-choice__mark {
    --s: calc(var(--gc-icon) + 2px);
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: none;
    width: var(--s);
    height: var(--s);
    border: 1.5px solid var(--gc-border-strong);
    border-radius: 5px;
    background: var(--gc-surface);
    transition: background-color 0.18s var(--gc-ease), border-color 0.18s var(--gc-ease), box-shadow 0.18s var(--gc-ease);
}

.gc-choice__mark::after {
    content: "";
    width: 50%;
    height: 28%;
    margin-top: -2px;
    border: solid #fff;
    border-width: 0 0 2px 2px;
    transform: rotate(-45deg) scale(0);
    transition: transform 0.22s var(--gc-spring);
}

.gc-choice:hover .gc-choice__mark { border-color: var(--gc-primary); }
.gc-choice__input:focus-visible + .gc-choice__mark { box-shadow: var(--gc-focus-ring); }

.gc-choice__input:checked + .gc-choice__mark {
    border-color: var(--gc-primary);
    background: var(--gc-primary);
    animation: gc-pop 0.28s var(--gc-ease);
}

.gc-choice__input:checked + .gc-choice__mark::after { transform: rotate(-45deg) scale(1); }

/* Radio */
.gc-choice__input[type="radio"] + .gc-choice__mark { border-radius: 50%; }

.gc-choice__input[type="radio"] + .gc-choice__mark::after {
    width: 42%;
    height: 42%;
    margin: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    transform: scale(0);
}

.gc-choice__input[type="radio"]:checked + .gc-choice__mark::after { transform: scale(1); }

/* Switch */
.gc-choices--switch .gc-choice__mark {
    width: calc(var(--s) * 1.85);
    border: 0;
    border-radius: 999px;
    background: var(--gc-border-strong);
    place-items: center start;
}

.gc-choices--switch .gc-choice__mark::after {
    width: calc(var(--s) - 4px);
    height: calc(var(--s) - 4px);
    margin: 0 0 0 2px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transform: translateX(0);
    transition: transform 0.25s var(--gc-spring);
}

.gc-choices--switch .gc-choice__input:checked + .gc-choice__mark { background: var(--gc-primary); animation: none; }
.gc-choices--switch .gc-choice__input:checked + .gc-choice__mark::after { transform: translateX(calc(var(--s) * 0.85)); }

.gc-choice:has(.gc-choice__input:disabled) { opacity: 0.55; cursor: not-allowed; }
.gc-field--invalid .gc-choice__mark { border-color: var(--gc-red); }

/* ==========================================================================
   Tabla
   ========================================================================== */
.gc-table {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--gc-border);
    border-radius: calc(var(--gc-radius) + 2px);
    background: var(--gc-surface);
    box-shadow: var(--gc-shadow-sm);
    font-family: var(--gc-font);
    font-size: var(--gc-fs);
    color: var(--gc-text);
}

.gc-table__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gc-gap);
    padding: calc(var(--gc-gap) * 1.5);
    border-bottom: 1px solid var(--gc-border);
}

.gc-table__title { margin: 0 auto 0 0; font-size: calc(var(--gc-fs) + 2px); font-weight: 700; }
/* El buscador queda siempre a la derecha, haya o no título/herramientas */
.gc-table__search { flex: 0 1 280px; min-width: 160px; margin-left: auto; }
.gc-table__search .gc-control { width: 100%; }
.gc-table__tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gc-gap); }

/* Barra de selección / acciones masivas */
.gc-table__bulk {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gc-gap);
    padding: calc(var(--gc-gap)) calc(var(--gc-gap) * 1.5);
    border-bottom: 1px solid var(--gc-border);
    background: var(--gc-surface-2);
    font-size: var(--gc-fs-sm);
    transition: background-color 0.25s var(--gc-ease);
}

.gc-table__bulk.has-selection { background: var(--gc-primary-soft); }
.gc-table__bulk-count { font-weight: 600; margin-right: auto; }
.gc-table__bulk-count strong { color: var(--gc-primary-strong); }
.gc-table__bulk-actions { display: flex; flex-wrap: wrap; gap: var(--gc-gap); }
.gc-table__bulk-actions[hidden],
.gc-table__bulk [data-gc-when-selected][hidden] { display: none; }
.gc-table__bulk.has-selection [data-gc-when-selected] { animation: gc-rise-in 0.22s var(--gc-ease); }

.gc-table__body {
    position: relative;
    min-height: 120px;
}

.gc-table__scroll {
    max-width: 100%;
    max-height: var(--gc-table-max-h, 480px);
    overflow: auto;
    overscroll-behavior: contain;
}

.gc-table__table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
    font-variant-numeric: tabular-nums;
}

.gc-table__table th,
.gc-table__table td {
    padding: var(--gc-cell-py) var(--gc-cell-px);
    border: 0;
    border-bottom: 1px solid var(--gc-surface-3);
    text-align: left;
    vertical-align: middle;
    line-height: 1.35;
    white-space: nowrap;
}

.gc-table__table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--gc-surface-2);
    border-bottom: 1px solid var(--gc-border);
    color: var(--gc-muted);
    font-size: var(--gc-fs-sm);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* Alineación por columna (col.align): left por defecto, center, right. Checks y acciones siempre centrados. */
.gc-table__table .is-right { text-align: right; }
.gc-table__table .is-center { text-align: center; }
.gc-table__table .gc-table__cell--muted { color: #a5b1b7; }

.gc-table__sort {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
    transition: color 0.15s;
}

.gc-table__sort:hover,
th[aria-sort="ascending"] .gc-table__sort,
th[aria-sort="descending"] .gc-table__sort { color: var(--gc-text); }
.gc-table__sort:focus-visible { outline: 2px solid var(--gc-primary); outline-offset: 2px; border-radius: 3px; }
.is-right .gc-table__sort { flex-direction: row-reverse; }

.gc-table__sort-icon {
    display: inline-flex;
    flex-direction: column;
    width: 8px;
    gap: 2px;
}

.gc-table__sort-icon::before,
.gc-table__sort-icon::after {
    content: "";
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.3;
    transition: opacity 0.15s, transform 0.2s var(--gc-spring);
}

.gc-table__sort-icon::before { border-bottom: 4px solid currentColor; }
.gc-table__sort-icon::after { border-top: 4px solid currentColor; }
th[aria-sort="ascending"] .gc-table__sort-icon::before { opacity: 1; color: var(--gc-primary); transform: translateY(-1px); }
th[aria-sort="descending"] .gc-table__sort-icon::after { opacity: 1; color: var(--gc-primary); transform: translateY(1px); }

.gc-table__table tbody tr {
    transition: background-color 0.15s;
    animation: gc-rise-in 0.3s var(--gc-ease) both;
    animation-delay: calc(var(--i, 0) * 18ms);
}

.gc-table__table tbody tr:hover { background: #f7fbf8; }
.gc-table__table tbody tr.is-selected { background: var(--gc-primary-soft); }
.gc-table__table tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--gc-primary); }
.gc-table__table tbody tr:last-child td { border-bottom: 0; }

.gc-table__check { width: 1%; padding-right: 0 !important; text-align: center !important; }
.gc-table__check .gc-choice { padding: 0; }

.gc-table__actions-col {
    position: sticky;
    right: 0;
    width: 1%;
    text-align: center !important;
    background: var(--gc-surface);
    box-shadow: -8px 0 8px -8px rgba(16, 32, 40, 0.15);
}

thead .gc-table__actions-col { z-index: 3; background: var(--gc-surface-2); }

/* actions-align="left" | "right": acciones alineadas aunque cada fila tenga distinta cantidad */
.gc-table--actions-left .gc-table__actions-col { text-align: left !important; }
.gc-table--actions-right .gc-table__actions-col { text-align: right !important; }

/* Grilla (.gc-table--grid, por defecto en Blade): bordes entre columnas */
.gc-table--grid .gc-table__table th,
.gc-table--grid .gc-table__table td { border-right: 1px solid var(--gc-surface-3); }
.gc-table--grid .gc-table__table thead th { border-right-color: var(--gc-border); }
.gc-table--grid .gc-table__table th:last-child,
.gc-table--grid .gc-table__table td:last-child,
.gc-table--grid .gc-table__table :is(th, td):has(+ .gc-table__actions-col) { border-right: 0; }
.gc-table--grid .gc-table__table .gc-table__check { padding-right: var(--gc-cell-px) !important; }
/* La columna de acciones fija lleva su propio borde izquierdo en lugar de la sombra */
.gc-table--grid .gc-table__actions-col { border-left: 1px solid var(--gc-surface-3); box-shadow: none; }
.gc-table--grid thead .gc-table__actions-col { border-left-color: var(--gc-border); }

/* Color por fila (row._tone): fondo suave + acento a la izquierda */
.gc-table__table tbody tr[class*="gc-table__row--"] { background: var(--row-bg); }
.gc-table__table tbody tr[class*="gc-table__row--"] td:first-child { box-shadow: inset 3px 0 0 var(--row-accent); }
.gc-table__table tbody tr[class*="gc-table__row--"]:hover { background: var(--row-bg-hover); }
.gc-table__table tbody tr[class*="gc-table__row--"] .gc-table__actions-col { background: var(--row-bg); }
.gc-table__table tbody tr[class*="gc-table__row--"]:hover .gc-table__actions-col { background: var(--row-bg-hover); }
.gc-table__row--red { --row-bg: #fdf0ef; --row-bg-hover: #fbe3e1; --row-accent: var(--gc-red); }
.gc-table__row--orange { --row-bg: #fef8ea; --row-bg-hover: #fdf0d3; --row-accent: var(--gc-orange); }
.gc-table__row--green { --row-bg: #effbf7; --row-bg-hover: #dff6ee; --row-accent: var(--gc-green); }
.gc-table__row--blue { --row-bg: #eef4fa; --row-bg-hover: #e1ecf7; --row-accent: var(--gc-blue); }
.gc-table__row--lightblue { --row-bg: #eef6fd; --row-bg-hover: #e0effb; --row-accent: var(--gc-lightblue); }
.gc-table__row--black { --row-bg: var(--gc-surface-2); --row-bg-hover: var(--gc-surface-3); --row-accent: var(--gc-black); }

/* Etiqueta junto al valor (col.tagKey) */
.gc-table__tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(29, 43, 51, 0.08);
    color: var(--gc-muted);
    font-size: calc(var(--gc-fs-sm) - 1px);
    font-weight: 600;
    line-height: 1.5;
    vertical-align: 1px;
}

/* Columnas con minWidth/maxWidth: el título puede ir en dos líneas y el contenido se recorta con "…" */
.gc-table__table th.gc-table__th--sized { white-space: normal; }
.gc-table__table th.gc-table__th--sized .gc-table__sort { text-align: inherit; }
.gc-table__cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-table__filters th.gc-table__th--sized .gc-control { min-width: 0; }

/* Acciones renderizadas como link (action.href) */
a.gc-btn { text-decoration: none; }

/* Fila de filtros por columna (sticky debajo de los títulos) */
.gc-table__table thead .gc-table__filters th {
    top: var(--gc-table-head-h, 0px);
    padding-top: 6px;
    padding-bottom: 6px;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
}
.gc-table__filters .gc-control { --gc-h: calc(var(--gc-h-row, 28px)); min-width: 90px; }
.gc-table__filters .gc-control__input { padding: 0 8px; font-size: var(--gc-fs-sm); }
.gc-table__filters .is-right .gc-control__input { text-align: right; }
.gc-table__filters .is-center .gc-control__input { text-align: center; }
tr:hover .gc-table__actions-col { background: #f7fbf8; }
tr.is-selected .gc-table__actions-col { background: var(--gc-primary-soft); }

.gc-table__row-actions { display: inline-flex; gap: 4px; }
.gc-table__row-actions .gc-btn { --gc-h: calc(var(--gc-h-row, 28px)); }

[data-gc-size="sm"] .gc-table__row-actions .gc-btn,
.gc-table[data-gc-size="sm"] .gc-table__row-actions .gc-btn { --gc-h-row: 24px; }
[data-gc-size="lg"] .gc-table__row-actions .gc-btn,
.gc-table[data-gc-size="lg"] .gc-table__row-actions .gc-btn { --gc-h-row: 34px; }

/* Estados internos */
.gc-table__loading {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(1px);
    animation: gc-fade-in 0.2s var(--gc-ease);
}

.gc-table__loading[hidden] { display: none; }

.gc-table__loading-card {
    display: inline-flex;
    align-items: center;
    gap: var(--gc-gap);
    padding: 8px 14px;
    border: 1px solid var(--gc-border);
    border-radius: 999px;
    background: var(--gc-surface);
    box-shadow: var(--gc-shadow-md);
    color: var(--gc-muted);
    font-size: var(--gc-fs-sm);
    font-weight: 600;
}

.gc-table__loading-card img { width: 28px; height: 28px; object-fit: contain; }

.gc-table__state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--gc-gap);
    padding: calc(var(--gc-gap) * 5) var(--gc-px);
    color: var(--gc-muted);
    text-align: center;
    animation: gc-rise-in 0.3s var(--gc-ease);
}

.gc-table__state[hidden] { display: none; }
/* Sólo el ícono grande del estado (no los íconos de botones como "Reintentar") */
.gc-table__state > svg { width: 44px; height: 44px; color: var(--gc-border-strong); }
.gc-table__state-title { margin: 0; color: var(--gc-text); font-weight: 600; }
.gc-table__state--error > svg { color: var(--gc-red); }

/* Pie / paginación */
.gc-table__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--gc-gap);
    padding: var(--gc-gap) calc(var(--gc-gap) * 1.5);
    border-top: 1px solid var(--gc-border);
    color: var(--gc-muted);
    font-size: var(--gc-fs-sm);
}

.gc-table__per-page { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }
.gc-table__per-page .gc-control { --gc-h: calc(var(--gc-h) - 6px); width: auto; }
.gc-table__per-page select.gc-control__input { padding-left: 8px; font-size: var(--gc-fs-sm); }

.gc-pager { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 3px; margin: 0; padding: 0; list-style: none; }

.gc-pager__btn {
    min-width: calc(var(--gc-h) - 6px);
    height: calc(var(--gc-h) - 6px);
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: calc(var(--gc-radius) - 2px);
    background: transparent;
    color: var(--gc-text);
    font-family: inherit;
    font-size: var(--gc-fs-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, transform 0.15s, color 0.15s;
}

.gc-pager__btn:hover:not(:disabled) { background: var(--gc-surface-3); }
.gc-pager__btn:active:not(:disabled) { transform: scale(0.92); }
.gc-pager__btn:focus-visible { outline: 2px solid var(--gc-primary); outline-offset: 1px; }
.gc-pager__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.gc-pager__btn svg { width: 14px; height: 14px; vertical-align: middle; }

.gc-pager__btn[aria-current="page"] {
    background: var(--gc-primary);
    color: #fff;
    box-shadow: 0 3px 8px rgba(1, 199, 142, 0.4);
    animation: gc-pop 0.3s var(--gc-ease);
}

.gc-pager__gap { padding: 0 4px; color: var(--gc-muted); }

/* ==========================================================================
   Modales y alertas
   ========================================================================== */
.gc-modal {
    --gc-modal-w: 560px;
    width: calc(100% - 32px);
    max-width: var(--gc-modal-w);
    max-height: calc(100vh - 48px);
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: calc(var(--gc-radius) + 6px);
    background: var(--gc-surface);
    box-shadow: var(--gc-shadow-lg);
    color: var(--gc-text);
    font-family: var(--gc-font);
    font-size: var(--gc-fs);
    overflow: hidden;
}

.gc-modal--sm { --gc-modal-w: 420px; }
.gc-modal--lg { --gc-modal-w: 820px; }
.gc-modal--xl { --gc-modal-w: 1100px; }

.gc-modal::backdrop {
    background: rgba(20, 34, 42, 0.45);
    backdrop-filter: blur(3px);
}

.gc-modal[open] { animation: gc-modal-in 0.28s var(--gc-spring); }
.gc-modal[open]::backdrop { animation: gc-fade-in 0.2s ease; }
.gc-modal.is-closing { animation: gc-modal-out 0.18s ease forwards; }
.gc-modal.is-closing::backdrop { animation: gc-fade-in 0.18s ease reverse forwards; }
.gc-modal.is-shaking { animation: gc-shake 0.35s; }

@keyframes gc-modal-in { from { opacity: 0; transform: translateY(14px) scale(0.95); } }
@keyframes gc-modal-out { to { opacity: 0; transform: translateY(8px) scale(0.97); } }

.gc-modal__panel {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 48px);
}

.gc-modal__header {
    display: flex;
    align-items: flex-start;
    gap: calc(var(--gc-gap) * 1.5);
    padding: calc(var(--gc-px) * 1.4) calc(var(--gc-px) * 1.4) var(--gc-gap);
}

.gc-modal__icon {
    display: grid;
    place-items: center;
    flex: none;
    width: calc(var(--gc-h) + 4px);
    height: calc(var(--gc-h) + 4px);
    border-radius: 50%;
    animation: gc-pop 0.45s 0.1s var(--gc-ease) both;
}

.gc-modal__icon svg { width: calc(var(--gc-icon) + 6px); height: calc(var(--gc-icon) + 6px); }
.gc-modal--info .gc-modal__icon { background: var(--gc-lightblue-soft); color: var(--gc-lightblue); }
.gc-modal--success .gc-modal__icon { background: var(--gc-green-soft); color: var(--gc-green); }
.gc-modal--warning .gc-modal__icon { background: var(--gc-orange-soft); color: var(--gc-orange-strong); }
.gc-modal--danger .gc-modal__icon { background: var(--gc-red-soft); color: var(--gc-red); }

.gc-modal__heading { flex: 1; min-width: 0; padding-top: 2px; }
.gc-modal__title { margin: 0; font-size: calc(var(--gc-fs) + 4px); font-weight: 700; line-height: 1.3; color: var(--gc-text); }
.gc-modal__description { margin: 4px 0 0; color: var(--gc-muted); line-height: 1.5; }

.gc-modal__close {
    flex: none;
    width: 32px;
    height: 32px;
    margin: -4px -6px 0 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--gc-muted);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, transform 0.25s var(--gc-ease);
}

.gc-modal__close:hover { background: var(--gc-surface-3); color: var(--gc-text); transform: rotate(90deg); }
.gc-modal__close:focus-visible { outline: 2px solid var(--gc-primary); outline-offset: 1px; }
.gc-modal__close svg { width: 18px; height: 18px; vertical-align: middle; }

.gc-modal__body {
    padding: var(--gc-gap) calc(var(--gc-px) * 1.4);
    overflow: auto;
    line-height: 1.5;
}

.gc-modal__body:empty { display: none; }

.gc-modal__footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--gc-gap);
    padding: var(--gc-px) calc(var(--gc-px) * 1.4) calc(var(--gc-px) * 1.4);
}

.gc-modal__footer:empty { display: none; }

/* ==========================================================================
   Toasts
   ========================================================================== */
.gc-toasts {
    position: fixed;
    z-index: 2100;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
    font-family: var(--gc-font);
}

.gc-toasts--top-center { right: auto; left: 50%; transform: translateX(-50%); }
.gc-toasts--bottom-right { top: auto; bottom: 16px; flex-direction: column-reverse; }
.gc-toasts--bottom-center { top: auto; bottom: 16px; right: auto; left: 50%; transform: translateX(-50%); flex-direction: column-reverse; }

.gc-toast {
    --t: var(--gc-lightblue);
    --t-soft: var(--gc-lightblue-soft);
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 12px 14px 14px;
    overflow: hidden;
    border: 1px solid var(--gc-border);
    border-left: 4px solid var(--t);
    border-radius: var(--gc-radius);
    background: var(--gc-surface);
    box-shadow: var(--gc-shadow-md);
    color: var(--gc-text);
    font-size: var(--gc-fs);
    pointer-events: auto;
    animation: gc-toast-in 0.42s var(--gc-spring);
}

.gc-toasts--top-center .gc-toast,
.gc-toasts--bottom-center .gc-toast { animation-name: gc-toast-in-y; }

.gc-toast.is-leaving { animation: gc-toast-out 0.3s var(--gc-ease) forwards; }
.gc-toast.is-bumped { animation: gc-pop 0.3s var(--gc-ease); }

@keyframes gc-toast-in { from { opacity: 0; transform: translateX(110%); } }
@keyframes gc-toast-in-y { from { opacity: 0; transform: translateY(-120%); } }
@keyframes gc-toast-out { to { opacity: 0; transform: translateX(40%); margin-top: var(--gc-leave-mt, -60px); } }

.gc-toast--success { --t: var(--gc-green); --t-soft: var(--gc-green-soft); }
.gc-toast--error { --t: var(--gc-red); --t-soft: var(--gc-red-soft); }
.gc-toast--warning { --t: var(--gc-orange-strong); --t-soft: var(--gc-orange-soft); }
.gc-toast--info { --t: var(--gc-lightblue); --t-soft: var(--gc-lightblue-soft); }

.gc-toast--basic {
    --t: #000;
    border-color: #000;
    background: #111;
    color: #fff;
}

.gc-toast__icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--t-soft);
    color: var(--t);
}

.gc-toast__icon svg { width: 18px; height: 18px; }
.gc-toast__content { flex: 1; min-width: 0; padding-top: 4px; }
.gc-toast__title { margin: 0 0 2px; font-weight: 700; line-height: 1.3; }
.gc-toast__message { margin: 0; line-height: 1.4; overflow-wrap: anywhere; }
.gc-toast--basic .gc-toast__content { padding-top: 0; }

.gc-toast__count {
    display: inline-block;
    min-width: 20px;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--t);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    vertical-align: 1px;
}

.gc-toast__count[hidden] { display: none; }

.gc-toast__close {
    flex: none;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    opacity: 0.55;
    cursor: pointer;
    transition: opacity 0.15s, background-color 0.15s, transform 0.25s var(--gc-ease);
}

.gc-toast__close:hover { opacity: 1; background: rgba(127, 127, 127, 0.15); transform: rotate(90deg); }
.gc-toast__close:focus-visible { opacity: 1; outline: 2px solid var(--t); }
.gc-toast--basic .gc-toast__close:focus-visible { outline-color: #fff; }
.gc-toast__close svg { width: 16px; height: 16px; vertical-align: middle; }

.gc-toast__progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--t);
    opacity: 0.55;
    transform-origin: left center;
    animation: gc-toast-progress linear forwards;
    animation-duration: var(--gc-toast-duration, 5000ms);
}

.gc-toast--basic .gc-toast__progress { background: #fff; opacity: 0.4; }
.gc-toast:hover .gc-toast__progress,
.gc-toast:focus-within .gc-toast__progress { animation-play-state: paused; }

@keyframes gc-toast-progress { to { transform: scaleX(0); } }

/* ==========================================================================
   Selector de tamaño
   ========================================================================== */
.gc-segmented {
    position: relative;
    display: inline-flex;
    padding: 3px;
    border-radius: calc(var(--gc-radius) + 2px);
    background: var(--gc-surface-3);
    font-family: var(--gc-font);
}

.gc-segmented__btn {
    position: relative;
    z-index: 1;
    min-width: calc(var(--gc-h) + 4px);
    height: calc(var(--gc-h) - 6px);
    padding: 0 10px;
    border: 0;
    border-radius: var(--gc-radius);
    background: transparent;
    color: var(--gc-muted);
    font-family: inherit;
    font-size: var(--gc-fs-sm);
    font-weight: 700;
    cursor: pointer;
    transition: color 0.2s, background-color 0.25s var(--gc-ease), box-shadow 0.25s var(--gc-ease);
}

.gc-segmented__btn:hover { color: var(--gc-text); }
.gc-segmented__btn[aria-pressed="true"] { background: var(--gc-surface); color: var(--gc-primary-strong); box-shadow: var(--gc-shadow-sm); }
.gc-segmented__btn:focus-visible { outline: 2px solid var(--gc-primary); outline-offset: 1px; }

/* Overlay global existente (layouts/loadingOverlay). Base duplicada de goass.scss (mismos valores)
   para que <x-loading> se vea bien en páginas sin layouts.app, como el login. */
.overlay.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(26, 43, 53, 0.3);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.loading-overlay__card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    max-width: calc(100vw - 2rem);
    padding: 1rem 1.4rem;
    border: 1px solid rgba(91, 158, 97, 0.28);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 34px rgba(21, 39, 49, 0.2);
    color: #31533a;
    font-family: var(--gc-font);
    font-size: 1rem;
    font-weight: 600;
}
.loading-overlay__icon { width: 48px; height: 48px; flex: 0 0 48px; object-fit: contain; }
.loading-overlay__text { overflow-wrap: anywhere; }

/* Animación de entrada */
.loading-overlay.gc-loading-visible { animation: gc-fade-in 0.18s ease; }
.loading-overlay.gc-loading-visible .loading-overlay__card { animation: gc-modal-in 0.3s var(--gc-spring); }

/* ==========================================================================
   Encabezado de pantalla
   ========================================================================== */
.gc-page-header {
    --c: var(--gc-primary);
    --c-strong: var(--gc-primary-strong);
    --c-soft: var(--gc-primary-soft);

    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: calc(var(--gc-gap) * 2);
    margin: 0 0 calc(var(--gc-gap) * 3);
    padding: calc(var(--gc-gap) * 1.5) 0 calc(var(--gc-gap) * 2.5);
    font-family: var(--gc-font);
    color: var(--gc-text);
    animation: gc-rise-in 0.4s var(--gc-ease) both;
}

.gc-page-header--green { --c: var(--gc-green); --c-strong: var(--gc-green-strong); --c-soft: var(--gc-green-soft); }
.gc-page-header--blue { --c: var(--gc-blue); --c-strong: var(--gc-blue-strong); --c-soft: var(--gc-blue-soft); }
.gc-page-header--lightblue { --c: var(--gc-lightblue); --c-strong: var(--gc-lightblue-strong); --c-soft: var(--gc-lightblue-soft); }
.gc-page-header--red { --c: var(--gc-red); --c-strong: var(--gc-red-strong); --c-soft: var(--gc-red-soft); }
.gc-page-header--orange { --c: var(--gc-orange); --c-strong: var(--gc-orange-strong); --c-soft: var(--gc-orange-soft); }
.gc-page-header--black { --c: var(--gc-black); --c-strong: var(--gc-black-strong); --c-soft: var(--gc-surface-3); }

/* Divisoria con acento de color que se dibuja al entrar */
.gc-page-header::before,
.gc-page-header::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 1px;
    pointer-events: none;
}
.gc-page-header::before { right: 0; background: var(--gc-border); }
.gc-page-header::after {
    width: 96px;
    height: 3px;
    bottom: -1px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--c), var(--c-strong));
    transform-origin: left;
    animation: gc-page-header-line 0.7s 0.15s var(--gc-ease) both;
}

@keyframes gc-page-header-line {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.gc-page-header__icon {
    position: relative;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--gc-h) + 14px);
    height: calc(var(--gc-h) + 14px);
    border-radius: calc(var(--gc-radius) + 6px);
    background: linear-gradient(135deg, var(--c), var(--c-strong));
    color: #fff;
    box-shadow: 0 8px 20px -6px var(--c), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    animation: gc-modal-in 0.5s var(--gc-spring) both;
}
.gc-page-header__icon svg { width: calc(var(--gc-icon) + 8px); height: calc(var(--gc-icon) + 8px); }

.gc-page-header__heading { flex: 1 1 260px; min-width: 0; }
.gc-page-header__eyebrow {
    margin: 0 0 2px;
    color: var(--c-strong);
    font-size: var(--gc-fs-sm);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.gc-page-header__title {
    margin: 0;
    font-family: inherit;
    font-size: calc(var(--gc-fs) * 1.7);
    font-weight: 750;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--gc-text);
}
.gc-page-header__subtitle { margin: 4px 0 0; color: var(--gc-muted); font-size: var(--gc-fs); line-height: 1.4; }

.gc-page-header__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gc-gap); }

/* ==========================================================================
   Panel
   Tamaño (sm | md | lg): la fuente y el alto de cabecera salen de --gc-fs y --gc-h.
   ========================================================================== */
.gc-panel {
    /* Mismos tokens de color que los botones */
    --c: var(--gc-primary);
    --c-strong: var(--gc-primary-strong);
    --c-soft: var(--gc-primary-soft);
    --c-ink: var(--gc-primary-strong);
    --c-on: #fff;

    /* Cabecera solid por defecto */
    --head-bg: linear-gradient(180deg, var(--c), var(--c-strong));
    --head-fg: var(--c-on);
    --head-icon-bg: rgba(255, 255, 255, 0.18);
    --head-icon-fg: var(--c-on);
    --head-border: transparent;

    display: flex;
    flex-direction: column;
    min-width: 0;
    margin: 0 0 calc(var(--gc-gap) * 2);
    border: 1px solid var(--gc-border);
    border-radius: calc(var(--gc-radius) + 2px);
    background: var(--gc-surface);
    box-shadow: var(--gc-shadow-sm);
    font-family: var(--gc-font);
    font-size: var(--gc-fs);
    color: var(--gc-text);
    overflow: hidden;
}

.gc-panel--green { --c: var(--gc-green); --c-strong: var(--gc-green-strong); --c-soft: var(--gc-green-soft); --c-ink: var(--gc-green-strong); }
.gc-panel--blue { --c: var(--gc-blue); --c-strong: var(--gc-blue-strong); --c-soft: var(--gc-blue-soft); --c-ink: var(--gc-blue-strong); }
.gc-panel--lightblue { --c: var(--gc-lightblue); --c-strong: var(--gc-lightblue-strong); --c-soft: var(--gc-lightblue-soft); --c-ink: var(--gc-lightblue-strong); }
.gc-panel--red { --c: var(--gc-red); --c-strong: var(--gc-red-strong); --c-soft: var(--gc-red-soft); --c-ink: var(--gc-red-strong); }
.gc-panel--orange { --c: var(--gc-orange); --c-strong: var(--gc-orange-strong); --c-soft: var(--gc-orange-soft); --c-ink: #9a6200; --c-on: var(--gc-orange-ink); }
.gc-panel--black { --c: var(--gc-black); --c-strong: var(--gc-black-strong); --c-soft: var(--gc-surface-3); --c-ink: var(--gc-black); }
.gc-panel--white {
    --c: var(--gc-surface);
    --c-strong: var(--gc-surface-2);
    --c-soft: var(--gc-surface-3);
    --c-ink: var(--gc-text);
    --c-on: var(--gc-text);
    --head-icon-bg: var(--gc-surface-3);
    --head-border: var(--gc-border);
}

/* fill: soft (fondo suave con acento) y outline (blanca con borde superior de color) */
.gc-panel--soft {
    --head-bg: var(--c-soft);
    --head-fg: var(--gc-text);
    --head-icon-bg: var(--gc-surface);
    --head-icon-fg: var(--c-ink);
    --head-border: transparent;
}
.gc-panel--soft .gc-panel__header { box-shadow: inset 3px 0 0 var(--c); }

.gc-panel--outline {
    --head-bg: var(--gc-surface);
    --head-fg: var(--gc-text);
    --head-icon-bg: var(--c-soft);
    --head-icon-fg: var(--c-ink);
    --head-border: var(--gc-border);
    border-top: 3px solid var(--c);
}
.gc-panel--white.gc-panel--soft,
.gc-panel--white.gc-panel--outline { --head-icon-fg: var(--gc-text); }
.gc-panel--white.gc-panel--outline { border-top-color: var(--gc-border-strong); }

.gc-panel__header {
    position: relative;
    display: flex;
    align-items: center;
    gap: calc(var(--gc-gap) * 1.25);
    min-height: calc(var(--gc-h) + 10px);
    padding: calc(var(--gc-gap) * 0.75) calc(var(--gc-px) * 1.2);
    border-bottom: 1px solid var(--head-border);
    background: var(--head-bg);
    color: var(--head-fg);
}

/* Brillo superior en la cabecera sólida, como en los botones */
.gc-panel:not(.gc-panel--soft):not(.gc-panel--outline):not(.gc-panel--white) .gc-panel__header::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
}

.gc-panel__icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--gc-h) - 8px);
    height: calc(var(--gc-h) - 8px);
    border-radius: var(--gc-radius);
    background: var(--head-icon-bg);
    color: var(--head-icon-fg);
}
.gc-panel__icon svg { width: calc(var(--gc-icon) + 2px); height: calc(var(--gc-icon) + 2px); }

.gc-panel__heading { position: relative; flex: 1 1 auto; min-width: 0; }
.gc-panel__title {
    margin: 0;
    font-family: inherit;
    font-size: calc(var(--gc-fs) + 1px);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0.02em;
    color: inherit;
}
.gc-panel__subtitle { margin: 2px 0 0; font-size: var(--gc-fs-sm); line-height: 1.3; opacity: 0.8; }

.gc-panel__actions { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: var(--gc-gap); }
/* Botones ghost/outline en cabecera sólida: toman el color del texto de la cabecera */
.gc-panel:not(.gc-panel--soft):not(.gc-panel--outline):not(.gc-panel--white) .gc-panel__actions :is(.gc-btn--ghost, .gc-btn--outline) {
    --f: var(--head-fg);
    --b-strong: rgba(255, 255, 255, 0.16);
    --bd: rgba(255, 255, 255, 0.45);
}
.gc-panel:not(.gc-panel--soft):not(.gc-panel--outline):not(.gc-panel--white) .gc-panel__actions .gc-btn--ghost { --bd: transparent; }

.gc-panel__toggle {
    position: relative;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--gc-h) - 6px);
    height: calc(var(--gc-h) - 6px);
    margin: 0 calc(var(--gc-gap) * -0.5) 0 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: background-color 0.15s;
}
.gc-panel__toggle:hover { background: rgba(127, 140, 150, 0.18); }
.gc-panel__toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.gc-panel__toggle svg { width: calc(var(--gc-icon) + 2px); height: calc(var(--gc-icon) + 2px); transition: transform 0.3s var(--gc-ease); }
.gc-panel.is-collapsed .gc-panel__toggle svg { transform: rotate(-90deg); }

/* Plegado animado: grid 1fr → 0fr */
.gc-panel__collapse {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.3s var(--gc-ease);
}
.gc-panel.is-collapsed .gc-panel__collapse { grid-template-rows: 0fr; }
.gc-panel.is-collapsed .gc-panel__header { border-bottom-color: transparent; }
.gc-panel__inner { min-height: 0; overflow: hidden; }
.gc-panel.is-collapsed .gc-panel__inner { visibility: hidden; transition: visibility 0s 0.3s; }

.gc-panel__body { padding: calc(var(--gc-px) * 1.2); }
.gc-panel__body--flush { padding: 0; }
.gc-panel__body > :last-child { margin-bottom: 0; }

.gc-panel__footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: var(--gc-gap);
    padding: calc(var(--gc-gap) * 1.25) calc(var(--gc-px) * 1.2);
    border-top: 1px solid var(--gc-surface-3);
    background: var(--gc-surface-2);
}

/* Grilla de campos para el contenido (p. ej. filtros): <div class="gc-grid">…</div> */
.gc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--gc-grid-min, 220px), 1fr));
    gap: 0 calc(var(--gc-gap) * 2);
}

/* Textarea con el mismo aspecto que los gc-control: <div class="gc-control gc-control--textarea"><textarea class="gc-control__input">…</textarea></div> */
.gc-control--textarea { height: auto; }
textarea.gc-control__input {
    display: block;
    min-height: calc(var(--gc-h) * 3);
    padding: calc(var(--gc-gap) * 1.25) var(--gc-px);
    line-height: 1.45;
    resize: vertical;
}

/* ==========================================================================
   Pestañas
   ========================================================================== */
.gc-tabs {
    --c: var(--gc-primary);
    --c-strong: var(--gc-primary-strong);
    --c-soft: var(--gc-primary-soft);
    font-family: var(--gc-font);
    color: var(--gc-text);
}
.gc-tabs--green { --c: var(--gc-green); --c-strong: var(--gc-green-strong); --c-soft: var(--gc-green-soft); }
.gc-tabs--blue { --c: var(--gc-blue); --c-strong: var(--gc-blue-strong); --c-soft: var(--gc-blue-soft); }
.gc-tabs--lightblue { --c: var(--gc-lightblue); --c-strong: var(--gc-lightblue-strong); --c-soft: var(--gc-lightblue-soft); }
.gc-tabs--red { --c: var(--gc-red); --c-strong: var(--gc-red-strong); --c-soft: var(--gc-red-soft); }
.gc-tabs--orange { --c: var(--gc-orange); --c-strong: var(--gc-orange-strong); --c-soft: var(--gc-orange-soft); }
.gc-tabs--black { --c: var(--gc-black); --c-strong: var(--gc-black-strong); --c-soft: var(--gc-surface-3); }

.gc-tabs__list {
    position: relative;
    display: inline-flex;
    max-width: 100%;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    vertical-align: top;
}
.gc-tabs__list::-webkit-scrollbar { display: none; }
.gc-tabs--block .gc-tabs__list { display: flex; }
.gc-tabs--block .gc-tabs__tab { flex: 1 1 0; }

.gc-tabs__tab {
    position: relative;
    z-index: 1;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--gc-gap);
    min-height: var(--gc-h);
    margin: 0;
    padding: 0 calc(var(--gc-px) * 1.25);
    border: 0;
    border-radius: var(--gc-radius);
    outline: 0;
    background: transparent;
    color: var(--gc-muted);
    font: inherit;
    font-size: var(--gc-fs);
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.22s var(--gc-ease), background-color 0.22s var(--gc-ease), transform 0.18s var(--gc-ease);
}
.gc-tabs__tab:hover:not(:disabled) { color: var(--c-strong); }
.gc-tabs__tab:active:not(:disabled) { transform: scale(0.97); }
.gc-tabs__tab:focus-visible { box-shadow: var(--gc-focus-ring); }
.gc-tabs__tab:disabled { opacity: 0.45; cursor: not-allowed; }

.gc-tabs__icon { display: inline-flex; }
.gc-tabs__icon .gc-icon { width: var(--gc-icon); height: var(--gc-icon); }
.gc-tabs__tab[aria-selected="true"] .gc-tabs__icon { animation: gc-tabs-icon-pop 0.45s var(--gc-spring); }
@keyframes gc-tabs-icon-pop {
    0% { transform: scale(0.7) rotate(-8deg); }
    100% { transform: scale(1) rotate(0); }
}

.gc-tabs__badge {
    min-width: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--gc-surface-3);
    color: var(--gc-muted);
    font-size: calc(var(--gc-fs-sm) - 1px);
    line-height: 18px;
    text-align: center;
    transition: background-color 0.22s var(--gc-ease), color 0.22s var(--gc-ease);
}

.gc-tabs__indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--gc-tabs-w, 0);
    height: var(--gc-tabs-h, 0);
    border-radius: var(--gc-radius);
    transform: translate(var(--gc-tabs-x, 0), var(--gc-tabs-y, 0));
    pointer-events: none;
}
.gc-tabs.is-ready .gc-tabs__indicator {
    transition: transform 0.42s var(--gc-spring), width 0.42s var(--gc-spring), height 0.3s var(--gc-ease);
}

/* Apariencia pill: pastilla con degradé que se desliza sobre un riel */
.gc-tabs--pill .gc-tabs__list {
    padding: 4px;
    border-radius: calc(var(--gc-radius) + 4px);
    background: var(--gc-surface-3);
    box-shadow: inset 0 1px 2px rgba(16, 32, 40, 0.08);
}
.gc-tabs--pill .gc-tabs__indicator {
    background: linear-gradient(135deg, var(--c), var(--c-strong));
    box-shadow: 0 6px 14px -6px var(--c), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.gc-tabs--pill .gc-tabs__tab[aria-selected="true"] { color: #fff; }
.gc-tabs--pill .gc-tabs__tab:hover:not(:disabled):not([aria-selected="true"]) { background: rgba(255, 255, 255, 0.6); }
.gc-tabs--pill .gc-tabs__tab[aria-selected="true"] .gc-tabs__badge { background: rgba(255, 255, 255, 0.25); color: #fff; }
.gc-tabs--orange.gc-tabs--pill .gc-tabs__tab[aria-selected="true"] { color: var(--gc-orange-ink); }
/* Antes de medir (o sin JS) el fondo lo lleva la pestaña activa */
.gc-tabs--pill:not(.is-ready) .gc-tabs__tab[aria-selected="true"] { background: linear-gradient(135deg, var(--c), var(--c-strong)); }

/* Apariencia line: subrayado deslizante */
.gc-tabs--line .gc-tabs__list {
    display: flex;
    border-bottom: 1px solid var(--gc-border);
}
.gc-tabs--line .gc-tabs__tab { border-radius: var(--gc-radius) var(--gc-radius) 0 0; }
.gc-tabs--line .gc-tabs__tab:hover:not(:disabled) { background: var(--c-soft); }
.gc-tabs--line .gc-tabs__tab[aria-selected="true"] { color: var(--c-strong); }
.gc-tabs--line .gc-tabs__tab[aria-selected="true"] .gc-tabs__badge { background: var(--c-soft); color: var(--c-strong); }
.gc-tabs--line .gc-tabs__indicator {
    top: auto;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(90deg, var(--c), var(--c-strong));
    transform: translateX(var(--gc-tabs-x, 0));
}
.gc-tabs--line:not(.is-ready) .gc-tabs__tab[aria-selected="true"] { box-shadow: inset 0 -3px 0 var(--c); }

/* Paneles: entran desde el lado hacia el que se movió la selección */
.gc-tabs__panels { padding-top: calc(var(--gc-gap) * 2); }
.gc-tabs__panel[hidden] { display: none; }
.gc-tabs__panel { outline: 0; }
.gc-tabs__panel:focus-visible { border-radius: var(--gc-radius); box-shadow: var(--gc-focus-ring); }
.gc-tabs__panel.is-from-right { animation: gc-tabs-from-right 0.34s var(--gc-ease) both; }
.gc-tabs__panel.is-from-left { animation: gc-tabs-from-left 0.34s var(--gc-ease) both; }
@keyframes gc-tabs-from-right {
    from { opacity: 0; transform: translateX(18px); }
    to { opacity: 1; transform: none; }
}
@keyframes gc-tabs-from-left {
    from { opacity: 0; transform: translateX(-18px); }
    to { opacity: 1; transform: none; }
}

/* ==========================================================================
   Accesibilidad: movimiento reducido
   (la barra de progreso de toasts se mantiene: controla el auto-cierre)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    [class^="gc-"]:not(.gc-toast__progress),
    [class*=" gc-"]:not(.gc-toast__progress),
    [class^="gc-"]::before,
    [class*=" gc-"]::before,
    [class^="gc-"]::after,
    [class*=" gc-"]::after,
    .gc-modal::backdrop {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Pantallas angostas */
@media (max-width: 600px) {
    .gc-table__search { flex: 1 1 100%; }
    .gc-table__footer { justify-content: center; }
    .gc-modal__footer { flex-direction: column-reverse; }
    .gc-modal__footer .gc-btn { width: 100%; }
    .gc-toasts,
    .gc-toasts--top-center { left: 16px; right: 16px; width: auto; transform: none; }
}
