:root {
  color-scheme: light;
  --blue-950: #082b4d;
  --blue-800: #0d4d79;
  --blue-700: #176ba0;
  --blue-500: #3a9bd4;
  --blue-300: #8dccea;
  --blue-100: #dff3fc;
  --blue-50: #f2faff;
  --green-700: #087f5b;
  --green-600: #0b9f70;
  --green-100: #dff8ed;
  --amber-700: #a55b06;
  --amber-100: #fff1ce;
  --red-700: #ad2e24;
  --red-100: #ffebe8;
  --ink: #15364e;
  --muted: #667f91;
  --line: #d8e8f1;
  --paper: #ffffff;
  --shadow: 0 24px 65px rgba(20, 82, 119, .13);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #fff 0%, #f6fbfe 42%, #edf7fc 100%);
}
body.chat-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(58, 155, 212, .24);
  outline-offset: 2px;
}
.hidden { display: none !important; }
.page-glow { position: fixed; z-index: -1; border-radius: 50%; filter: blur(4px); pointer-events: none; }
.glow-one { width: 34rem; height: 34rem; inset: -13rem auto auto -11rem; background: rgba(141, 204, 234, .22); }
.glow-two { width: 27rem; height: 27rem; inset: 35vh -12rem auto auto; background: rgba(11, 159, 112, .08); }

.site-header {
  width: min(1260px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(13, 77, 121, .09);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-symbol {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #fff;
  border-radius: 15px;
  background: linear-gradient(145deg, var(--blue-500), var(--blue-800));
  box-shadow: 0 9px 22px rgba(23, 107, 160, .25);
  font-weight: 900;
}
.brand strong, .brand small { display: block; }
.brand strong { color: var(--blue-950); font-size: 1rem; }
.brand small { margin-top: 2px; color: var(--muted); font-size: .72rem; }
.header-tools { display: flex; align-items: center; gap: 12px; }
.language-switch { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .76rem; }
.language-switch select { height: 38px; padding: 0 10px; color: var(--ink); border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.text-button { padding: 9px 12px; color: var(--blue-700); border: 0; background: transparent; font-weight: 700; }
.api-docs-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 12px;
  color: var(--blue-700);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  text-decoration: none;
  font-size: .78rem;
  font-weight: 800;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.api-docs-link:hover { border-color: var(--blue-300); background: var(--blue-50); transform: translateY(-1px); }
.api-docs-link:focus-visible { outline: 3px solid rgba(58, 155, 212, .24); outline-offset: 2px; }

.page-shell { width: min(1260px, calc(100% - 40px)); margin: 0 auto 90px; }
.hero { display: grid; grid-template-columns: 1.45fr .75fr; gap: 40px; align-items: end; padding: 70px 0 48px; }
.eyebrow { margin: 0 0 9px; color: var(--blue-700); font-size: .7rem; font-weight: 800; letter-spacing: .12em; }
.hero h1 { max-width: 850px; margin: 0; color: var(--blue-950); font-size: clamp(2.2rem, 5vw, 4.15rem); line-height: 1.18; letter-spacing: -.045em; }
.hero-copy > p:last-child { max-width: 780px; margin: 22px 0 0; color: var(--muted); font-size: 1.02rem; line-height: 1.9; }
.hero-badge { display: flex; align-items: center; gap: 13px; padding: 18px; border: 1px solid #cfe9df; border-radius: 19px; background: rgba(255,255,255,.82); box-shadow: 0 12px 34px rgba(8, 127, 91, .08); }
.hero-badge .shield { display: grid; flex: 0 0 42px; height: 42px; place-items: center; color: #fff; border-radius: 14px; background: var(--green-600); font-weight: 900; }
.hero-badge strong, .hero-badge small { display: block; }
.hero-badge strong { color: var(--green-700); }
.hero-badge small { margin-top: 4px; color: var(--muted); line-height: 1.55; }

.workspace { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; align-items: start; }
.step-rail { position: sticky; top: 20px; padding: 25px; color: #fff; border-radius: 25px; background: linear-gradient(155deg, var(--blue-800), var(--blue-950)); box-shadow: var(--shadow); }
.rail-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid rgba(255,255,255,.12); font-weight: 800; }
.rail-heading small { padding: 5px 8px; border-radius: 99px; background: rgba(255,255,255,.1); }
.step-rail ol { margin: 24px 0 0; padding: 0; list-style: none; }
.step-rail li { position: relative; display: flex; align-items: flex-start; gap: 12px; min-height: 73px; opacity: .48; transition: opacity .2s ease; }
.step-rail li::after { content: ""; position: absolute; top: 34px; bottom: 5px; right: 15px; width: 1px; background: rgba(255,255,255,.18); }
[dir="ltr"] .step-rail li::after { right: auto; left: 15px; }
.step-rail li:last-child::after { display: none; }
.step-rail li.active, .step-rail li.done { opacity: 1; }
.step-rail li > span { display: grid; z-index: 1; flex: 0 0 31px; height: 31px; place-items: center; color: #d8ecf8; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; background: rgba(255,255,255,.08); font-size: .76rem; font-weight: 900; }
.step-rail li.active > span { color: var(--blue-950); border-color: #fff; background: #fff; box-shadow: 0 0 0 5px rgba(255,255,255,.08); }
.step-rail li.done > span { color: #fff; border-color: var(--green-600); background: var(--green-600); }
.step-rail li strong, .step-rail li small { display: block; }
.step-rail li strong { font-size: .84rem; }
.step-rail li small { margin-top: 4px; color: #bcd3e2; font-size: .69rem; line-height: 1.45; }
.rail-note { margin-top: 15px; padding: 15px; border: 1px solid rgba(255,255,255,.13); border-radius: 16px; background: rgba(255,255,255,.07); }
.rail-note strong { color: #83e0bf; font-size: .76rem; }
.rail-note p { margin: 7px 0 0; color: #c5d9e6; font-size: .7rem; line-height: 1.7; }

.content-column { min-width: 0; display: grid; gap: 20px; }
#admin-console { display: grid; gap: 20px; }
.step-card { position: relative; padding: 34px; overflow: hidden; border: 1px solid var(--line); border-radius: 25px; background: rgba(255,255,255,.94); box-shadow: 0 14px 45px rgba(20, 82, 119, .07); }
.active-card { border-color: #a9d9ee; box-shadow: 0 17px 48px rgba(58, 155, 212, .11); }
.locked-card { opacity: .67; }
.section-number { position: absolute; inset: 22px auto auto 25px; color: #e1f1f8; font-size: 3.3rem; font-weight: 900; letter-spacing: -.08em; pointer-events: none; }
[dir="ltr"] .section-number { right: 25px; left: auto; }
.section-heading { position: relative; padding-inline-end: 82px; }
.section-heading.with-action { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; padding-inline-end: 0; }
.section-heading h2 { margin: 0; color: var(--blue-950); font-size: clamp(1.3rem, 3vw, 1.85rem); }
.section-heading > p:last-child, .section-heading > div > p:last-child { max-width: 750px; margin: 10px 0 0; color: var(--muted); line-height: 1.75; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 30px; }
.compact-form { width: min(560px, 100%); grid-template-columns: 1fr; }
.full-field { grid-column: 1 / -1; }
.field { display: flex; min-width: 0; flex-direction: column; gap: 7px; }
.field > span { color: var(--blue-950); font-size: .83rem; font-weight: 750; }
.field > small, .field > div + small { color: var(--muted); font-size: .69rem; line-height: 1.55; }
.field input, .field select, .copy-row input {
  width: 100%;
  height: 48px;
  padding: 0 13px;
  color: var(--ink);
  border: 1px solid #cfe0e9;
  border-radius: 13px;
  background: #fbfdfe;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus { border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(58,155,212,.09); outline: none; }
.password-wrap { position: relative; }
.password-wrap input { padding-inline-end: 46px; }
.password-toggle { position: absolute; inset: 5px auto 5px 5px; width: 38px; color: var(--muted); border: 0; border-radius: 9px; background: transparent; }
[dir="ltr"] .password-toggle { right: 5px; left: auto; }
.form-group-title { display: flex; align-items: center; gap: 11px; margin-top: 7px; padding: 13px 15px; border-radius: 14px; background: var(--blue-50); }
.form-group-title > span { display: grid; flex: 0 0 38px; height: 38px; place-items: center; color: var(--blue-700); border-radius: 12px; background: #fff; font-size: .72rem; font-weight: 900; }
.form-group-title strong, .form-group-title small { display: block; }
.form-group-title small { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.security-reminder { justify-content: center; padding: 13px; border: 1px dashed #b5d9c9; border-radius: 14px; background: #f7fdf9; }
.security-reminder strong { color: var(--green-700); font-size: .79rem; }

.primary-button, .secondary-button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 10px; padding: 0 18px; border-radius: 13px; font-weight: 800; transition: transform .15s ease, opacity .15s ease; }
.primary-button { color: #fff; border: 1px solid var(--green-600); background: linear-gradient(135deg, var(--green-600), var(--green-700)); box-shadow: 0 9px 22px rgba(8,127,91,.18); }
.secondary-button { color: var(--blue-700); border: 1px solid #bcdceb; background: var(--blue-50); }
.primary-button:hover:not(:disabled), .secondary-button:hover:not(:disabled) { transform: translateY(-1px); }
.primary-button:disabled, .secondary-button:disabled { cursor: not-allowed; opacity: .48; box-shadow: none; }
.mode-tabs { display: inline-flex; gap: 5px; margin-top: 28px; padding: 5px; border-radius: 14px; background: #edf6fa; }
.mode-tab { min-height: 39px; padding: 0 15px; color: var(--muted); border: 0; border-radius: 10px; background: transparent; font-weight: 750; }
.mode-tab.active { color: var(--blue-800); background: #fff; box-shadow: 0 5px 14px rgba(20,82,119,.09); }
.mode-panel { margin-top: 23px; }

.status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 26px; }
.status-item { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: #fbfdfe; }
.status-item span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .7rem; }
.status-item span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #9bb1c0; }
.status-item.good span::before { background: var(--green-600); box-shadow: 0 0 0 4px rgba(11,159,112,.1); }
.status-item.warn span::before { background: #e79a22; box-shadow: 0 0 0 4px rgba(231,154,34,.11); }
.status-item strong { display: block; margin-top: 7px; color: var(--blue-950); font-size: .88rem; word-break: break-word; }
.instruction-box { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; padding: 13px 15px; color: var(--amber-700); border: 1px solid #f4d898; border-radius: 14px; background: #fffaf0; }
.instruction-box span { font-weight: 900; }
.instruction-box p { margin: 0; font-size: .73rem; line-height: 1.65; }
.empty-state { padding: 18px; color: var(--muted); border: 1px dashed #bfd6e2; border-radius: 15px; background: #f9fcfd; font-size: .8rem; line-height: 1.65; }
.tenant-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-bottom: 15px; }
.tenant-summary.empty-state { display: block; }
.summary-item { padding: 12px; border-radius: 12px; background: var(--blue-50); }
.summary-item small, .summary-item strong { display: block; }
.summary-item small { color: var(--muted); font-size: .65rem; }
.summary-item strong { margin-top: 5px; font-size: .77rem; overflow-wrap: anywhere; }
.api-key-result { margin-top: 20px; }
.one-time-alert { display: flex; justify-content: space-between; gap: 18px; padding: 14px; color: var(--amber-700); border-radius: 14px; background: var(--amber-100); }
.one-time-alert span { font-size: .72rem; }
.copy-row { display: flex; gap: 8px; margin-top: 12px; direction: ltr; }
.copy-row input { font-family: Consolas, monospace; }
.confirm-check { display: flex; align-items: center; gap: 9px; margin-top: 13px; color: var(--muted); font-size: .75rem; }
.confirm-check input { width: 17px; height: 17px; accent-color: var(--green-600); }
.selected-tenant-banner { margin: 22px 0 15px; padding: 15px; color: var(--blue-800); border: 1px solid #c5e5f4; border-radius: 14px; background: var(--blue-50); font-size: .8rem; }
.test-explainer { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0; list-style: none; }
.test-explainer li { display: flex; align-items: flex-start; gap: 8px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; }
.test-explainer li span { display: grid; flex: 0 0 24px; height: 24px; place-items: center; color: #fff; border-radius: 8px; background: var(--blue-500); font-size: .67rem; font-weight: 900; }
.test-explainer p { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.55; }
.connection-result { margin-top: 15px; padding: 14px; border-radius: 14px; font-size: .78rem; line-height: 1.6; }
.connection-result.success { color: var(--green-700); border: 1px solid #a9dec9; background: var(--green-100); }
.connection-result.error { color: var(--red-700); border: 1px solid #f0bab5; background: var(--red-100); }
.ready-card { display: grid; grid-template-columns: auto 1fr auto; gap: 17px; align-items: center; padding: 27px; color: var(--blue-950); border: 1px solid #a7ddc8; border-radius: 24px; background: linear-gradient(135deg, #f4fff9, #e7f9f1); box-shadow: 0 15px 38px rgba(8,127,91,.1); }
.ready-icon { display: grid; width: 54px; height: 54px; place-items: center; color: #fff; border-radius: 18px; background: var(--green-600); font-size: 1.4rem; font-weight: 900; }
.ready-card h2 { margin: 0; }
.ready-card p:last-child { margin: 7px 0 0; color: var(--muted); line-height: 1.65; }

.chat-fab { position: fixed; z-index: 50; right: 28px; bottom: 28px; display: flex; min-width: 64px; height: 64px; align-items: center; justify-content: center; gap: 9px; padding: 0 20px; color: #fff; border: 0; border-radius: 99px; background: linear-gradient(145deg, var(--green-600), var(--green-700)); box-shadow: 0 18px 40px rgba(8,127,91,.32); font-weight: 800; }
[dir="rtl"] .chat-fab { right: auto; left: 28px; }
.fab-pulse { position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 0 rgba(11,159,112,.35); animation: fabPulse 2.2s infinite; }
.fab-icon { font-size: 1.28rem; }
@keyframes fabPulse { 0% { box-shadow: 0 0 0 0 rgba(11,159,112,.32); } 65% { box-shadow: 0 0 0 14px rgba(11,159,112,0); } 100% { box-shadow: 0 0 0 0 rgba(11,159,112,0); } }
.chat-backdrop { position: fixed; z-index: 60; inset: 0; background: rgba(5, 31, 51, .28); backdrop-filter: blur(3px); }
.chat-drawer { position: fixed; z-index: 70; right: 24px; bottom: 24px; width: min(440px, calc(100% - 32px)); height: min(720px, calc(100vh - 32px)); display: grid; grid-template-rows: auto auto 1fr auto auto auto; overflow: hidden; border: 1px solid #c7dfeb; border-radius: 25px; background: #fff; box-shadow: 0 28px 80px rgba(4,39,64,.28); }
[dir="rtl"] .chat-drawer { right: auto; left: 24px; }
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px; color: #fff; background: linear-gradient(125deg, var(--blue-500), var(--blue-800)); }
.chat-identity { display: flex; align-items: center; gap: 10px; }
.chat-logo { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 13px; background: rgba(255,255,255,.16); }
.chat-identity small, .chat-identity strong { display: block; }
.chat-identity small { color: #d9effb; font-size: .65rem; }
.chat-identity strong { margin-top: 2px; font-size: .93rem; }
.chat-header-actions { display: flex; gap: 6px; }
.chat-header-actions button { width: 35px; height: 35px; color: #fff; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; background: rgba(255,255,255,.08); font-size: 1.15rem; }
.chat-context { display: flex; align-items: center; gap: 7px; padding: 9px 18px; color: var(--muted); border-bottom: 1px solid var(--line); background: #f8fcfe; font-size: .67rem; }
.chat-context strong { color: var(--blue-700); }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-600); box-shadow: 0 0 0 4px rgba(11,159,112,.09); }
.chat-messages { min-height: 0; padding: 18px; overflow-y: auto; background: linear-gradient(#fff, #f7fbfd); }
.chat-message { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 14px; }
.chat-message.user { flex-direction: row-reverse; }
.chat-avatar { display: grid; flex: 0 0 31px; height: 31px; place-items: center; color: #fff; border-radius: 10px; background: var(--blue-500); font-size: .72rem; font-weight: 900; }
.chat-message.user .chat-avatar { color: var(--green-700); background: var(--green-100); }
.chat-bubble { max-width: 82%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 16px 16px 5px 16px; background: #fff; box-shadow: 0 6px 18px rgba(20,82,119,.06); }
.chat-message.user .chat-bubble { color: #fff; border-color: var(--blue-700); border-radius: 16px 16px 16px 5px; background: var(--blue-700); }
.chat-message.error .chat-bubble { color: var(--red-700); border-color: #f0bab5; background: var(--red-100); }
.chat-bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .78rem; line-height: 1.72; }
.chat-meta { display: block; margin-top: 5px; color: var(--muted); font-size: .58rem; }
.chat-typing .chat-bubble { display: flex; gap: 4px; padding: 14px; }
.chat-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--blue-500); animation: dots 1s infinite ease-in-out; }
.chat-typing i:nth-child(2) { animation-delay: .12s; }
.chat-typing i:nth-child(3) { animation-delay: .24s; }
@keyframes dots { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
.chat-actions-wrap { padding: 0 17px 10px; }
.chat-actions-wrap > small { color: var(--muted); font-size: .63rem; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chat-suggestions button { padding: 8px 10px; color: var(--blue-700); border: 1px solid #bcdceb; border-radius: 99px; background: var(--blue-50); font-size: .7rem; }
.chat-composer { display: flex; align-items: flex-end; gap: 8px; margin: 0 14px; padding: 7px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: 0 8px 25px rgba(20,82,119,.08); }
.chat-composer textarea { flex: 1; min-height: 42px; max-height: 110px; padding: 10px; resize: none; color: var(--ink); border: 0; outline: none; background: transparent; line-height: 1.5; }
.chat-special-input { flex: 1; min-height: 42px; padding: 8px 10px; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; background: #fff; outline: none; }
.chat-composer button { display: grid; flex: 0 0 42px; height: 42px; place-items: center; color: #fff; border: 0; border-radius: 12px; background: var(--green-600); }
.chat-composer button:disabled { opacity: .5; }
.chat-drawer footer { display: flex; align-items: center; gap: 5px; padding: 8px 17px 13px; color: var(--muted); font-size: .58rem; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 25px; max-width: min(470px, calc(100% - 30px)); padding: 12px 17px; transform: translateX(-50%); color: #fff; border-radius: 13px; background: var(--blue-950); box-shadow: 0 14px 35px rgba(5,31,51,.28); font-size: .78rem; }
.toast.error { background: var(--red-700); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .hero-badge { width: min(540px, 100%); }
  .workspace { grid-template-columns: 1fr; }
  .step-rail { position: static; }
  .step-rail ol { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
  .step-rail li { min-height: 0; flex-direction: column; }
  .step-rail li::after, .step-rail li small { display: none; }
  .status-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
  .site-header, .page-shell { width: min(100% - 24px, 1260px); }
  .site-header { min-height: 72px; }
  .brand small, .language-switch > span { display: none; }
  .hero { padding: 43px 0 30px; }
  .hero h1 { font-size: 2.25rem; }
  .step-rail { padding: 20px; }
  .step-rail ol { grid-template-columns: repeat(5, minmax(44px, 1fr)); }
  .step-rail li div { display: none; }
  .step-card { padding: 26px 20px; border-radius: 20px; }
  .section-number { font-size: 2.6rem; }
  .section-heading { padding-inline-end: 58px; }
  .section-heading.with-action { flex-direction: column; }
  .form-grid, .status-grid, .tenant-summary, .test-explainer { grid-template-columns: 1fr; }
  .mode-tabs { width: 100%; }
  .mode-tab { flex: 1; }
  .one-time-alert, .copy-row { flex-direction: column; }
  .ready-card { grid-template-columns: auto 1fr; }
  .ready-card .primary-button { grid-column: 1 / -1; }
  .chat-fab { right: 16px; bottom: 16px; min-width: 58px; height: 58px; padding: 0 17px; }
  [dir="rtl"] .chat-fab { right: auto; left: 16px; }
  .fab-label { display: none; }
  .chat-drawer, [dir="rtl"] .chat-drawer { inset: 8px; width: auto; height: auto; border-radius: 20px; }
}
