/* ============================================================
   SERFICON — Área Privada de Clientes  v2.0
   Diseño: Refinado, profesional, responsive completo
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

:root {
    --color-primary:   #1a3a5c;
    --color-accent:    #2563eb;
    --color-accent-lt: #dbeafe;
    --color-accent-dk: #1d4ed8;
    --color-success:   #059669;
    --color-warning:   #d97706;
    --color-danger:    #dc2626;
    --color-bg:        #f0f4f8;
    --color-surface:   #ffffff;
    --color-border:    #e2e8f0;
    --color-text:      #1e293b;
    --color-muted:     #64748b;
    --nav-h:      64px;
    --radius:     14px;
    --radius-sm:  9px;
    --radius-xs:  6px;
    --shadow-xs:  0 1px 2px rgba(0,0,0,.06);
    --shadow:     0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
    --shadow-lg:  0 8px 32px rgba(0,0,0,.12);
    --font-head:  'Syne', sans-serif;
    --font-body:  'DM Sans', sans-serif;
    --transition: all .18s ease;
}

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

.srf-body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* NAV */
.srf-nav {
    position: sticky; top: 0; z-index: 200;
    height: var(--nav-h);
    background: var(--color-primary);
    box-shadow: 0 2px 20px rgba(0,0,0,.22);
}
.srf-nav-inner {
    max-width: 1240px; margin: 0 auto;
    padding: 0 24px; height: 100%;
    display: flex; align-items: center; gap: 24px;
}
.srf-nav-logo {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; color: #fff;
    font-family: var(--font-head); font-size: 1.15rem; font-weight: 700;
    letter-spacing: -0.02em; flex-shrink: 0;
}
.srf-nav-logo img {
    border-radius: 8px; height: 34px; width: auto;
    max-height: 34px; object-fit: contain; display: block;
}
.srf-nav-menu { display: flex; list-style: none; gap: 2px; flex: 1; }
.srf-nav-menu a {
    display: flex; align-items: center; gap: 7px;
    padding: 8px 13px; border-radius: var(--radius-xs);
    color: rgba(255,255,255,.68); text-decoration: none;
    font-size: .875rem; font-weight: 500; transition: var(--transition);
}
.srf-nav-menu a svg {
    width: 15px; height: 15px; stroke: currentColor; fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}
.srf-nav-menu a:hover, .srf-nav-menu a.activo {
    background: rgba(255,255,255,.15); color: #fff;
}
.srf-nav-menu a.activo { font-weight: 600; }
.srf-nav-usuario {
    display: flex; align-items: center; gap: 12px;
    color: rgba(255,255,255,.7); font-size: .85rem; flex-shrink: 0; margin-left: auto;
}
.srf-nav-usuario span { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srf-btn-logout {
    background: rgba(255,255,255,.1); color: #fff !important;
    border: 1px solid rgba(255,255,255,.18); padding: 6px 15px;
    border-radius: 20px; font-size: .8rem; text-decoration: none !important;
    font-weight: 600; transition: var(--transition); flex-shrink: 0;
}
.srf-btn-logout:hover { background: rgba(255,255,255,.22); }
.srf-nav-toggle {
    display: none; background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.15); color: #fff;
    width: 38px; height: 38px; border-radius: var(--radius-xs);
    cursor: pointer; font-size: 1.1rem;
    align-items: center; justify-content: center; transition: var(--transition);
    margin-left: auto;
}
.srf-nav-toggle:hover { background: rgba(255,255,255,.2); }

/* DRAWER MOBILE */
.srf-nav-drawer { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 300; }
.srf-nav-drawer.open { display: block; }
.srf-nav-drawer-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(3px); }
.srf-nav-drawer-inner {
    position: absolute; top: 0; left: 0; bottom: 0; width: 280px;
    background: var(--color-primary); display: flex; flex-direction: column;
    overflow-y: auto; box-shadow: 4px 0 32px rgba(0,0,0,.25);
    animation: slideInLeft .22s ease;
}
@keyframes slideInLeft { from { transform: translateX(-100%); } to { transform: translateX(0); } }
.srf-drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px; border-bottom: 1px solid rgba(255,255,255,.1);
}
.srf-drawer-close {
    background: rgba(255,255,255,.12); border: none; color: #fff;
    width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
    font-size: 1rem; display: flex; align-items: center; justify-content: center;
}
.srf-drawer-menu { list-style: none; padding: 12px; flex: 1; }
.srf-drawer-menu a {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 14px; border-radius: var(--radius-sm);
    color: rgba(255,255,255,.75); text-decoration: none;
    font-size: .95rem; font-weight: 500; margin-bottom: 2px; transition: var(--transition);
}
.srf-drawer-menu a svg {
    width: 18px; height: 18px; stroke: currentColor; fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}
.srf-drawer-menu a:hover, .srf-drawer-menu a.activo { background: rgba(255,255,255,.14); color: #fff; }
.srf-drawer-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); }
.srf-drawer-user { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.srf-drawer-avatar {
    width: 38px; height: 38px; background: rgba(255,255,255,.15);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: #fff; flex-shrink: 0;
}
.srf-drawer-username { font-size: .9rem; color: rgba(255,255,255,.9); font-weight: 500; }
.srf-drawer-logout {
    display: block; text-align: center; padding: 9px;
    border-radius: var(--radius-xs); background: rgba(255,255,255,.1);
    color: #fff; text-decoration: none; font-size: .875rem; font-weight: 600; transition: var(--transition);
}
.srf-drawer-logout:hover { background: rgba(255,255,255,.2); }

/* MAIN */
.srf-main {
    min-height: calc(100vh - var(--nav-h) - 60px);
    padding: 32px 24px; max-width: 1240px; margin: 0 auto;
}
.srf-main-login {
    max-width: 100%; padding: 0;
    display: flex; align-items: center; justify-content: center; min-height: 100vh;
    background: linear-gradient(135deg, #0f2645 0%, var(--color-primary) 40%, #1e4d8c 100%);
}

/* LOGIN */
.srf-login-wrapper {
    width: 100%; display: flex; justify-content: center; align-items: center;
    min-height: 100vh; padding: 24px 16px;
}
.srf-login-card {
    background: var(--color-surface); border-radius: 20px;
    padding: 48px 44px; width: 100%; max-width: 420px;
    box-shadow: 0 24px 64px rgba(0,0,0,.22);
}
.srf-login-logo { text-align: center; margin-bottom: 36px; }
.srf-login-logo img { height: 52px; border-radius: 12px; margin-bottom: 14px; }
.srf-login-logo h1 {
    font-family: var(--font-head); font-size: 1.5rem; font-weight: 700;
    color: var(--color-primary); margin: 0 0 5px;
}
.srf-login-logo p { color: var(--color-muted); font-size: .9rem; }
.srf-login-form { display: flex; flex-direction: column; gap: 18px; }
.srf-field label {
    display: block; font-size: .78rem; font-weight: 700;
    color: var(--color-muted); margin-bottom: 6px;
    text-transform: uppercase; letter-spacing: .06em;
}
.srf-field input, .srf-field select, .srf-field textarea {
    width: 100%; padding: 11px 14px;
    border: 1.5px solid var(--color-border); border-radius: var(--radius-sm);
    font-family: var(--font-body); font-size: .95rem; color: var(--color-text);
    background: #fafbfc; transition: var(--transition); outline: none;
}
.srf-field input:focus, .srf-field select:focus, .srf-field textarea:focus {
    border-color: var(--color-accent); background: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.srf-input-group { position: relative; }
.srf-input-group input { padding-right: 44px; }
.srf-toggle-pass {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: var(--color-muted); padding: 4px;
}
.srf-field-check { flex-direction: row; align-items: center; gap: 8px; }
.srf-field-check label {
    display: flex; align-items: center; gap: 8px; font-size: .9rem;
    text-transform: none; letter-spacing: 0; color: var(--color-text); margin: 0; cursor: pointer;
}
.srf-field-check input { width: auto; accent-color: var(--color-accent); }
.srf-login-footer { text-align: center; margin-top: 20px; color: var(--color-muted); font-size: .875rem; }
.srf-login-footer a { color: var(--color-accent); text-decoration: none; font-weight: 500; }
.srf-login-footer span { margin: 0 8px; }

/* BOTONES */
.srf-btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--color-accent); color: #fff; border: none;
    padding: 12px 24px; border-radius: var(--radius-sm);
    font-family: var(--font-body); font-size: .95rem; font-weight: 600;
    cursor: pointer; text-decoration: none; transition: var(--transition); width: 100%;
}
.srf-btn-primary:hover { background: var(--color-accent-dk); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,.28); }
.srf-btn-outline {
    display: inline-flex; align-items: center; gap: 6px;
    background: transparent; color: var(--color-accent);
    border: 1.5px solid var(--color-accent); padding: 9px 18px;
    border-radius: var(--radius-sm); font-family: var(--font-body);
    font-size: .875rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: var(--transition);
}
.srf-btn-outline:hover { background: var(--color-accent-lt); }
.srf-btn-sm { padding: 6px 12px; font-size: .8rem; }

/* ALERTS */
.srf-alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: .9rem; }
.srf-alert-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.srf-alert-success { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }

/* PAGE HEADER */
.srf-page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 28px; flex-wrap: wrap; gap: 12px;
}
.srf-page-header h2 {
    font-family: var(--font-head); font-size: 1.55rem;
    font-weight: 700; color: var(--color-primary); line-height: 1.2;
}
.srf-page-header p { color: var(--color-muted); font-size: .9rem; margin-top: 4px; }

/* DASHBOARD CARDS */
.srf-cards-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 24px; }
.srf-summary-card {
    background: var(--color-surface); border-radius: var(--radius);
    padding: 22px 20px; display: flex; align-items: center; gap: 16px;
    text-decoration: none; color: var(--color-text);
    box-shadow: var(--shadow); border: 1px solid var(--color-border); transition: var(--transition);
}
.srf-summary-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: rgba(37,99,235,.2); }
.srf-summary-icon {
    width: 50px; height: 50px; border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.srf-summary-icon svg { width: 22px; height: 22px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.srf-icon-docs      { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.srf-icon-consultas { background: linear-gradient(135deg, #059669, #10b981); }
.srf-icon-cal       { background: linear-gradient(135deg, #d97706, #f59e0b); }
.srf-summary-num   { display: block; font-family: var(--font-head); font-size: 2.1rem; font-weight: 700; line-height: 1; }
.srf-summary-label { display: block; font-size: .8rem; color: var(--color-muted); margin-top: 5px; font-weight: 500; }

.srf-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* PANELES */
.srf-panel {
    background: var(--color-surface); border-radius: var(--radius);
    padding: 22px 24px; box-shadow: var(--shadow); border: 1px solid var(--color-border);
}
.srf-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 8px; }
.srf-panel-header h3 { font-family: var(--font-head); font-size: .975rem; font-weight: 600; }
.srf-panel-header a  { font-size: .82rem; color: var(--color-accent); text-decoration: none; font-weight: 500; white-space: nowrap; }
.srf-panel-docs { margin-bottom: 0; }
.srf-mt { margin-top: 20px; }

/* EVENT LIST */
.srf-event-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.srf-event-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 13px; border-radius: var(--radius-sm);
    background: var(--color-bg); border: 1px solid var(--color-border); transition: var(--transition);
}
.srf-event-item:hover { border-color: var(--color-accent); background: #f0f6ff; }
.srf-event-item.srf-urgente { background: #fff7ed; border-color: #fed7aa; }
.srf-event-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.srf-event-info { flex: 1; min-width: 0; }
.srf-event-info strong { display: block; font-size: .875rem; font-weight: 600; }
.srf-event-info small  { color: var(--color-muted); font-size: .775rem; }
.srf-badge-urgente {
    background: linear-gradient(135deg, #f97316, #ef4444); color: #fff;
    font-size: .68rem; padding: 3px 9px; border-radius: 10px;
    white-space: nowrap; font-weight: 700; flex-shrink: 0;
}

/* DOCS DASHBOARD */
.srf-doc-tipos { display: flex; gap: 12px; }
.srf-doc-tipo {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--color-bg); border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm); padding: 18px 12px;
    text-decoration: none; color: var(--color-text); transition: var(--transition); text-align: center;
}
.srf-doc-tipo:hover { background: var(--color-accent-lt); border-color: var(--color-accent); }
.srf-doc-tipo strong { font-family: var(--font-head); font-size: 1.7rem; font-weight: 700; }
.srf-doc-tipo span   { font-size: .78rem; color: var(--color-muted); margin-top: 4px; font-weight: 500; }

/* BADGES */
.srf-badge {
    display: inline-flex; align-items: center; padding: 2px 9px;
    border-radius: 20px; font-size: .72rem; font-weight: 700;
    background: #e2e8f0; color: #475569; letter-spacing: .02em;
}
.srf-badge-laboral     { background: #dbeafe; color: #1d4ed8; }
.srf-badge-fiscal      { background: #fef9c3; color: #92400e; }
.srf-badge-nomina      { background: #d1fae5; color: #065f46; }
.srf-badge-factura     { background: #ede9fe; color: #5b21b6; }
.srf-badge-liquidacion { background: #fee2e2; color: #991b1b; }
.srf-badge-otro        { background: #f1f5f9; color: #64748b; }
.srf-badge-estado-abierta    { background: #dbeafe; color: #1d4ed8; }
.srf-badge-estado-en_proceso { background: #fef9c3; color: #92400e; }
.srf-badge-estado-cerrada    { background: #f1f5f9; color: #64748b; }

/* CONSULTAS */
.srf-consultas-lista { display: flex; flex-direction: column; gap: 8px; }
.srf-consulta-item {
    display: flex; align-items: center; gap: 14px;
    background: var(--color-surface); padding: 15px 18px;
    border-radius: var(--radius-sm); border: 1.5px solid var(--color-border);
    text-decoration: none; color: var(--color-text); transition: var(--transition);
}
.srf-consulta-item:hover { border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.srf-consulta-main { flex: 1; min-width: 0; }
.srf-consulta-main strong { display: block; font-size: .93rem; font-weight: 600; }
.srf-consulta-main small  { color: var(--color-muted); font-size: .8rem; }
.srf-consulta-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.srf-consulta-list li { display: flex; align-items: center; gap: 10px; font-size: .875rem; }
.srf-consulta-list a  { color: var(--color-accent); text-decoration: none; flex: 1; font-weight: 500; }
.srf-consulta-list small { color: var(--color-muted); white-space: nowrap; }

/* CALENDARIO */
.srf-leyenda { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.srf-leyenda-item { display: flex; align-items: center; gap: 6px; font-size: .83rem; color: var(--color-muted); }
.srf-leyenda-dot  { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.srf-anio-nav { display: flex; gap: 8px; }
.srf-cal-wrapper { padding: 16px; }
.fc .fc-button-primary { background-color: var(--color-accent) !important; border-color: var(--color-accent) !important; font-family: var(--font-body) !important; font-weight: 600 !important; }
.fc .fc-button-primary:hover { background-color: var(--color-accent-dk) !important; }
.fc .fc-button-primary:not(:disabled):active,
.fc .fc-button-primary:not(:disabled).fc-button-active { background-color: var(--color-primary) !important; border-color: var(--color-primary) !important; }
.fc-daygrid-event { cursor: pointer; border-radius: 4px !important; font-size: .78rem !important; }

/* PROXIMOS */
.srf-proximos-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.srf-proximo-card {
    display: flex; border: 1px solid var(--color-border);
    border-radius: var(--radius-sm); overflow: hidden; background: var(--color-surface); transition: var(--transition);
}
.srf-proximo-card:hover { border-color: var(--color-accent); }
.srf-proximo-card.srf-urgente { border-color: #fed7aa; background: #fff7ed; }
.srf-proximo-card.srf-proximo { border-color: #fde68a; background: #fefce8; }
.srf-proximo-color { width: 5px; flex-shrink: 0; }
.srf-proximo-info  { padding: 13px 14px; flex: 1; }
.srf-proximo-info strong { display: block; font-size: .875rem; margin-bottom: 3px; font-weight: 600; }
.srf-proximo-info span   { display: block; font-size: .78rem; color: var(--color-muted); margin-bottom: 6px; }
.srf-proximo-fecha { font-size: .78rem; }
.srf-text-rojo { color: var(--color-danger); font-weight: 700; }
.srf-text-gris { color: var(--color-muted); }

/* MODAL */
.srf-modal {
    position: fixed; inset: 0; z-index: 1000; background: rgba(15,23,42,.55);
    display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px);
}
.srf-modal-inner {
    background: var(--color-surface); border-radius: var(--radius);
    width: 100%; max-width: 520px; box-shadow: var(--shadow-lg);
    max-height: 90vh; overflow-y: auto; animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity:0; transform:scale(.96) translateY(10px); } to { opacity:1; transform:scale(1) translateY(0); } }
.srf-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--color-border);
}
.srf-modal-header h3 { font-family: var(--font-head); font-size: 1.1rem; font-weight: 700; }
.srf-modal-close {
    background: var(--color-bg); border: 1px solid var(--color-border);
    width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
    color: var(--color-muted); display: flex; align-items: center; justify-content: center; transition: var(--transition);
}
.srf-modal-close:hover { background: #fee2e2; color: var(--color-danger); border-color: #fca5a5; }
.srf-modal-inner form { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.srf-modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding-top: 8px; }
.srf-modal-footer .srf-btn-primary { width: auto; }

/* EMPTY STATE */
.srf-empty-state { text-align: center; padding: 52px 24px; color: var(--color-muted); }
.srf-empty-state svg { stroke: #cbd5e1; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 16px; opacity: .7; }
.srf-empty-state p { font-size: .95rem; margin-bottom: 16px; }
.srf-empty { color: var(--color-muted); font-size: .9rem; font-style: italic; }
.srf-mb { margin-bottom: 16px; }

/* FOOTER */
.srf-footer {
    text-align: center; padding: 20px; font-size: .8rem;
    color: var(--color-muted); border-top: 1px solid var(--color-border); margin-top: 48px;
}
.srf-footer a { color: var(--color-accent); text-decoration: none; }

/* RESPONSIVE */
@media (max-width: 900px) { .srf-two-col { grid-template-columns: 1fr; } .srf-proximos-grid { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
    .srf-nav-menu, .srf-nav-usuario { display: none !important; }
    .srf-nav-toggle { display: flex; }
    .srf-nav-inner { gap: 12px; }
    .srf-cards-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .srf-main { padding: 20px 16px; }
    .srf-page-header h2 { font-size: 1.3rem; }
    .srf-panel { padding: 16px; }
    .srf-login-card { padding: 32px 22px; }
}
@media (max-width: 480px) {
    .srf-cards-grid { grid-template-columns: 1fr; }
    .srf-doc-tipos { flex-direction: column; }
    .srf-modal-inner form { padding: 18px; }
    .fc .fc-toolbar { flex-direction: column; gap: 8px; }
}

/* ── Grid de 4 columnas (dashboard con facturas) ────────── */
.srf-cards-grid-4 { grid-template-columns: repeat(4, 1fr); }
.srf-icon-facturas { background: linear-gradient(135deg, #7c3aed, #a78bfa); }

@media (max-width: 900px)  { .srf-cards-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .srf-cards-grid-4 { grid-template-columns: 1fr 1fr; } }
