*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:      #c0622a;
  --primary-dark: #a04e20;
  --bg:           #1e2329;
  --surface:      #252d35;
  --surface-2:    #1a2028;
  --border:       #2e3a44;
  --text:         #d4cfc8;
  --text-2:       #9aacba;
  --chip-bg:      #2e3a44;
  --error-bg:     #3a2020;
  --error:        #e07878;
  --success-bg:   #1a3028;
  --success:      #6abf85;
  --radius:       3px;
  --shadow:       0 1px 4px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md:    0 4px 20px rgba(0,0,0,.5);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-y: auto;
}

/* ── Login ─────────────────────────────────────────── */

#login-screen {
  position: fixed; inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 100;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 48px 48px 40px;
  width: 360px;
  text-align: center;
  border: 1px solid var(--border);
}

.login-logo  { font-size: 42px; margin-bottom: 14px; }
.login-card h1 { font-size: 22px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.login-card > p { color: var(--text-2); font-size: 13px; margin-bottom: 32px; line-height: 1.5; }

#login-btn {
  width: 100%; padding: 11px 16px;
  background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background .15s;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
#login-btn:hover    { background: var(--primary-dark); }
#login-btn:disabled { opacity: .65; cursor: default; }

.login-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-msg {
  color: var(--error); background: var(--error-bg);
  border-radius: var(--radius); padding: 10px 14px;
  font-size: 13px; margin-top: 16px; text-align: left;
  line-height: 1.5;
}

/* ── App shell ─────────────────────────────────────── */

#app { display: flex; flex-direction: column; min-height: 100vh; align-items: center; }

.app-header {
  align-self: stretch;
  position: sticky; top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--primary);
  padding: 0 24px; height: 54px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; box-shadow: var(--shadow);
  z-index: 10;
}
.header-brand { font-size: 15px; font-weight: 600; color: var(--text); }
.header-user  { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 13px; }

.btn-ghost {
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 5px 12px; font-size: 13px; cursor: pointer; color: var(--text-2);
  transition: border-color .15s, color .15s;
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--primary); color: var(--text); }

.app-body {
  display: flex;
  gap: 24px;
  padding: 28px 32px 48px;
  max-width: 1280px;
  width: 100%;
  align-items: flex-start;
}

/* ── Form panel ─────────────────────────────────────── */

.form-panel {
  width: 460px; flex-shrink: 0;
  padding: 24px 24px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.panel-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .7px;
  color: var(--text-2); margin-bottom: 20px;
}

.field-group { margin-bottom: 14px; }
.field-group label {
  display: block; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-2); margin-bottom: 4px;
}
.field-group label.required::after {
  content: ' *'; color: var(--primary); font-weight: 700;
}
.field-group .hint { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 11px; color: var(--text-2); margin-top: 1px; opacity: .8; }

.field-group input,
.field-group select,
.field-group textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-family: inherit; outline: none;
  transition: border-color .15s;
  background: var(--surface-2); color: var(--text);
}
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus { border-color: var(--primary); }
.field-group textarea { resize: vertical; }

.rich-input {
  width: 100%; min-height: 64px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-family: inherit; outline: none;
  background: var(--surface-2); color: var(--text);
  transition: border-color .15s;
  white-space: pre-wrap; overflow-wrap: break-word;
  line-height: 1.5; overflow-y: auto;
}
.rich-input:focus { border-color: var(--primary); }
.rich-input:empty::before {
  content: attr(data-placeholder);
  color: var(--text-2); opacity: .5; pointer-events: none;
}
.field-group select option { background: var(--surface-2); color: var(--text); }

.webhooks-container { display: flex; flex-wrap: wrap; gap: 7px; }
.webhook-pill {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px; color: var(--text-2);
  cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.webhook-pill:hover { border-color: var(--primary); color: var(--text); }
.webhook-pill.selected {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(192,98,42,.35);
}

.field-row { display: flex; gap: 10px; }
.field-row .field-group { flex: 1; }

/* Pasos */
.pasos-header {
  display: grid;
  grid-template-columns: 70px 1fr 1fr 28px;
  gap: 6px; margin-bottom: 4px;
}
.pasos-header span { font-size: 11px; color: var(--text-2); padding: 0 2px; }

.paso-row {
  display: grid;
  grid-template-columns: 70px 1fr 1fr 28px;
  gap: 6px; align-items: center; margin-bottom: 6px;
}
.paso-row input {
  padding: 7px 8px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-family: inherit; outline: none; width: 100%;
  background: var(--surface-2); color: var(--text);
  transition: border-color .15s;
}
.paso-row input:focus { border-color: var(--primary); }

.btn-remove {
  background: none; border: none;
  color: var(--text-2); font-size: 18px;
  cursor: pointer; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; padding: 0; transition: background .15s, color .15s;
}
.btn-remove:hover { background: var(--error-bg); color: var(--error); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; min-height: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--chip-bg); border-radius: 16px;
  padding: 3px 8px 3px 12px;
  font-size: 12px; color: var(--primary); font-weight: 500;
  border: 1px solid var(--border);
}
.chip-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-2); font-size: 14px; line-height: 1;
  padding: 0; display: flex; align-items: center;
  transition: color .15s;
}
.chip-remove:hover { color: var(--error); }

.chip-primary { background: rgba(192,98,42,.15); border-color: var(--primary); color: var(--primary); }
.chip-star {
  background: none; border: none; cursor: pointer;
  color: var(--text-2); font-size: 11px; padding: 0;
  line-height: 1; display: flex; align-items: center;
  transition: color .15s;
}
.chip-star:hover { color: var(--primary); }
.chip-primary .chip-star { color: var(--primary); }

.inline-add { display: flex; gap: 6px; }
.inline-add input {
  flex: 1; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; outline: none;
  background: var(--surface-2); color: var(--text);
  transition: border-color .15s;
}
.inline-add input:focus { border-color: var(--primary); }

.mention-wrap { margin-bottom: 14px; }

.toggle-label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
  text-transform: none; letter-spacing: 0;
  font-size: 13px; font-weight: 400;
  color: var(--text); margin-bottom: 0;
}
.toggle-label input[type="checkbox"] {
  display: none !important;
  width: auto; padding: 0; border: none; background: none;
}
.toggle-track {
  width: 36px; height: 20px; border-radius: 10px;
  background: var(--border); position: relative;
  flex-shrink: 0; transition: background .2s;
}
.toggle-label input:checked + .toggle-track { background: var(--primary); }
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: left .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.toggle-label input:checked + .toggle-track .toggle-thumb { left: 18px; }
.toggle-text { font-size: 13px; color: var(--text); }
.toggle-hint { color: var(--text-2); font-size: 11px; margin-left: 2px; }

.format-toolbar { display: flex; gap: 3px; margin-bottom: 4px; }
.format-btn {
  padding: 2px 7px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface-2);
  font-size: 12px; cursor: pointer; color: var(--text-2); line-height: 1.6;
  transition: border-color .15s, color .15s;
}
.format-btn:hover { border-color: var(--primary); color: var(--primary); }
.format-btn-clear { margin-left: 4px; }
.format-btn-clear:hover { border-color: var(--error); color: var(--error); }

.btn-secondary {
  padding: 7px 12px; background: none;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 12px; cursor: pointer;
  color: var(--primary); font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn-secondary:hover { background: var(--chip-bg); border-color: var(--primary); }

.form-actions { margin-top: 24px; }
.btn-primary {
  width: 100%; padding: 11px;
  background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background .15s;
}
.btn-primary:hover    { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .65; cursor: default; }

.result-msg { margin-top: 12px; padding: 10px 14px; border-radius: var(--radius); font-size: 13px; }
.result-success { background: var(--success-bg); color: var(--success); }
.result-error   { background: var(--error-bg);   color: var(--error); }

/* ── Preview panel — formato Google Chat inalterado ── */

.preview-panel {
  flex: 1;
  padding: 24px;
  background: #1a1f2e;
  border: 1px solid #2a3548;
  border-radius: 12px;
  min-height: 400px;
}

.preview-panel .panel-title { color: #9aa0a6; }

.gc-card {
  background: #1e2a38;
  border-radius: 12px;
  overflow: hidden;
  font-family: 'Google Sans', 'Segoe UI', system-ui, sans-serif;
  color: #e8eaed;
  font-size: 14px;
  max-width: 520px;
}

.gc-header {
  padding: 16px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.gc-header-title    { font-size: 16px; font-weight: 600; color: #fff; }
.gc-header-subtitle { font-size: 12px; color: #9aa0a6; margin-top: 3px; }
.gc-header-subtitle b { color: #c8ccd0; }

.gc-section {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.gc-section:last-child { border-bottom: none; }

.gc-section-header {
  font-size: 12px; font-weight: 600;
  color: #bdc1c6; margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: .4px;
}

.gc-text { color: #dadce0; line-height: 1.6; }
.gc-text b { color: #fff; font-weight: 600; }

.gc-step {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 6px 0;
}
.gc-step + .gc-step { border-top: 1px solid rgba(255,255,255,.05); }

.gc-step-icon  { font-size: 18px; margin-top: 2px; flex-shrink: 0; }
.gc-step-time  { font-size: 11px; color: #9aa0a6; margin-bottom: 2px; }
.gc-step-title { font-weight: 600; color: #fff; }
.gc-step-title b { font-weight: 600; }
.gc-step-sub   { font-size: 12px; color: #9aa0a6; margin-top: 2px; }

.gc-services { color: #dadce0; line-height: 1.8; word-break: break-word; }
.gc-services b { color: #fff; font-weight: 600; }

.gc-cierre { color: #bdc1c6; font-style: italic; }
.gc-mention { color: #8ab4f8; font-size: 11px; font-weight: 600; }

.preview-placeholder { color: #5f6368; font-style: italic; }
