:root {
    --rh-navy: #13283f;
    --rh-navy-soft: #1d3854;
    --rh-blue: #2878bd;
    --rh-cyan: #52b9c7;
    --rh-bg: #f3f6f9;
    --rh-border: #dce4eb;
    --rh-text: #203142;
    --rh-muted: #6e7f90;
    --rh-white: #fff;
    --rh-shadow: 0 16px 40px rgba(18, 40, 63, .08);
}

* { box-sizing: border-box; }

body.rh-portal {
    margin: 0;
    min-height: 100vh;
    background: var(--rh-bg);
    color: var(--rh-text);
    font-family: Inter, Arial, sans-serif;
}

.rh-portal-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: 260px;
    overflow-y: auto;
    background: linear-gradient(180deg, var(--rh-navy), #0c1c2d);
    color: #dbe7f0;
    transition: width .2s ease, transform .2s ease;
}

.rh-portal-brand {
    display: flex;
    min-height: 88px;
    align-items: center;
    gap: 13px;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    color: #fff;
    text-decoration: none;
}

.rh-portal-brand img {
    width: 46px;
    height: 46px;
    object-fit: contain;
    padding: 5px;
    border-radius: 12px;
    background: #fff;
}

.rh-portal-brand span { font-size: 14px; font-weight: 700; line-height: 1.25; }
.rh-portal-brand small { display: block; margin-top: 4px; color: #9ab3c8; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .12em; }
.rh-portal-sidebar nav { padding: 20px 14px 36px; }
.rh-portal-sidebar nav p { margin: 22px 12px 8px; color: #7490a7; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.rh-portal-sidebar nav a { display: flex; align-items: center; gap: 12px; margin: 3px 0; padding: 11px 12px; border-radius: 9px; color: #c8d7e4; font-size: 13px; font-weight: 500; text-decoration: none; transition: .18s ease; }
.rh-portal-sidebar nav a:hover, .rh-portal-sidebar nav a.active { background: rgba(82,185,199,.15); color: #fff; }
.rh-portal-sidebar nav a.active { box-shadow: inset 3px 0 var(--rh-cyan); }
.rh-portal-sidebar nav a i { width: 20px; color: #77cbd5; text-align: center; }
.portal-menu-section { margin-top: 20px; }
.portal-menu-section-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 12px 7px;
    border: 0;
    background: transparent;
    color: #82a2bd;
    font: inherit;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    text-align: left;
    text-transform: uppercase;
    cursor: pointer;
    transition: color .18s ease;
}
.portal-menu-section-toggle:hover { color: #d7e7f2; }
.portal-menu-section-toggle:focus-visible { border-radius: 6px; outline: 2px solid var(--rh-cyan); outline-offset: 2px; }
.portal-menu-section-toggle i { flex: 0 0 auto; font-size: 9px; transition: transform .18s ease; }
.portal-menu-section-links { display: block; }
.portal-menu-section.is-closed .portal-menu-section-links { display: none; }
.portal-menu-section.is-closed .portal-menu-section-toggle i { transform: rotate(-90deg); }
.rh-portal-shell { min-height: 100vh; margin-left: 260px; transition: margin-left .2s ease; }
.rh-portal-topbar { position: sticky; top: 0; z-index: 20; display: flex; min-height: 72px; align-items: center; gap: 16px; padding: 0 28px; border-bottom: 1px solid var(--rh-border); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
.rh-portal-topbar > div:nth-child(2) { display: flex; flex-direction: column; }
.rh-portal-topbar > div:nth-child(2) strong { font-size: 14px; }
.rh-portal-topbar > div:nth-child(2) span { margin-top: 2px; color: var(--rh-muted); font-size: 11px; }
.rh-portal-topbar button { display: grid; flex: 0 0 38px; width: 38px; height: 38px; place-items: center; border: 1px solid var(--rh-border); border-radius: 8px; background: #fff; color: var(--rh-navy); cursor: pointer; }
.rh-portal-user { display: flex; align-items: center; gap: 14px; margin-left: auto; text-align: right; }
.rh-portal-user span { display: flex; flex-direction: column; }
.rh-portal-user strong { font-size: 12px; }
.rh-portal-user small { margin-top: 2px; color: var(--rh-muted); font-size: 10px; }
.rh-portal-user a { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 9px; background: #edf3f7; color: var(--rh-navy); }
.rh-portal-main { padding: 30px; }
.rh-portal-main > section:not(.rh-dashboard):not(.rh-forbidden) { margin: 0; padding: 0; }
.rh-portal-main .container { width: 100%; max-width: 100%; }
.rh-portal-message, .rh-login-error { margin-bottom: 18px; padding: 12px 14px; border: 1px solid #f1c9c9; border-radius: 8px; background: #fff0f0; color: #9f2d2d; font-size: 13px; }
.rh-expiry-alert {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 18px;
    padding: 13px 15px;
    border: 1px solid #efcf8d;
    border-radius: 10px;
    background: #fff8e9;
    color: #76520a;
    text-decoration: none;
}
.rh-expiry-alert[hidden] { display: none; }
.rh-expiry-alert > i:first-child { font-size: 18px; }
.rh-expiry-alert > i:last-child { margin-left: auto; }
.rh-expiry-alert span, .rh-expiry-alert strong, .rh-expiry-alert small { display: block; }
.rh-expiry-alert strong { font-size: 12px; }
.rh-expiry-alert small { margin-top: 3px; color: #967326; font-size: 10px; }

@media (min-width: 801px) {
    .rh-portal-sidebar-collapsed .rh-portal-sidebar { width: 78px; }
    .rh-portal-sidebar-collapsed .rh-portal-shell { margin-left: 78px; }
    .rh-portal-sidebar-collapsed .rh-portal-brand { justify-content: center; padding-inline: 12px; }
    .rh-portal-sidebar-collapsed .rh-portal-brand img { width: 42px; height: 42px; }
    .rh-portal-sidebar-collapsed .rh-portal-brand span,
    .rh-portal-sidebar-collapsed .rh-portal-sidebar nav p,
    .rh-portal-sidebar-collapsed .rh-portal-sidebar nav a span,
    .rh-portal-sidebar-collapsed .portal-menu-section-toggle { display: none; }
    .rh-portal-sidebar-collapsed .portal-menu-section { margin-top: 3px; }
    .rh-portal-sidebar-collapsed .portal-menu-section-links { display: block !important; }
    .rh-portal-sidebar-collapsed .rh-portal-sidebar nav { padding-inline: 10px; }
    .rh-portal-sidebar-collapsed .rh-portal-sidebar nav a {
        justify-content: center;
        min-height: 44px;
        padding-inline: 8px;
    }
    .rh-portal-sidebar-collapsed .rh-portal-sidebar nav a i { width: auto; font-size: 16px; }
    .rh-portal-sidebar-collapsed .rh-portal-sidebar nav a.active { box-shadow: inset 3px 0 var(--rh-cyan); }
}

.rh-dashboard-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.rh-eyebrow { color: var(--rh-blue); font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.rh-dashboard h1, .rh-forbidden h1 { margin: 6px 0 8px; color: var(--rh-navy); font-size: clamp(25px, 3vw, 34px); line-height: 1.1; }
.rh-dashboard-heading p { margin: 0; color: var(--rh-muted); font-size: 13px; }
.rh-dashboard-date { color: var(--rh-muted); font-size: 12px; text-transform: capitalize; }
.rh-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.rh-kpi-grid article { position: relative; overflow: hidden; padding: 20px; border: 1px solid var(--rh-border); border-radius: 13px; background: #fff; box-shadow: var(--rh-shadow); }
.rh-kpi-grid article::after { position: absolute; top: 0; right: 0; width: 58px; height: 4px; background: var(--rh-cyan); content: ""; }
.rh-kpi-grid span, .rh-kpi-grid small { display: block; color: var(--rh-muted); font-size: 11px; }
.rh-kpi-grid strong { display: block; margin: 10px 0 7px; color: var(--rh-navy); font-size: 29px; }
.rh-kpi-grid .is-unavailable strong { color: #9aabb8; font-size: 18px; }
.rh-dashboard-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, .85fr); gap: 20px; }
.rh-dashboard-panel { padding: 22px; border: 1px solid var(--rh-border); border-radius: 13px; background: #fff; box-shadow: var(--rh-shadow); }
.rh-panel-heading h2 { margin: 4px 0 18px; color: var(--rh-navy); font-size: 18px; }
.rh-quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rh-quick-grid a { display: flex; align-items: center; gap: 14px; padding: 15px; border: 1px solid var(--rh-border); border-radius: 10px; color: var(--rh-text); text-decoration: none; transition: .18s ease; }
.rh-quick-grid a:hover { transform: translateY(-2px); border-color: #a9d4dc; box-shadow: 0 10px 25px rgba(18,40,63,.08); }
.rh-quick-grid i { display: grid; flex: 0 0 38px; height: 38px; place-items: center; border-radius: 9px; background: #e8f5f7; color: #26899a; }
.rh-quick-grid span { display: flex; min-width: 0; flex-direction: column; }
.rh-quick-grid strong { font-size: 12px; }
.rh-quick-grid small { margin-top: 4px; color: var(--rh-muted); font-size: 10px; }
.rh-phase-panel ul { display: grid; gap: 15px; margin: 0; padding: 0; list-style: none; }
.rh-phase-panel li { display: flex; align-items: flex-start; gap: 10px; }
.rh-phase-panel i { margin-top: 2px; color: var(--rh-cyan); font-size: 12px; }
.rh-phase-panel li span { display: flex; flex-direction: column; }
.rh-phase-panel strong { font-size: 12px; }
.rh-phase-panel small { margin-top: 4px; color: var(--rh-muted); font-size: 10px; line-height: 1.45; }

.rh-forbidden { max-width: 650px; margin: 8vh auto !important; padding: 45px !important; border: 1px solid var(--rh-border); border-radius: 14px; background: #fff; text-align: center; box-shadow: var(--rh-shadow); }
.rh-forbidden > i { display: block; margin-bottom: 20px; color: var(--rh-cyan); font-size: 40px; }
.rh-forbidden p { color: var(--rh-muted); font-size: 13px; line-height: 1.6; }
.rh-forbidden a { display: inline-block; margin-top: 15px; padding: 10px 16px; border-radius: 8px; background: var(--rh-navy); color: #fff; text-decoration: none; }

body.rh-portal-login { margin: 0; min-height: 100vh; background: radial-gradient(circle at 12% 15%, rgba(82,185,199,.22), transparent 28%), linear-gradient(145deg, #10253b, #1b3a58); font-family: Inter, Arial, sans-serif; }
.rh-portal-login main { display: grid; min-height: 100vh; padding: 24px; place-items: center; }
.rh-login-card { width: min(100%, 420px); padding: 38px; border: 1px solid rgba(255,255,255,.7); border-radius: 18px; background: rgba(255,255,255,.97); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.rh-login-card > img { width: 150px; max-height: 54px; object-fit: contain; object-position: left center; }
.rh-login-heading { margin: 30px 0 25px; }
.rh-login-heading span { color: var(--rh-blue); font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.rh-login-heading h1 { margin: 7px 0 8px; color: var(--rh-navy); font-size: 28px; }
.rh-login-heading p, .rh-login-card > small { color: var(--rh-muted); font-size: 12px; }
.rh-login-card form { display: grid; }
.rh-login-card label { margin: 13px 0 6px; color: var(--rh-text); font-size: 11px; font-weight: 600; }
.rh-login-card input { width: 100%; height: 46px; padding: 0 13px; border: 1px solid #ccd8e1; border-radius: 8px; background: #fbfcfd; font: inherit; font-size: 13px; outline: none; }
.rh-login-card input:focus { border-color: var(--rh-blue); box-shadow: 0 0 0 3px rgba(40,120,189,.12); }
.rh-login-card button { height: 47px; margin: 22px 0 17px; border: 0; border-radius: 8px; background: linear-gradient(90deg, var(--rh-blue), #1f658f); color: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.rh-login-card button:disabled { cursor: wait; opacity: .7; }

@media (max-width: 1050px) {
    .rh-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rh-dashboard-layout { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
    .rh-portal-sidebar { width: 260px; transform: translateX(-100%); }
    .rh-portal-menu-open .rh-portal-sidebar { transform: translateX(0); }
    .rh-portal-shell { margin-left: 0; }
    .rh-portal-main { padding: 20px; }
    .rh-portal-user small { display: none; }
}

@media (max-width: 570px) {
    .rh-kpi-grid, .rh-quick-grid { grid-template-columns: 1fr; }
    .rh-dashboard-heading { align-items: flex-start; flex-direction: column; }
    .rh-login-card { padding: 28px 24px; }
    .rh-portal-topbar { padding: 0 16px; }
    .rh-portal-topbar > div:nth-child(2) span, .rh-portal-user span { display: none; }
}
