:root {
  --inst-primary: #1d4ed8;
  --inst-primary-hover: #1e40af;
  --inst-bg: #f1f5f9;
  --inst-card: #ffffff;
  --inst-text: #0f172a;
  --inst-muted: #64748b;
  --inst-border: #e2e8f0;
  --inst-ok: #15803d;
  --inst-warn: #b45309;
  --inst-fail: #b91c1c;
  --inst-radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
  background: radial-gradient(circle at top, #e0e7ff 0%, var(--inst-bg) 45%);
  color: var(--inst-text);
  line-height: 1.6;
  min-height: 100vh;
}

.inst-shell { max-width: 1080px; margin: 24px auto; padding: 0 16px 56px; }
.inst-topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.inst-brand { font-size: 1.55rem; font-weight: 800; color: var(--inst-primary); margin: 0; display: flex; align-items: center; gap: 8px; }
.inst-subtitle { color: var(--inst-muted); margin: 2px 0 0; font-size: .9rem; }
.inst-lang-pills { display: flex; gap: 6px; }
.inst-lang-pills a {
  padding: 6px 12px; border-radius: 999px; font-size: .82rem; font-weight: 700;
  text-decoration: none; background: #fff; color: var(--inst-text); border: 1px solid var(--inst-border);
}
.inst-lang-pills a.is-active { background: var(--inst-primary); color: #fff; border-color: var(--inst-primary); }

.inst-overall-bar { width: 100%; height: 6px; background: #cbd5e1; border-radius: 999px; overflow: hidden; margin-bottom: 16px; }
.inst-overall-fill { height: 100%; background: linear-gradient(90deg, var(--inst-primary), #06b6d4); transition: width .3s ease; }

.inst-stepper {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  margin-bottom: 20px; padding: 0; list-style: none;
}
.inst-stepper li a, .inst-stepper li span {
  display: inline-block; font-size: .76rem; padding: 5px 10px; border-radius: 999px;
  background: #e2e8f0; color: #475569; font-weight: 600; text-decoration: none;
}
.inst-stepper li.is-done a { background: #dcfce7; color: var(--inst-ok); }
.inst-stepper li.is-done a:hover { filter: brightness(.95); }
.inst-stepper li.is-current span { background: var(--inst-primary); color: #fff; box-shadow: 0 4px 12px rgba(29,78,216,.28); }

.inst-card {
  background: var(--inst-card); border: 1px solid var(--inst-border);
  border-radius: var(--inst-radius); padding: 28px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .06);
}
.inst-card h2 { margin-top: 0; font-size: 1.38rem; }

.inst-alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; font-size: .92rem; }
.inst-alert-error { background: #fef2f2; color: var(--inst-fail); border: 1px solid #fecaca; }
.inst-alert-ok { background: #f0fdf4; color: var(--inst-ok); border: 1px solid #bbf7d0; }
.inst-alert-warn { background: #fffbeb; color: var(--inst-warn); border: 1px solid #fde68a; }

.inst-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.inst-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.inst-field label { font-weight: 600; font-size: .88rem; }
.inst-input-row { display: flex; gap: 6px; align-items: center; }
.inst-field input[type="text"],
.inst-field input[type="email"],
.inst-field input[type="password"],
.inst-field input[type="number"],
.inst-field input[type="url"],
.inst-field select,
.inst-field textarea {
  width: 100%; padding: 10px 13px; border: 1px solid #cbd5e1;
  border-radius: 9px; font-size: .94rem; font-family: inherit;
}
.inst-field input:focus, .inst-field select:focus, .inst-field textarea:focus {
  outline: 2px solid var(--inst-primary); border-color: var(--inst-primary);
}

.inst-actions {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--inst-border);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: 9px; border: 1px solid transparent;
  font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--inst-primary); color: #fff; }
.btn-primary:hover { background: var(--inst-primary-hover); }
.btn-secondary { background: #fff; color: var(--inst-text); border-color: #cbd5e1; }
.btn-danger { background: var(--inst-fail); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.inst-requirements-table { overflow-x: auto; }
.req-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.req-table th, .req-table td { padding: 10px 12px; border-bottom: 1px solid var(--inst-border); text-align: start; font-size: .88rem; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.badge-ok { background: #dcfce7; color: var(--inst-ok); }
.badge-warn { background: #fef3c7; color: var(--inst-warn); }
.badge-fail { background: #fee2e2; color: var(--inst-fail); }

.theme-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); margin-top: 14px; }
.theme-card {
  border: 2px solid var(--inst-border); border-radius: 12px; overflow: hidden;
  background: #fff; display: flex; flex-direction: column; transition: border-color .15s, transform .15s; cursor: pointer;
}
.theme-card:hover { transform: translateY(-2px); }
.theme-card.is-selected { border-color: var(--inst-primary); box-shadow: 0 0 0 3px rgba(29,78,216,.16); }
.theme-thumb { aspect-ratio: 16/10; background: #0f172a; overflow: hidden; position: relative; }
.theme-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.theme-dots { position: absolute; bottom: 8px; inset-inline-end: 8px; display: flex; gap: 4px; background: rgba(15,23,42,.75); padding: 4px 7px; border-radius: 999px; }
.theme-dots span { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.theme-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.theme-meta { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; color: var(--inst-muted); font-weight: 700; }

.brand-preview {
  border-radius: 12px; padding: 22px; color: #fff; margin-bottom: 18px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand-preview img { max-height: 44px; border-radius: 6px; background: rgba(255,255,255,.15); padding: 4px; }

.preview-modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .8);
  display: none; flex-direction: column; z-index: 1000; padding: 14px;
}
.preview-modal.is-open { display: flex; }
.preview-bar {
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 10px 10px 0 0;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.preview-stage { flex: 1; background: #334155; display: flex; justify-content: center; border-radius: 0 0 10px 10px; overflow: hidden; padding: 10px; }
.preview-stage iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 8px; transition: width .2s; }

.progress-track { width: 100%; height: 14px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin: 14px 0; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--inst-primary), #10b981); transition: width .25s ease; }
.job-list { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.job-item { padding: 10px 12px; border: 1px solid var(--inst-border); border-radius: 9px; font-size: .88rem; display: flex; align-items: center; gap: 8px; background: #f8fafc; }
.job-item.is-running { border-color: var(--inst-primary); background: #eff6ff; font-weight: 700; }
.job-item.is-done { border-color: #bbf7d0; background: #f0fdf4; color: var(--inst-ok); }
.job-item.is-fail { border-color: #fecaca; background: #fef2f2; color: var(--inst-fail); }

.install-log {
  background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem;
  max-height: 220px; overflow-y: auto; line-height: 1.65;
}
.pwd-meter { height: 6px; border-radius: 999px; background: #e2e8f0; overflow: hidden; margin-top: 6px; }
.pwd-meter-bar { height: 100%; width: 0%; transition: width .2s, background .2s; }
