:root {
  --brand: #0b7a4b;
  --brand-deep: #065f3a;
  --brand-soft: #e8f6ef;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #d1d5db;
  --ok: #16a34a;
  --warn: #e11d48;
  --warn-soft: #ffe4e6;
  --ok-soft: #dcfce7;
  --card: #ffffff;
  --bg1: #f3faf6;
  --bg2: #eef2ff;
  --font: "Be Vietnam Pro", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #c7f0db 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #dbeafe 0%, transparent 50%),
    linear-gradient(180deg, var(--bg1), #f8fafc 40%, var(--bg2));
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.wrap {
  width: min(560px, calc(100% - 24px));
  margin: 0 auto;
  padding: 20px 0 40px;
}
.admin-wrap { width: min(1100px, calc(100% - 24px)); }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 0 8px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--brand-deep); }
.brand img { width: 42px; height: 42px; object-fit: contain; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav a, .nav button, .btn {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: #fff;
  color: var(--brand-deep);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
.nav a.on, .btn-primary {
  background: linear-gradient(180deg, var(--brand), var(--brand-deep));
  color: #fff;
}
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-ghost { background: #fff; }

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 22px 18px 20px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, .08);
}
.logo {
  display: block;
  width: min(180px, 55%);
  margin: 0 auto 12px;
  object-fit: contain;
}
h1 {
  margin: 0 0 8px;
  text-align: center;
  color: var(--brand-deep);
  font-size: 1.35rem;
  line-height: 1.35;
}
.lead {
  margin: 0 0 18px;
  text-align: center;
  color: var(--muted);
  font-size: .95rem;
}

.field { margin-bottom: 12px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  font-size: .92rem;
  color: #14532d;
}
.input, .select, .textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); }
.textarea { min-height: 72px; resize: vertical; }

.submit {
  width: 100%;
  margin-top: 8px;
  border: 0;
  border-radius: 12px;
  padding: 14px;
  font-weight: 800;
  letter-spacing: .02em;
  color: #fff;
  background: linear-gradient(180deg, var(--brand), var(--brand-deep));
  cursor: pointer;
}
.submit:disabled { opacity: .55; cursor: not-allowed; }
.form-error, .login-error {
  margin-top: 10px;
  color: #b91c1c;
  text-align: center;
  font-weight: 600;
  min-height: 1.2em;
}
.form-ok {
  margin-top: 10px;
  color: var(--ok);
  text-align: center;
  font-weight: 700;
}

.steps { display: flex; flex-direction: column; gap: 10px; }
.step {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px;
}
.step-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
}
.step.done .step-icon { background: var(--ok); }
.step.pending .step-icon, .step.blocked .step-icon { background: #f43f5e; }
.step-text {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: .92rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.step-badge {
  flex: none;
  max-width: 46%;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .78rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
}
.step.done .step-badge { background: var(--ok-soft); color: #15803d; }
.step.pending .step-badge, .step.blocked .step-badge { background: var(--warn-soft); color: #be123c; }

.meta {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: .88rem;
}
.meta b { color: var(--ink); }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 40;
}
.overlay.show { display: flex; }
.modal {
  position: relative;
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 28px 22px 24px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.modal h2 {
  margin: 0 0 12px;
  color: var(--brand-deep);
  font-size: 1.25rem;
  letter-spacing: .04em;
}
.modal p { margin: 0; color: #6b7280; }
.modal-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: #fff;
  color: var(--brand);
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.15);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 16px;
}
@media (max-width: 920px) {
  .admin-grid { grid-template-columns: 1fr; }
  .step-text { white-space: normal; }
  .step-badge { max-width: 42%; }
}

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: #eef2f7;
  font-weight: 700;
  cursor: pointer;
}
.tabs button.on { background: var(--brand); color: #fff; }

.table-wrap { overflow: auto; border: 1px solid #e5e7eb; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid #eee; text-align: left; vertical-align: top; }
th { background: #f8fafc; font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.preview-frame {
  border: 1px dashed #86efac;
  border-radius: 16px;
  padding: 12px;
  background: linear-gradient(180deg, #f0fdf4, #fff);
}
.preview-frame h3 {
  margin: 0 0 10px;
  font-size: .95rem;
  color: var(--brand-deep);
}
.admin-note { color: var(--muted); font-size: .9rem; margin: 0 0 12px; }
.step-edit {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fafafa;
}
.step-edit .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 640px) {
  .step-edit .row { grid-template-columns: 1fr; }
}
.hidden { display: none !important; }
