/* Keytrail — panel de control (control.keytrail.app) · marca Keytrail */
:root{
  --ink:#121417; --ink-2:#2A2D31; --amber:#D9922B; --amber-soft:#F3E3C7; --amber-ink:#6B4510;
  --cream:#F4F1EA; --sand:#E9E5DC; --sand-2:#C9C4B8; --gray:#4A4D52; --gray-2:#B9BBBF;
  --ok:#2F7D4F; --err:#A3241C; --white:#FFFFFF;
  --r:14px;
}
*{ box-sizing: border-box; }
html,body{ margin: 0; }
body{ background: var(--cream); color: var(--ink); font: 400 14px/1.5 'Sora', system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
a{ color: inherit; }
button, input, select, textarea{ font: inherit; color: inherit; }
[hidden]{ display: none !important; }
.sr{ position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Botones y campos ---------- */
.btn{ display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--ink); color: var(--cream); font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover{ background: var(--ink-2); }
.btn:disabled{ opacity: .5; cursor: default; }
.btn-line{ background: transparent; color: var(--ink); }
.btn-line:hover{ background: var(--ink); color: var(--cream); }
.btn-sm{ min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn-danger{ background: transparent; color: var(--err); border-color: var(--err); }
.btn-danger:hover{ background: var(--err); color: #fff; }
.link{ background: none; border: 0; padding: 0; color: var(--gray); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 13px; }

.field{ display: flex; flex-direction: column; gap: 7px; }
.field > span, .field > label{ font-weight: 600; }
.field small{ font-size: 12px; color: var(--gray); }
.input, select.input, textarea.input{ width: 100%; min-height: 46px; border: 1px solid var(--sand); border-radius: 10px; padding: 0 14px; background: var(--white); }
textarea.input{ padding: 12px 14px; min-height: 80px; resize: vertical; }
.input:focus{ outline: 2px solid var(--ink); outline-offset: 1px; }
.suffix{ display: flex; align-items: stretch; border: 1px solid var(--sand); border-radius: 10px; overflow: hidden; background: var(--white); }
.suffix .input{ border: 0; border-radius: 0; }
.suffix span{ display: flex; align-items: center; padding: 0 14px; color: var(--gray); background: var(--cream); white-space: nowrap; }
.grid2{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.hint-ok{ color: var(--ok); font-weight: 600; }
.hint-err{ color: var(--err); font-weight: 600; }
.msg-err{ background: #FBEDEC; color: var(--err); border-radius: 10px; padding: 10px 14px; font-size: 13px; }

/* ---------- Ingreso ---------- */
.login{ min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card{ width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.login-card img{ height: 36px; width: auto; align-self: flex-start; }
.login-card h1{ margin: 8px 0 0; font-size: 26px; letter-spacing: -0.03em; }
.login-card p{ margin: 0; color: var(--gray); }

/* ---------- Estructura ---------- */
.shell{ min-height: 100vh; display: flex; flex-wrap: wrap; }
.side{ flex: 1 1 220px; max-width: 240px; background: var(--ink); color: var(--cream); padding: 28px 20px; display: flex; flex-direction: column; gap: 28px; }
.side-brand{ display: flex; align-items: center; gap: 10px; }
.side-brand img{ height: 28px; width: auto; }
.side-brand .tag{ margin-left: auto; font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); background: var(--amber); padding: 3px 7px; border-radius: 999px; }
.side nav{ display: flex; flex-direction: column; gap: 4px; }
.side nav a{ display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; color: var(--gray-2); text-decoration: none; }
.side nav a.on{ background: var(--ink-2); color: var(--cream); font-weight: 600; }
.side nav a:hover{ color: var(--cream); }
.side nav svg{ width: 18px; height: 18px; flex-shrink: 0; }
.side-user{ margin-top: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--gray-2); }
.side-user .av{ width: 32px; height: 32px; border-radius: 50%; background: var(--amber); color: var(--ink); display: flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; }
.side-user button{ background: none; border: 0; color: var(--gray-2); text-decoration: underline; padding: 0; cursor: pointer; font-size: 12px; }

.main{ flex: 999 1 640px; min-width: 0; padding: 32px 40px 64px; display: flex; flex-direction: column; gap: 22px; }
.eyebrow{ margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gray); }
.h1{ margin: 0; font-size: 32px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; }
.h2{ margin: 0; font-size: 16px; font-weight: 600; }
.head{ display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.back{ font-size: 13px; color: var(--gray); text-decoration: none; }
.card{ background: var(--white); border-radius: var(--r); }
.pad{ padding: 22px 24px; }
.stack{ display: flex; flex-direction: column; gap: 18px; }
.muted{ color: var(--gray); }
.small{ font-size: 12px; }

/* ---------- KPIs y tabla ---------- */
.kpis{ display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.kpi{ background: var(--white); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.kpi b{ font-size: 32px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.2; }
.kpi span{ font-size: 13px; color: var(--gray); }
.kpi small{ font-size: 12px; color: var(--gray); }
.toolbar{ display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--sand); }
.toolbar .input{ flex: 1 1 240px; background: var(--cream); min-height: 42px; width: auto; }
.chips{ display: flex; flex-wrap: wrap; gap: 6px; }
.chip{ min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--sand); background: var(--white); font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.on{ background: var(--ink); border-color: var(--ink); color: var(--cream); }
.table-wrap{ overflow-x: auto; }
table.list{ width: 100%; min-width: 760px; border-collapse: collapse; }
table.list th{ text-align: left; font-size: 12px; font-weight: 600; color: var(--gray); padding: 12px; }
table.list th:first-child, table.list td:first-child{ padding-left: 20px; }
table.list td{ padding: 14px 12px; border-top: 1px solid var(--sand); vertical-align: middle; }
table.list tr.row{ cursor: pointer; }
table.list tr.row:hover td{ background: #FBFAF7; }
.cli{ display: flex; align-items: center; gap: 12px; text-decoration: none; }
.cli b{ display: block; font-weight: 600; }
.cli small{ font-size: 12px; color: var(--gray); }
.sw2{ display: flex; width: 40px; height: 40px; border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.sw2 span{ flex: 1; }
.sw2.lg{ width: 52px; height: 52px; border-radius: 12px; }
.pill{ display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--sand); }
.pill.black{ background: var(--ink); color: var(--cream); }
.pill.platinum{ background: #DADDE2; }
.pill.gold{ background: var(--amber-soft); color: var(--amber-ink); }
.estado{ display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.estado i{ width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.estado.demo i{ background: var(--amber); }
.estado.off i{ background: var(--sand-2); }
.empty{ padding: 40px 20px; text-align: center; color: var(--gray); }

/* ---------- Ficha ---------- */
.tabs{ display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--sand); }
.tabs a{ display: inline-flex; align-items: center; min-height: 42px; padding: 0 14px; color: var(--gray); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on{ color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.cols{ display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.cols > .card, .cols > form{ flex: 1 1 420px; }
.cols > aside{ flex: 1 1 320px; display: flex; flex-direction: column; gap: 12px; }
.savebar{ display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 12px; }

.opts{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.opt{ display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--sand); cursor: pointer; }
.opt:has(input:checked){ border: 2px solid var(--ink); font-weight: 600; padding: 11px 13px; }
.color-in{ display: flex; align-items: center; gap: 10px; border: 1px solid var(--sand); border-radius: 10px; padding: 6px 8px; }
.color-in input[type=color]{ width: 34px; height: 34px; border: 0; padding: 0; background: none; cursor: pointer; }
.color-in input[type=text]{ flex: 1; min-width: 0; border: 0; min-height: 34px; text-transform: uppercase; }
.logos{ display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.logo-slot{ position: relative; min-height: 112px; border: 1.5px dashed var(--sand-2); border-radius: 12px; background: var(--cream); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px; text-align: center; font-size: 12px; color: var(--gray); cursor: pointer; }
.logo-slot.dark{ border-color: #6B7385; color: #DCE0E8; }
.logo-slot b{ color: inherit; font-weight: 600; }
.logo-slot:not(.dark) b{ color: var(--ink); }
.logo-slot img{ max-width: 100%; max-height: 48px; object-fit: contain; }
.logo-slot .x{ position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(18,20,23,.75); color: #fff; cursor: pointer; font-size: 14px; line-height: 1; }
.logo-slot input{ position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Vista previa */
.prev-label{ font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gray); }
.prev{ display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.phone{ width: 220px; height: 440px; border-radius: 30px; border: 8px solid var(--ink); background: #F7F4EF; overflow: hidden; display: flex; flex-direction: column; color: #211E1B; }
.phone .ph-top{ padding: 16px 14px 10px; min-height: 48px; display: flex; align-items: center; }
.phone .ph-top img{ max-height: 26px; max-width: 150px; object-fit: contain; }
.phone .ph-body{ padding: 0 14px; display: flex; flex-direction: column; gap: 10px; }
.phone .ph-hello{ font-size: 20px; font-weight: 600; }
.phone .ph-goal{ border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.phone .ph-bar{ height: 5px; border-radius: 3px; background: rgba(255,255,255,.25); overflow: hidden; }
.phone .ph-bar i{ display: block; width: 50%; height: 100%; }
.phone .ph-task{ background: #fff; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.phone .ph-task b{ font-weight: 600; }
.phone .ph-task span:not(.ph-btn){ color: #6E6860; }
.phone .ph-btn{ align-self: flex-start; margin-top: 6px; padding: 5px 10px; border-radius: 6px; font-weight: 600; }
.phone .ph-nav{ margin-top: auto; display: flex; justify-content: space-around; padding: 10px 6px 14px; background: #fff; font-size: 9px; color: #6E6860; }
.prev-side{ flex: 1 1 170px; display: flex; flex-direction: column; gap: 12px; }
.prev-web{ background: #fff; border-radius: var(--r); overflow: hidden; }
.prev-web .pw-hero{ height: 90px; position: relative; }
.prev-web .pw-hero i{ position: absolute; right: 14px; top: 14px; width: 30px; height: 30px; border-radius: 50%; }
.prev-web .pw-body{ padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.prev-web .pw-name{ font-size: 17px; font-weight: 600; }
.prev-web .pw-btn{ align-self: flex-start; padding: 6px 10px; font-size: 11px; font-weight: 600; }
.prev-icon{ background: #fff; border-radius: var(--r); padding: 14px; display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--gray); }
.prev-icon canvas{ width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0; }
.prev-icon b{ color: var(--ink); }
.contrast{ background: #fff; border-radius: var(--r); padding: 14px; font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
.contrast .bad{ color: var(--err); }

/* Plan y módulos */
.plans{ display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.plan{ background: var(--white); border: 1px solid var(--sand); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
.plan .pn{ display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; }
.plan p{ margin: 0; font-size: 13px; color: var(--gray); }
.plan .pp{ font-size: 13px; font-weight: 600; margin-top: auto; }
.plan:has(input:checked){ background: var(--ink); color: var(--cream); border: 2px solid var(--ink); padding: 17px; }
.plan:has(input:checked) p{ color: var(--gray-2); }
.mods .mod{ display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--sand); }
.mods .mod:first-of-type{ border-top: 0; }
.mods .mod > div{ flex: 1 1 240px; }
.mods .mod b{ display: block; font-weight: 600; }
.mods .mod small{ font-size: 12px; color: var(--gray); }
.mods .mod.extra{ background: #FBF7EF; }
.mods .mod.off b{ color: var(--gray); text-decoration: line-through; }
.switch{ display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.switch input{ width: 20px; height: 20px; accent-color: var(--ink); }
.lock{ display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gray); }
.tag-extra{ display: inline-block; padding: 3px 9px; border-radius: 999px; background: var(--amber-soft); color: var(--amber-ink); font-size: 11px; font-weight: 600; }

/* Equipo */
.team-row{ display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--sand); }
.team-row:first-child{ border-top: 0; }
.team-row > div{ flex: 1 1 200px; }
.team-row b{ display: block; font-weight: 600; }

/* Planes */
.plan-edit{ display: flex; flex-direction: column; gap: 14px; }
.plan-edit .checks{ display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }

/* Pasos */
.steps{ list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.steps li{ display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px; background: var(--white); color: var(--gray); }
.steps li i{ width: 24px; height: 24px; border-radius: 50%; background: var(--sand); color: var(--ink); display: flex; align-items: center; justify-content: center; font-size: 12px; font-style: normal; font-weight: 600; }
.steps li.on{ background: var(--ink); color: var(--cream); font-weight: 600; }
.steps li.on i{ background: var(--amber); }
.bullets{ display: flex; flex-direction: column; gap: 10px; }
.bullets span{ display: flex; gap: 10px; }
.bullets span::before{ content: ''; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--amber); flex-shrink: 0; }

/* Hoja / diálogo */
.sheet-bg{ position: fixed; inset: 0; background: rgba(18,20,23,.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.sheet{ background: var(--white); border-radius: 18px; width: 100%; max-width: 440px; padding: 24px; display: flex; flex-direction: column; gap: 14px; max-height: 92vh; overflow: auto; }
.sheet h3{ margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.sheet p{ margin: 0; color: var(--gray); }
.clave{ font-size: 22px; font-weight: 600; letter-spacing: .02em; background: var(--cream); border-radius: 12px; padding: 14px; text-align: center; user-select: all; }
.sheet .row{ display: flex; flex-wrap: wrap; gap: 10px; }

.toast{ position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--cream); padding: 12px 18px; border-radius: 12px; font-size: 13px; z-index: 60; max-width: calc(100% - 32px); }
.loading{ padding: 60px 0; text-align: center; color: var(--gray); }

@media (max-width: 760px){
  .side{ max-width: none; flex-basis: 100%; padding: 16px 16px 12px; gap: 12px; }
  .side nav{ flex-direction: row; flex-wrap: wrap; }
  .side nav a{ padding: 8px 12px; }
  .side-user{ display: none; }
  .main{ padding: 20px 16px 48px; }
  .kpis{ grid-template-columns: 1fr; }
  .grid2, .opts{ grid-template-columns: 1fr; }
  .h1{ font-size: 26px; }
}
