:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-strong: #f1f5f4;
  --text: #16201d;
  --muted: #63716d;
  --line: #d9dfdc;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --accent: #d97706;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(25, 36, 33, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 42px);
  background: rgba(246, 248, 251, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
}

.brand-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.brand-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.nav a,
.ghost-button,
.primary-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.nav a.active,
.ghost-button {
  background: var(--surface-strong);
}

.primary-button {
  color: #fff;
  background: var(--primary);
}

.primary-button:hover {
  background: var(--primary-strong);
}

.main {
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 42px) 54px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--primary-strong);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 3.6rem);
  line-height: 1.04;
}

h2 {
  margin: 0;
  font-size: 1.35rem;
}

h3 {
  margin: 0;
  font-size: 1rem;
}

.lede {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.55;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tool-card {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
}

.tool-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.86rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #e7f2ef;
  color: var(--primary-strong);
  font-weight: 700;
  font-size: 0.78rem;
}

.tool-card p,
.empty p,
.result-panel p {
  color: var(--muted);
  line-height: 1.48;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 18px;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  color: #33413d;
  font-size: 0.88rem;
  font-weight: 750;
}

input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

input:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--primary);
}

.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

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

.metric {
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-strong);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 1.08rem;
}

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

.history-row {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.history-row header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.history-row time {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.status {
  margin: 12px 0 0;
  color: var(--muted);
  min-height: 22px;
}

.status.error {
  color: var(--danger);
}

.empty {
  padding: 24px;
  text-align: center;
}

.code {
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: #13201d;
  color: #e8f5f1;
  font-size: 0.84rem;
}

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

  .nav {
    width: 100%;
    justify-content: flex-start;
  }

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

  .form-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }
}
