:root{
    --brand:#154f7a;
    --brand-dark:#0d3355;
    --accent:#1f8a70;
    --gold:#b8872f;
    --ink:#162033;
    --muted:#617186;
    --line:#d8e2ec;
    --surface:#ffffff;
    --page:#f3f7fb;
    --danger:#c2413b;
    --shadow:0 16px 36px rgba(20,48,78,.12);
}

*{box-sizing:border-box;}
html{min-height:100%;}
body{
    margin:0;
    min-height:100vh;
    background:
        radial-gradient(circle at top left, rgba(31,138,112,.14), transparent 34%),
        linear-gradient(180deg,#f7fbff 0%, var(--page) 48%, #edf4f9 100%);
    color:var(--ink);
    font-family:"Inter","Segoe UI",Arial,sans-serif;
}

a{color:var(--brand);font-weight:700;text-decoration:none;}
a:hover{color:var(--brand-dark);text-decoration:underline;}

.auth-page{
    min-height:100vh;
    display:grid;
    place-items:center;
    padding:28px 16px;
    background:
        radial-gradient(circle at 12% 12%, rgba(31,138,112,.18), transparent 28%),
        radial-gradient(circle at 88% 18%, rgba(184,135,47,.17), transparent 30%),
        linear-gradient(135deg,#eff7fb 0%,#f8fbff 48%,#eef7f4 100%);
}

.auth-card{
    width:min(100%, 1040px);
    display:grid;
    grid-template-columns:minmax(290px,.88fr) minmax(340px,1.12fr);
    background:var(--surface);
    border:1px solid var(--line);
    border-radius:8px;
    box-shadow:0 24px 60px rgba(14,48,82,.18);
    overflow:hidden;
}

.auth-brand{
    background:
        linear-gradient(160deg,rgba(13,51,85,.96),rgba(21,79,122,.94)),
        linear-gradient(35deg,rgba(31,138,112,.55),rgba(184,135,47,.35));
    color:#fff;
    padding:38px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
    gap:28px;
}

.auth-brand img,.brand-mark{
    width:78px;
    height:78px;
    object-fit:contain;
    background:#fff;
    border-radius:8px;
    padding:8px;
}

.auth-brand h1{
    margin:16px 0 8px;
    font-size:32px;
    line-height:1.15;
    letter-spacing:0;
    font-weight:900;
}

.auth-brand p{margin:0;color:#dcecf7;font-size:15px;line-height:1.55;}
.auth-badges{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    margin-top:18px;
}
.auth-badge{
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:7px 10px;
    border-radius:999px;
    background:rgba(255,255,255,.13);
    border:1px solid rgba(255,255,255,.18);
    color:#fff;
    font-size:12px;
    font-weight:800;
}
.auth-help{
    border-top:1px solid rgba(255,255,255,.22);
    padding-top:18px;
    font-size:14px;
    color:#e9f5fb;
}

.auth-form{padding:38px;}
.auth-form h2,.page-title{
    margin:0 0 8px;
    color:var(--brand-dark);
    font-size:28px;
    font-weight:800;
    letter-spacing:0;
}
.auth-kicker{
    display:inline-flex;
    align-items:center;
    gap:7px;
    color:var(--accent);
    background:#eaf8f3;
    border:1px solid #cdece1;
    border-radius:999px;
    padding:6px 10px;
    font-size:12px;
    font-weight:900;
    margin-bottom:12px;
}

.form-note{
    background:#fff8e8;
    border:1px solid #f0d599;
    border-left:4px solid var(--gold);
    border-radius:8px;
    padding:12px 14px;
    color:#5f4b1b;
    font-size:14px;
    margin:18px 0;
}

.form-control,.form-select,textarea.form-control{
    border:1px solid #cbd8e4;
    border-radius:6px;
    min-height:44px;
    padding:10px 12px;
    box-shadow:none;
    font-size:15px;
}

.form-control::placeholder{
    color:#91a0af;
    font-size:14px;
}

.form-control:focus,.form-select:focus,textarea.form-control:focus{
    border-color:var(--brand);
    box-shadow:0 0 0 3px rgba(21,79,122,.12);
}

label,.form-label{color:#314255;font-weight:700;font-size:13px;}
.input-group-text{background:linear-gradient(160deg,var(--brand),var(--accent));color:#fff;border:1px solid var(--brand);border-radius:6px;}
.captcha-box,.metric-box{
    background:#fff8e8;
    border:1px solid #f0d599;
    border-radius:6px;
    color:#7a4d00;
    font-weight:800;
}

.btn{border-radius:6px;font-weight:800;}
.btn-primary,.generate-btn,.btn-custom{
    background:linear-gradient(135deg,var(--brand),var(--accent))!important;
    border-color:var(--brand)!important;
    color:#fff!important;
}
.btn-primary:hover,.generate-btn:hover,.btn-custom:hover{
    background:var(--brand-dark)!important;
    border-color:var(--brand-dark)!important;
    color:#fff!important;
    transform:none!important;
}
.btn-success{background:var(--accent)!important;border-color:var(--accent)!important;}

.app-shell{
    min-height:100vh;
    display:grid;
    grid-template-columns:260px 1fr;
}

.sidebar{
    background:#102f4c;
    color:#fff;
    padding:22px 18px;
    position:sticky;
    top:0;
    height:100vh;
}

.sidebar-brand{
    display:flex;
    gap:12px;
    align-items:center;
    padding-bottom:18px;
    border-bottom:1px solid rgba(255,255,255,.16);
}

.sidebar-brand img{width:46px;height:46px;object-fit:contain;background:#fff;border-radius:6px;padding:5px;}
.sidebar-brand strong{display:block;font-size:15px;}
.sidebar-brand span{display:block;font-size:12px;color:#cce0ee;}

.nav-list{display:grid;gap:8px;margin-top:22px;}
.nav-list a{
    display:flex;
    align-items:center;
    gap:10px;
    color:#e9f4fb;
    padding:11px 12px;
    border-radius:6px;
    font-weight:700;
}
.nav-list a:hover,.nav-list a.active{background:rgba(255,255,255,.12);text-decoration:none;color:#fff;}

.content{
    padding:28px;
    min-width:0;
}

.dashboard-hero,.page-card,.panel,.portal-card,.card-box{
    background:rgba(255,255,255,.96)!important;
    border:1px solid var(--line)!important;
    border-radius:8px!important;
    box-shadow:var(--shadow)!important;
}

.dashboard-hero{
    display:flex;
    justify-content:space-between;
    gap:18px;
    align-items:center;
    padding:24px;
    margin-bottom:18px;
}

.dashboard-hero h1{margin:0;color:var(--brand-dark);font-size:30px;font-weight:850;letter-spacing:0;}
.dashboard-hero p{margin:6px 0 0;color:var(--muted);}
.profile-card{
    display:flex;
    align-items:center;
    gap:14px;
    min-width:260px;
    background:#fff;
    border:1px solid var(--line);
    border-radius:8px;
    padding:12px 14px;
    box-shadow:0 10px 24px rgba(20,48,78,.08);
}
.profile-avatar{
    width:48px;
    height:48px;
    border-radius:8px;
    display:grid;
    place-items:center;
    background:linear-gradient(160deg,var(--brand),var(--accent));
    color:#fff;
    font-size:20px;
    font-weight:900;
}
.profile-card span{
    display:block;
    color:var(--muted);
    font-size:12px;
    font-weight:800;
    text-transform:uppercase;
}
.profile-card strong{
    display:block;
    color:var(--brand-dark);
    font-size:17px;
    line-height:1.15;
}
.profile-card small{color:var(--muted);font-weight:700;}

.stat-grid,.action-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:14px;
}

.stat-card,.action-card{
    background:#fff;
    border:1px solid var(--line);
    border-radius:8px;
    padding:18px;
    box-shadow:0 8px 20px rgba(20,48,78,.07);
}

.stat-card span,.action-card span{display:block;color:var(--muted);font-size:13px;font-weight:700;}
.stat-card strong{display:block;margin-top:6px;color:var(--brand-dark);font-size:28px;}
.action-card h3{margin:8px 0;color:var(--ink);font-size:18px;font-weight:800;}
.action-card p{min-height:42px;margin:0 0 14px;color:var(--muted);font-size:14px;}

.log-toolbar{
    display:flex;
    justify-content:space-between;
    gap:12px;
    align-items:end;
    flex-wrap:wrap;
    margin-bottom:12px;
}

.log-toolbar form{
    display:flex;
    gap:10px;
    align-items:end;
    flex-wrap:wrap;
}

.status-pill{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:58px;
    border-radius:999px;
    padding:4px 9px;
    font-size:12px;
    font-weight:800;
    background:#edf5fb;
    color:var(--brand-dark);
}

.status-pill.in{background:#e9f8f1;color:#176347;}
.status-pill.out{background:#fff3e0;color:#8a520a;}
.status-pill.sent{background:#e9f8f1;color:#176347;}
.status-pill.pending{background:#fff4f4;color:#9f2f2b;}

.mobile-page-header{
    display:none;
    background:#102f4c;
    color:#fff;
    padding:14px 16px;
}

.mobile-page-header a{color:#fff;}

.topbar h1,h1{letter-spacing:0;}
.table-wrap{border-radius:8px!important;border:1px solid var(--line)!important;}
thead th{background:#e6f0f7!important;color:#17344f!important;}
.pagination-wrap{
    display:flex;
    justify-content:center;
    overflow-x:auto;
    padding:4px 0;
}
.pagination.compact{
    flex-wrap:nowrap;
    gap:4px;
    margin-bottom:0;
}
.pagination.compact .page-link{
    border-radius:6px;
    min-width:38px;
    min-height:38px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:800;
    color:var(--brand);
}
.pagination.compact .page-item.active .page-link{
    background:var(--brand);
    border-color:var(--brand);
    color:#fff;
}
.pagination.compact .page-item.disabled .page-link{
    color:#8b98a7;
    background:#f2f6fa;
}

@media(max-width:900px){
    .auth-card{grid-template-columns:1fr;}
    .auth-brand{padding:24px;}
    .auth-brand h1{font-size:25px;}
    .auth-form{padding:24px;}
    .app-shell{grid-template-columns:1fr;}
    .sidebar{position:relative;height:auto;}
    .nav-list{grid-template-columns:repeat(2,minmax(0,1fr));}
    .content{padding:18px;}
    .dashboard-hero{display:block;}
    .dashboard-hero .btn,.dashboard-hero .profile-card{margin-top:14px;}
    .profile-card{min-width:0;width:100%;}
    .stat-grid,.action-grid{grid-template-columns:1fr;}
    .mobile-page-header{display:flex;justify-content:space-between;align-items:center;}
}

@media(max-width:560px){
    .auth-page{padding:12px;}
    .auth-brand,.auth-form{padding:20px;}
    .nav-list{grid-template-columns:1fr;}
    .content{padding:14px;}
    .dashboard-hero h1{font-size:24px;}
    .action-card p{min-height:0;}
}
