/* Attuned Healthcare — Signature Generator
   Brand palette:
     --blue:   #016cae
     --orange: #f58220
     --text:   #333333
*/

:root {
  --blue: #016cae;
  --orange: #f58220;
  --text: #333333;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f7f9fb;
  --card: #ffffff;
  --danger: #d03e2f;
  --warn: #b26a00;
  --success: #0f766e;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(1, 108, 174, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Poppins', 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.topbar__logo { height: 28px; width: auto; display: block; }
.topbar__user { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--muted); }
.topbar__signout {
  color: var(--blue);
  text-decoration: none;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.topbar__signout:hover { text-decoration: underline; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}
h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--blue);
  margin: 0 0 4px 0;
}
.lede {
  color: var(--muted);
  max-width: 680px;
  margin: 0 0 24px 0;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .preview-panel { order: -1; }
}

.form-panel, .preview-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.field { margin-bottom: 18px; }
.field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 6px;
}
.field .req { color: var(--danger); }
.field .optional { color: var(--muted); font-weight: 400; }
.field .lock-icon { color: var(--muted); }

.field input {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(1, 108, 174, 0.15);
}
.field input[readonly] {
  background: #f3f4f6;
  color: var(--muted);
  cursor: not-allowed;
}
.field input:invalid:not(:placeholder-shown) {
  border-color: var(--danger);
}

.field__help {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0 0;
}
.field__hint {
  font-size: 12px;
  margin: 6px 0 0 0;
  min-height: 16px;
}
.field__hint.populated { color: var(--success); }
.field__hint.missing { color: var(--warn); }

.preview-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.preview-frame {
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: #ffffff;
  padding: 0;
  min-height: 240px;
  overflow: auto;
}
#preview {
  width: 100%;
  height: 240px;
  border: 0;
  display: block;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn--primary {
  background: var(--blue);
  color: #fff;
}
.btn--primary:hover { background: #005a93; }
.btn--primary.is-success {
  background: var(--success);
}
.btn--secondary {
  background: #fff;
  color: var(--blue);
  border-color: var(--blue);
}
.btn--secondary:hover { background: rgba(1, 108, 174, 0.06); }
.btn--tertiary {
  background: transparent;
  color: var(--blue);
  padding: 6px 0;
  border: 0;
  justify-content: flex-start;
  font-weight: 500;
}
.btn--tertiary:hover { text-decoration: underline; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
}
.modal__panel {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px rgba(0,0,0,0.2);
}
.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: 0;
  font-size: 28px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px 10px;
}
.modal__close:hover { color: var(--text); }
.modal__panel h2 {
  font-size: 22px;
  margin: 0;
  padding: 24px 24px 8px 24px;
  color: var(--blue);
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  flex-wrap: wrap;
}
.tab {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.is-active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}
.tab-content {
  padding: 20px 24px 24px 24px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.6;
}
.tab-content ol { padding-left: 20px; }
.tab-content li { margin-bottom: 8px; }
.tab-content code {
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 13px;
}
.tab-content .warn {
  background: #fff7ed;
  border-left: 3px solid var(--orange);
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 13px;
  color: var(--warn);
}

.btn__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
