:root {
  --bg: #f1f1ee;
  --card: #ffffff;
  --panel: #fcfcfb;
  --ink: #1f2328;
  --muted: #5c6470;
  --border: #e6e6e2;
  --primary: #3f6fb0;

  --done-ink: #2e9e5b;
  --failed-bg: #fdecec;
  --failed-ink: #c0392b;
}

* {
  box-sizing: border-box;
}

/* Our display rules on .panel / .error-step would otherwise beat the UA
   stylesheet's [hidden] { display: none }, leaving every screen visible. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem;
  background: var(--bg);
  color: var(--ink);
  font:
    16px/1.55 -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
}

/* ─── Branding ──────────────────────────────────────────────────────────── */

.brand {
  margin-bottom: 1.25rem;
}

.brand-logo {
  display: block;
  height: 64px;
  width: auto;
}

/* ─── Card (centered, scrollable modal) ─────────────────────────────────── */

.card {
  width: 100%;
  max-width: 770px;
  height: min(720px, calc(100dvh - 180px));
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 20px;
  padding: 1.75rem 1.9rem;
  box-shadow:
    0 1px 4px rgba(0, 0, 0, 0.06),
    0 12px 32px rgba(0, 0, 0, 0.05);
}

/* ─── Header (greeting) ─────────────────────────────────────────────────── */

.wizard-head {
  flex: 0 0 auto;
  margin-bottom: 1.25rem;
}

.greeting {
  font-size: 1.5rem;
  font-weight: 400;
  margin: 0;
}

/* ─── Body + panel ──────────────────────────────────────────────────────── */

#wizard {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
}

.panel {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  padding: 1.4rem 1.5rem;
}

.panel-content {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  /* Pull the scroll track toward the panel's right edge (shrinking the gap to
     it) while padding-right keeps the content itself off the scrollbar. */
  margin-right: -1rem;
  padding-right: 1rem;
}

.panel-title {
  font-size: 1.12rem;
  font-weight: 700;
  margin: 0 0 0.9rem;
}

/* ─── Text & content ────────────────────────────────────────────────────── */

.lead {
  color: var(--muted);
  margin: 0 0 1rem;
}

.subhead {
  font-weight: 600;
  margin: 1.1rem 0 0.4rem;
}

ol {
  padding-left: 1.2rem;
  margin: 0.3rem 0 0;
}

ol li {
  margin: 0.45rem 0;
}

.note {
  color: var(--muted);
  font-size: 0.92rem;
  background: #f0f0ed;
  border-left: 3px solid #c9c9c2;
  padding: 0.75rem 0.95rem;
  border-radius: 0 8px 8px 0;
  margin: 1.1rem 0 0;
}

code {
  background: #eef1f4;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.9em;
}

.muted {
  color: var(--muted);
}

/* ─── Copy fields (site URL rows) ───────────────────────────────────────── */

.field-label {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  margin: 1.1rem 0 0.4rem;
}

.copy-field {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
}

.copy-field--input {
  background: var(--card);
}

.copy-field code,
.copy-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0.7rem 0.85rem;
  font: inherit;
  color: var(--ink);
}

.copy-field code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: auto;
  /* Scrollable, but hide the scrollbar (Firefox / IE / WebKit). */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.copy-field code::-webkit-scrollbar {
  display: none;
}

.copy-field input {
  outline: none;
}

.copy-field input:-webkit-autofill,
.copy-field input:-webkit-autofill:hover,
.copy-field input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 100px var(--card) inset;
  box-shadow: 0 0 0 100px var(--card) inset;
  -webkit-text-fill-color: var(--ink);
}

.copy-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  color: var(--muted);
}

.copy-icon svg {
  width: 18px;
  height: 18px;
}

.copy-icon:hover {
  color: var(--ink);
}

.copy-icon.copied {
  color: var(--done-ink);
}

/* ─── Multi-site list (add / remove site rows) ──────────────────────────────── */

.site-rows {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Each site is a bounded card so its URL + filters read as one unit, and an
   added site can't be mistaken for another filter field. */
.site-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.8rem;
}

/* Row header: the "Site N" label on the left, the remove (×) button on the right. */
.site-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.site-number {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
}

/* Kept off the .copy-icon class so wireCopyButtons() never treats it as a copy
   target. */
.site-remove {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 0.35rem 0.4rem;
  cursor: pointer;
  color: var(--muted);
}

.site-remove svg {
  width: 16px;
  height: 16px;
}

.site-remove:hover {
  color: var(--failed-ink);
}

/* The per-site folder fields. The negative side margins pull the top divider to
   the card's edges, splitting the card into a clear "site" zone (URL) and
   "folders" zone; the matching padding realigns the content. */
.site-filters {
  margin: 0.7rem -0.8rem 0;
  padding: 0.75rem 0.8rem 0;
  border-top: 1px solid var(--border);
}

.filter-hint {
  font-size: 0.9rem;
  margin: 0.6rem 0 0;
}

.add-site {
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary);
  padding: 0.5rem 0;
  margin-top: 0.5rem;
  cursor: pointer;
}

.add-site:hover {
  text-decoration: underline;
}

/* ─── Multi-line code block (Cloud Shell commands) ──────────────────────── */

.code-block {
  position: relative;
  margin-top: 0.5rem;
}

.code-block pre {
  margin: 0;
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 2.6rem 0.7rem 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-block .copy-icon {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
}

/* ─── Folder-selection inputs ───────────────────────────────────────────── */

.glob-input {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  padding: 0.7rem 0.85rem;
  font: inherit;
  color: var(--ink);
  outline: none;
}

.glob-input::placeholder {
  color: #8a8f98;
}

/* ─── Error state ───────────────────────────────────────────────────────── */

.error-step {
  display: block;
}

.error-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  background: var(--failed-bg);
  color: var(--failed-ink);
}

.error-badge svg {
  width: 14px;
  height: 14px;
}

.error-title {
  color: var(--failed-ink);
  font-size: 1.12rem;
  font-weight: 700;
  margin: 0.7rem 0 0.6rem;
}

/* ─── Footer ────────────────────────────────────────────────────────────── */

footer {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.ext {
  width: 13px;
  height: 13px;
  vertical-align: -1px;
  margin-left: 2px;
}
