:root {
  --ink: #0b1220;
  --ink-2: #273449;
  --muted: #6b7890;
  --dark: #07101f;
  --dark-2: #111f35;
  --line: rgba(15, 29, 51, 0.14);
  --green: #10b981;
  --lime: #baf45b;
  --gold: #f7b955;
  --rose: #ef476f;
  --blue: #2f6df6;
  --radius: 24px;
  --shadow: 0 30px 80px rgba(5, 15, 31, 0.16);
  --shadow-soft: 0 18px 50px rgba(5, 15, 31, 0.1);
  --font-display: "Archivo", sans-serif;
  --font-body: "DM Sans", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 10% 8%, rgba(16, 185, 129, 0.26), transparent 25rem),
    radial-gradient(circle at 90% 2%, rgba(247, 185, 85, 0.22), transparent 26rem),
    radial-gradient(circle at 88% 82%, rgba(47, 109, 246, 0.15), transparent 26rem),
    linear-gradient(180deg, #f9f7ee 0%, #eef8f4 44%, #f8fbff 100%);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .55;
  background-image:
    linear-gradient(rgba(15, 29, 51, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 29, 51, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 76%);
}

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

.tools-shell {
  position: relative;
  width: min(1520px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 22px 0 56px;
}

.tools-header {
  position: sticky;
  top: 14px;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(250px, auto) auto;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 26px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(7,16,31,.96), rgba(15,29,51,.92)),
    radial-gradient(circle at 12% 0%, rgba(16,185,129,.28), transparent 24rem);
  box-shadow: 0 24px 70px rgba(5,15,31,.28);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 18px;
  background: linear-gradient(145deg, #fff, #dbeafe);
  box-shadow: 0 14px 34px rgba(0,0,0,.28);
}

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

.brand-copy { display: grid; min-width: 0; }
.brand-title {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-subtitle {
  margin-top: 2px;
  color: rgba(255,255,255,.68);
  font-weight: 700;
  font-size: .82rem;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.bot-chip, .action-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 13px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  color: rgba(255,255,255,.86);
  background: rgba(255,255,255,.08);
  font-size: .8rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}
.bot-chip b { color: #fff; }
.action-link { cursor: pointer; transition: transform .18s ease, background .18s ease; }
.action-link:hover { transform: translateY(-1px); background: rgba(255,255,255,.14); }
.action-primary {
  color: #08111f;
  border-color: transparent;
  background: linear-gradient(135deg, var(--lime), var(--green));
  box-shadow: 0 14px 34px rgba(16,185,129,.28);
}

main {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.tools-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 18px;
  align-items: stretch;
  padding: clamp(28px, 4vw, 54px);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 36px;
  color: #fff;
  background:
    linear-gradient(118deg, rgba(7,16,31,.96), rgba(13,34,60,.94) 48%, rgba(7,16,31,.78)),
    radial-gradient(circle at 82% 20%, rgba(247,185,85,.36), transparent 22rem),
    radial-gradient(circle at 30% 88%, rgba(16,185,129,.28), transparent 24rem);
  box-shadow: var(--shadow);
}

.eyebrow, .section-kicker {
  margin: 0 0 12px;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.tools-hero h1 {
  max-width: 880px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3rem, 6.6vw, 7rem);
  font-weight: 900;
  line-height: .92;
  letter-spacing: -.052em;
  word-spacing: .06em;
}

.tools-hero p:not(.eyebrow) {
  max-width: 680px;
  margin: 22px 0 0;
  color: rgba(255,255,255,.76);
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  font-weight: 700;
}

.hero-card {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  min-height: 250px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 28px;
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(14px);
}
.hero-card img { width: 132px; height: 132px; object-fit: contain; filter: drop-shadow(0 18px 28px rgba(0,0,0,.32)); }
.hero-card span { color: rgba(255,255,255,.62); font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; }
.hero-card b { font-family: var(--font-display); font-size: 1.2rem; }

.tool-tabs {
  position: sticky;
  top: 100px;
  z-index: 35;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 28px;
  background: rgba(7,16,31,.92);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.tool-tab {
  min-height: 44px;
  border-radius: 999px;
  padding: 10px 15px;
  color: rgba(255,255,255,.72);
  background: rgba(255,255,255,.06);
  font-family: var(--font-display);
  font-weight: 900;
  cursor: pointer;
}
.tool-tab.active {
  color: #06111f;
  background: linear-gradient(135deg, var(--lime), var(--green));
}

.tool-message {
  border: 1px solid rgba(16,185,129,.28);
  border-radius: 18px;
  padding: 13px 15px;
  color: #075f44;
  background: rgba(16,185,129,.08);
  font-weight: 900;
}

.tool-panel { display: none; }
.tool-panel.active { display: grid; gap: 18px; }

.panel-head,
.tool-card,
.code-vault,
.history-panel {
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 28px;
  background: rgba(255,255,255,.76);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.panel-head {
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(280px, 560px);
  gap: 18px;
  align-items: center;
  padding: 22px;
}
.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.8vw, 4.2rem);
  line-height: .92;
  letter-spacing: -.06em;
}
.panel-head .section-kicker { color: var(--green-dark, #087a5b); }
.panel-head p:not(.section-kicker) { margin: 0; color: var(--muted); font-weight: 800; }

.workspace-grid {
  display: grid;
  gap: 16px;
}
.two-col { grid-template-columns: minmax(0, 1fr) minmax(320px, .9fr); }

.tool-card {
  display: grid;
  gap: 12px;
  padding: 22px;
}
.credential-block {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(16,185,129,.18);
  border-radius: 22px;
  background:
    radial-gradient(circle at 0 0, rgba(167,243,208,.34), transparent 34%),
    linear-gradient(135deg, rgba(255,255,255,.88), rgba(240,253,250,.72));
}
.mini-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.mini-section-head b {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
}
.mini-section-head span,
.hint-text {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
  line-height: 1.45;
}
.hint-text code {
  padding: 2px 6px;
  border-radius: 8px;
  color: #075f44;
  background: rgba(16,185,129,.10);
  font-weight: 900;
}
.compact-head {
  margin-top: 2px;
}
.mini-output {
  min-height: 118px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .86rem;
}
.tool-card label {
  color: var(--ink-2);
  font-weight: 900;
}
textarea, input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.94);
  color: var(--ink);
  min-height: 48px;
  padding: 12px 14px;
  outline: none;
}
textarea {
  resize: vertical;
  font-family: var(--font-body);
}
textarea:focus, input:focus, select:focus {
  border-color: rgba(16,185,129,.75);
  box-shadow: 0 0 0 5px rgba(16,185,129,.14);
}

.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.option-row label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-2);
  font-size: .88rem;
}
.option-row input {
  width: auto;
  min-height: auto;
}

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

.btn {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 16px;
  padding: 13px 18px;
  font-family: var(--font-display);
  font-weight: 900;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  color: #06111f;
  background: linear-gradient(135deg, var(--lime), var(--green));
  box-shadow: 0 18px 36px rgba(16,185,129,.24);
}
.btn-secondary {
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
}

.code-vault {
  position: relative;
  min-height: 310px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  overflow: hidden;
  padding: 24px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(7,16,31,.94), rgba(17,39,70,.92)),
    radial-gradient(circle at 50% 15%, rgba(16,185,129,.34), transparent 16rem);
}
.code-vault::before {
  content: "";
  position: absolute;
  width: 230px;
  height: 230px;
  border-radius: 999px;
  background: url("/static/optimus-prime-brand.png?v=20260515-tools1") center / contain no-repeat;
  opacity: .1;
}
.vault-label {
  position: relative;
  color: rgba(255,255,255,.68);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.code-button {
  position: relative;
  width: min(100%, 350px);
  min-height: 118px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 26px;
  color: #06111f;
  background: linear-gradient(135deg, #fff, #e9fff6);
  box-shadow: 0 20px 45px rgba(0,0,0,.2);
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 7vw, 4.8rem);
  font-weight: 900;
  letter-spacing: -.06em;
  cursor: pointer;
}
.code-button:disabled { cursor: not-allowed; color: var(--muted); }

.output-card textarea { min-height: 280px; }
.output-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.output-head b { font-family: var(--font-display); }
.mini-btn {
  min-height: 34px;
  border-radius: 999px;
  padding: 7px 12px;
  color: #06111f;
  background: linear-gradient(135deg, var(--lime), var(--green));
  font-weight: 900;
  cursor: pointer;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.metric-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(248,251,255,.85);
}
.metric-grid span {
  display: block;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.metric-grid b {
  display: block;
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.history-panel { overflow: hidden; }
.history-title {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 900;
}
.table-scroll { overflow-x: auto; }
table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
}
th, td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(15,29,51,.08);
  text-align: left;
}
th {
  color: var(--muted);
  background: rgba(248,251,255,.74);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}
td { color: var(--ink-2); font-weight: 700; }
.muted { color: var(--muted); }

.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.button-row .btn { flex: 1 1 190px; }
.btn-danger-soft {
  color: #9f1239;
  border: 1px solid rgba(239,71,111,.22);
  background: rgba(239,71,111,.08);
}
.compact-metrics { grid-template-columns: 120px 110px minmax(0, 1fr); }
.compact-metrics b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 11px;
  border: 1px solid rgba(47,109,246,.18);
  border-radius: 999px;
  color: #2850c8;
  background: rgba(47,109,246,.08);
  font-size: .75rem;
  font-weight: 900;
  text-transform: uppercase;
}
.status-pill.ok,
#gemini-cookie-status.ok {
  color: #047857;
}
.status-pill.bad,
#gemini-cookie-status.bad {
  color: #be123c;
}
.capture-help {
  padding: 13px 14px;
  border: 1px solid rgba(247,185,85,.34);
  border-radius: 16px;
  color: #7c4a03;
  background: rgba(247,185,85,.12);
  font-weight: 800;
}
.capture-help a {
  color: #075f44;
  font-weight: 900;
}
.live-console {
  background:
    linear-gradient(135deg, rgba(255,255,255,.84), rgba(245,250,255,.78)),
    radial-gradient(circle at 0 0, rgba(47,109,246,.12), transparent 24rem);
}
.gemini-metrics { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.gemini-metrics div {
  min-height: 74px;
}
.gemini-metrics b {
  font-size: clamp(1rem, 2vw, 1.5rem);
}
.progress-rail {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15,29,51,.08);
}
.progress-rail span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
  transition: width .25s ease;
}
.cli-output {
  min-height: 260px;
  max-height: 440px;
  margin: 0;
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  color: #d7fbe8;
  background: #07101f;
  box-shadow: inset 0 0 0 1px rgba(16,185,129,.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
.result-grid .tool-card {
  border-top: 4px solid var(--line);
}
.result-box textarea {
  min-height: 250px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .84rem;
}
.active-box { border-top-color: rgba(16,185,129,.75) !important; }
.used-box { border-top-color: rgba(247,185,85,.85) !important; }
.invalid-box { border-top-color: rgba(239,71,111,.72) !important; }

@media (max-width: 1120px) {
  .tools-header,
  .tools-hero,
  .panel-head,
  .two-col,
  .three-col {
    grid-template-columns: 1fr;
  }
  .gemini-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .header-actions { justify-content: flex-start; }
  .tool-tabs { top: 96px; }
}

@media (max-width: 720px) {
  .tools-shell {
    width: min(100vw - 18px, 1520px);
    padding-top: 8px;
  }
  .tools-header,
  .tools-hero,
  .panel-head,
  .tool-card,
  .code-vault,
  .history-panel {
    border-radius: 22px;
  }
  .tools-header { top: 8px; }
  .header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .bot-chip, .action-link {
    white-space: normal;
    text-align: center;
  }
  .tools-hero { padding: 28px 20px; }
  .tools-hero h1 {
    font-size: clamp(3rem, 15vw, 5.2rem);
    letter-spacing: -.04em;
  }
  .tool-tabs {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-radius: 22px;
  }
  .tool-tab { min-width: 0; }
  .filters-grid,
  .metric-grid,
  .gemini-metrics,
  .compact-metrics {
    grid-template-columns: 1fr;
  }
  .cli-output { max-height: 320px; }
}

@media (max-width: 440px) {
  .brand-mark { width: 48px; height: 48px; }
  .brand-title { font-size: .98rem; }
  .tool-tabs { grid-template-columns: 1fr; }
}

/* Enforce HTML5 `hidden` attribute against later class rules like .tool-card { display: grid } */
[hidden] { display: none !important; }

/* Lovable Tools — toolbar above the iframe */
.premium-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin: 6px 0 12px;
  background: rgba(11,18,32,0.04);
  border: 1px solid rgba(11,18,32,0.08);
  border-radius: 14px;
}
.premium-toolbar-label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink, #0b1220);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.premium-iframe-wrap {
  position: relative;
  width: 100%;
  background: #0b0f1f;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(11,18,32,0.18);
}
.premium-iframe-wrap iframe {
  display: block;
  width: 100%;
  height: clamp(640px, 88vh, 1500px);
  border: 0;
  background: #0b0f1f;
}
#premium-head-note code {
  font-family: var(--mono, 'JetBrains Mono', monospace);
  background: rgba(11,18,32,0.08);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.85em;
}

/* Premium tools sub-tabs and sub-panels (legacy — kept for any cached HTML) */
.tool-subtab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: #c7d2e2;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.tool-subtab:hover { background: rgba(255,255,255,0.08); color: #f1f5fb; }
.tool-subtab.active {
  background: linear-gradient(135deg, #2c4ed4, #6c4cdb);
  border-color: rgba(255,255,255,0.25);
  color: #fff;
}
.premium-subpanel { display: none; margin-top: 18px; }
.premium-subpanel.active { display: block; }
#premium-shell .tool-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(80px,1fr)); gap: 8px; margin: 8px 0 12px; }
.metric-grid div { background: rgba(255,255,255,0.04); border-radius: 10px; padding: 6px 10px; text-align: center; }
.metric-grid span { display: block; font-size: 0.7rem; color: var(--muted); }
.metric-grid b { font-size: 1.05rem; }

