:root {
    --brand: #173b6c;
    --brand-dark: #102b50;
    --brand-soft: #eaf0f8;
    --accent: #c59a3a;
    --text: #172033;
    --muted: #677084;
    --border: #dfe4ec;
    --surface: #ffffff;
    --background: #f4f6f9;
    --danger: #a62929;
    --danger-bg: #fff0f0;
    --shadow: 0 18px 45px rgba(20, 39, 70, .10);
    --radius: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--text);
    background: var(--background);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}

a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
    background:
        radial-gradient(circle at 10% 10%, rgba(197, 154, 158, .56), transparent 28%),
        linear-gradient(135deg, #102b50 0%, #173b6c 48%, #eef2f7 48%, #f7f8fa 100%);
}

.login-shell {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: 0 28px 80px rgba(8, 24, 48, .24);
}

.login-brand {
    min-height: 520px;
    padding: 58px;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background:
        linear-gradient(rgba(16, 43, 80, .75), rgba(16, 43, 80, .92)),
        repeating-linear-gradient(45deg, rgba(255,255,255,.06) 0 1px, transparent 1px 18px);
}
.login-brand img { margin-bottom: auto; filter: brightness(0) invert(1); }
.login-brand h1 { margin: 0 0 10px; font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.05; }
.login-brand p { margin: 0; max-width: 34rem; color: rgba(255,255,255,.78); }

.login-card { padding: 58px 48px; align-self: center; }
.login-card h2 { margin: 0; font-size: 1.8rem; }
.muted { color: var(--muted); }

.stack-form { display: grid; gap: 10px; margin-top: 28px; }
.stack-form label { margin-top: 8px; font-weight: 700; font-size: .92rem; }
.stack-form input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 13px;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.stack-form input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(23, 59, 108, .12); }

.button {
    border: 0;
    border-radius: 10px;
    padding: 12px 18px;
    font-weight: 800;
}
.button-primary { margin-top: 16px; color: #fff; background: var(--brand); }
.button-primary:hover { background: var(--brand-dark); }

.alert { margin-top: 22px; padding: 12px 14px; border-radius: 10px; }
.alert-error { color: var(--danger); border: 1px solid #f0c4c4; background: var(--danger-bg); }

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    color: #fff;
    background: var(--brand-dark);
    box-shadow: 0 8px 24px rgba(8, 24, 48, .16);
}
.header-inner {
    width: min(1180px, calc(100% - 40px));
    min-height: 72px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; font-weight: 800; }
.brand img { filter: brightness(0) invert(1); }
.desktop-nav { display: flex; align-items: stretch; align-self: stretch; }
.nav-link {
    display: inline-flex;
    align-items: center;
    height: 100%;
    padding: 0 16px;
    border: 0;
    color: #fff;
    background: transparent;
    text-decoration: none;
    font-weight: 700;
}
.nav-link:hover, .nav-link:focus-visible { background: rgba(255,255,255,.10); }
.dropdown { position: relative; }
.dropdown-toggle::after { content: ""; width: 7px; height: 7px; margin-left: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); }
.dropdown-menu {
    position: absolute;
    top: calc(100% - 2px);
    left: 0;
    min-width: 210px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    background: #fff;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: .16s ease;
}
.dropdown-menu-right { right: 0; left: auto; }
.dropdown:hover .dropdown-menu, .dropdown:focus-within .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu a, .menu-button {
    width: 100%;
    display: block;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    color: var(--text);
    background: transparent;
    text-align: left;
    text-decoration: none;
}
.dropdown-menu a:hover, .menu-button:hover { background: var(--brand-soft); }

.nav-toggle, .hamburger, .mobile-drawer, .drawer-overlay { display: none; }

.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
main.page-shell { padding-top: 34px; padding-bottom: 48px; }
.hero-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    padding: 32px;
    border-radius: var(--radius);
    color: #fff;
    background: linear-gradient(120deg, var(--brand-dark), var(--brand));
    box-shadow: var(--shadow);
}
.hero-card h1 { margin: 3px 0 8px; font-size: clamp(1.75rem, 4vw, 2.65rem); }
.hero-card p { margin: 0; color: rgba(255,255,255,.78); }
.eyebrow { margin: 0; color: var(--accent); font-size: .75rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.user-badge { display: flex; align-items: center; gap: 12px; min-width: 190px; padding: 12px 14px; border: 1px solid rgba(255,255,255,.15); border-radius: 12px; background: rgba(255,255,255,.08); }
.user-badge small { display: block; color: rgba(255,255,255,.62); }
.user-avatar { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--brand-dark); background: #fff; font-weight: 900; }

.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; }
.panel { padding: 26px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 24px rgba(20, 39, 70, .05); }
.panel-wide { grid-column: 1 / -1; }
.panel h2 { margin: 3px 0 14px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.status-pill { padding: 6px 10px; border-radius: 999px; color: #315d42; background: #e8f5ec; font-size: .78rem; font-weight: 800; }
.table-wrap { overflow-x: auto; }
.profile-table { width: 100%; border-collapse: collapse; }
.profile-table th, .profile-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); text-align: left; }
.profile-table th { width: 32%; color: var(--muted); font-size: .9rem; }
.profile-table tr:last-child th, .profile-table tr:last-child td { border-bottom: 0; }
.site-footer { padding: 24px 0; border-top: 1px solid var(--border); color: var(--muted); background: #fff; font-size: .9rem; }

@media (max-width: 760px) {
    .login-body { display: block; padding: 0; background: #fff; }
    .login-shell { min-height: 100vh; grid-template-columns: 1fr; border: 0; border-radius: 0; box-shadow: none; }
    .login-brand { min-height: auto; padding: 30px 24px; justify-content: flex-start; }
    .login-brand img { width: 140px; height: auto; margin: 0 0 32px; }
    .login-brand h1 { font-size: 2rem; }
    .login-card { padding: 36px 24px 52px; }

    .header-inner, .page-shell { width: min(100% - 28px, 1180px); }
    .desktop-nav { display: none; }
    .brand span { display: none; }
    .hamburger { width: 44px; height: 44px; display: grid; place-content: center; gap: 5px; border-radius: 10px; cursor: pointer; }
    .hamburger span { width: 24px; height: 2px; display: block; background: #fff; }
    .mobile-drawer {
        position: fixed;
        z-index: 60;
        inset: 0 0 0 auto;
        width: min(330px, 86vw);
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 24px;
        color: var(--text);
        background: #fff;
        box-shadow: -18px 0 45px rgba(8, 24, 48, .22);
        transform: translateX(110%);
        transition: transform .22s ease;
    }
    .drawer-heading { margin-bottom: 14px; color: var(--brand); font-size: 1.25rem; font-weight: 900; }
    .mobile-drawer a, .drawer-logout { display: block; width: 100%; padding: 12px; border: 0; border-radius: 9px; color: var(--text); background: transparent; text-align: left; text-decoration: none; font-weight: 700; }
    .mobile-drawer a:hover, .drawer-logout:hover { background: var(--brand-soft); }
    .drawer-overlay { position: fixed; z-index: 50; inset: 0; background: rgba(8, 24, 48, .55); opacity: 0; visibility: hidden; transition: .22s ease; }
    .nav-toggle:checked ~ .mobile-drawer { transform: translateX(0); }
    .nav-toggle:checked ~ .drawer-overlay { display: block; opacity: 1; visibility: visible; }

    main.page-shell { padding-top: 20px; }
    .hero-card { align-items: flex-start; flex-direction: column; padding: 24px; }
    .user-badge { width: 100%; }
    .content-grid { grid-template-columns: 1fr; }
    .panel-wide { grid-column: auto; }
    .panel-heading { align-items: flex-start; flex-direction: column; }

    .profile-table, .profile-table tbody, .profile-table tr, .profile-table th, .profile-table td { display: block; width: 100%; }
    .profile-table tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
    .profile-table tr:last-child { border-bottom: 0; }
    .profile-table th, .profile-table td { padding: 2px 0; border: 0; }
    .profile-table td { font-weight: 700; overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
