:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #eef3f6;
  --text: #1f2933;
  --muted: #64707d;
  --line: #d9e1e7;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --danger: #b42318;
  --accent: #c2410c;
  --shadow: 0 14px 34px rgba(31, 41, 51, 0.08);
  --content: 1180px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

a {
  color: var(--primary);
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 14px max(18px, calc((100vw - var(--content)) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 250, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  color: var(--text);
  font-weight: 800;
  font-size: 1.08rem;
}

.topnav,
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.topnav a,
.site-footer a {
  color: var(--muted);
  font-weight: 650;
}

.workspace {
  width: min(calc(100% - 28px), var(--content));
  min-height: calc(100vh - 86px);
  margin: 18px auto 0;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

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

.tool-rail {
  position: sticky;
  top: 76px;
  padding: 14px;
  max-height: calc(100vh - 92px);
  overflow: auto;
}

.rail-head {
  padding: 10px 10px 14px;
  border-bottom: 1px solid var(--line);
}

.rail-head span,
.eyebrow,
.tool-group-label,
.privacy-chip,
.tool-card span,
.status-line {
  color: var(--muted);
  font-size: 0.86rem;
}

.rail-head strong {
  display: block;
  font-size: 1.05rem;
}

.tool-group-label {
  margin: 16px 8px 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.tool-tab {
  width: 100%;
  display: block;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 10px 10px;
  cursor: pointer;
}

.tool-tab:hover,
.tool-tab.active {
  border-color: #a7d7d2;
  background: #e8f5f3;
  color: var(--primary-dark);
}

.tool-panel {
  padding: 22px;
}

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

h1,
h2 {
  margin: 0 0 8px;
  line-height: 1.12;
}

h1 {
  font-size: clamp(1.9rem, 4vw, 3.4rem);
}

h2 {
  font-size: clamp(1.4rem, 2.4vw, 2rem);
}

.lead {
  max-width: 70ch;
  margin: 0;
  color: var(--muted);
}

.privacy-chip {
  white-space: nowrap;
  border: 1px solid #a7d7d2;
  background: #e8f5f3;
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 750;
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 172px;
  padding: 24px;
  border: 2px dashed #9eb3c0;
  border-radius: 8px;
  background: var(--surface-2);
  text-align: center;
}

.drop-zone.is-dragging {
  border-color: var(--primary);
  background: #e8f5f3;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-zone strong {
  display: block;
  font-size: 1.18rem;
}

.drop-zone span {
  color: var(--muted);
}

.file-list,
.result-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.file-item,
.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.file-item span,
.result-item span {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.option-field {
  display: none;
}

.option-field.is-visible {
  display: block;
}

.option-field span {
  display: block;
  margin-bottom: 6px;
  font-weight: 750;
}

.option-field input,
.option-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.primary-action,
.secondary-action,
.result-item a {
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 11px 16px;
  font-weight: 800;
  cursor: pointer;
}

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

.primary-action:hover {
  background: var(--primary-dark);
}

.secondary-action {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.result-item a {
  display: inline-flex;
  color: #fff;
  background: var(--accent);
}

.status-line {
  margin-top: 12px;
}

.status-line.is-error {
  color: var(--danger);
  font-weight: 750;
}

.section {
  width: min(calc(100% - 28px), var(--content));
  margin: 34px auto;
}

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

.section-head p {
  margin: 0;
  color: var(--muted);
}

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

.tool-card {
  padding: 16px;
}

.tool-card strong,
.tool-card span {
  display: block;
}

.policy-page {
  width: min(calc(100% - 28px), 880px);
  margin: 30px auto;
}

.policy-card {
  padding: 24px;
}

.policy-card h1 {
  font-size: 2.2rem;
}

.site-footer {
  width: min(calc(100% - 28px), var(--content));
  margin: 34px auto 0;
  padding: 22px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.tool-content {
  width: min(calc(100% - 28px), var(--content));
  margin: 26px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: 18px;
}

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

.content-panel h2,
.content-panel h3 {
  margin-top: 0;
}

.content-panel p,
.content-panel li {
  color: var(--muted);
}

.content-panel ul {
  padding-left: 20px;
}

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

.related-list a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-weight: 750;
}

.related-list a:hover {
  border-color: #a7d7d2;
  color: var(--primary-dark);
}

.article-page {
  width: min(calc(100% - 28px), 900px);
  margin: 28px auto;
}

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

.article-page p,
.article-page li {
  color: var(--muted);
}

.article-page ul,
.article-page ol {
  padding-left: 22px;
}

.article-page h2 {
  margin-top: 28px;
}

@media (max-width: 900px) {
  .workspace,
  .catalog-grid,
  .options-grid,
  .tool-content {
    grid-template-columns: 1fr;
  }

  .tool-rail {
    position: static;
    max-height: none;
  }

  .panel-head,
  .section-head {
    display: block;
  }

  .privacy-chip {
    display: inline-flex;
    margin-top: 12px;
  }
}
