:root {
    color-scheme: light;
    --ink: #17223b;
    --muted: #68748a;
    --line: #dce3ed;
    --surface: #ffffff;
    --canvas: #f3f6fa;
    --navy: #163b69;
    --blue: #2368a2;
    --cyan: #1ea7b6;
    --success: #16745a;
    --danger: #a83737;
    --shadow: 0 20px 55px rgba(22, 59, 105, .1);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 85% 5%, rgba(30, 167, 182, .11), transparent 26rem),
        radial-gradient(circle at 7% 95%, rgba(35, 104, 162, .08), transparent 28rem),
        var(--canvas);
    font-family: Tahoma, Arial, sans-serif;
    line-height: 1.75;
}

button, input { font: inherit; }
a { color: inherit; }
:where(a, button, input):focus-visible {
    outline: 3px solid #f0a229;
    outline-offset: 3px;
}
.site-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    min-height: 82px;
    padding: 14px clamp(20px, 6vw, 88px);
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid rgba(220, 227, 237, .9);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
    width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
    color: white; font-size: 1.35rem; font-weight: 800;
    background: linear-gradient(145deg, var(--navy), var(--cyan));
    box-shadow: 0 8px 20px rgba(35, 104, 162, .24);
}
.brand strong { display: block; letter-spacing: .12em; font-size: 1.15rem; }
.brand small { display: block; color: var(--muted); font-size: .72rem; }
.user-menu { display: flex; align-items: center; gap: 16px; color: var(--muted); }
.user-menu form { margin: 0; }
.text-button { background: none; color: var(--navy); border: 0; cursor: pointer; padding: 8px; font-weight: 700; }
.main-content { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 54px 0; flex: 1; }
.footer { text-align: center; padding: 20px; color: var(--muted); font-size: .8rem; }
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 22px; border: 1px solid var(--line); background: var(--surface); }
.alert-error { color: var(--danger); border-color: #efcaca; background: #fff5f5; }
.alert-success { color: var(--success); border-color: #bde4d7; background: #f1fbf7; }

.login-grid { min-height: 610px; display: grid; grid-template-columns: 1.08fr .92fr; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; overflow: hidden; box-shadow: var(--shadow); }
.welcome-panel {
    position: relative; overflow: hidden; padding: clamp(42px, 7vw, 88px);
    color: white; background: linear-gradient(145deg, #102d52 0%, #1a5685 58%, #1598a9 100%);
    display: flex; flex-direction: column; justify-content: center;
}
.welcome-panel::after { content: ''; position: absolute; width: 340px; height: 340px; border: 1px solid rgba(255,255,255,.17); border-radius: 48% 52% 66% 34%; left: -160px; bottom: -170px; transform: rotate(25deg); }
.eyebrow { color: var(--cyan); font-weight: 800; font-size: .76rem; letter-spacing: .04em; }
.welcome-panel .eyebrow { color: #8ce5ed; }
.welcome-panel h1 { font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1.35; margin: 14px 0; }
.welcome-panel p { max-width: 520px; color: rgba(255,255,255,.8); font-size: 1.04rem; }
.feature-list { list-style: none; margin: 28px 0 0; padding: 0; }
.feature-list li { padding: 7px 28px 7px 0; position: relative; }
.feature-list li::before { content: '✓'; position: absolute; right: 0; color: #8ce5ed; font-weight: 800; }
.login-card { padding: clamp(36px, 6vw, 76px); display: flex; flex-direction: column; justify-content: center; }
.card-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.card-heading h2 { margin: 0; font-size: 1.65rem; }
.card-heading p { margin: 2px 0 0; color: var(--muted); font-size: .88rem; }
.lock-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: #e9f5f7; color: var(--cyan); }
.login-card label { display: block; font-size: .84rem; font-weight: 700; margin: 14px 0 6px; }
.login-card input { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; color: var(--ink); padding: 12px 14px; direction: ltr; text-align: left; outline: none; }
.login-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(35, 104, 162, .1); }
.primary-button, .launch-button { border: 0; border-radius: 12px; background: linear-gradient(135deg, var(--navy), var(--blue)); color: white; min-height: 48px; padding: 10px 20px; font-weight: 800; text-decoration: none; cursor: pointer; }
.login-card .primary-button { margin-top: 24px; width: 100%; }
.privacy-note { color: var(--muted); font-size: .72rem; margin: 18px 0 0; text-align: center; }

.dashboard-intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.dashboard-intro h1 { margin: 6px 0 0; font-size: clamp(1.8rem, 4vw, 2.8rem); }
.dashboard-intro p { color: var(--muted); margin: 4px 0 0; }
.security-badge { white-space: nowrap; color: var(--success); background: #eaf8f2; border: 1px solid #c4e9dc; border-radius: 999px; padding: 8px 14px; font-size: .8rem; }
.security-badge span { font-weight: 900; margin-left: 5px; }
.app-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.app-card { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 28px; display: flex; gap: 20px; box-shadow: 0 12px 35px rgba(22, 59, 105, .07); }
.app-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--blue); }
.app-rfq::before { background: var(--cyan); }
.app-icon { flex: 0 0 60px; height: 60px; border-radius: 17px; display: grid; place-items: center; background: #eaf0f8; color: var(--navy); font-size: 1.55rem; font-weight: 900; }
.app-rfq .app-icon { background: #e6f7f7; color: #117b87; }
.app-content { min-width: 0; flex: 1; }
.app-kicker { color: var(--muted); font-size: .72rem; }
.app-content h2 { margin: 2px 0; font-size: 1.5rem; }
.app-content > p { min-height: 52px; color: var(--muted); font-size: .88rem; margin: 5px 0 16px; }
.roles { padding: 11px 13px; border-radius: 10px; background: var(--canvas); margin-bottom: 18px; }
.roles span { display: block; color: var(--muted); font-size: .68rem; }
.roles strong { display: block; font-size: .82rem; overflow-wrap: anywhere; }
.launch-button { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.app-rfq .launch-button { background: linear-gradient(135deg, #126f7b, #1ea7b6); }
.app-disabled { opacity: .7; box-shadow: none; }
.no-access { color: var(--danger); background: #fff5f5; border-radius: 10px; padding: 11px; font-size: .8rem; }
.sso-note { margin-top: 24px; padding: 16px 20px; display: flex; align-items: center; gap: 14px; background: #edf3f9; border: 1px solid #d8e4f1; border-radius: 14px; font-size: .8rem; }
.sso-note span { color: var(--muted); }
.error-page { text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 70px 30px; box-shadow: var(--shadow); }
.error-page > strong { color: var(--cyan); font-size: 4rem; }
.error-page h1 { margin: 0; }
.error-page p { color: var(--muted); margin-bottom: 28px; }
.handoff-card { width: min(540px, 100%); margin: 70px auto; padding: 54px 34px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.handoff-card h1 { margin: 18px 0 6px; }
.handoff-card p { color: var(--muted); }
.handoff-card form { margin-top: 24px; }
.handoff-spinner { width: 52px; height: 52px; margin: 0 auto; border: 4px solid #dce8f2; border-top-color: var(--cyan); border-radius: 50%; animation: handoff-spin .8s linear infinite; }
@keyframes handoff-spin { to { transform: rotate(360deg); } }

@media (max-width: 800px) {
    .main-content { padding-top: 28px; }
    .login-grid, .app-grid { grid-template-columns: 1fr; }
    .login-grid { min-height: 0; }
    .welcome-panel { padding: 38px 28px; }
    .welcome-panel h1 { font-size: 2rem; }
    .login-card { padding: 38px 28px; }
    .dashboard-intro { align-items: flex-start; flex-direction: column; }
    .user-menu > span { display: none; }
    .app-card { padding: 22px; }
}

@media (max-width: 480px) {
    .topbar { padding: 12px 16px; }
    .brand small { display: none; }
    .main-content { width: min(100% - 20px, 1180px); }
    .app-card { flex-direction: column; }
    .sso-note { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: no-preference) {
    .app-card, button { transition: transform .18s ease, box-shadow .18s ease; }
    .app-card:not(.app-disabled):hover { transform: translateY(-3px); box-shadow: 0 18px 45px rgba(22, 59, 105, .12); }
    button:hover { transform: translateY(-1px); }
}

@media (prefers-reduced-motion: reduce) {
    .handoff-spinner { animation: none; border-top-color: var(--navy); }
}
