:root {
  --bg: #ffffff;
  --surface: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --accent: #111827;
  --accent-soft: #f1f5f9;
  --good: #047857;
  --good-bg: #ecfdf5;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --radius: 10px;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.55 var(--sans); }
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: .47rem .72rem;
  background: var(--bg);
  font-size: .83rem;
  font-weight: 650;
  cursor: pointer;
}
button:hover { background: var(--accent-soft); border-color: var(--muted); }
button:disabled { opacity: .52; cursor: default; }
.primary, .primary:hover { color: var(--bg); background: var(--accent); border-color: var(--accent); }
h1, h2, h3, p, pre { margin: 0; }
h1 { font-size: clamp(1.95rem, 4.5vw, 3.1rem); line-height: 1.12; letter-spacing: -.045em; }
h1 span { display: inline-block; }
h2 { font-size: 1.18rem; line-height: 1.3; letter-spacing: -.015em; }
h3 { font-size: 1.07rem; line-height: 1.35; }
p { color: var(--muted); }
code, pre { font-family: var(--mono); }
code { font-size: .9em; overflow-wrap: anywhere; }
p code, dd code { background: var(--accent-soft); padding: .1em .25em; border-radius: 3px; }

.container, .header-inner { max-width: 1060px; width: calc(100% - 2rem); margin-inline: auto; }
.site-header, .site-footer { border-color: var(--border); border-style: solid; border-width: 0 0 1px; }
.header-inner, .site-footer > div, .brand-group, .top-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem 1rem;
}
.header-inner, .site-footer > div { justify-content: space-between; padding-block: .8rem; }
.brand { font-weight: 800; letter-spacing: -.025em; text-decoration: none; }
.badge { border-radius: 999px; padding: .18rem .58rem; background: var(--good-bg); color: var(--good); font-size: .74rem; font-weight: 700; }
.top-nav a { color: var(--muted); font-size: .8rem; font-weight: 650; text-decoration: none; }
.top-nav a:hover { color: var(--text); text-decoration: underline; }
.intro { padding: clamp(1.65rem, 4vw, 3rem) 0 1.3rem; }
.intro p { margin-top: .65rem; }
.card { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.tabs { display: flex; flex-wrap: wrap; gap: .35rem .55rem; padding: .55rem; border-bottom: 1px solid var(--border); }
.tabs button { border-color: transparent; color: var(--muted); text-align: start; }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--bg); }
.workspace-grid { display: grid; grid-template-columns: 1fr 1fr; }
.workspace-input, .workspace-output { min-width: 0; padding: 1rem; }
.workspace-output { border-left: 1px solid var(--border); }
.workspace h2 { font-size: .97rem; margin-bottom: .52rem; }
.settings-grid, .service-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; margin-bottom: 1rem; }
.service-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; padding: .75rem; border-top: 1px solid var(--border); }
label { display: block; font-size: .82rem; font-weight: 680; }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: .25rem;
  padding: .4rem .5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font: .84rem/1.45 var(--mono);
}
textarea { resize: vertical; min-height: 3rem; }
.hint { color: var(--muted); font-size: .76rem; font-weight: 400; }
label .hint { display: block; }
#privacy-note { margin-block: .4rem .75rem; }
#converterNote:not(:empty) { margin-top: .65rem; }
.chips, .actions { display: flex; flex-wrap: wrap; gap: .38rem; }
.chips button { border-radius: 999px; background: var(--surface); }
.chips button[aria-pressed="true"] { border-color: var(--accent); color: var(--bg); background: var(--accent); }
.chips button:hover { border-color: var(--accent); }
#presets { margin-bottom: 1rem; }
#services { display: grid; gap: .45rem; }
.service { border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
summary { cursor: pointer; }
.service summary { padding: .45rem .65rem; overflow-wrap: anywhere; font-size: .85rem; }
.service summary code { margin-inline-start: .5rem; color: var(--muted); }
.full-width { grid-column: 1 / -1; }
.remove { justify-self: start; }

pre {
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: .83rem;
  line-height: 1.48;
  overflow: auto;
}
pre code { font-size: inherit; overflow-wrap: normal; }
#composeOutput { height: clamp(13.5rem, 27vh, 22rem); }
.env-preview { margin-block: .7rem; }
.env-preview summary { font: 650 .85rem var(--mono); margin-bottom: .35rem; }
#envOutput { min-height: 2.5rem; max-height: 8rem; }
#outputStatus { margin-block: .35rem; font-size: .81rem; }
.audit { margin-top: .8rem; padding-top: .7rem; border-top: 1px solid var(--border); }
#auditList { display: flex; flex-wrap: wrap; gap: .3rem; padding: 0; margin: 0; list-style: none; }
.pill { border-radius: 7px; padding: .24rem .48rem; font-size: .78rem; overflow-wrap: anywhere; }
.pill.good { color: var(--good); background: var(--good-bg); font-weight: 700; }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.info { color: var(--muted); background: var(--accent-soft); }

.callout { margin-top: .85rem; padding: .65rem .85rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: .88rem; font-weight: 650; }
.content-section { margin-top: 1.8rem; scroll-margin-top: .7rem; }
.content-section > p, .template-card p, .resource-card p { margin-top: .35rem; font-size: .9rem; }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: .7rem; }
.template-card, .resource-card, .reference { padding: .85rem; }
.template-card { display: flex; flex-direction: column; align-items: flex-start; }
.template-card pre { width: 100%; height: 13.5rem; margin-block: auto .6rem; }
.template-card p { margin-bottom: .65rem; }
.reference dl { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; column-gap: .8rem; row-gap: .55rem; margin: .65rem 0 0; font-size: .9rem; }
.reference dt, .reference summary { font-weight: 680; }
.reference dd { margin: 0; color: var(--muted); }
.reference details { padding: .6rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.reference details:last-child { padding-bottom: 0; border-bottom: 0; }
.reference details p { margin-top: .2rem; }
.site-footer { margin-top: 2rem; border-width: 1px 0 0; color: var(--muted); font-size: .82rem; }

@media (max-width: 859px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .workspace-output { border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 540px) {
  .container, .header-inner { width: calc(100% - 1.25rem); }
  .top-nav { gap: .4rem .65rem; }
  .tabs button { flex: 1 1 10rem; }
  .workspace-input, .workspace-output { padding: .72rem; }
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .template-grid, .reference dl { grid-template-columns: minmax(0, 1fr); }
  .reference dd { margin-bottom: .3rem; }
}
