@import url('https://fonts.googleapis.com/css2?family=Michroma&family=Montserrat:wght@400;500;600;700;800;900&display=swap');

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Montserrat", system-ui, sans-serif;
    background: #f3f6fb;
    color: #0f172a;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    background: #f3f6fb;
}

.sidebar {
    width: 270px;
    background: linear-gradient(180deg, #1E2A5B, #142044);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 22px 18px;
    position: fixed;
    inset: 0 auto 0 0;
    box-shadow: 10px 0 30px rgba(30,42,91,.24);
    z-index: 20;
}

.brand {
    margin-bottom: 34px;
}

.brand .login-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.brand .login-brand img {
    width: 185px;
    max-width: 100%;
    display: block;
}

.brand span {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    opacity: .72;
    font-weight: 600;
    text-align: center;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.nav-link {
    height: 50px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 16px;
    color: rgba(255,255,255,.76);
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    transition: .18s ease;
}

.nav-link:hover {
    background: rgba(255,255,255,.10);
    color: #fff;
    transform: translateX(2px);
}

.nav-link.active {
    background: #FF4F00;
    color: #fff;
    box-shadow: 0 14px 26px rgba(255,79,0,.28);
}

.nav-link .material-icons {
    font-size: 22px;
    flex-shrink: 0;
}

.main {
    flex: 1;
    margin-left: 270px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    min-height: 88px;
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    border-bottom: 1px solid rgba(30,42,91,.10);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar h1 {
    margin: 0;
    font-family: "Michroma", "Montserrat", sans-serif;
    font-size: 18px;
    text-transform: uppercase;
    color: #1E2A5B;
    letter-spacing: .04em;
}

.topbar p {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

#userName {
    padding: 10px 14px;
    border-radius: 999px;
    background: #eef3f8;
    color: #1E2A5B;
    font-size: 13px;
    font-weight: 900;
    border: 1px solid rgba(30,42,91,.10);
}

.btn {
    border: 0;
    border-radius: 14px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-family: "Montserrat", sans-serif;
    font-weight: 800;
    cursor: pointer;
    background: #fff;
    color: #1E2A5B;
    box-shadow: 0 8px 18px rgba(15,23,42,.08);
}

.btn:hover {
    transform: translateY(-1px);
}

#logoutBtn {
    background: #eef3f8;
    color: #1E2A5B;
}

.content {
    padding: 24px;
    width: 100%;
    max-width: 1480px;
    margin: 0 auto;
    background: #f3f6fb;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background: #fff;
    border: 1px solid rgba(30,42,91,.10);
    border-radius: 22px;
    padding: 20px;
    box-shadow: 0 12px 28px rgba(15,23,42,.06);
}

.card span {
    display: block;
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
}

.card strong {
    display: block;
    margin-top: 10px;
    font-size: 30px;
    color: #1E2A5B;
}

.panel {
    background: #fff;
    border: 1px solid rgba(30,42,91,.10);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 12px 28px rgba(15,23,42,.06);
}

.panel-header {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(30,42,91,.10);
}

.panel-header h2 {
    margin: 0;
    color: #1E2A5B;
    font-size: 18px;
    font-weight: 900;
}

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

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

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid rgba(30,42,91,.08);
    text-align: left;
    font-size: 14px;
}

th {
    background: #f8fafc;
    color: #1E2A5B;
    font-weight: 900;
}

td {
    color: #334155;
    font-weight: 600;
}

.status{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:5px 10px;
    border-radius:999px;
    font-size:12px;
    font-weight:900;
    text-transform:uppercase;
    letter-spacing:.3px;
}

.status-draft{
    background: rgba(255,79,0,.12);
    color: #FF4F00;
}

.status-sent{
    background:#eff6ff;
    color:#2563eb;
}

.status-approved{
    background:#ecfdf5;
    color:#15803d;
}

.status-rejected{
    background:#fef2f2;
    color:#dc2626;
}

.status-expired{
    background:#f3f4f6;
    color:#6b7280;
}

.empty-state,
.loading,
.error-box {
    background: #fff;
    border: 1px solid rgba(30,42,91,.10);
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 12px 28px rgba(15,23,42,.06);
}

.empty-state h2 {
    margin: 0 0 8px;
    color: #1E2A5B;
}

.empty-state p,
.loading {
    color: #64748b;
    font-weight: 700;
}

.error-box {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
    font-weight: 800;
}

[hidden] {
    display: none !important;
}

@media (max-width: 850px) and (min-width: 521px) {
    .sidebar {
        width: 110px;
        padding: 18px 10px;
    }

    .brand {
        display: none;
    }

    .nav {
        gap: 12px;
    }

    .nav-link {
        height: auto;
        min-height: 74px;
        padding: 10px 8px;
        flex-direction: column;
        justify-content: center;
        text-align: center;
        gap: 6px;
        font-size: 13px;
        line-height: 1.15;
    }

    .main {
        margin-left: 110px;
    }

    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 520px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 78px;
        min-height: 78px;
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
        z-index: 9999;
        overflow: hidden;
    }

    .brand {
        display: none;
    }

    .nav {
        width: 100%;
        height: 100%;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 4px;
        padding: 0;
        overflow: hidden;
    }

    .nav-link {
        width: 100%;
        min-width: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 6px 2px;
        gap: 3px;
        border-radius: 18px;
        font-size: 10.5px;
        line-height: 1.05;
        text-align: center;
        white-space: nowrap;
    }

    .nav-link.active {
        transform: none;
        box-shadow: 0 8px 18px rgba(255,79,0,.28);
    }

    .main {
        margin-left: 0;
        padding-bottom: calc(96px + env(safe-area-inset-bottom));
    }

    .topbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        min-height: auto;
    }

    .topbar h1 {
        font-size: 16px;
        margin: 0;
    }

    #pageSubtitle {
        display: none;
    }

    .topbar-actions {
        width: auto;
        gap: 8px;
    }

    #userName {
        padding: 0;
        width: 38px;
        height: 38px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        font-weight: 900;
        overflow: hidden;
    }

    #logoutBtn {
        width: 38px;
        height: 38px;
        padding: 0;
        font-size: 0;
    }

    #logoutBtn::before {
        content: "⎋";
        font-size: 18px;
    }

    .content {
        padding: 16px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }
}

.modal-backdrop{
    position:fixed;
    inset:0;
    background:rgba(15,23,42,.60);
    display:flex;
    align-items:center;
    justify-content:center;
    padding:20px;
    z-index:1000;
    backdrop-filter:blur(6px);
}

.modal-card{
    width:100%;
    max-width:520px;
    background:#fff;
    border-radius:22px;
    box-shadow:0 25px 60px rgba(0,0,0,.25);
    overflow:hidden;
}

.modal-head{
    padding:22px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    border-bottom:1px solid rgba(30,42,91,.10);
}

.settings-form{
    padding:24px;
    display:grid;
    gap:14px;
}

.settings-form label{
    display:grid;
    gap:6px;
    font-size:13px;
    font-weight:700;
    color:#334155;
}

.settings-form input,
.settings-form select{
    height:44px;
    border:1px solid #dbe3ef;
    border-radius:12px;
    padding:0 12px;
    font-size:14px;
    outline:none;
}

.modal-actions{
    display:flex;
    justify-content:flex-end;
    gap:10px;
    margin-top:10px;
}

.modal-card{
    width:min(980px,95vw);
    max-height:90vh;
    overflow:auto;
}

.settings-form{
    padding:24px;
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:16px 18px;
}

.settings-form label{
    display:flex;
    flex-direction:column;
    gap:6px;
    font-size:13px;
    font-weight:700;
    color:#334155;
}

.settings-form input,
.settings-form select{
    height:44px;
    border:1px solid #dbe3ef;
    border-radius:12px;
    padding:0 12px;
    font-size:14px;
    outline:none;
    background:#fff;
}

.settings-form input:focus,
.settings-form select:focus{
    border-color:#FF4F00;
    box-shadow:0 0 0 4px rgba(255,79,0,.12);
}

.modal-actions{
    grid-column:1 / -1;
    display:flex;
    justify-content:flex-end;
    gap:10px;
    margin-top:10px;
    padding-top:16px;
    border-top:1px solid rgba(30,42,91,.08);
}

.modal-head{
    padding:22px 24px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    border-bottom:1px solid rgba(30,42,91,.10);
}

.modal-head h2{
    margin:0;
    color:#1E2A5B;
    font-size:20px;
    font-weight:800;
}

@media(max-width:850px){

    .modal-card{
        width:95vw;
    }

    .settings-form{
        grid-template-columns:1fr;
    }

}

.context-menu{
    position:fixed;
    min-width:190px;
    background:#fff;
    border:1px solid rgba(30,42,91,.12);
    border-radius:14px;
    box-shadow:0 18px 50px rgba(15,23,42,.22);
    padding:8px;
    z-index:2000;
}

.context-menu button{
    width:100%;
    border:0;
    background:transparent;
    display:flex;
    align-items:center;
    gap:10px;
    padding:10px 12px;
    border-radius:10px;
    cursor:pointer;
    font-size:14px;
    color:#334155;
    text-align:left;
}

.context-menu button:hover{
    background:#f1f5f9;
    color:#1E2A5B;
}

.context-menu .material-icons{
    font-size:20px;
    color:#64748b;
}

.nav-group{
    display:grid;
    gap:4px;
}

.nav-submenu{
    display:grid;
    gap:4px;
    margin-left:18px;
    padding-left:10px;
    border-left:1px solid rgba(255,255,255,.14);
}

.nav-sublink{
    font-size:13px;
    padding:9px 10px;
    opacity:.88;
}

.nav-sublink .material-icons{
    font-size:18px;
}

/* ==========================================================
   FORCE CHANGE PASSWORD
========================================================== */
.force-password-page{
    min-height:100vh;
    display:grid;
    grid-template-columns:1fr 480px;
    background:
        radial-gradient(circle at top left, rgba(255,79,0,.18), transparent 34%),
        linear-gradient(135deg,#1E2A5B,#0f172a);
}

.force-password-left{
    color:#fff;
    padding:70px;
    display:flex;
    flex-direction:column;
    justify-content:center;
}

.force-brand img{
    width:220px;
    margin-bottom:42px;
}

.force-password-left h1{
    font-size:46px;
    margin:0 0 18px;
}

.force-password-left p{
    max-width:560px;
    font-size:18px;
    line-height:1.6;
    color:rgba(255,255,255,.82);
}

.force-password-right{
    background:#fff;
    padding:54px 42px;
    display:flex;
    align-items:center;
}

.force-password-form{
    width:100%;
    display:grid;
    gap:16px;
}

.force-password-form h2{
    margin:0;
    color:#1E2A5B;
    font-size:24px;
}

.force-password-form ul{
    margin:0 0 12px;
    padding-left:20px;
    color:#64748b;
    font-size:14px;
    line-height:1.7;
}

.force-password-form label{
    display:grid;
    gap:7px;
    font-size:13px;
    font-weight:700;
    color:#334155;
}

.force-password-form input{
    height:48px;
    border:1px solid #dbe3ef;
    border-radius:14px;
    padding:0 14px;
    font-size:15px;
    outline:none;
}

.force-password-form input:focus{
    border-color:#FF4F00;
    box-shadow:0 0 0 4px rgba(255,79,0,.12);
}



@media(max-width:850px){
    .force-password-page{
        grid-template-columns:1fr;
    }

    .force-password-left{
        padding:38px 28px 20px;
    }

    .force-password-left h1{
        font-size:32px;
    }

    .force-password-right{
        padding:28px;
        align-items:flex-start;
    }
}

.force-password-form .login-error,
#forcePasswordMsg{
    margin-top:4px;
    padding:13px 14px;
    border-radius:14px;
    background:#fef2f2;
    border:1px solid #fecaca;
    color:#b91c1c;
    font-size:14px;
    font-weight:700;
    line-height:1.4;
    display:flex;
    align-items:center;
    gap:8px;
}

#forcePasswordMsg[hidden]{
    display:none;
}

.password-field{
    position:relative;
}

.password-field input{
    width:100%;
    height:48px;
    padding:0 46px 0 14px;   /* espacio para el ojo */
    box-sizing:border-box;
}

.password-toggle{ 
    all: unset;
    position:absolute;
    top:50%;
    right:12px;
    transform:translateY(-50%);
    width:28px;
    height:28px;
    border:none;
    background:transparent;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    color:#94a3b8;
    transition:.18s;
}

.password-toggle:hover{
    color:#FF4F00;
    background:rgba(255,79,0,.08);
}

.password-toggle .material-icons{
    font-size:20px;
}

.login-success{
    margin-top:4px;
    padding:13px 14px;
    border-radius:14px;
    background:#ecfdf5;
    border:1px solid #bbf7d0;
    color:#047857;
    font-size:14px;
    font-weight:700;
    line-height:1.4;
}