:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9dee7;
  --panel: #ffffff;
  --blue: #145db2;
  --blue-dark: #0f4789;
  --green: #0f766e;
  --amber: #a15c07;
  --soft-blue: #eaf2ff;
  --soft-green: #e7f6f3;
  --shadow: 0 14px 36px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Yu Gothic UI",
    "Meiryo",
    system-ui,
    sans-serif;
}

.lpBody {
  background: #f5f7fb;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.lpTopbar {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 36px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 25, 46, 0.68);
  backdrop-filter: blur(8px);
}

.lpBrand {
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
}

.lpNav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.lpNav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 6px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.lpNav a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.lpNavPrimary {
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.14);
}

.lpHero {
  position: relative;
  min-height: min(760px, 92vh);
  display: grid;
  align-items: end;
  padding: 120px 36px 56px;
  overflow: hidden;
  color: #ffffff;
  background:
    linear-gradient(90deg, rgba(8, 25, 46, 0.92), rgba(8, 25, 46, 0.7) 44%, rgba(8, 25, 46, 0.18)),
    url("/ui/assets/hero-console.png") center/cover;
}

.lpHeroContent {
  position: relative;
  z-index: 1;
  max-width: 660px;
}

.lpHeroContent .eyebrow {
  color: rgba(255, 255, 255, 0.76);
}

.lpHero h1 {
  max-width: 640px;
  font-size: 44px;
  line-height: 1.16;
}

.lpHero p {
  max-width: 600px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 16px;
  line-height: 1.8;
}

.lpHeroActions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.lpHeroActions .primaryLink {
  background: #ffffff;
  color: #145db2;
}

.lpHeroActions .primaryLink:hover {
  background: #eef4ff;
}

.lpHeroActions .secondaryLink {
  border: 1px solid rgba(255, 255, 255, 0.34);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.lpBand {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 36px 44px;
}

.lpBand > div {
  min-width: 0;
  padding: 20px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.lpBand h2 {
  font-size: 17px;
}

.lpBand p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 32px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.topActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settingsMenu {
  position: relative;
}

.settingsMenu summary {
  list-style: none;
}

.settingsMenu summary::-webkit-details-marker {
  display: none;
}

.settingsMenuPanel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 20;
  display: grid;
  min-width: 190px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(17, 24, 39, 0.13);
}

.settingsMenuPanel a,
.settingsMenuPanel button {
  padding: 12px 14px;
  border: 0;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
}

.settingsMenuPanel a + a,
.settingsMenuPanel button + a,
.settingsMenuPanel a + button,
.settingsMenuPanel button + button {
  border-top: 1px solid var(--line);
}

.settingsMenuPanel a:hover,
.settingsMenuPanel button:hover {
  background: #f9fafb;
}

.settingsMenu[open] .iconButton {
  border-color: #d0d5dd;
  color: var(--ink);
  background: #f9fafb;
  box-shadow: none;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
}

.versionLine {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.versionLine span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.versionLine span.ok {
  border-color: #b9ded6;
  color: var(--green);
  background: var(--soft-green);
}

.versionLine span.warning {
  border-color: #f3c387;
  color: var(--amber);
  background: #fff7ed;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

.status,
.countBadge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #98a2b3;
  box-shadow: 0 0 0 3px rgba(152, 162, 179, 0.13);
}

.status.ok {
  border-color: #b9ded6;
  color: var(--green);
  background: var(--soft-green);
}

.status.ok::before {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
}

.okBadge {
  border-color: #b9ded6;
  color: var(--green);
  background: var(--soft-green);
}

.status.error {
  border-color: #f3c387;
  color: var(--amber);
  background: #fff7ed;
}

.status.error::before {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(161, 92, 7, 0.13);
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(420px, 1fr);
  gap: 20px;
  padding: 20px 32px 32px;
}

.consoleLayout {
  align-items: start;
}

.settingsPage {
  display: grid;
  gap: 20px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 32px 32px;
}

.isHidden {
  display: none !important;
}

.setupSteps {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
}

.stepButton {
  display: grid;
  gap: 4px;
  min-height: 74px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 14px 16px;
  color: var(--muted);
  background: #fff;
  text-align: left;
  text-decoration: none;
}

.stepButton:last-child {
  border-right: 0;
}

.stepButton span {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.stepButton strong {
  color: var(--ink);
  font-size: 15px;
}

.stepButton.active {
  color: var(--blue);
  background: var(--soft-blue);
  box-shadow: inset 0 -3px 0 var(--blue);
}

.stepButton.completed {
  color: var(--green);
  background: var(--soft-green);
}

.stepButton:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.stepButton:disabled strong {
  color: var(--muted);
}

[data-step-panel].setupHidden {
  display: none;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.workspacePanel {
  grid-column: 1 / -1;
  overflow: hidden;
}

.workspaceTabs {
  display: flex;
  gap: 0;
  padding: 6px;
  border-bottom: 1px solid var(--line);
  background: #f9fafb;
}

.tabButton {
  min-height: 42px;
  min-width: 132px;
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.tabButton:hover {
  color: var(--ink);
  background: #ffffff;
}

.tabButton.active {
  color: #ffffff;
  background: var(--blue);
}

.tabPane {
  display: none;
}

.tabPane.active {
  display: block;
}

.panelHeadPlain {
  border-bottom: 0;
  padding-bottom: 0;
}

.settingsPanel {
  grid-column: 1 / -1;
  order: 3;
}

.usagePanel {
  width: min(760px, calc(100vw - 32px));
}

.licensePanel {
  grid-column: 1 / -1;
  order: 2;
}

.indexPanel {
  grid-column: 1 / -1;
  order: 4;
}

.setupSteps {
  order: 1;
}

[data-step-panel="qa"] {
  order: 6;
}

[data-step-panel="query"] {
  order: 7;
}

.panelHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.setupNotice {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-color: #f3c387;
  background: #fff7ed;
}

.formStack,
.queryForm,
.fileImport {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.settingsGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  padding: 18px;
}

.settingsGrid .primaryButton {
  align-self: end;
}

.checkLine {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding-top: 20px;
}

.checkLine input {
  width: 18px;
  height: 18px;
}

.settingsField.isHidden {
  display: none;
}

.indexStatus {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 18px 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
}

.indexStatus p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.indexStatus.warning {
  border-color: #f3c387;
  background: #fff7ed;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #7aa7df;
  box-shadow: 0 0 0 3px rgba(20, 93, 178, 0.13);
}

.primaryButton,
.secondaryButton,
.iconButton,
.closeButton,
.backLink,
.primaryLink,
.secondaryLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
}

.primaryButton,
.primaryLink {
  min-height: 42px;
  padding: 10px 14px;
  color: #fff;
  background: var(--blue);
}

.primaryButton:hover,
.primaryLink:hover {
  background: var(--blue-dark);
}

.secondaryButton,
.secondaryLink {
  min-height: 40px;
  padding: 10px 14px;
  color: var(--blue);
  background: var(--soft-blue);
}

.dangerButton {
  color: #b42318;
  background: #fff1f0;
}

.iconButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  color: #475467;
  background: transparent;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.iconButton:hover {
  border-color: #d0d5dd;
  color: var(--ink);
  background: #f9fafb;
}

.closeButton {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #d0d5dd;
  color: #475467;
  background: #ffffff;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.closeButton:hover {
  border-color: #b8c0cc;
  color: var(--ink);
  background: #f2f4f7;
}

.backLink {
  gap: 6px;
  min-height: 36px;
  padding: 7px 10px 7px 8px;
  border: 1px solid transparent;
  color: #475467;
  background: transparent;
  font-size: 13px;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.backLink .uiIcon {
  width: 17px;
  height: 17px;
}

.backLink:hover {
  border-color: #d0d5dd;
  color: var(--ink);
  background: #f9fafb;
}

.iconButton:focus-visible,
.closeButton:focus-visible,
.backLink:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(20, 93, 178, 0.16);
}

.uiIcon {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.divider {
  height: 1px;
  background: var(--line);
}

.fileDrop input {
  padding: 8px;
}

.message {
  min-height: 20px;
  margin: 0;
  padding: 0 18px 18px;
  color: var(--muted);
  font-size: 13px;
}

.usageGrid {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 12px;
  padding: 18px;
}

.usageGrid > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fafb;
}

.usageGrid p:last-child {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.usageCost {
  font-size: 22px !important;
  font-weight: 800;
}

.usageBreakdown {
  max-height: 320px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 0 18px 18px;
}

.licenseGrid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr);
  gap: 14px;
  padding: 18px;
}

.licenseSummary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.licenseSummary > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fafb;
}

.licenseSummary p:last-child {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.licenseForm {
  display: grid;
  gap: 10px;
}

.licenseActions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.licenseHistory {
  display: grid;
  gap: 8px;
  padding: 0 18px 18px;
}

.licenseHistoryRow {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
}

.licenseHistoryRow strong {
  color: var(--ink);
}

.countBadge.warning {
  border-color: #f3c387;
  color: var(--amber);
  background: #fff7ed;
}

.countBadge.error {
  border-color: #f4b4ad;
  color: #b42318;
  background: #fff1f0;
}

.usageRow {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.usageRow div {
  display: grid;
  gap: 3px;
}

.usageRow div:last-child {
  text-align: right;
}

.usageRow span,
.emptyText {
  color: var(--muted);
  font-size: 12px;
}

.queryPanel {
  display: grid;
  align-content: start;
}

.compactField {
  width: 92px;
}

.compactField input {
  height: 34px;
  padding: 6px 8px;
}

.answerBox {
  margin: 0 18px 18px;
  padding: 16px;
  border: 1px solid #c9d7ec;
  border-radius: 8px;
  background: #f8fbff;
}

.answerText {
  min-height: 56px;
  line-height: 1.65;
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.metrics span {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
}

.listHeader {
  padding: 0 18px 10px;
}

.sourceList {
  display: grid;
  gap: 10px;
  padding: 0 18px 18px;
}

.sourceItem {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.sourceMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.sourceQuestion {
  margin: 0 0 6px;
  font-weight: 700;
}

.sourceAnswer {
  margin: 0;
  color: #344054;
  line-height: 1.55;
}

.tablePanel {
  grid-column: 1 / -1;
}

.tableWrap {
  overflow: auto;
  max-height: 460px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.loadingOverlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(246, 247, 249, 0.72);
  backdrop-filter: blur(2px);
}

.modalOverlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 84px 16px 24px;
}

.modalBackdrop {
  position: absolute;
  inset: 0;
  background: rgba(246, 247, 249, 0.72);
  backdrop-filter: blur(2px);
}

.modalPanel {
  position: relative;
  z-index: 1;
  max-height: calc(100vh - 120px);
  overflow: hidden;
}

.smallModalPanel {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 32px));
  overflow: hidden;
}

.modalActions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.modalLead {
  margin: 0;
  color: #344054;
  line-height: 1.7;
}

.modalButtonRow {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.loadingOverlay.isVisible {
  display: flex;
}

.loadingDialog {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 280px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.loadingDialog p:last-child {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #d9dee7;
  border-top-color: var(--blue);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f9fafb;
}

td {
  line-height: 1.45;
}

@media (max-width: 900px) {
  .lpTopbar {
    padding: 18px;
  }

  .lpHero {
    min-height: 760px;
    padding: 104px 18px 32px;
  }

  .lpHero h1 {
    font-size: 34px;
  }

  .lpBand {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .topActions {
    flex-wrap: wrap;
    width: 100%;
  }

  .settingsMenuPanel {
    left: 0;
    right: auto;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .settingsPage {
    padding: 16px;
  }

  .settingsGrid {
    grid-template-columns: 1fr;
  }

  .usageGrid {
    grid-template-columns: 1fr;
  }

  .setupSteps {
    grid-template-columns: 1fr;
  }

  .stepButton {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .licenseGrid,
  .licenseSummary {
    grid-template-columns: 1fr;
  }

  .usageRow {
    flex-direction: column;
  }

  .usageRow div:last-child {
    text-align: left;
  }

  .modalButtonRow {
    flex-direction: column-reverse;
  }
}
