:root {
  --accent: #25d366; /* verde WhatsApp */
  --accent-dim: rgba(37, 211, 102, 0.1);
  --dark: #0d0d0f;
  --surface: #16171a;
  --surface2: #1e1f24;
  --border: rgba(37, 211, 102, 0.15);
  --border2: rgba(37, 211, 102, 0.08);
  --white: #f0f0f2;
  --muted: rgba(240, 240, 242, 0.45);
  --green: #48bb78;
  --red: #fc8181;
  --blue: #2563eb;
}

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

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Inter", sans-serif;
  background: var(--dark);
  color: var(--white);
  display: flex;
  flex-direction: column;
}

/* HEADER */
.header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(13, 13, 15, 0.98);
  flex-shrink: 0;
  z-index: 200;

  a {
    display: inline-block;
    text-decoration: none;
    color: inherit;
  }
}

.header-title {
  font-family: "Syne", sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
}

.header-title span {
  color: var(--blue);
}

.btn-copy {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #111;
  border: none;
  border-radius: 7px;
  padding: 8px 16px;
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.btn-copy:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.btn-copy:not(:disabled):hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.btn-copy.copied {
  background: var(--green);
  color: #fff;
}

.btn-tool {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 14px;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-tool:hover {
  border-color: var(--blue);
  color: #60a5fa;
}

/* WORKSPACE */
.workspace {
  display: grid;
  grid-template-columns: 400px 1fr;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* SIDEBAR */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px 16px 60px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.section-label {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.05rem;
  color: var(--accent);
  margin-bottom: 8px;
}

.optional-label {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--muted);
}

.field-hint {
  font-size: 0.68rem;
  color: rgba(240, 240, 242, 0.28);
}

.phone-row {
  display: flex;
  gap: 0;
  border: 1px solid var(--border2);
  border-radius: 7px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.phone-row:focus-within {
  border-color: var(--accent);
}

.phone-prefix {
  background: var(--surface2);
  color: var(--muted);
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border-right: 1px solid var(--border2);
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.phone-row input {
  flex: 1;
  background: var(--surface2);
  border: none;
  color: var(--white);
  font-family: "Inter", sans-serif;
  font-size: 0.85rem;
  padding: 8px 12px;
  outline: none;
}

.field textarea {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 0 0 7px 7px;
  color: var(--white);
  font-family: "Inter", sans-serif;
  font-size: 0.82rem;
  padding: 9px 10px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  resize: none;
  line-height: 1.6;
}

.field textarea:focus {
  border-color: var(--accent);
}

/* TOOLBAR */
.msg-toolbar {
  display: flex;
  gap: 3px;
  align-items: center;
  padding: 6px 8px;
  background: #111113;
  border: 1px solid var(--border2);
  border-radius: 7px 7px 0 0;
}

.tb-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  transition: all 0.15s;
}

.tb-btn:hover {
  background: var(--surface2);
  border-color: var(--border2);
  color: var(--white);
}

.tb-sep {
  flex: 1;
}

.char-count {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}

.char-count.warn {
  color: #f6ad55;
}

/* DIVIDER */
.divider-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(37, 211, 102, 0.15), transparent);
  flex-shrink: 0;
}

/* TEMPLATES */
.templates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.template-btn {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 10px 12px;
  text-align: left;
  transition: all 0.2s;
  line-height: 1.4;
}

.template-btn:hover {
  border-color: var(--accent);
  color: var(--white);
  background: var(--accent-dim);
}

/* RESULT AREA */
.result-area {
  background: #1a1a1c;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.result-inner {
  width: 100%;
  max-width: 480px;
}

/* EMPTY STATE */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  color: rgba(37, 211, 102, 0.25);
  margin-bottom: 8px;
}

.empty-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--muted);
}

.empty-sub {
  font-size: 0.85rem;
  color: rgba(240, 240, 242, 0.28);
}

/* RESULT CARD */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.result-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(37, 211, 102, 0.6);
}

.link-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 10px 14px;
}

.link-text {
  flex: 1;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-copy-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  transition: color 0.2s;
  flex-shrink: 0;
}

.link-copy-btn:hover {
  color: var(--accent);
}

.result-actions {
  display: flex;
  gap: 10px;
}

.btn-whatsapp {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.btn-whatsapp:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.btn-copy-full {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: transparent;
  color: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 18px;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-copy-full:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.result-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.75rem;
  color: rgba(240, 240, 242, 0.35);
  line-height: 1.5;
  padding-top: 4px;
  border-top: 1px solid var(--border2);
}

.result-tip svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* RESPONSIVE */
@media (max-width: 700px) {
  .workspace {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .result-area {
    min-height: 300px;
  }
}