/* =====================================================================
   WhatsApp Claude Bridge — Design System
   Paleta tomada del isotipo del proyecto (Solo icono.png):
   amarillo · naranja · rojo · magenta · azul · cian · grafito
   ===================================================================== */

:root {
  /* ----- Brand colors (from logo) -------------------------------- */
  --c-yellow:   #F5C518;
  --c-orange:   #F58220;
  --c-red:      #E63946;
  --c-magenta:  #C61F5D;
  --c-blue:     #2E73D6;
  --c-cyan:     #4DB6FF;
  --c-graphite: #3A3D42;

  /* ----- Semantic tokens ----------------------------------------- */
  --bg:           #F7F6F2;       /* warm off-white, balancea el naranja */
  --bg-elevated:  #FFFFFF;
  --bg-soft:      #FBF9F4;
  --surface:      #FFFFFF;
  --surface-2:    #F2EFE8;
  --border:       #E7E3D8;
  --border-strong:#D4CFC1;

  --text:         #1B1D22;
  --text-muted:   #6B6E78;
  --text-soft:    #9CA0AC;
  --text-on-dark: #FBF9F4;

  --primary:        var(--c-orange);
  --primary-hover:  #E2701A;
  --primary-soft:   #FDE9D6;

  --accent:         var(--c-magenta);
  --info:           var(--c-blue);
  --success:        #2BA361;
  --success-soft:   #DEF6E9;
  --warning:        var(--c-yellow);
  --warning-soft:   #FDF3CF;
  --danger:         var(--c-red);
  --danger-soft:    #FCE0E3;

  /* ----- Effects -------------------------------------------------- */
  --radius-xs:  6px;
  --radius-sm:  10px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-sm:  0 1px 2px rgba(27,29,34,.04), 0 1px 1px rgba(27,29,34,.03);
  --shadow-md:  0 4px 12px rgba(27,29,34,.06), 0 2px 4px rgba(27,29,34,.04);
  --shadow-lg:  0 18px 40px -12px rgba(27,29,34,.18), 0 8px 16px -8px rgba(27,29,34,.08);
  --shadow-pop: 0 24px 60px -20px rgba(245,130,32,.35);

  --grad-warm: linear-gradient(135deg, var(--c-yellow) 0%, var(--c-orange) 45%, var(--c-red) 100%);
  --grad-cool: linear-gradient(135deg, var(--c-cyan) 0%, var(--c-blue) 100%);
  --grad-brand:linear-gradient(135deg,
                 var(--c-yellow) 0%,
                 var(--c-orange) 35%,
                 var(--c-red) 65%,
                 var(--c-magenta) 100%);

  --font-sans: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

/* ===================================================================
   Base
=================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
}

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--text); line-height: 1.25; margin: 0; }
h1 { font-size: 1.7rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; font-weight: 650; letter-spacing: -.005em; }
h3 { font-size: 1.05rem; font-weight: 600; }

p { margin: 0 0 10px; color: var(--text); }
.muted { color: var(--text-muted); }
.soft  { color: var(--text-soft); }

code, pre, .mono { font-family: var(--font-mono); font-size: .85rem; }

::selection { background: var(--primary-soft); color: var(--text); }

/* ===================================================================
   Layout shell
=================================================================== */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 28px;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar .brand {
  display: flex; align-items: center; gap: 12px;
  font-weight: 700; font-size: .95rem;
  color: var(--text);
}

.topbar .brand img {
  width: 36px; height: 36px;
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
}

.topbar .brand small {
  display: block;
  font-weight: 500;
  font-size: .73rem;
  color: var(--text-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.topbar nav {
  display: flex; gap: 4px;
  margin-left: 18px;
}

.topbar nav a {
  position: relative;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 550;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s ease, background .15s ease;
}
.topbar nav a:hover { color: var(--text); background: var(--surface-2); }
.topbar nav a.active {
  color: var(--text);
  background: var(--surface-2);
}
.topbar nav a.active::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 2px;
  height: 2px; border-radius: 2px;
  background: var(--grad-warm);
}

.topbar .spacer { flex: 1; }

.topbar .user-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 6px;
  background: var(--surface-2);
  border-radius: 999px;
  font-size: .82rem; color: var(--text);
}

.topbar .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--grad-warm);
  color: #fff; font-weight: 700; font-size: .78rem;
  display: inline-flex; align-items: center; justify-content: center;
}

.topbar form.logout { margin: 0; }

.main {
  flex: 1;
  padding: 36px 28px 60px;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 28px;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.page-header .eyebrow {
  font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600;
  margin-bottom: 8px;
}
.page-header p { color: var(--text-muted); max-width: 640px; }

/* ===================================================================
   Cards / surfaces
=================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 18px; }
.card-title { font-size: 1.05rem; font-weight: 650; margin-bottom: 4px; }
.card-sub   { color: var(--text-muted); font-size: .9rem; margin-bottom: 22px; }

.card-row {
  display: flex; align-items: flex-start; gap: 16px;
}
.card-row + .card-row {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 760px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ===================================================================
   Forms
=================================================================== */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }

.field label,
.field > .lbl {
  display: block;
  font-weight: 600;
  font-size: .88rem;
  margin-bottom: 6px;
  color: var(--text);
}
.field .key {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 2px 7px;
  border-radius: 6px;
  margin-left: 8px;
  vertical-align: 1px;
}
.field .hint {
  display: block;
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 6px;
}

input:not([type]),
input[type=text], input[type=email], input[type=password],
input[type=tel], input[type=number], input[type=search],
input[type=url],
select, textarea {
  width: 100%;
  padding: 11px 13px;
  font: inherit;
  font-size: .92rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border .15s ease, box-shadow .15s ease, background .15s ease;
}
textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-orange);
  box-shadow: 0 0 0 4px rgba(245,130,32,.16);
}
input::placeholder, textarea::placeholder { color: var(--text-soft); }

/* Quita el tinte amarillo/azulado que aplica Chrome/Edge a los inputs
   autorrellenados — asi todos los campos se ven igual aunque el browser
   intente prellenarlos. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-elevated) inset !important;
  box-shadow: 0 0 0 1000px var(--bg-elevated) inset !important;
  transition: background-color 9999s ease-in-out 0s,
              color 9999s ease-in-out 0s;
}

.field-inline {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.field-inline input[type=checkbox] {
  width: 18px; height: 18px; accent-color: var(--c-orange);
}

/* ===================================================================
   Buttons
=================================================================== */
.btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  font-size: .9rem; font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease,
              background .15s ease, color .15s ease;
  text-decoration: none;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  color: #fff;
  background: var(--grad-warm);
  box-shadow: 0 6px 18px -8px rgba(230,57,70,.55),
              0 2px 4px rgba(245,130,32,.18);
}
.btn-primary:hover { filter: brightness(1.05); box-shadow: var(--shadow-pop); }

.btn-secondary {
  color: var(--text);
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-ghost {
  color: var(--text-muted);
  background: transparent;
}
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

.btn-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}
.btn-danger:hover { background: #f9c8cd; }

.btn-block { width: 100%; }
.btn-lg    { padding: 14px 22px; font-size: 1rem; border-radius: var(--radius-md); }
.btn-sm    { padding: 7px 12px; font-size: .82rem; }

/* ===================================================================
   Banners / alerts
=================================================================== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  display: flex; align-items: center; gap: 10px;
  font-size: .9rem;
  margin-bottom: 16px;
}
.alert-success {
  background: var(--success-soft);
  color: #155e3a;
  border-color: #b8e6c9;
}
.alert-info {
  background: #E1ECFB;
  color: #1B4FA4;
  border-color: #C3D8F4;
}
.alert-warn {
  background: var(--warning-soft);
  color: #7a5b00;
  border-color: #F2DE85;
}
.alert-danger {
  background: var(--danger-soft);
  color: #8a1d29;
  border-color: #f0b6bc;
}

.alert .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ===================================================================
   Badges
=================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  letter-spacing: .02em;
}
.badge-success { background: var(--success-soft); color: #1F7A4A; }
.badge-warn    { background: var(--warning-soft); color: #8a6c00; }
.badge-info    { background: #DCE9FA; color: #1F4FA0; }
.badge-danger  { background: var(--danger-soft); color: #8a1d29; }

.badge-dot::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: .85;
}

/* ===================================================================
   Login screen
=================================================================== */
.login-screen {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--bg);
}
@media (max-width: 920px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-aside  { display: none; }
}

.login-aside {
  position: relative;
  background:
    radial-gradient(900px 600px at 80% 10%, rgba(245,197,24,.40), transparent 60%),
    radial-gradient(700px 500px at 10% 90%, rgba(46,115,214,.30), transparent 65%),
    radial-gradient(900px 700px at 60% 60%, rgba(198,31,93,.28), transparent 60%),
    linear-gradient(160deg, #2A1A14 0%, #1B1D22 60%, #14181E 100%);
  color: var(--text-on-dark);
  padding: 56px;
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
}

.login-aside::before {
  content: "";
  position: absolute; inset: -40% -10% auto auto;
  width: 480px; height: 480px;
  background: var(--grad-brand);
  filter: blur(80px);
  opacity: .35;
  pointer-events: none;
}

.login-aside .brand {
  display: flex; align-items: center; gap: 14px;
  position: relative;
}
.login-aside .brand img {
  width: 56px; height: 56px;
  border-radius: 14px;
  box-shadow: 0 18px 40px -12px rgba(0,0,0,.5);
}
.login-aside .brand strong { font-size: 1.15rem; }
.login-aside .brand small  { display: block; color: #C7C2B5; font-size: .8rem; font-weight: 500; }

.login-aside .hero {
  position: relative;
  max-width: 460px;
}
.login-aside .hero h1 {
  color: #fff;
  font-size: 2.3rem;
  line-height: 1.1;
  letter-spacing: -.02em;
  margin-bottom: 16px;
}
.login-aside .hero h1 span {
  background: var(--grad-warm);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-aside .hero p {
  color: #D5D0C2;
  font-size: 1rem;
  line-height: 1.55;
}

.login-aside .feature-list {
  position: relative;
  list-style: none; padding: 0; margin: 24px 0 0;
  display: grid; gap: 12px;
}
.login-aside .feature-list li {
  display: flex; align-items: center; gap: 12px;
  font-size: .92rem; color: #E9E4D4;
}
.login-aside .feature-list .ico {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: var(--c-yellow);
}

.login-aside .footer {
  position: relative;
  font-size: .8rem;
  color: #A7A294;
}

.login-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.login-form {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  box-shadow: var(--shadow-lg);
}
.login-form h2 {
  font-size: 1.45rem; letter-spacing: -.01em; margin-bottom: 6px;
}
.login-form .sub {
  color: var(--text-muted);
  margin-bottom: 26px;
  font-size: .92rem;
}

.login-form .brand-mobile {
  display: none;
  align-items: center; gap: 10px;
  margin-bottom: 18px;
  font-weight: 700;
}
.login-form .brand-mobile img { width: 36px; height: 36px; border-radius: 9px; }
@media (max-width: 920px) {
  .login-form .brand-mobile { display: flex; }
}

.help-link {
  display: block;
  text-align: center;
  margin-top: 18px;
  font-size: .82rem;
  color: var(--text-muted);
}

/* ===================================================================
   API tester (test page)
=================================================================== */
.tester-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
@media (max-width: 960px) {
  .tester-layout { grid-template-columns: 1fr; }
}

.console {
  background: #14171C;
  color: #E6E1D5;
  border-radius: var(--radius-lg);
  border: 1px solid #232830;
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 460px;
  box-shadow: var(--shadow-md);
}
.console header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 18px;
  background: #1B1F26;
  border-bottom: 1px solid #232830;
  font-size: .82rem; color: #C7C2B5;
  font-family: var(--font-mono);
}
.console header .dots {
  display: inline-flex; gap: 6px; margin-right: 8px;
}
.console header .dots span {
  width: 10px; height: 10px; border-radius: 50%;
}
.console header .dots span:nth-child(1) { background: var(--c-red); }
.console header .dots span:nth-child(2) { background: var(--c-yellow); }
.console header .dots span:nth-child(3) { background: var(--c-cyan); }
.console .log {
  flex: 1;
  padding: 18px;
  font-family: var(--font-mono);
  font-size: .82rem;
  line-height: 1.65;
  overflow: auto;
}
.console .log .entry { margin-bottom: 12px; }
.console .log .ts   { color: #7C8597; margin-right: 8px; }
.console .log .lvl-in  { color: var(--c-cyan); }
.console .log .lvl-out { color: var(--c-yellow); }
.console .log .lvl-err { color: var(--c-red); }
.console .log .lvl-ok  { color: #6BD08A; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.tabs button {
  background: transparent;
  border: 0;
  padding: 10px 14px;
  font: inherit; font-size: .88rem; font-weight: 550;
  color: var(--text-muted);
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button:hover { color: var(--text); }
.tabs button.active {
  color: var(--text);
  border-bottom-color: var(--c-orange);
}

/* Mode toggle pills */
.pill-group {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.pill-group label {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: .85rem; font-weight: 550;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: background .15s ease, color .15s ease;
}
.pill-group input { display: none; }
.pill-group input:checked + span {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.pill-group span {
  padding: 7px 14px;
  border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px;
}

/* Empty state */
.empty {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
}
.empty .ico {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  color: var(--c-orange);
  margin-bottom: 12px;
}

/* Misc utility */
.row    { display: flex; gap: 12px; align-items: center; }
.between{ justify-content: space-between; }
.mt-0   { margin-top: 0 !important; }
.mt-1   { margin-top: 8px; }
.mt-2   { margin-top: 16px; }
.mt-3   { margin-top: 24px; }
.mt-4   { margin-top: 32px; }

/* ===================================================================
   Mobile
=================================================================== */
@media (max-width: 720px) {
  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar nav { display: none; }
  .main { padding: 24px 16px 48px; }
  .card { padding: 22px; border-radius: var(--radius-md); }
  h1 { font-size: 1.4rem; }
}
