:root {
    --blue-900: #003366;
    --blue-700: #004e9b;
    --blue-500: #009fda;
    --orange: #ff5800;
    --text: #333;
    --muted: #707070;
    --line: #d5dce2;
    --soft: #eef3f7;
    --shadow: 0 14px 38px rgba(0, 32, 75, .13);
    font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body { color: var(--text); background: #fff; }

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; }

.demo-banner {
    position: fixed;
    z-index: 3000;
    inset: 0 0 auto;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 7px 14px;
    color: #fff;
    background: #1c2630;
    font-size: 12px;
    text-align: center;
}

.demo-banner strong { color: #ffd166; letter-spacing: .08em; }
.realtime-status { color: #bfe7ff; font-size: 10px; }
.realtime-status.is-connected { color: #b8f2c6; }
.realtime-status.is-error { color: #ffd0a8; }

.portal-shell { min-height: 100vh; }

.app-header {
    position: fixed;
    z-index: 1003;
    top: 34px;
    left: 0;
    right: 0;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    background: var(--blue-700);
    box-shadow: 0 2px 7px rgba(0,0,0,.12);
}

.app-header-left, .app-header-right { display: flex; align-items: center; height: 100%; }
.app-header-left { gap: 0; }
.app-header-right { gap: 24px; padding-right: 20px; }

.menu-toggle {
    width: 64px;
    height: 64px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.menu-toggle span { display: block; width: 28px; height: 2px; border-radius: 2px; background: currentColor; transition: transform .2s, opacity .2s; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.header-separator { width: 2px; height: 52px; background: linear-gradient(90deg, #023568, #026891); }
.header-logo-link { display: inline-flex; margin-left: 106px; align-items: center; }
.header-logo { height: 34px; width: auto; }
.site-name { font-size: 16px; font-weight: 700; }
.previous-version { border: 2px solid #fff; border-radius: 24px; padding: 9px 18px; color: #fff; background: transparent; cursor: default; }

.portal-body { position: relative; min-height: 100vh; padding-top: 98px; padding-bottom: 40px; }

.sidebar {
    position: fixed;
    z-index: 1002;
    top: 98px;
    bottom: 40px;
    left: 0;
    width: 64px;
    overflow: hidden;
    background: #fff;
    box-shadow: 3px 0 9px rgba(0,0,0,.18);
    transition: width .25s ease;
}

.sidebar.is-open { width: 300px; }
.sidebar nav { padding-top: 8px; }
.sidebar-item { display: flex; align-items: center; min-width: 300px; height: 50px; color: var(--blue-700); text-decoration: none; border-left: 3px solid transparent; transition: background .2s, border-color .2s; }
.sidebar-item:hover { background: #f3f7fa; }
.sidebar-item.is-active { border-left-color: var(--orange); font-weight: 700; }
.sidebar-icon { display: inline-flex; width: 61px; min-width: 61px; justify-content: center; color: var(--blue-700); font-size: 23px; }
.sidebar-item > span:last-child { white-space: nowrap; font-size: 15px; }
.sidebar-secondary { position: absolute; bottom: 0; left: 0; right: 0; display: flex; width: 300px; height: 40px; border-top: 1px solid #e3e8ec; background: #fff; }
.sidebar-secondary a { display: flex; flex: 1; align-items: center; justify-content: center; color: var(--blue-700); font-size: 21px; text-decoration: none; }
.sidebar-secondary a:hover { background: #f2f6fa; }
.sidebar-overlay { display: none; }

.app-footer { position: fixed; z-index: 1000; right: 0; bottom: 0; left: 64px; height: 40px; display: flex; align-items: center; justify-content: center; padding: 6px 20px; color: #666; background: #eee; font-size: 11px; text-align: center; }

.login-scene { position: relative; min-height: calc(100vh - 138px); overflow: hidden; background: #fff; }
.login-background-image { position: absolute; inset: 0 0 0 40%; background: linear-gradient(180deg, rgba(255,255,255,.64), rgba(255,255,255,.64)), url('assets/07.webp') center/cover no-repeat; }
.login-curve { position: absolute; z-index: 1; top: -95vh; left: -11%; width: 56%; height: 200vh; border-radius: 0 42% 42% 0; background: #fff; box-shadow: 8px 0 20px rgba(0,0,0,.025); }
.login-card { position: relative; z-index: 5; width: min(380px, calc(100% - 40px)); min-height: 480px; margin-left: clamp(80px, 9vw, 170px); padding-top: clamp(45px, 12vh, 110px); }
.login-heading { margin-bottom: 22px; text-align: center; font-weight: 700; }
.login-heading p { margin: 0 0 5px; color: var(--blue-500); font-size: 24px; }
.login-heading h1 { margin: 0; color: var(--blue-700); font-size: 31px; }
.demo-credentials { display: flex; flex-direction: column; gap: 3px; margin-bottom: 17px; padding: 11px 13px; border: 1px solid #b7d7ed; border-radius: 8px; color: #235b80; background: #edf8ff; font-size: 12px; line-height: 1.4; }
.demo-credentials code, .safe-card-note code { padding: 1px 4px; border-radius: 3px; color: #1e3a6b; background: #dcecff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.demo-form { width: 100%; }
.field-group { margin-bottom: 19px; }
.floating-field, .input-with-action { position: relative; display: flex; align-items: center; border-bottom: 1px solid var(--blue-700); }
.floating-field:focus-within, .input-with-action:focus-within { border-bottom-color: var(--blue-500); }
.floating-field input { width: 100%; height: 47px; padding: 17px 38px 5px 0; border: 0; outline: 0; color: #555; background: transparent; }
.floating-field label { position: absolute; top: 15px; left: 0; color: #999; font-size: 16px; pointer-events: none; transition: top .18s, font-size .18s, color .18s; }
.floating-field input:focus + label, .floating-field input:not(:placeholder-shown) + label { top: 0; color: var(--blue-700); font-size: 13px; font-weight: 700; }
.eye-button { display: inline-flex; align-items: center; justify-content: center; width: 29px; min-width: 29px; padding: 3px; border: 0; color: var(--blue-700); background: transparent; cursor: pointer; }
.eye-button span { font-size: 15px; opacity: .85; }
.remember-row { display: flex; align-items: center; gap: 10px; margin: 14px 0 31px; color: var(--blue-700); font-size: 14px; font-weight: 700; }
.remember-row input { width: 40px; height: 22px; appearance: none; border-radius: 22px; outline: 0; background: #b0c4de; cursor: pointer; transition: background .2s; }
.remember-row input::before { display: block; width: 18px; height: 18px; margin: 2px; border-radius: 50%; background: #fff; content: ''; transition: transform .2s; }
.remember-row input:checked { background: #1976d2; }
.remember-row input:checked::before { transform: translateX(18px); }
.primary-pill { display: block; width: min(100%, 250px); min-height: 44px; margin: 0 auto; padding: 10px 24px; border: 0; border-radius: 999px; color: #fff; background: linear-gradient(180deg, var(--blue-500), var(--blue-700)); box-shadow: 0 4px 10px rgba(0, 78, 155, .18); cursor: pointer; transition: transform .16s, opacity .16s, box-shadow .16s; }
.primary-pill:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(0, 78, 155, .24); }
.primary-pill:disabled { color: #888; background: #d0d0d0; box-shadow: none; cursor: not-allowed; }
.safe-caption, .page-footnote { margin: 17px auto 0; color: #7e8790; font-size: 11px; line-height: 1.45; text-align: center; }
.live-feed { margin-top: 19px; padding: 10px 12px; border: 1px solid #dbe7ef; border-radius: 8px; background: #f8fbfd; }
.live-feed-heading { display: flex; justify-content: space-between; margin-bottom: 7px; color: #315f7d; font-size: 11px; font-weight: 700; }
.live-feed-heading > span:last-child { min-width: 18px; padding: 1px 5px; border-radius: 10px; color: #fff; background: #5799bb; text-align: center; }
.live-feed ul { display: flex; flex-direction: column; gap: 5px; max-height: 82px; overflow: auto; margin: 0; padding: 0; list-style: none; }
.live-feed li { padding: 5px 6px; border-radius: 4px; color: #5f6e78; background: #fff; font-size: 10px; line-height: 1.35; }
.live-feed li.is-error { color: #8b3e3e; background: #fff2f2; }
.live-feed-empty { color: #8b969e !important; background: transparent !important; font-style: italic; }
.form-alert { margin: 0 0 14px; padding: 10px 12px; border: 1px solid #e2a9a9; border-radius: 8px; color: #9b2727; background: #fff1f1; font-size: 13px; line-height: 1.4; }
.form-waiting { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; padding: 10px 12px; border: 1px solid #b7d7ed; border-radius: 8px; color: #225e91; background: #edf8ff; font-size: 13px; }
.small-spinner { width: 15px; height: 15px; border: 2px solid #b7d7ed; border-top-color: var(--blue-700); border-radius: 50%; animation: spin 1s linear infinite; }

.simple-header { display: flex; justify-content: center; padding: 14px 16px; background: var(--blue-900); }
.simple-header img { height: 40px; width: auto; }
.verification-page, .otp-page { min-height: calc(100vh - 34px); padding-bottom: 24px; background: #e9eff4; font-family: Arial, Helvetica, sans-serif; }
.verification-container, .otp-container { display: flex; flex-direction: column; align-items: center; padding: 22px 16px; }
.verification-card, .otp-card { width: min(100%, 480px); padding: 24px 21px; border-radius: 12px; background: #fff; box-shadow: 0 3px 12px rgba(0,0,0,.08); }
.safe-card-note { display: flex; flex-direction: column; gap: 3px; margin-bottom: 20px; padding: 12px 14px; border: 1px solid #bad7a7; border-radius: 8px; color: #396029; background: #f1faec; font-size: 12px; line-height: 1.45; }
.verification-card h1, .otp-container > h1 { margin: 0 0 16px; color: #0066cc; font-size: 17px; text-decoration: underline; }
.verification-intro, .otp-card > p { margin: 0 0 18px; color: #454545; font-size: 14px; line-height: 1.55; }
.question-group { margin: 0 0 20px; }
.question-group label, .otp-field label { display: block; margin-bottom: 7px; color: #333; font-size: 14px; line-height: 1.45; }
.input-with-action { gap: 7px; padding-bottom: 5px; border-bottom-color: #c9c9c9; }
.input-with-action input { flex: 1; min-width: 0; padding: 5px 0; border: 0; outline: 0; color: #333; background: transparent; font-size: 14px; }
.verification-card hr { margin: 24px 0; border: 0; border-top: 1px solid #e0e0e0; }
.verification-card h2 { margin: 0 0 15px; color: #0066cc; font-size: 16px; text-decoration: underline; }
.device-options { display: flex; flex-direction: column; gap: 11px; margin-bottom: 23px; }
.device-option { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 15px; border: 1px solid #e1e1e1; border-radius: 8px; color: #0066cc; background: #fff; cursor: pointer; text-align: left; transition: border .18s, background .18s; }
.device-option:hover, .device-option[aria-pressed="true"] { border-color: #0066cc; background: #e8f2ff; }
.device-symbol { color: #999; font-size: 13px; letter-spacing: 2px; }
.otp-page { background: #f1f3f5; }
.context-header { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 12px 16px; border-bottom: 1px solid #e1e1e1; color: #2f5496; background: #fff; font-size: 13px; }
.context-header b { color: #999; }
.context-header time { flex-basis: 100%; color: #888; font-size: 12px; }
.otp-container > h1 { color: #2f5496; font-size: 22px; text-decoration: none; }
.otp-card { padding: 25px 21px; }
.step-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.step-circle { display: flex; align-items: center; justify-content: center; width: 48px; min-width: 48px; height: 48px; border: 2px solid #2f5496; border-radius: 50%; color: #2f5496; font-size: 13px; font-weight: 700; }
.step-heading h2 { margin: 0 0 4px; color: #2f5496; font-size: 17px; }
.step-heading p { margin: 0; color: #888; font-size: 13px; }
.otp-card > p { margin-bottom: 14px; }
.otp-field { display: flex; flex-wrap: wrap; margin: 5px 0 22px; }
.otp-field label { flex-basis: 100%; color: #2f5496; font-size: 13px; }
.otp-field input { letter-spacing: 3px; font-size: 17px; }
.text-button { display: block; width: fit-content; margin: 17px auto 0; padding: 2px 8px; border: 0; color: #1e3a6b; background: transparent; font-size: 14px; cursor: pointer; text-decoration: none; }
.text-button:hover { text-decoration: underline; }

.validating-page { position: relative; display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 34px); overflow: hidden; padding: 20px; background: linear-gradient(135deg, #071b3d, #12609d); }
.validating-grid { position: absolute; inset: -50%; opacity: .2; background-image: linear-gradient(rgba(255,255,255,.25) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.25) 1px, transparent 1px); background-size: 50px 50px; transform: rotate(8deg); animation: grid-move 20s linear infinite; }
.validating-orb { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .45; }
.orb-one { top: 10%; left: 8%; width: 130px; height: 130px; background: #169fe6; }
.orb-two { right: 8%; bottom: 12%; width: 200px; height: 200px; background: #ff813e; opacity: .28; }
.validating-card { position: relative; z-index: 2; width: min(100%, 500px); padding: 68px 58px 45px; overflow: hidden; border: 1px solid rgba(255,255,255,.55); border-radius: 30px; background: rgba(255,255,255,.94); box-shadow: 0 35px 75px rgba(0,0,0,.24); text-align: center; }
.validating-accent { position: absolute; top: 0; right: 0; left: 0; height: 4px; background: linear-gradient(90deg, transparent, #ff8d42, #ffb366, transparent); }
.validating-spinner { position: relative; width: 174px; height: 174px; margin: 0 auto 36px; }
.validating-spinner > span { position: absolute; inset: 0; border: 3px solid transparent; border-top-color: #1b7fd4; border-right-color: rgba(27,127,212,.3); border-radius: 50%; animation: spin 3s linear infinite; }
.validating-spinner > span:nth-child(2) { inset: 13px; border-top-color: transparent; border-bottom-color: #ff8d42; animation-direction: reverse; animation-duration: 3.5s; }
.validating-spinner > span:nth-child(3) { inset: 30px; border-width: 2px; border-top-color: #6dc4ff; animation-duration: 4s; }
.validating-badge { position: absolute; inset: 47px; display: flex; align-items: center; justify-content: center; border: 2px solid rgba(255,255,255,.35); border-radius: 50%; background: linear-gradient(135deg, #0d52a8, #1b7fd4); box-shadow: 0 15px 35px rgba(27,127,212,.4); }
.validating-badge img { width: 68px; height: 68px; object-fit: contain; clip-path: circle(50%); }
.validating-card h1 { margin: 0 0 12px; color: #0a2463; font-size: 24px; }
.loading-dots { display: inline-block; color: #1b7fd4; letter-spacing: 3px; }
.validating-card > p { margin: 0; color: #555; font-size: 14px; line-height: 1.6; }
.progress-track { height: 3px; margin: 28px 0 35px; overflow: hidden; border-radius: 3px; background: #e4e7ea; }
.progress-track div { width: 70%; height: 100%; background: linear-gradient(90deg, #1b7fd4, #ff8d42, #1b7fd4); animation: progress 2s ease-in-out infinite; }
.safe-status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 17px; border: 1px solid rgba(27,127,212,.16); border-radius: 15px; background: #f1f7ff; }
.safe-status-grid div { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.safe-status-grid strong { color: #1b7fd4; font-size: 24px; }
.safe-status-grid span { color: #1b7fd4; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.safe-status-grid small { color: #888; font-size: 10px; }
.not-found-page { display: grid; min-height: calc(100vh - 34px); place-items: center; padding: 20px; background: #eef3f7; }
.not-found-card { width: min(100%, 460px); padding: 35px; border-radius: 18px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.not-found-card h1 { margin-top: 0; color: var(--blue-700); }
.not-found-card p { margin-bottom: 26px; color: var(--muted); }

[hidden] { display: none !important; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes progress { 0% { width: 0; } 50% { width: 75%; } 100% { width: 100%; } }
@keyframes grid-move { to { transform: translate(50px, 50px) rotate(8deg); } }

@media (max-width: 1024px) {
    .header-logo-link { margin-left: 35px; }
    .login-background-image { left: 49%; }
    .login-curve { left: -20%; width: 72%; }
    .login-card { margin-left: 83px; }
}

@media (max-width: 700px) {
    .demo-banner { flex-wrap: wrap; font-size: 10px; gap: 6px; }
    .app-header-right { padding-right: 12px; }
    .site-name, .previous-version { display: none; }
    .header-logo-link { margin-left: 20px; }
    .sidebar { width: 0; }
    .sidebar.is-open { width: min(300px, 86vw); }
    .sidebar-overlay { position: fixed; z-index: 1001; inset: 98px 0 40px; border: 0; background: rgba(0,0,0,.52); cursor: pointer; }
    .sidebar-overlay.is-visible { display: block; }
    .app-footer { left: 0; padding: 6px 10px; font-size: 10px; }
    .login-scene { min-height: calc(100vh - 138px); }
    .login-background-image { display: none; }
    .login-curve { top: -60vh; left: -68%; width: 210%; height: 150vh; border-radius: 50%; }
    .login-card { width: min(380px, calc(100% - 38px)); margin: 0 auto; padding-top: 52px; }
    .login-heading p { font-size: 22px; }
    .login-heading h1 { font-size: 29px; }
    .validating-card { padding: 50px 30px 35px; border-radius: 24px; }
}

@media (max-width: 430px) {
    .demo-banner { position: static; min-height: 38px; }
    .app-header { top: 38px; }
    .portal-body { padding-top: 102px; }
    .sidebar { top: 102px; }
    .sidebar-overlay { inset: 102px 0 40px; }
    .verification-card, .otp-card { padding: 20px 16px; }
    .safe-status-grid { grid-template-columns: 1fr; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
