:root {
  --bg-deep: #1c1c1c;
  --bg-panel: #2b2b2b;
  --bg-field: #232323;
  --gold: #b58a24;
  --gold-soft: #cba03a;
  --white: #ffffff;
  --grey: #a0a0a0;
  --line: #3a3a3a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-deep);
  color: var(--white);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 32px;
  background: var(--bg-panel);
  border-bottom: 2px solid var(--gold);
}

.brand {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
  white-space: nowrap;
}
.brand-service { color: var(--white); }
.brand-iq { color: var(--gold); }

.topbar-title h1 { margin: 0; font-size: 19px; font-weight: 600; }
.topbar-title p { margin: 2px 0 0; font-size: 13px; color: var(--grey); }

/* ---------- Page wrapper ---------- */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 32px 56px;
}

.req { color: var(--gold-soft); font-weight: 700; }

/* ---------- Instruction header ---------- */
.instructions {
  background: var(--bg-panel);
  color: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px 34px;
  margin-bottom: 26px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  border-top: 4px solid var(--gold);
}
.instructions-title {
  margin: 0 0 16px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--white);
}
.instructions-list {
  margin: 0;
  padding-left: 22px;
  font-size: 15px;
  line-height: 1.85;
  color: #cfcfcf;
}
.instructions-list li { margin-bottom: 2px; }
.instructions-list strong { color: var(--white); }
.instructions-list .req { color: var(--gold-soft); }
.help-link {
  color: var(--gold-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.help-link:hover { color: var(--gold); }

/* ---------- Layout (modern flexbox — preview UI only) ---------- */
.layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
}

.form-panel { flex: 1 1 360px; min-width: 320px; }
.preview-panel { flex: 1 1 600px; min-width: 320px; }

.panel-heading {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gold);
}

/* ---------- Fields ---------- */
.field { margin-top: 16px; display: flex; flex-direction: column; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

.field label { font-size: 12px; font-weight: 600; color: var(--grey); margin-bottom: 6px; }

.field input,
.field textarea {
  width: 100%;
  background: var(--bg-field);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--white);
  font-size: 14px;
  font-family: inherit;
  padding: 10px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field textarea { resize: vertical; line-height: 1.5; }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(181, 138, 36, 0.18);
}

/* ---------- Buttons (form) ---------- */
.actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

.btn {
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  padding: 11px 20px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.06s ease, box-shadow 0.18s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }

.btn-ghost { background: transparent; color: var(--white); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-soft); }

/* ---------- Preview stage (white, like a mail client body) ---------- */
.preview-hint { margin: 6px 0 16px; font-size: 13px; color: var(--grey); }

.preview-stage {
  background: #ffffff;
  border-radius: 8px;
  padding: 20px;
  overflow-x: hidden;
}

/* ---------- Copy area ---------- */
.copy-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--gold);
  color: #161616;
  font-size: 16px;
  font-weight: 700;
  padding: 15px 34px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(181, 138, 36, 0.32);
}
.btn-copy .copy-icon { transition: transform 0.18s ease; }
.btn-copy:hover {
  background: var(--gold-soft);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(181, 138, 36, 0.42);
}
.btn-copy:hover .copy-icon { transform: scale(1.12) rotate(-4deg); }
.btn-copy.copied {
  background: #1f7a3d;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(31, 122, 61, 0.4);
}

.status {
  min-height: 20px;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--gold-soft);
  text-align: center;
}
.status.success { color: #57d98a; }

/* ---------- Hidden Outlook signature (kept in DOM, off-screen) ---------- */
#outlookSignature {
  position: absolute;
  left: -99999px;
  top: 0;
  width: 700px;
  white-space: normal;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .btn-copy:hover { transform: none; }
}

@media (max-width: 760px) {
  .topbar { padding: 18px 20px; }
  .page { padding: 20px; }
  .instructions { padding: 24px; }
  .instructions-title { font-size: 24px; }
  .field-row { flex-direction: column; gap: 0; }
  .btn-copy { width: 100%; justify-content: center; }
}

.field select{
  width:100%;
  background:var(--bg-field);
  border:1px solid var(--line);
  border-radius:6px;
  color:var(--white);
  font-size:14px;
  padding:10px 12px;
}
.field textarea{
  resize:none;
  overflow:hidden;
  min-height:140px;
}
.preview-stage{
  overflow:hidden !important;
}
#signaturePreview{
  overflow:hidden;
  width:100%;
}

/* ---------- Read-only fields (visible, non-editable) ---------- */
.field input[readonly],
.field textarea[readonly] {
  color: #cfcfcf;
  cursor: not-allowed;
  opacity: 0.9;
}
.field input[readonly]:focus,
.field textarea[readonly]:focus {
  border-color: var(--line);
  box-shadow: none;
}