@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/nunito-400") format("truetype");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/nunito-600") format("truetype");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/nunito-700") format("truetype");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/assets/nunito-800") format("truetype");
}

:root {
  --orange: #ff5c2b;
  --orange-dim: rgba(255, 92, 43, .12);
  --font: "Nunito", sans-serif;
  --bg: #0a0a0a;
  --bg-secondary: #111;
  --bg-card: #161616;
  --border: rgba(255, 255, 255, .08);
  --border-hover: rgba(255, 255, 255, .18);
  --text-primary: #fff;
  --text-secondary: #a0a09a;
  --text-muted: #adadad;
  --brand: #ff5c2b;
  --ink: #0c0d10;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg);
  line-height: 1.45;
  font-weight: 600;
}
button, input, textarea, select { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; display: block; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(28px, 4vw, 36px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
h2 { font-size: 15px; font-weight: 800; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: var(--orange-dim); color: var(--text-primary); }
::placeholder { color: var(--text-muted); }

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.muted, small { color: var(--text-secondary); font-weight: 600; }
.lede { margin: 8px 0 14px; color: var(--text-secondary); max-width: 62ch; }

.gate { min-height: 100vh; display: grid; place-items: center; padding: 32px 24px; }
.chooser, .card {
  width: min(760px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 32px;
}
.card { width: min(440px, 100%); display: grid; gap: 14px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.choice {
  display: grid;
  gap: 6px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  min-height: 140px;
  align-content: end;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
}
.choice:hover { border-color: var(--border-hover); background: var(--orange-dim); }
.choice strong { font-size: 22px; font-weight: 800; }
.choice span { color: var(--text-secondary); }

.shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; background: var(--bg); }
.side {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-right: 1px solid var(--border);
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px; }
.mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}
.brand strong { display: block; font-weight: 800; }
.nav { display: grid; gap: 4px; }
.nav-btn, .side-foot button, .btn, .kcard-hit, .row {
  border: 0;
  cursor: pointer;
  text-align: left;
}
.nav-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 28px;
  padding: 12px 16px;
  font-weight: 700;
}
.nav-btn.active { background: var(--orange-dim); color: var(--text-primary); }
.nav-btn:hover { background: rgba(255, 255, 255, .04); color: var(--text-primary); }
.badge {
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}
.side-foot { margin-top: auto; display: grid; gap: 4px; padding: 8px; }
.side-foot button {
  background: transparent;
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 10px 12px;
  font-weight: 700;
}
.side-foot button:hover { background: rgba(255, 255, 255, .04); color: var(--text-primary); }
#live.is-off { color: var(--brand); }

#main {
  padding: 32px 36px 48px;
  min-width: 0;
}
.topbar, .portal-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 20px;
}
.filters, .line, .actions, .split { display: flex; gap: 10px; flex-wrap: wrap; }
.filters { margin-bottom: 18px; align-items: center; }
.filters input, .filters select, .field input, .field textarea, .field select,
.title-input, .code-input, .line input, .panel input, .panel textarea, .panel select, .reply textarea, textarea, select {
  width: 100%;
  background: var(--bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.filters input:hover, .filters select:hover, .field input:hover, .field textarea:hover, .field select:hover,
.title-input:hover, .code-input:hover, .line input:hover, .panel input:hover, .panel textarea:hover, .panel select:hover, textarea:hover, select:hover {
  border-color: var(--border-hover);
}
.filters input:focus, .filters select:focus, .field input:focus, .field textarea:focus, .field select:focus,
.title-input:focus, .code-input:focus, .line input:focus, .panel input:focus, .panel textarea:focus, .panel select:focus, textarea:focus, select:focus {
  border-color: var(--brand);
  outline: none;
}
.filters input, .filters select { width: auto; min-width: 160px; }
.filters input { flex: 1; min-width: 220px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text-secondary); font-weight: 700; }
.title-input {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  padding: 8px 12px;
  margin: 8px 0 12px;
}
.code-input {
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.04em;
}

.btn {
  border-radius: 20px;
  padding: 10px 18px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  text-align: center;
  font-weight: 800;
  min-height: 40px;
}
.btn:hover { border-color: var(--border-hover); }
.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: rgba(255, 255, 255, .04); color: var(--text-primary); }
.btn-danger { background: rgba(255, 92, 43, .16); color: #ffb4a2; border-color: transparent; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.actions .btn-primary, .stack .btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
}

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  align-items: stretch;
}
.column {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px;
  min-height: 460px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.column.is-over { outline: 2px dashed var(--brand); outline-offset: -4px; }
.col-ingresado { background: #141816; }
.col-en_progreso { background: #141820; }
.col-estancado { background: #1c1412; }
.col-en_revision { background: #1c1812; }
.col-aprobado { background: #141c16; }
.col-completado { background: #121212; }
.column-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 6px 2px; }
.count {
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--orange-dim);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 800;
}
.column-body { display: flex; flex-direction: column; gap: 8px; min-height: 72px; flex: 1; }
.column-empty { color: var(--text-muted); font-size: 13px; padding: 8px; }
.kcard {
  background: #1c1c1c;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.kcard:hover { border-color: var(--border-hover); }
.kcard.is-unread { box-shadow: inset 3px 0 0 var(--brand); }
.kcard.dragging { opacity: 0.45; }
.kcard[draggable="true"] { cursor: grab; }
.kcard-hit {
  display: grid;
  gap: 4px;
  width: 100%;
  background: transparent;
  color: var(--text-primary);
  padding: 12px;
}
.kcard-hit strong { font-weight: 800; }
.kcard-hit small { color: var(--text-secondary); }
.num { font-weight: 800; color: var(--brand); font-size: 12px; }
.pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255, 255, 255, .06);
  color: var(--text-secondary);
}
.p-baja { background: rgba(76, 175, 80, .16); color: #a5d6a7; }
.p-media { background: rgba(255, 193, 7, .16); color: #ffe082; }
.p-alta { background: var(--orange-dim); color: #ffab91; }
.p-urgente { background: rgba(244, 67, 54, .18); color: #ff8a80; }
.s-ingresado { background: rgba(128, 203, 196, .16); color: #b2dfdb; }
.s-en_progreso { background: rgba(100, 181, 246, .16); color: #bbdefb; }
.s-estancado { background: rgba(239, 83, 80, .16); color: #ffcdd2; }
.s-en_revision { background: rgba(255, 183, 77, .16); color: #ffe0b2; }
.s-aprobado { background: rgba(102, 187, 106, .16); color: #c8e6c9; }
.s-completado { background: rgba(255, 255, 255, .08); color: var(--text-muted); }
.ready {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 12px 12px;
  font-weight: 800;
  color: var(--brand);
}
.ready.banner { margin: 0 0 14px; padding: 12px 14px; background: var(--orange-dim); border-radius: 12px; }
.ready input { width: 18px; height: 18px; accent-color: var(--brand); }
.ready.done { color: #a5d6a7; }

.detail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.stack, .panel, .client-card, .user-card { display: grid; gap: 12px; }
.panel, .client-card, .user-card, .composer {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.composer { max-width: 920px; }
.detail .composer { max-width: none; }
.field { display: grid; gap: 6px; }
.field span, .panel h2 { font-size: 13px; color: var(--text-secondary); font-weight: 800; }
.line input { flex: 1; }
.drop {
  border: 1.5px dashed var(--border-hover);
  border-radius: 16px;
  padding: 16px;
  background: var(--bg);
}
.drop.over, .drop:focus-within { background: var(--orange-dim); border-color: var(--brand); }
.files { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.files li, .msg header, .codebox, .portal-top { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.files img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; }
.msg { padding: 12px 0; border-top: 1px solid var(--border); }
.msg-sistema { color: var(--text-secondary); font-size: 14px; }
.msg p { margin-top: 6px; }
.prose { white-space: pre-wrap; }
.empty { padding: 8px 0 14px; color: var(--text-secondary); }
.clients, .users { display: grid; gap: 10px; }
.client-card, .user-card { grid-template-columns: 1fr auto; align-items: center; }
.card-main { display: grid; gap: 4px; }
.codebox {
  justify-content: start;
  font-weight: 800;
  background: var(--ink);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  width: fit-content;
}
.flash { outline: 2px solid var(--brand); }
.banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--orange-dim);
  color: var(--text-primary);
  border: 1px solid rgba(255, 92, 43, .28);
}
.portal-wrap { width: min(920px, 100%); margin: 0 auto; padding: 36px 32px 56px; }
.portal-wrap.is-wide { width: min(1600px, 100%); }
.thread { display: grid; }
.line button, .files button, .actions button, .drop label {
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 800;
}
.line button:hover, .files button:hover, .actions button:hover, .drop label:hover {
  border-color: var(--border-hover);
}

#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 20; width: min(360px, calc(100% - 32px)); }
.toast {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-hover);
  border-radius: 12px;
  padding: 14px 16px;
  font-weight: 700;
}
.toast-bad { background: #3a1714; border-color: rgba(255, 92, 43, .4); color: #ffd7cc; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav { grid-auto-flow: column; overflow-x: auto; }
  .side-foot { grid-auto-flow: column; margin-top: 0; align-items: center; }
  .detail, .choices, .client-card, .user-card { grid-template-columns: 1fr; }
  #main { padding: 24px 20px 36px; }
  .portal-wrap { padding: 24px 20px 40px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}
