/* ============================================================
   dgtl.ai — Brand Configurator UI
   Colour tokens mirror the company's own SCSS config:
     $primary: #39f   $success: #51cc8a   $danger: #ef376e
     $warning: #fc0   $info:    #747af2
   Hover/active shades computed the same way as the generator's own
   shade-color(15%/20%) logic, so the tool's chrome uses real
   dgtl.ai brand mechanics rather than an arbitrary accent colour.
   ============================================================ */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #171a20;
  --muted: #6b7280;
  --line: #e3e5ea;
  --gap-md: 24px;

  --primary: #3399ff;
  --primary-hover: #2b82d9;
  --primary-active: #297acc;

  --success: #51cc8a;
  --success-hover: #45ad75;

  --danger: #ef376e;
  --danger-hover: #cb2f5e;

  --warning: #ffcc00;
  --warning-ink: #7a5b00;
  --warning-bg: #fff6d6;
  --warning-border: #ffe38a;

  --info: #747af2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ---------- header / brand ---------- */
header {
  padding: 20px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.header-inner { max-width: 1300px; margin: 0 auto; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.brand-mark {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--primary);
  flex-shrink: 0;
}
.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.brand-divider {
  width: 1px;
  height: 16px;
  background: var(--line);
}
.brand-product {
  font-size: 15px;
  color: var(--muted);
  font-weight: 500;
}
header p { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 760px; }

/* ---------- layout ---------- */
main {
  max-width: 1300px;
  margin: 0 auto;
  padding: 28px 32px 72px;
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
}
#panelDesigner {
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
}
.io-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-md);
}
@media (max-width: 900px) {
  .io-row { grid-template-columns: 1fr; }
}

/* ---------- cards ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}
.panel h2 {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 14px;
}
.card-description {
  font-size: 13px;
  color: var(--muted);
  margin: -4px 0 18px;
  line-height: 1.55;
  max-width: 720px;
}

/* ---------- shared form basics ---------- */
textarea {
  width: 100%;
  height: 480px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  resize: vertical;
  background: #fbfbfc;
  color: var(--ink);
}
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(51, 153, 255, .15);
}

.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.color-row input[type="text"] {
  flex: 1;
  font-family: monospace;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.color-row label { width: 92px; font-size: 13px; font-weight: 600; }
.color-row input[type="color"] {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
}
.swatch-wrap {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.swatch-wrap input[type="color"] {
  width: 100%;
  height: 100%;
  margin: 0;
}
.swatch-letter {
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  pointer-events: none;
  z-index: 1;
}
.contrast-hint { font-size: 11px; color: var(--muted); width: 84px; text-align: right; }
.color-row input[type="text"].invalid {
  border-color: var(--danger);
  background: #fdeef2;
}
.color-row input[type="text"].invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 55, 110, .15);
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}
.neutrals { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- buttons ---------- */
button.primary {
  width: 100%;
  margin-top: 16px;
  padding: 11px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

button.secondary {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
button.secondary:hover { background: #f4f5f7; border-color: #d3d6dc; }

button.zip {
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
button.zip:hover { background: #000; border-color: #000; }

button.secondary.danger { border-color: #f3c6d3; color: var(--danger); }
button.secondary.danger:hover { background: #fdeef2; border-color: var(--danger); }

.file-btn-label {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  box-sizing: border-box;
}
.file-btn-label:hover { background: #f4f5f7; border-color: #d3d6dc; }

/* ---------- misc form rows ---------- */
.file-row { display: flex; gap: 8px; margin-bottom: 10px; }
.file-row input[type="file"] { font-size: 12px; flex: 1; }

.toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.toolbar button {
  flex: 1;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
}
.toolbar button:hover { background: #f4f5f7; }

/* ---------- log ---------- */
.log {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 12px;
  white-space: pre-wrap;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.log-warning {
  color: var(--warning-ink);
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 12px;
}

/* ---------- typography settings grid ---------- */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}
.type-row {
  display: grid;
  grid-template-columns: 60px 1fr 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.type-row label { font-size: 13px; font-weight: 600; }
.type-row input {
  font-family: monospace;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 100%;
}
.type-row-header {
  display: grid;
  grid-template-columns: 60px 1fr 1fr;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}

/* ---------- font/favicon uploads ---------- */
.upload-group {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 12px;
}
.upload-group h3 {
  font-size: 11.5px;
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 700;
}
.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.upload-row label { width: 110px; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.upload-row input[type="text"] {
  font-family: monospace;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 140px;
}
.upload-row input[type="file"] { font-size: 12px; flex: 1; }
.file-status { font-size: 11px; color: var(--muted); min-width: 90px; }

/* ---------- actions card ---------- */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
}
.actions-grid > div { display: flex; flex-direction: column; gap: 8px; }
.actions-grid button, .actions-grid .file-btn-label { margin-top: 0 !important; }

/* ---------- step 1 / step 2 (process-ordered, visually prominent) ---------- */
.step-panel { border-color: var(--primary); border-width: 1.5px; }
.step-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #fff;
  background: var(--primary);
  padding: 3px 9px;
  border-radius: 4px;
  margin-bottom: 10px;
}
.step1-grid, .step2-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .step1-grid, .step2-grid { grid-template-columns: 1fr; }
}
.step1-actions, .step2-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.step1-actions button, .step2-actions button { margin-top: 0 !important; }
.step1-grid textarea, .step2-grid textarea { height: 260px; margin: 0; }

/* ---------- administration (deliberately de-emphasised) ---------- */
.admin-panel {
  background: transparent;
  border: 1px dashed var(--line);
  box-shadow: none;
}
.admin-panel h2 { color: var(--muted); }
.admin-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.admin-actions button, .admin-actions .file-btn-label {
  margin-top: 0 !important;
  font-weight: 500;
}
.admin-panel button.secondary { background: transparent; }
.admin-panel .file-btn-label { background: transparent; }