:root {
  --bg: #f3f7fb;
  --panel: #ffffff;
  --panel-soft: #f7fbff;
  --line: #ccdae8;
  --line-strong: #aebfd0;
  --text: #0b1739;
  --muted: #6b8093;
  --navy: #0b1739;
  --blue: #1797ed;
  --teal: #08b9ac;
  --orange: #f49a14;
  --red: #de2537;
  --green: #159352;
  --purple: #6e429a;
  --shadow: 0 8px 28px rgba(24, 60, 87, .09);
  --shadow-lg: 0 24px 70px rgba(8, 42, 73, .14);
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Montserrat, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.portal-ui { text-transform: capitalize; }
.portal-ui input,
.portal-ui textarea,
.portal-ui code,
.portal-ui pre,
.portal-ui td,
.portal-ui dd,
.portal-ui .alert,
.portal-ui .user-chip strong,
.portal-ui .user-chip small,
.portal-ui .verified-chip small,
.portal-ui .sidebar-account strong,
.portal-ui .sidebar-account small,
.portal-ui .profile-identity h2,
.portal-ui .profile-identity p,
.portal-ui .account-status-strip small { text-transform: none; }
.portal-ui input::placeholder,
.portal-ui textarea::placeholder { text-transform: capitalize; }
a { color: #0575dc; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(25px, 3vw, 38px); line-height: 1.15; }
h2 { margin-bottom: 6px; font-size: 22px; line-height: 1.25; }
h3 { margin-bottom: 7px; font-size: 17px; line-height: 1.3; }
.muted { color: var(--muted); }
.eyebrow { margin-bottom: 7px; color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: .12em; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.button:hover { transform: translateY(-1px); text-decoration: none; }
.button.primary { color: #fff; background: linear-gradient(100deg, var(--blue), var(--teal)); box-shadow: 0 8px 18px rgba(23, 151, 237, .18); }
.button.secondary { border-color: #9eb6c9; color: var(--navy); background: #fff; }
.button.full { width: 100%; }
.button.large { min-height: 48px; padding: 12px 22px; border-radius: 12px; }
.button.disabled { border-color: #d7e2ed; color: #7a90a4; background: #eef1f4; cursor: not-allowed; box-shadow: none; }
.button.disabled:hover { transform: none; }
.text-button { padding: 0; border: 0; color: #0575dc; background: transparent; cursor: pointer; font-weight: 800; }
.text-button.danger { color: var(--red); }

.alert { margin: 0 0 16px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; }
.alert.error { border-color: #efb2b9; color: #9d1322; background: #fff2f4; }
.alert.notice { border-color: #8dc8e9; color: #075f91; background: #edf8ff; }
.alert.success-alert { border-color: #8bd2aa; color: #086d3d; background: #eefbf4; }

/* Authentication */
.auth-page {
  min-height: 100vh;
  padding: 8px;
  overflow-x: hidden;
  background: radial-gradient(circle at 12% 15%, rgba(23, 151, 237, .13), transparent 34rem), #eef4fa;
}
.auth-shell {
  display: grid;
  grid-template-columns: minmax(480px, 1.08fr) minmax(480px, .92fr);
  width: min(100%, 1500px);
  min-height: calc(100vh - 16px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(204, 218, 232, .8);
  border-radius: 32px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(8, 42, 73, .14);
}
.auth-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  padding: clamp(46px, 6vw, 78px);
  color: #fff;
  background: radial-gradient(circle at 85% 4%, rgba(255,255,255,.12), transparent 17rem), linear-gradient(145deg, #148ff0 0%, #12a5d4 52%, #07bca8 100%);
}
.auth-logo { align-self: flex-start; padding: 13px 18px; border-radius: 2px; background: #fff; box-shadow: 0 10px 30px rgba(5, 55, 105, .13); }
.auth-logo img { display: block; width: 126px; height: auto; }
.auth-brand-copy { display: grid; align-content: center; flex: 1; max-width: 680px; padding: 58px 0 44px; }
.auth-brand-copy h1 { margin-bottom: 22px; font-size: clamp(40px, 4.7vw, 68px); line-height: 1.08; letter-spacing: -.035em; }
.auth-brand-copy p { max-width: 650px; margin: 0; color: rgba(255,255,255,.94); font-size: clamp(16px, 1.5vw, 20px); line-height: 1.7; }
.auth-feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; max-width: 650px; }
.auth-feature-grid article { display: grid; gap: 3px; min-height: 106px; padding: 22px 24px; border: 1px solid rgba(255,255,255,.28); border-radius: 22px; background: rgba(255,255,255,.12); box-shadow: inset 0 1px rgba(255,255,255,.12); }
.auth-feature-grid strong { font-size: 28px; line-height: 1.2; }
.auth-feature-grid span { color: rgba(255,255,255,.9); font-size: 15px; }
.auth-brand .eyebrow { color: rgba(255, 255, 255, .84); }
.auth-brand h1 { max-width: 560px; font-size: clamp(34px, 5vw, 58px); }
.auth-brand > p:not(.eyebrow) { max-width: 570px; color: rgba(255, 255, 255, .92); font-size: 16px; }
.auth-benefits { display: grid; gap: 11px; margin: 22px 0 0; padding: 0; list-style: none; }
.auth-benefits li::before { content: "✓"; display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 9px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.auth-panel { display: grid; place-items: center; min-width: 0; padding: clamp(28px, 4vw, 62px); overflow-y: auto; background: #fff; transition: color .18s ease, background .18s ease; }
.auth-card { width: min(100%, 520px); padding: 22px 8px; border: 0; border-radius: 18px; background: transparent; box-shadow: none; }
.auth-card.compact { width: min(calc(100% - 32px), 500px); }
.mobile-logo { display: none; width: 122px; height: auto; margin-bottom: 24px; }
.auth-card-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.auth-kicker { margin: 0; color: #061426; font-size: 15px; font-weight: 900; }
.auth-theme-toggle { min-height: 42px; padding: 9px 17px; border: 0; border-radius: 22px; color: #168bdb; background: #eff8fe; cursor: pointer; font-weight: 900; }
.auth-title { margin-bottom: 8px; color: #061426; font-size: clamp(38px, 4vw, 52px); letter-spacing: -.03em; }
.auth-subtitle { margin-bottom: 30px; color: #7b8793; font-size: 17px; }
.auth-form { gap: 19px; margin-top: 0; }
.auth-form label { gap: 8px; color: #27384b; font-size: 13px; font-weight: 900; }
.auth-form input { min-height: 62px; padding: 14px 18px; border-color: #d4dfe8; border-radius: 18px; color: #16263b; background: #f7fafc; font-size: 16px; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 58px; }
.password-toggle { position: absolute; top: 50%; right: 13px; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; transform: translateY(-50%); border: 0; border-radius: 50%; color: #8395a5; background: transparent; cursor: pointer; }
.password-toggle:hover { color: #168bdb; background: #e9f4fb; }
.password-toggle .ui-icon { width: 21px; height: 21px; }
.auth-submit { min-height: 62px; margin-top: 2px; border-radius: 18px; font-size: 15px; }
.auth-link-row { display: flex; justify-content: space-between; gap: 18px; margin-top: 19px; font-size: 13px; font-weight: 900; }
.auth-link-row.single { justify-content: center; }
.auth-link-row.single span { color: #7b8793; }
.register-card { padding-top: 12px; padding-bottom: 12px; }
.register-card .auth-card-top { margin-bottom: 18px; }
.register-card .auth-title { font-size: clamp(34px, 3.4vw, 46px); }
.register-card .auth-subtitle { margin-bottom: 20px; }
.register-form { gap: 12px; }
.register-form input { min-height: 48px; border-radius: 14px; }
.register-form .auth-submit { min-height: 52px; }
.standalone-logo { display: block; width: 138px; height: auto; margin: 0 auto 26px; }
.auth-simple { display: grid; place-items: center; min-height: 100vh; padding: 32px 16px; background: linear-gradient(180deg, #eef6fc 0, #f7fafe 280px, var(--bg) 100%); }
.form-stack { display: grid; gap: 15px; margin-top: 22px; }
.form-stack label, .grant-form label, .request-row label { display: grid; gap: 6px; color: #577087; font-size: 11px; font-weight: 800; }
input, select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #b8cada;
  border-radius: 8px;
  outline: none;
  color: var(--text);
  background: #fff;
}
input:focus, select:focus { border-color: #338bc2; box-shadow: 0 0 0 3px #338bc219; }
label small { color: var(--muted); font-weight: 500; }
.form-link-row { display: flex; justify-content: flex-end; margin-top: -4px; font-size: 12px; }
.auth-switch { margin: 22px 0 0; text-align: center; color: var(--muted); }
.message-card { text-align: center; }
.message-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 18px; border-radius: 50%; color: #fff; background: var(--green); font-size: 24px; }
.message-icon.warning { background: var(--orange); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: -10px 0 24px; padding: 4px; border: 1px solid #dbe6ef; border-radius: 11px; background: #f4f8fb; }
.auth-tabs a { padding: 9px; border-radius: 8px; color: #61788d; text-align: center; font-size: 12px; font-weight: 800; }
.auth-tabs a:hover { text-decoration: none; }
.auth-tabs a.active { color: var(--navy); background: #fff; box-shadow: 0 3px 12px rgba(15, 52, 80, .09); }
.google-button { display: flex; align-items: center; justify-content: center; gap: 11px; min-height: 48px; margin-top: 19px; padding: 10px 15px; border: 1px solid #cdd9e3; border-radius: 24px; color: #24364b; background: #fff; font-weight: 800; box-shadow: 0 4px 14px rgba(15, 52, 80, .06); }
.google-button:hover { border-color: #829cb1; text-decoration: none; background: #fafdff; }
.google-mark { display: block; width: 20px; height: 20px; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 17px 0 -4px; color: #8799a8; font-size: 10px; letter-spacing: .06em; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: #dfe8ef; }
.back-home { display: block; margin-top: 17px; color: #6f8293; text-align: center; font-size: 11px; font-weight: 700; }
.auth-credit { margin: 20px 0 0; color: #91a0ad; text-align: center; font-size: 11px; }

html[data-auth-theme="dark"] .auth-panel { color: #edf6ff; background: #091829; }
html[data-auth-theme="dark"] .auth-card,
html[data-auth-theme="dark"] .auth-title,
html[data-auth-theme="dark"] .auth-kicker,
html[data-auth-theme="dark"] .auth-form label { color: #edf6ff; }
html[data-auth-theme="dark"] .auth-subtitle,
html[data-auth-theme="dark"] .auth-link-row.single span,
html[data-auth-theme="dark"] .back-home,
html[data-auth-theme="dark"] .auth-credit { color: #9fb0c2; }
html[data-auth-theme="dark"] .auth-theme-toggle { color: #62c7ff; background: #132c43; }
html[data-auth-theme="dark"] .auth-form input { border-color: #29435a; color: #f4f8fc; background: #10253a; }
html[data-auth-theme="dark"] .google-button { border-color: #335169; color: #edf6ff; background: #10253a; }
html[data-auth-theme="dark"] .password-toggle { color: #a4b9cb; }

/* Public home */
.public-page { background: #f7faff; }
.public-header { position: sticky; top: 0; z-index: 40; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 30px; min-height: 76px; padding: 12px clamp(20px, 6vw, 88px); border-bottom: 1px solid rgba(188, 207, 222, .8); background: rgba(255, 255, 255, .94); backdrop-filter: blur(16px); }
.public-logo img { display: block; width: 130px; }
.public-header nav { display: flex; justify-content: center; gap: 28px; }
.public-header nav a { color: #526b80; font-size: 12px; font-weight: 800; }
.public-actions, .hero-actions { display: flex; gap: 10px; }
.hero-section { position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); align-items: center; gap: clamp(36px, 6vw, 88px); min-height: 650px; padding: 72px clamp(22px, 7vw, 110px) 86px; overflow: hidden; background: radial-gradient(circle at 84% 18%, rgba(8, 185, 172, .13), transparent 30rem), radial-gradient(circle at 12% 12%, rgba(23, 151, 237, .14), transparent 34rem), #f7fbff; }
.hero-section::after { content: ""; position: absolute; right: -8%; bottom: -210px; width: 520px; height: 520px; border: 1px solid rgba(23,151,237,.13); border-radius: 50%; }
.hero-copy { position: relative; z-index: 1; }
.hero-copy h1 { max-width: 760px; margin-bottom: 20px; font-size: clamp(42px, 5.7vw, 78px); letter-spacing: -.045em; }
.hero-lead { max-width: 680px; margin-bottom: 28px; color: #587086; font-size: clamp(16px, 1.6vw, 20px); line-height: 1.7; }
.trust-row { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 30px; color: #48667d; font-size: 11px; font-weight: 800; }
.trust-row span::first-letter { color: var(--teal); }
.hero-console { position: relative; z-index: 2; display: grid; gap: 14px; padding: 24px; border: 1px solid rgba(167, 195, 216, .8); border-radius: 22px; background: rgba(255,255,255,.95); box-shadow: var(--shadow-lg); transform: perspective(1100px) rotateY(-3deg) rotateX(1deg); }
.console-head { display: flex; align-items: center; gap: 6px; padding-bottom: 16px; border-bottom: 1px solid #e0e9f0; }
.console-head > span { width: 8px; height: 8px; border-radius: 50%; background: #ff6b66; }
.console-head > span:nth-child(2) { background: #f7bd42; }
.console-head > span:nth-child(3) { background: #25bd72; }
.console-head strong { margin-left: auto; color: #61788d; font-size: 10px; letter-spacing: .1em; }
.console-metric { display: grid; gap: 2px; padding: 18px; border-radius: 14px; color: #fff; background: linear-gradient(115deg, var(--navy), #123b68); }
.console-metric small { font-size: 9px; letter-spacing: .1em; opacity: .72; }
.console-metric strong { font-size: 34px; }
.console-metric span { font-size: 11px; opacity: .75; }
.console-product { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 15px; border: 1px solid #d9e5ed; border-radius: 13px; }
.console-product div:nth-child(2) { display: grid; }
.console-product small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.public-section { padding: 88px clamp(22px, 7vw, 110px); background: #fff; }
.public-section-heading { max-width: 720px; margin: 0 auto 38px; text-align: center; }
.public-section-heading h2 { font-size: clamp(30px, 4vw, 46px); }
.public-section-heading > p:last-child { color: var(--muted); font-size: 15px; }
.public-product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; max-width: 1180px; margin: auto; }
.public-product-card { padding: clamp(24px, 4vw, 40px); border: 1px solid #cfdeea; border-radius: 20px; background: linear-gradient(160deg, #fff, #f8fcff); box-shadow: 0 13px 40px rgba(16, 60, 91, .08); }
.public-product-card h3 { font-size: 24px; }
.public-product-card > p:not(.product-broker):not(.product-price) { min-height: 48px; color: var(--muted); }
.public-product-card .product-price {
  min-height: 0;
  margin: 10px 0 14px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--navy);
}
.public-product-card .product-price strong { font-size: 28px; letter-spacing: -.04em; }
.public-product-card .product-price span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: capitalize;
  letter-spacing: .06em;
}
.product-icon.large { width: 52px; height: 52px; margin-bottom: 20px; }
.access-section { display: grid; grid-template-columns: .8fr 1.2fr; align-items: center; gap: 44px; padding: 70px clamp(22px, 7vw, 110px); color: #fff; background: linear-gradient(115deg, #0b1739, #0d315d); }
.access-section .eyebrow { color: #50c8ff; }
.access-section h2 { font-size: clamp(28px, 4vw, 42px); }
.access-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0; padding: 0; list-style: none; }
.access-steps li { display: grid; gap: 5px; padding: 18px; border: 1px solid rgba(255,255,255,.14); border-radius: 14px; background: rgba(255,255,255,.07); }
.access-steps span { display: grid; place-items: center; width: 30px; height: 30px; margin-bottom: 7px; border-radius: 9px; color: #052547; background: #5cd6e7; font-weight: 900; }
.access-steps small { color: rgba(255,255,255,.65); }
.public-footer { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 22px; padding: 25px clamp(22px, 7vw, 110px); border-top: 1px solid #d6e2eb; color: var(--muted); background: #fff; font-size: 11px; }
.public-footer img { width: 105px; }

/* Portal shell */
.portal-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; min-height: 100vh; height: 100vh; padding: 22px 16px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; color: #fff; background: var(--navy); }
.sidebar-logo { display: block; margin: 0 8px 28px; padding: 9px 12px; border-radius: 9px; background: #fff; }
.sidebar-logo img { display: block; width: 120px; height: auto; }
.sidebar nav { display: grid; gap: 5px; }
.nav-heading { margin: 19px 11px 7px; color: #7890a9; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.nav-link { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 9px 11px; border-radius: 8px; color: #c9d7e4; font-size: 12px; font-weight: 700; text-decoration: none; }
.nav-link span { display: inline-grid; place-items: center; width: 21px; font-size: 17px; }
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.nav-link.active { color: #fff; background: linear-gradient(100deg, rgba(23, 151, 237, .92), rgba(8, 185, 172, .76)); }
.sidebar-logout { margin-top: auto; }
.nav-button { width: 100%; border: 0; background: transparent; cursor: pointer; text-align: left; }
.portal-main { min-width: 0; padding: 28px clamp(20px, 4vw, 56px) 60px; background: linear-gradient(180deg, #eef6fc 0, #f7fafe 280px, var(--bg) 100%); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.topbar h1 { font-size: clamp(25px, 3vw, 36px); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .88); }
.user-chip > span { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #fff; background: linear-gradient(145deg, var(--blue), var(--teal)); font-weight: 800; }
.user-chip div { display: grid; }
.user-chip small { color: var(--muted); }
.user-chip.admin > span { background: var(--navy); }
.section-block { margin-top: 24px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.section-heading h2, .section-heading p { margin-bottom: 0; }
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.product-card { display: grid; gap: 17px; padding: 22px; border: 1px solid var(--line); border-top: 3px solid var(--line-strong); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.product-card.active { border-top-color: var(--green); }
.product-card.pending, .product-card.scheduled { border-top-color: var(--orange); }
.product-card.expired, .product-card.suspended { border-top-color: var(--red); }
.product-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.product-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; color: #076496; background: #e8f5fd; font-size: 23px; font-weight: 800; }
.product-broker { margin: 0 0 6px; color: var(--blue); font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.status { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 9px; border: 1px solid #cbd8e3; border-radius: 999px; color: #586d7e; background: #eef1f4; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status.active, .status.approved { border-color: #84cfa6; color: #087940; background: #eaf9f1; }
.status.pending, .status.scheduled { border-color: #e7be78; color: #9b5c00; background: #fff7e8; }
.status.expired, .status.suspended, .status.revoked { border-color: #e5a1aa; color: #a8192a; background: #fff0f2; }
.feature-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; color: #52718a; font-size: 12px; }
.feature-list li::before { content: "✓"; margin-right: 8px; color: var(--green); font-weight: 800; }
.access-window { display: flex; gap: 18px; padding: 12px; border: 1px solid #d7e2ed; border-radius: 9px; background: var(--panel-soft); }
.access-window span { display: grid; gap: 2px; color: var(--navy); font-weight: 800; }
.access-window small { color: var(--muted); font-size: 8px; letter-spacing: .08em; }
.product-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.product-actions small { color: var(--muted); }
.profile-card { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-top: 24px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.profile-card h2, .profile-card p { margin-bottom: 0; }
.profile-note { display: grid; gap: 3px; text-align: right; }
.profile-note span { color: var(--muted); font-size: 12px; }

/* Admin */
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.metric-card { display: grid; gap: 6px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); }
.metric-card small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.metric-card strong { color: var(--navy); font-size: 29px; }
.metric-card span { color: var(--muted); font-size: 11px; }
.product-admin-strip, .request-list, #users, #audit, .section-block:has(> .grant-form) { scroll-margin-top: 16px; }
.compact-product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.compact-product { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.compact-product div:nth-child(2) { display: grid; }
.compact-product small { color: var(--muted); }
.compact-product-actions { display: flex !important; align-items: center; gap: 8px; }
.compact-product-actions .button { min-height: 36px; padding: 7px 12px; font-size: 11px; }
.request-list { display: grid; gap: 10px; }
.request-row { display: grid; grid-template-columns: minmax(160px, 1.1fr) minmax(160px, 1fr) 105px 135px 135px auto; align-items: end; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.request-user, .request-product { display: grid; align-self: center; }
.request-user small, .request-product small { color: var(--muted); }
.request-product > small { font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.grant-form { display: grid; grid-template-columns: 1.2fr 1.2fr .7fr .8fr .8fr auto; align-items: end; gap: 10px; margin-bottom: 16px; padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 13px; border-bottom: 1px solid #d6e1eb; text-align: left; vertical-align: middle; font-size: 11px; }
th { color: #577087; background: #f5faff; font-size: 9px; letter-spacing: .06em; }
td > small { display: block; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
.empty-cell, .empty-state { padding: 24px; color: var(--muted); text-align: center; }
.empty-state { border: 1px dashed var(--line-strong); border-radius: 11px; background: var(--panel-soft); }

/* Secure configuration */
.configuration-main { max-width: none; }
.security-callout {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 17px 18px;
  border: 1px solid #a7d9c0;
  border-radius: 14px;
  background: linear-gradient(115deg, #effbf5, #f7fffb);
  box-shadow: 0 8px 24px rgba(20, 116, 72, .06);
}
.security-callout p { margin: 2px 0 0; color: #4f7463; font-size: 12px; }
.security-icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-weight: 900;
}
.configuration-grid { display: grid; gap: 20px; margin-top: 20px; }
.configuration-card {
  scroll-margin-top: 18px;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 14px 42px rgba(16, 60, 91, .08);
}
.configuration-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e0e9f0;
}
.configuration-card-head h2, .configuration-card-head p { margin-bottom: 0; }
.provider-mark {
  display: grid;
  place-items: center;
  width: 47px;
  height: 47px;
  border-radius: 14px;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(16, 60, 91, .13);
}
.provider-mark.upstox { background: linear-gradient(145deg, #6d3cf0, #934cf3); }
.provider-mark.angel { background: linear-gradient(145deg, #ea3a43, #f07b38); }
.provider-mark.google { color: #4285f4; background: #fff; border: 1px solid #d7e0e8; }
.provider-mark.google img { width: 25px; height: 25px; }
.configuration-intro { max-width: 900px; margin: 17px 0; color: #5a7287; font-size: 13px; }
.configuration-status-row { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 18px; }
.configuration-status-row span {
  padding: 7px 10px;
  border: 1px solid #d7e3ec;
  border-radius: 999px;
  color: #61778b;
  background: #f8fbfe;
  font-size: 10px;
}
.configuration-status-row b { margin-left: 3px; color: #087940; }
.configuration-status-row b.missing { color: #aa2130; }
.configuration-status-row b.warning-text { color: #a66100; }
.configuration-form { display: grid; gap: 14px; }
.configuration-form.two-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.configuration-form label {
  display: grid;
  gap: 6px;
  color: #526b80;
  font-size: 11px;
  font-weight: 800;
}
.configuration-form input[readonly] { color: #52718a; background: #eef5fa; cursor: copy; }
.configuration-form .full-span { grid-column: 1 / -1; }
.secret-field { position: relative; display: block; }
.secret-field input { padding-right: 62px; }
.secret-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  min-height: 29px;
  padding: 4px 8px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 6px;
  color: #126d9f;
  background: #e8f5fd;
  cursor: pointer;
  font-size: 9px;
  font-weight: 900;
}
.configuration-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 3px; }
.setup-steps {
  display: grid;
  gap: 9px;
  margin: 5px 0 0;
  padding-left: 23px;
  color: #557087;
  font-size: 12px;
}
.setup-steps.compact { margin-top: 18px; padding-top: 16px; border-top: 1px solid #e0e9f0; }
.setup-steps code {
  padding: 2px 5px;
  border: 1px solid #d8e4ed;
  border-radius: 5px;
  color: #0b4167;
  background: #f4f9fd;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.safety-note {
  margin-top: 18px;
  padding: 12px 13px;
  border-left: 3px solid var(--orange);
  border-radius: 7px;
  color: #7a591e;
  background: #fff8e9;
  font-size: 11px;
}
.google-setup-layout { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr); gap: 30px; padding-top: 17px; }
.google-setup-layout .configuration-intro { margin-top: 0; }
.google-form { align-self: start; padding: 18px; border: 1px solid #d8e4ed; border-radius: 13px; background: #f8fbfe; }
.toggle-label {
  display: flex !important;
  align-items: flex-start;
  gap: 10px !important;
  padding: 12px;
  border: 1px solid #b8d5e7;
  border-radius: 10px;
  background: #eef8fe;
  cursor: pointer;
}
.toggle-label input { width: 18px; min-height: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--blue); }
.toggle-label span { display: grid; gap: 2px; }
.toggle-label small { color: var(--muted); font-weight: 500; }

@media (max-width: 1120px) {
  .request-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grant-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .google-setup-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .auth-page { padding: 0; }
  .public-header { grid-template-columns: 1fr auto; min-height: 66px; padding: 10px 16px; }
  .public-header nav { display: none; }
  .public-actions .secondary { display: none; }
  .hero-section { grid-template-columns: 1fr; min-height: auto; padding: 64px 20px; }
  .hero-console { transform: none; }
  .public-product-grid, .access-section { grid-template-columns: 1fr; }
  .access-steps { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; min-height: 100vh; border: 0; border-radius: 0; }
  .auth-brand { display: none; }
  .auth-panel { min-height: 100vh; padding: 24px 18px; }
  .mobile-logo { display: block; }
  .portal-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; min-height: auto; height: auto; padding: 13px 16px; }
  .sidebar-logo { display: inline-block; width: 144px; margin: 0 0 12px; }
  .sidebar nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
  .nav-heading { display: none; }
  .nav-link { flex: 0 0 auto; }
  .sidebar-logout { display: none; }
  .portal-main { padding: 22px 16px 44px; }
  .product-grid, .compact-product-grid { grid-template-columns: 1fr; }
  .configuration-card { border-radius: 14px; }
}
@media (max-width: 620px) {
  .public-logo img { width: 108px; }
  .public-header .button { min-height: 38px; padding: 8px 11px; font-size: 11px; }
  .hero-copy h1 { font-size: 42px; }
  .hero-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .hero-actions .button { width: 100%; }
  .trust-row { display: grid; gap: 9px; }
  .hero-console { padding: 15px; }
  .console-product { grid-template-columns: auto 1fr; }
  .console-product .status { grid-column: 2; justify-self: start; }
  .public-section { padding: 60px 16px; }
  .access-section { padding: 55px 18px; }
  .public-footer { grid-template-columns: 1fr; text-align: center; }
  .public-footer img { margin: auto; }
  .auth-card { padding: 25px 8px; }
  .auth-card-top { margin-bottom: 22px; }
  .auth-title { font-size: 36px; }
  .auth-subtitle { font-size: 15px; }
  .auth-link-row { font-size: 12px; }
  .topbar, .section-heading, .profile-card { align-items: flex-start; flex-direction: column; }
  .user-chip { width: 100%; }
  .metric-grid { grid-template-columns: 1fr; }
  .compact-product { grid-template-columns: auto 1fr; }
  .compact-product .button { grid-column: 1 / -1; }
  .compact-product-actions { grid-column: 1 / -1; width: 100%; }
  .compact-product-actions .button { flex: 1; }
  .request-row, .grant-form { grid-template-columns: 1fr; }
  .profile-note { text-align: left; }
  .configuration-form.two-column { grid-template-columns: 1fr; }
  .configuration-card-head { grid-template-columns: auto 1fr; }
  .configuration-card-head .status { grid-column: 1 / -1; justify-self: start; }
  .configuration-actions { display: grid; grid-template-columns: 1fr; }
  .google-form { padding: 14px; }
}
