/* NOX LABS — Panel de la agencia. Estética: negro puro, Inter, sin gradientes. */
:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1b1b1b;
  --border: #2a2a2a;
  --border-2: #383838;
  --text: #f5f5f5;
  --muted: #8a8a8a;
  --muted-2: #6a6a6a;
  --accent: #c6ff3f;
  --accent-ink: #0a0a0a;
  --alta: #ff4d4d;
  --media: #ffb020;
  --baja: #6a6a6a;
  --ok: #3fd07a;
  --info: #4da3ff;
  --radius: 14px;
  --tab-h: 64px;
  --top-h: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex; align-items: center; gap: 12px;
  padding-left: 16px; padding-right: 16px;
  background: rgba(10,10,10,0.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; font-size: 14px; }
.brand span { color: var(--accent); }
.topbar .view-title { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.topbar .spacer { flex: 1; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 17px;
}
.icon-btn:active { background: var(--surface-2); }

/* ---------- Desktop nav (hidden on mobile) ---------- */
.desknav { display: none; gap: 4px; }
.desknav a {
  color: var(--muted); padding: 8px 14px; border-radius: 10px; font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
}
.desknav a.active { color: var(--text); background: var(--surface); }

/* ---------- Content ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 2px 16px; gap: 12px; }
.page-head h2 { font-size: 22px; letter-spacing: -0.01em; }
.page-head .sub { color: var(--muted); font-size: 13px; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.btn:active { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--alta); border-color: #4a2020; }
.btn.block { width: 100%; justify-content: center; }

/* ---------- Cards & tiles ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px;
}
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.tile .n { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.tile .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 8px; }
.tile.alert .n { color: var(--alta); }
.tile.accent .n { color: var(--accent); }

.section-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
  margin: 22px 2px 10px; font-weight: 700;
}

/* ---------- Badges / chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border-2); color: var(--muted);
}
.chip.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.u-alta { color: var(--alta); border-color: #4a2020; }
.u-media { color: var(--media); border-color: #4a3a10; }
.u-baja { color: var(--muted); }
.st-approved, .st-published, .st-hecha { color: var(--ok); border-color: #1e3d2a; }
.st-failed, .st-rejected, .st-descartada { color: var(--alta); border-color: #4a2020; }
.st-awaiting_approval, .st-ready, .st-pendiente { color: var(--media); border-color: #4a3a10; }
.st-en_progreso, .st-generating, .st-draft { color: var(--info); border-color: #1e344a; }

/* ---------- Task / list rows ---------- */
.row-item { display: flex; gap: 12px; align-items: flex-start; }
.row-item .grow { flex: 1; min-width: 0; }
.row-item .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.row-item .who { font-weight: 700; font-size: 14px; }
.row-item .summary { font-size: 15px; }
.row-item .raw { color: var(--muted); font-size: 13px; margin-top: 6px; font-style: italic; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select, .search input {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 8px 10px; border-radius: 10px; font-size: 14px;
}
.search { flex: 1; min-width: 140px; }
.search input { width: 100%; }

/* ---------- Piece card ---------- */
.piece { display: flex; gap: 12px; }
.piece .thumb {
  width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--border);
}
.piece .thumb.ph { display: grid; place-items: center; color: var(--muted-2); font-size: 22px; }

/* ---------- Client row ---------- */
.client-row { display: flex; align-items: center; gap: 12px; }
.client-row .avatar {
  width: 42px; height: 42px; border-radius: 10px; background: var(--surface-2);
  display: grid; place-items: center; font-weight: 800; color: var(--accent); flex-shrink: 0;
}
.client-row.inactive { opacity: 0.5; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text);
  padding: 11px 12px; border-radius: 10px;
}
.field textarea { resize: vertical; min-height: 80px; }
.field .hint { color: var(--muted-2); font-size: 12px; margin-top: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,0.7);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--bg); border: 1px solid var(--border); border-radius: 18px 18px 0 0;
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  padding: 18px 18px calc(24px + env(safe-area-inset-bottom));
}
.modal .modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal .modal-head h3 { font-size: 18px; }
.modal .modal-actions { display: flex; gap: 8px; margin-top: 18px; }
.modal .modal-actions .btn { flex: 1; justify-content: center; }

/* ---------- Bottom tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: rgba(15,15,15,0.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted-2); font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600;
}
.tabbar a .ic { font-size: 20px; line-height: 1; }
.tabbar a.active { color: var(--accent); }

/* ---------- Empty / misc ---------- */
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .big { font-size: 34px; margin-bottom: 10px; }
.muted { color: var(--muted); }
.linklist a { display: flex; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--border); color: var(--text); }
.linklist a:last-child { border-bottom: none; }
.linklist a .arrow { margin-left: auto; color: var(--muted-2); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tab-h) + 20px + env(safe-area-inset-bottom)); z-index: 80;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text);
  padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5); max-width: 88vw;
}
.toast.err { border-color: #4a2020; color: #ffb3b3; }

/* ---------- Setup screen ---------- */
.setup { max-width: 420px; margin: 8vh auto; padding: 24px; }
.setup .logo { font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; text-align: center; margin-bottom: 4px; }
.setup .logo span { color: var(--accent); }
.setup p { color: var(--muted); text-align: center; font-size: 13px; margin: 0 0 24px; }

/* ---------- Desktop ---------- */
@media (min-width: 820px) {
  body { padding-bottom: 0; }
  .desknav { display: flex; }
  .tabbar { display: none; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .modal-back { align-items: center; }
  .modal { border-radius: 18px; }
}
