:root {
  color-scheme: light;
  --ink: #071044;
  --text: #203254;
  --muted: #63718f;
  --line: #dbe5f2;
  --paper: #ffffff;
  --soft: #f2f7fb;
  --cyan: #00b8d9;
  --green: #27c185;
  --blue: #06156d;
  --shadow: 0 18px 45px rgba(28, 47, 88, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--soft);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(219, 229, 242, 0.75);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 112px;
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0;
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vw, 32px);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.nav a:hover {
  color: var(--ink);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  min-height: calc(100vh - 72px);
  padding: clamp(48px, 7vw, 88px) clamp(18px, 5vw, 72px);
  background:
    linear-gradient(135deg, rgba(0, 184, 217, 0.16), transparent 38%),
    linear-gradient(315deg, rgba(39, 193, 133, 0.14), transparent 42%),
    #f8fbff;
}

.hero-copy {
  max-width: 780px;
}

.eyebrow {
  margin: 0 0 14px;
  color: #007d95;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 760px;
  color: var(--ink);
  font-size: clamp(2.6rem, 6vw, 5.6rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.lead {
  max-width: 660px;
  margin: 24px 0 0;
  color: #334467;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

.primary,
.secondary,
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.primary {
  background: var(--blue);
  color: white;
  box-shadow: 0 14px 32px rgba(6, 21, 109, 0.22);
}

.primary:hover,
.secondary:hover,
.ghost:hover {
  transform: translateY(-1px);
}

.secondary,
.ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
}

.small {
  min-height: 38px;
  padding: 0 15px;
}

.full {
  width: 100%;
}

.auth-panel {
  width: min(100%, 420px);
  justify-self: end;
  padding: 22px;
  border: 1px solid rgba(219, 229, 242, 0.88);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbff;
}

.tab {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.tab.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(31, 54, 102, 0.09);
}

.auth-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: #fbfdff;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(0, 184, 217, 0.12);
}

input:disabled,
select:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.message {
  min-height: 24px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.message.error {
  color: #b42318;
}

.message.success {
  color: #087443;
}

.section {
  padding: clamp(48px, 6vw, 76px) clamp(18px, 5vw, 72px);
  background: var(--paper);
}

.section.muted {
  background: #eef6fb;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 26px;
}

.refresh-status {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.alert-stack {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.notice {
  max-width: 760px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}

.notice.success {
  border-color: #bcebd5;
  background: #effbf5;
  color: #087443;
}

.notice.warning {
  border-color: #ffe2a8;
  background: #fff8e8;
  color: #9a5b00;
}

.notice.error {
  border-color: #ffd0cb;
  background: #fff4f2;
  color: #b42318;
}

h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1.04;
  letter-spacing: 0;
}

.dashboard-empty {
  display: grid;
  gap: 8px;
  max-width: 680px;
  padding: 22px;
  border: 1px dashed #b9c7dc;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--muted);
}

.dashboard-empty strong {
  color: var(--ink);
  font-size: 1.08rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stats article,
.panel,
.plan {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.stats article {
  display: grid;
  gap: 10px;
  min-height: 104px;
  padding: 18px;
}

.stats span,
.panel-title span,
.meta,
.empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.stats strong {
  color: var(--ink);
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  line-height: 1;
}

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

.panel {
  min-height: 260px;
  padding: 18px;
}

.panel.collapsed {
  min-height: 0;
  padding-bottom: 12px;
}

.panel.collapsed .panel-title {
  margin-bottom: 0;
}

.verify-panel {
  min-height: 180px;
}

.panel.wide {
  grid-column: 1 / -1;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.collapse-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbff;
  color: var(--text);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
}

.collapse-toggle::after {
  content: "v";
  margin-left: 7px;
  font-size: 0.8rem;
}

.collapsed .collapse-toggle::after {
  content: ">";
}

.collapsed .collapsible-body {
  display: none;
}

h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.1rem;
  letter-spacing: 0;
}

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

.command-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #d7e4f4;
  border-radius: 8px;
  background: #f8fbff;
}

.command-box.generated {
  margin-top: 14px;
}

.command-box code {
  min-width: 0;
  color: var(--ink);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.96rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.verify-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #cdebf2;
  border-radius: 8px;
  background: #f2fcff;
}

.verify-box strong {
  color: var(--ink);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 1.2rem;
  letter-spacing: 0.04em;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.tool-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.inline-actions,
.item-actions,
.plan-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-actions {
  margin-top: 14px;
}

.inline-status {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.item-actions {
  margin-top: 6px;
}

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

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.history-actions select {
  width: auto;
  min-width: 170px;
}

.command-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid #edf2f8;
  border-radius: 8px;
  background: #fbfdff;
}

.command-row code {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.92rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.tool-message.success {
  color: #087443;
}

.tool-message.error {
  color: #b42318;
}

.danger {
  color: #b42318;
}

.item {
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid #edf2f8;
  border-radius: 8px;
  background: #fbfdff;
}

.item-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #e6faff;
  color: #007d95;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge.green {
  background: #e8fbf2;
  color: #087443;
}

.plans {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.plan {
  display: grid;
  align-content: start;
  gap: 16px;
  min-height: 310px;
  padding: 20px;
}

.plan.current {
  border-color: rgba(0, 184, 217, 0.55);
  box-shadow: 0 14px 34px rgba(0, 184, 217, 0.1);
}

.plan strong {
  color: var(--ink);
  font-size: 1.35rem;
}

.plan ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: #405173;
}

.limits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.limits span {
  padding: 6px 9px;
  border-radius: 999px;
  background: #f2f7fb;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 28px clamp(18px, 5vw, 72px);
  background: #071044;
  color: rgba(255, 255, 255, 0.76);
}

.footer a {
  color: white;
  font-weight: 800;
}

.hidden {
  display: none !important;
}

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .auth-panel {
    justify-self: start;
  }

  .stats,
  .plans,
  .tool-grid,
  .command-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .hero-actions,
  .dashboard-grid,
  .stats,
  .plans,
  .tool-grid,
  .tool-grid.compact,
  .command-list,
  .command-box,
  .verify-box,
  .command-row {
    grid-template-columns: 1fr;
  }

  .history-actions select {
    width: 100%;
  }

  .hero-actions {
    display: grid;
  }

  .primary,
  .secondary {
    width: 100%;
  }
}
