:root {
  --ink: #10213f;
  --muted: #687895;
  --green: #246bfe;
  --green-dark: #0b46c5;
  --mint: #e8f0ff;
  --cream: #f3f7ff;
  --line: #dbe4f3;
  --white: #ffffff;
  --danger: #b42318;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--cream); }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 44%) 1fr; }
.brand-panel { min-height: 100vh; padding: 52px clamp(34px, 6vw, 96px); color: white; background: radial-gradient(circle at 18% 14%, #2f7cff 0, transparent 34%), radial-gradient(circle at 82% 76%, rgba(38,125,255,.28) 0, transparent 36%), linear-gradient(145deg, #092c74, #061633 72%); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.brand-panel::after { content: ""; position: absolute; width: 440px; height: 440px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; right: -180px; bottom: -150px; box-shadow: 0 0 0 80px rgba(255,255,255,.025), 0 0 0 160px rgba(255,255,255,.02); }
.brand-mark, .portal-brand > span { width: 46px; height: 46px; border-radius: 14px; background: rgba(255,255,255,.96); color: #1355d8; display: grid; place-items: center; font-weight: 850; letter-spacing: -.04em; }
.brand-copy { position: relative; z-index: 1; max-width: 520px; }
.brand-copy h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(64px, 8vw, 116px); line-height: .86; letter-spacing: -.06em; margin: 12px 0 32px; font-weight: 500; }
.brand-copy > p:last-child { max-width: 430px; color: rgba(255,255,255,.76); font-size: 18px; line-height: 1.65; }
.eyebrow { color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .18em; margin: 0 0 10px; }
.brand-panel .eyebrow { color: #aecdff; }
.security-note { display: flex; gap: 10px; align-items: center; color: rgba(255,255,255,.68); font-size: 13px; position: relative; z-index: 1; }
.security-note span { width: 8px; height: 8px; border-radius: 50%; background: #72a8ff; box-shadow: 0 0 0 5px rgba(114,168,255,.14); }
.auth-panel { min-height: 100vh; display: grid; place-items: center; padding: 34px; background: #fbfcff; }
.auth-card { width: min(430px, 100%); }
.auth-card h2 { font-family: Georgia, "Times New Roman", serif; font-size: 38px; line-height: 1.1; letter-spacing: -.03em; margin: 0 0 12px; font-weight: 500; }
.muted { color: var(--muted); line-height: 1.55; }
form { margin-top: 28px; }
label { display: grid; gap: 8px; color: #3f5756; font-size: 13px; font-weight: 700; margin-bottom: 18px; }
input { width: 100%; border: 1px solid #ccd9d6; border-radius: 10px; background: white; color: var(--ink); padding: 13px 14px; outline: none; transition: border-color .2s, box-shadow .2s; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(15,123,108,.12); }
.primary-button, .secondary-button, .quiet-button { border: 0; border-radius: 10px; padding: 12px 16px; font-weight: 750; }
.primary-button { background: var(--green); color: white; width: 100%; display: flex; justify-content: center; align-items: center; gap: 12px; }
.primary-button:hover { background: var(--green-dark); }
.secondary-button { background: white; color: var(--green-dark); border: 1px solid var(--line); box-shadow: 0 5px 20px rgba(20,56,53,.06); }
.quiet-button { background: transparent; color: var(--green-dark); padding: 8px 10px; }
.compact { width: auto; min-width: 100px; align-self: end; margin-bottom: 18px; }
.auth-footer { margin-top: 34px; color: #91a09e; font-size: 12px; line-height: 1.5; }
.error-message, .inline-alert { color: var(--danger); background: #fff0ed; border: 1px solid #ffd2cb; border-radius: 9px; padding: 11px 13px; font-size: 13px; }
.setup-list { color: var(--muted); line-height: 1.6; padding-left: 20px; }
.setup-list code { display: block; color: var(--ink); background: var(--mint); border-radius: 6px; padding: 10px; margin-top: 7px; font-size: 13px; overflow-wrap: anywhere; }
.code-input { font-size: 26px; letter-spacing: .32em; text-align: center; }

.portal-layout { min-height: 100vh; background: #f3f6fc; }
.topbar { height: 72px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 42px; padding: 0 clamp(20px, 4vw, 64px); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.portal-brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 820; white-space: nowrap; }
.portal-brand > span { width: 34px; height: 34px; border-radius: 9px; color: white; background: var(--green); font-size: 12px; }
.topbar nav { display: flex; align-self: stretch; }
.nav-button { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 0 18px; color: var(--muted); font-weight: 700; }
.nav-button.active { color: var(--green); border-bottom-color: var(--green); }
.account-menu { margin-left: auto; display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 13px; }
.portal-main { max-width: 1440px; margin: 0 auto; padding: 46px clamp(20px, 4vw, 64px) 70px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin: 0 0 6px; font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: clamp(34px, 4vw, 48px); letter-spacing: -.04em; }
.page-heading p { margin-top: 0; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.summary-card { border: 1px solid var(--line); border-radius: 14px; background: white; padding: 20px; box-shadow: 0 8px 26px rgba(20,50,110,.06); }
.summary-card span { color: var(--muted); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.summary-card strong { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 31px; font-weight: 500; margin-top: 8px; }
.report-card, .security-card { background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 26px rgba(20,50,110,.06); }
.filter-bar { margin: 0; padding: 18px; display: grid; grid-template-columns: 170px 170px minmax(220px, 1fr) auto; gap: 14px; border-bottom: 1px solid var(--line); }
.filter-bar label { margin: 0; }
.table-scroll { overflow: auto; min-height: 250px; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { text-align: left; padding: 15px 18px; border-bottom: 1px solid #edf1ef; font-size: 13px; }
th { background: #f8faf8; color: #647a77; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
tbody tr:hover { background: #f8faff; }
tfoot td { background: #edf3ff; font-weight: 800; }
.empty-row td { text-align: center; padding: 56px; color: var(--muted); }
.pagination-bar { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; color: var(--muted); font-size: 13px; }
.inline-alert { margin: 14px 18px; }
.security-grid { display: grid; grid-template-columns: minmax(260px, .7fr) minmax(360px, 1.3fr); gap: 18px; }
.security-card { padding: 26px; }
.security-card h2 { margin-top: 0; }
.security-icon { width: 48px; height: 48px; display: grid; place-items: center; color: var(--green); background: var(--mint); border-radius: 50%; font-size: 24px; margin-bottom: 18px; }
.password-card form { max-width: 560px; }
.loading-view { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.loader { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #dce9e5; border-top-color: var(--green); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; }
  .brand-panel { min-height: 260px; padding: 30px; }
  .brand-copy h1 { font-size: 54px; margin-bottom: 12px; }
  .brand-copy > p:last-child, .security-note { display: none; }
  .auth-panel { min-height: calc(100vh - 260px); padding: 34px 22px; }
  .topbar { gap: 14px; }
  .topbar nav { display: none; }
  .account-menu span { display: none; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .compact { width: 100%; }
  .security-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .brand-panel { min-height: 210px; }
  .brand-copy h1 { font-size: 44px; }
  .auth-panel { min-height: calc(100vh - 210px); }
  .summary-grid { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .page-heading { align-items: flex-start; flex-direction: column; }
}
