/*
 * app.css — Estilos estructurales compartidos
 * ─────────────────────────────────────────────────────────────
 * No contiene valores de color directos.
 * Usa exclusivamente variables definidas en theme.css.
 * ─────────────────────────────────────────────────────────────
 */

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── BASE ────────────────────────────────────────────────── */
html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-weight: 300;
    font-size: 17px;
}

/* ── LAYOUT ──────────────────────────────────────────────── */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--accent);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 1.75rem 1.5rem 1.6rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    gap: .8rem;
}

.brand-icon {
    width: 38px; height: 38px;
    background: rgba(var(--coral-rgb), .15);
    border: 1px solid rgba(var(--coral-rgb), .4);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.brand-icon svg {
    width: 18px; height: 18px;
    fill: none;
    stroke: var(--coral);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand-text strong {
    display: block;
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 400;
    color: var(--surface);
    line-height: 1.2;
}

.brand-text span {
    font-size: .75rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(var(--surface-rgb), .45);
}

/* ── NAVIGATION ──────────────────────────────────────────── */
.nav {
    flex: 1;
    padding: 1.25rem 0;
    overflow-y: auto;
}

.nav-section {
    padding: .6rem 1.5rem .3rem;
    font-size: .72rem;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: rgba(var(--surface-rgb), .3);
}

.nav a {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .7rem 1.5rem;
    color: rgba(var(--surface-rgb), .65);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 300;
    border-left: 2px solid transparent;
    transition: color .15s, background .15s, border-color .15s;
}

.nav a:hover {
    color: var(--surface);
    background: rgba(255,255,255,.06);
}

.nav a.active {
    color: var(--coral);
    background: rgba(var(--coral-rgb), .08);
    border-left-color: var(--coral);
    font-weight: 400;
}

.nav a svg {
    width: 16px; height: 16px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .8;
}

/* Badge de no leídos en enlaces del sidebar */
.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
    flex-shrink: 0;
}

/* ── SIDEBAR FOOTER ──────────────────────────────────────── */
.sidebar-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin-bottom: .9rem;
}

.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(var(--coral-rgb), .2);
    border: 1px solid rgba(var(--coral-rgb), .35);
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem;
    color: var(--coral);
    font-weight: 500;
    flex-shrink: 0;
}

.user-name {
    font-size: .95rem;
    color: rgba(var(--surface-rgb), .8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .55rem .75rem;
    background: rgba(var(--danger-rgb), .1);
    border: 1px solid rgba(var(--danger-rgb), .25);
    border-radius: var(--radius);
    color: rgba(var(--coral-rgb), .8);
    font-family: var(--font-sans);
    font-size: .92rem;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.btn-logout:hover {
    background: rgba(var(--danger-rgb), .18);
    color: var(--coral);
}

.btn-logout svg {
    width: 14px; height: 14px;
    fill: none; stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
}

/* ── MAIN ────────────────────────────────────────────────── */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 400;
}

.topbar-date {
    font-size: .92rem;
    color: var(--muted);
}

/* ── CONTENT ─────────────────────────────────────────────── */
.content {
    padding: 2rem;
    flex: 1;
}

/* ── TOOLBAR ─────────────────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    max-width: 320px;
    background: #fff !important;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .6rem .9rem;
    font-family: var(--font-sans);
    font-size: .95rem;
    font-weight: 300;
    color: var(--text);
    outline: none;
    box-shadow: inset 0 1px 3px rgba(0,0,0,.07);
    transition: border-color .2s, box-shadow .2s;
}

.search-input:-webkit-autofill,
.search-input:-webkit-autofill:hover,
.search-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
    box-shadow: 0 0 0 1000px #fff inset !important;
    -webkit-text-fill-color: var(--text) !important;
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: inset 0 1px 3px rgba(0,0,0,.07),
                0 0 0 3px rgba(var(--accent-rgb), .08);
}

.search-input::placeholder { color: #bbb0a0; }

.filter-select {
    padding: .55rem 2rem .55rem .75rem;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a7060' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 5px center !important;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: .95rem;
    font-weight: 300;
    color: var(--text);
    outline: none;
    cursor: pointer;
    width: 200px;
    flex-shrink: 0;
    box-shadow: inset 0 1px 3px rgba(0,0,0,.07);
    transition: border-color .15s;
}

.filter-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .08);
}

/* ── BOTONES ─────────────────────────────────────────────── */

/* Primario — acción principal */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .62rem 1.2rem;
    background: var(--accent);
    color: var(--surface);
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: .95rem;
    font-weight: 400;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .2s;
}

.btn-primary:hover    { background: var(--accent-lt); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary svg {
    width: 15px; height: 15px;
    fill: none; stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round;
}

/* Secundario — cancelar / alternativo */
.btn-secondary {
    padding: .62rem 1.1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: .95rem;
    font-weight: 300;
    color: var(--text);
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.btn-secondary:hover {
    background: var(--bg);
    border-color: var(--muted);
}

/* Acción en tabla */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .75rem;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: .85rem;
    font-weight: 300;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    transition: background .15s, border-color .15s, color .15s;
}

.btn-action svg {
    width: 13px; height: 13px;
    fill: none; stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
}

.btn-action:hover {
    background: rgba(var(--accent-rgb), .06);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-action.danger:hover {
    background: rgba(var(--danger-rgb), .07);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-action.success:hover {
    background: rgba(80,140,80,.07);
    border-color: #4a8a4a;
    color: #3d7a3d;
}

/* Icónico cuadrado */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    transition: color .15s, border-color .15s, background .15s;
}

.btn-icon:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), .04);
}

.btn-icon.danger:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(var(--danger-rgb), .04);
}

.btn-icon svg {
    width: 13px; height: 13px;
    fill: none; stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round; stroke-linejoin: round;
}

/* Ghost — neutro */
.btn-ghost {
    padding: .55rem 1rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: .95rem;
    color: var(--muted);
    cursor: pointer;
    transition: color .15s, border-color .15s;
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--text);
}

/* Submit con spinner — formularios y confirmaciones */
.btn-submit {
    padding: .55rem 1.25rem;
    background: var(--accent);
    color: var(--surface);
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: .95rem;
    font-weight: 400;
    cursor: pointer;
    transition: background .15s;
    min-width: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
}

.btn-submit:hover    { background: var(--accent-lt); }
.btn-submit:disabled { opacity: .55; pointer-events: none; }

.btn-submit .spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(var(--surface-rgb), .3);
    border-top-color: var(--surface);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    display: none;
}

.btn-submit.loading .btn-text { display: none; }
.btn-submit.loading .spinner  { display: block; }

/* ── CAMPOS DE FORMULARIO ────────────────────────────────── */
.field {
    margin-bottom: 1.1rem;
}

.field:last-child { margin-bottom: 0; }

label {
    display: block;
    font-size: .8rem;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: .4rem;
}

.field-hint {
    font-size: .8rem;
    color: var(--muted);
    margin-top: .3rem;
    letter-spacing: 0;
    text-transform: none;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 300;
    padding: .7rem .9rem;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .08);
}

input::placeholder { color: #bbb0a0; }

/* ── TABLA ───────────────────────────────────────────────── */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    animation: fadeUp .4s cubic-bezier(.22,1,.36,1) both;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: .8rem 1.25rem;
    text-align: left;
    font-size: .78rem;
    font-weight: 400;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .12s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover      { background: rgba(var(--accent-rgb), .025); }

td {
    padding: .95rem 1.25rem;
    font-size: .97rem;
    vertical-align: middle;
}

.td-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.td-fecha {
    color: var(--muted);
    font-size: .9rem;
    white-space: nowrap;
}

/* ── BADGE ───────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .22rem .7rem;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 400;
}

.badge-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── MODAL ───────────────────────────────────────────────── */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(var(--text-rgb), .45);
    backdrop-filter: blur(2px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    animation: modalIn .25s cubic-bezier(.22,1,.36,1) both;
}

.modal-header {
    padding: 1.4rem 1.75rem 1.2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 400;
}

.modal-close {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--muted);
    transition: background .15s, color .15s;
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.modal-close svg {
    width: 16px; height: 16px;
    fill: none; stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round;
}

.modal-body   { padding: 1.5rem 1.75rem; }

.modal-footer {
    padding: 1rem 1.75rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
}

.modal-error {
    padding: .6rem .9rem;
    background: rgba(var(--danger-rgb), .07);
    border: 1px solid rgba(var(--danger-rgb), .25);
    border-radius: var(--radius);
    color: var(--danger);
    font-size: .9rem;
    display: none;
}

/* ── TOAST ───────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 1.75rem;
    right: 1.75rem;
    padding: .75rem 1.25rem;
    border-radius: var(--radius);
    font-size: .95rem;
    font-weight: 400;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    z-index: 500;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .25s, transform .25s;
    pointer-events: none;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok   { background: var(--accent); color: var(--surface); }
.toast.err  { background: var(--danger); color: var(--surface); }

/* ── ANIMACIONES ─────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(16px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
/* ── LOGIN: nota de pie y autoría ───────────────────────────── */
.footer-note {
    margin-top: 2rem;
    text-align: center;
    font-size: .82rem;
    color: var(--muted);
    letter-spacing: .03em;
}

.author-note {
    margin-top: 1.1rem;
    text-align: center;
    font-size: .85rem;
    color: rgba(var(--text-rgb), .55);
    letter-spacing: .03em;
}

.author-note a {
    color: rgba(var(--text-rgb), .55);
    text-decoration: none;
    transition: color .2s;
}

.author-note a:hover {
    color: rgba(var(--text-rgb), .85);
}

/* ── BOTÓN AYUDA (topbar) ────────────────────────────────── */
.btn-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-family: var(--font-sans);
    font-size: .95rem;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .15s, color .15s, background .15s;
    text-decoration: none;
}

.btn-help:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(var(--accent-rgb), .05);
}

/* ── MODAL DE AYUDA ──────────────────────────────────────── */
.modal-help {
    max-width: 680px !important;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
}

.modal-help .modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 0;
}

.help-section {
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border);
}

.help-section:last-child { border-bottom: none; }

.help-section h6 {
    font-family: var(--font-sans);
    font-size: .88rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: .65rem;
}

.help-section p,
.help-section li {
    font-size: .93rem;
    color: var(--text);
    line-height: 1.65;
    font-weight: 300;
}

.help-section p + p { margin-top: .5rem; }

.help-section ul,
.help-section ol {
    padding-left: 1.3rem;
    margin-top: .4rem;
}

.help-section li { margin-bottom: .3rem; }

.help-tip {
    margin-top: .75rem;
    padding: .7rem 1rem;
    background: rgba(var(--accent-rgb), .06);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: .88rem;
    color: var(--text);
    line-height: 1.55;
}

.help-example {
    margin-top: .75rem;
    padding: .65rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .88rem;
    color: var(--muted);
    font-style: italic;
    line-height: 1.55;
}

/* ── DASHBOARD — ETIQUETA DE SECCIÓN ─────────────────────── */
.section-label {
    font-size: .8rem;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 1rem;
}

/* ── DASHBOARD — TARJETAS DE ESTADÍSTICAS ────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2.25rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    animation: fadeUp .4s cubic-bezier(.22,1,.36,1) both;
}

.stat-card:nth-child(2) { animation-delay: .05s; }
.stat-card:nth-child(3) { animation-delay: .10s; }
.stat-card:nth-child(4) { animation-delay: .15s; }

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-label {
    font-size: .88rem;
    color: var(--muted);
    letter-spacing: .04em;
}

.stat-icon {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

.stat-icon svg {
    width: 15px; height: 15px;
    fill: none; stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round; stroke-linejoin: round;
}

.stat-icon.purple { background: rgba(var(--accent-rgb), .08);  color: var(--accent); }
.stat-icon.coral  { background: rgba(var(--coral-rgb),  .15);  color: #d4704e; }
.stat-icon.orange { background: rgba(var(--danger-rgb), .10);  color: var(--danger); }
.stat-icon.green  { background: rgba(80,140,80,.10); color: #4a8a4a; }

.stat-value {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 400;
    line-height: 1;
    color: var(--text);
}

.stat-sub {
    font-size: .88rem;
    color: var(--muted);
}

/* ── DASHBOARD — CUADRÍCULA INFERIOR ─────────────────────── */
.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

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

/* ── DASHBOARD — PANELES ─────────────────────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    animation: fadeUp .4s .2s cubic-bezier(.22,1,.36,1) both;
}

.panel-header {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-title {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text);
}

.panel-link {
    font-size: .88rem;
    color: var(--accent);
    text-decoration: none;
    opacity: .75;
    transition: opacity .15s;
}

.panel-link:hover { opacity: 1; }

/* ── DASHBOARD — ACTIVIDAD RECIENTE ──────────────────────── */
.activity-list { list-style: none; }

.activity-item {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .9rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-size: .95rem;
}

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

.activity-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-purple { background: var(--accent); }
.dot-coral  { background: var(--coral); }
.dot-orange { background: var(--danger); }

.activity-body { flex: 1; }

.activity-body strong {
    font-weight: 400;
    color: var(--text);
}

.activity-body p {
    font-size: .88rem;
    color: var(--muted);
    margin-top: .1rem;
}

.activity-time {
    font-size: .85rem;
    color: var(--muted);
    white-space: nowrap;
}

/* ── DASHBOARD — ACCIONES RÁPIDAS ────────────────────────── */
.quick-actions {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.qa-btn {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 1rem;
    color: var(--text);
    border: 1px solid var(--border);
    background: var(--bg);
    transition: border-color .15s, background .15s;
}

.qa-btn:hover {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), .04);
}

.qa-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.qa-icon svg {
    width: 16px; height: 16px;
    fill: none; stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round; stroke-linejoin: round;
}

.qa-icon.purple { background: rgba(var(--accent-rgb), .10); color: var(--accent); }
.qa-icon.coral  { background: rgba(var(--coral-rgb),  .15); color: #c45e3a; }
.qa-icon.orange { background: rgba(var(--danger-rgb), .10); color: var(--danger); }

.qa-label { flex: 1; }

.qa-arrow {
    color: var(--muted);
    font-size: .9rem;
    opacity: .5;
}

/* ── DASHBOARD — ESTADO VACÍO ────────────────────────────── */
.empty {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--muted);
    font-size: .85rem;
}

/* ── CAMPOS — REQUERIDOS Y FEEDBACK ─────────────────────────── */
.required {
    color: var(--danger);
    font-weight: 600;
    margin-left: 2px;
}

.field-feedback {
    display: block;
    font-size: .78rem;
    margin-top: .3rem;
    min-height: 1rem;
}

.field-feedback.ok  { color: #2d7a3a; }
.field-feedback.err { color: var(--danger); }
.field-feedback.ok::before  { content: '✓ '; }
.field-feedback.err::before { content: '✗ '; }

/* ── ACCIONES DE FORMULARIO ──────────────────────────────────── */
.actions-row,
.form-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 1rem;
}

/* ── BOTÓN SUBMIT — ESTADO ÉXITO ────────────────────────────── */
.btn-submit.success .btn-label::before { content: '✓ '; }
.btn-submit.success { background: #2d7a3a !important; }

/* ── PAGE BANNER ─────────────────────────────────────────────── */
.page-banner {
    display: none;
    align-items: center;
    gap: .65rem;
    padding: .8rem 1.1rem;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    animation: bannerIn .22s ease;
}

.page-banner.visible { display: flex; }
.page-banner.ok  { background: rgba(45,122,58,.1);  border: 1px solid rgba(45,122,58,.3);  color: #1e5e2a; }
.page-banner.err { background: rgba(232,93,58,.08); border: 1px solid rgba(232,93,58,.3);  color: #c0391a; }
.page-banner svg {
    flex-shrink: 0;
    width: 17px; height: 17px;
    stroke: currentColor;
    stroke-width: 2.2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@keyframes bannerIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

/* ── INPUT NARROW ────────────────────────────────────────────── */
.input-narrow { max-width: 120px; }

select.input-narrow,
input.input-narrow[type="number"] {
    height: var(--input-height, 2.4rem);
    padding: 0 .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: .95rem;
    font-family: inherit;
    box-sizing: border-box;
    width: 100%;
}

.input-narrow::-webkit-inner-spin-button,
.input-narrow::-webkit-outer-spin-button { opacity: 1; }

/* ── TOGGLE SWITCH ───────────────────────────────────────────── */
.toggle-row   { display: flex; align-items: center; gap: 1rem; }
.toggle-label { font-size: .95rem; color: var(--text); }
.toggle-desc  { font-size: .82rem; color: var(--muted); margin-top: 2px; }

.switch       { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    cursor: pointer;
    transition: .2s;
}

.slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: .2s;
}

input:checked + .slider             { background: var(--accent); }
input:checked + .slider::before     { transform: translateX(20px); }

/* ── CHIPS (categorías/tipos de documento) ───────────────────── */
.chips-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    min-height: 2rem;
    margin-bottom: .6rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: rgba(var(--accent-rgb), .08);
    color: var(--accent);
    border: 1px solid rgba(var(--accent-rgb), .18);
    border-radius: 20px;
    padding: .22rem .65rem;
    font-size: .82rem;
}

.chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    padding: 0;
    line-height: 1;
    font-size: .85rem;
    opacity: .6;
}

.chip-remove:hover { opacity: 1; }

.chip-add-row       { display: flex; gap: .5rem; }
.chip-add-row input { flex: 1; }

.btn-chip-add {
    background: var(--accent);
    color: var(--surface);
    border: none;
    border-radius: var(--radius);
    padding: .45rem .9rem;
    font-size: .85rem;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-chip-add:hover { opacity: .88; }

/* ── EXTENSIONES PERMITIDAS (checkboxes) ─────────────────────── */
.ext-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: .5rem .75rem;
    margin-bottom: .25rem;
}

.ext-check { display: flex; align-items: center; gap: .4rem; }

.ext-check input[type="checkbox"] {
    width: 15px; height: 15px;
    cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.ext-check span {
    font-size: .88rem;
    color: var(--text);
    cursor: pointer;
    font-family: monospace;
}

/* ── BADGES / ETIQUETAS DE FORMATO (PDF · DOCX) ─────────────── */
/* Usados en configuracion.php, perfil.php, contratos.php y contrato-nuevo.php */
.badge-fmt,
.fmt-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .28em .7em;
    border-radius: 5px;
    border: 1.5px solid var(--border);
    font-size: .78rem;
    font-weight: 600;
    user-select: none;
    pointer-events: none;
}

.badge-pdf,
.fmt-toggle-label.lbl-pdf  { background: rgba(220,50,50,.1);  color: #b83232; border-color: #b83232; }

.badge-docx,
.fmt-toggle-label.lbl-docx { background: rgba(30,100,200,.1); color: #1b5cb8; border-color: #1b5cb8; }

/* ── TIPOGRAFÍA DE CONTRATOS ─────────────────────────────────── */
.typo-cols      { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.typo-col-label { margin: 0 0 .75rem; }