:root {
  --bg: #F5F6F8;
  --panel: #FFFFFF;
  --line: #E3E6EC;
  --field: #D5DAE3;
  --soft: #EEF0F4;
  --text: #141824;
  --muted: #5B6475;
  --dis: #8A93A6;
  --primary: #4C6FFF;
  --primary-d: #3D5EF0;
  --ok: #1E8A50; --ok-bg: #E6F6ED; --ok-line: #BFE6CF;
  --warn: #8F5D00; --warn-bg: #FEF4DE; --warn-line: #F2D79B;
  --err: #D93445;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, sans-serif; }
h1 { font-size: 24px; font-weight: 600; margin: 0; letter-spacing: -0.015em; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }
h3 { font-size: 14px; font-weight: 600; margin: 0; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 13px; }
svg { flex-shrink: 0; }
button, input, select { font-family: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Barra superior */
.top { height: 64px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: var(--panel); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; color: var(--text); text-decoration: none; }
.logo-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; }
.user { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--line); display: grid; place-items: center; font-weight: 600; }

/* Botones */
.btn { height: 44px; padding: 0 16px; border-radius: 10px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; border: 1px solid transparent; text-decoration: none; white-space: nowrap; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.secondary { background: transparent; border-color: #C9CED8; color: var(--text); }
.btn.secondary:hover { background: var(--soft); }
.btn:disabled { background: var(--line); color: var(--dis); border-color: transparent; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--soft); }
.icon-btn:disabled { color: #C9CED8; background: transparent; cursor: default; }

/* Etiquetas de estado */
.pill { height: 26px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px 0 8px; border-radius: 13px; font-size: 12px; font-weight: 600; border: 1px solid; white-space: nowrap; }
.pill svg { width: 14px; height: 14px; }
.pill.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.pill.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }

/* Lista */
.page { max-width: 1344px; margin: 0 auto; padding: 32px 32px 64px; display: flex; flex-direction: column; gap: 24px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.head .muted { margin-top: 4px; font-size: 13px; }
.tabs { align-self: flex-start; display: flex; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.tab { height: 40px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.tab.active { background: var(--primary); color: #fff; font-weight: 600; }
.count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--soft); color: var(--muted); font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.tab.active .count { background: #3A55D6; color: #fff; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 14px; }
.thumb { height: 280px; border-radius: 10px; background: var(--soft); display: flex; align-items: center; justify-content: center; text-decoration: none; }
.phone { width: 158px; height: 280px; background: #000; border-radius: 12px; padding: 22px 12px; display: block; }
.phone-title { display: block; text-align: center; font: 15px/1.2 "Archivo Black", Inter, sans-serif; overflow-wrap: anywhere; }
.info { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 0 4px 4px; }
.info-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; align-items: flex-start; }
.info-text .pill { margin-top: 6px; }
.name { font-weight: 600; color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.name:hover { text-decoration: underline; }
.menu { position: relative; }
.menu summary { list-style: none; width: 44px; height: 44px; margin: -6px -6px 0 0; border-radius: 10px; display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover { background: var(--soft); }
.menu-pop { position: absolute; right: -6px; top: 42px; z-index: 5; width: 176px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 2px; }
.menu-pop button { height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; font-size: 14px; color: var(--text); cursor: pointer; text-align: left; }
.menu-pop button:hover { background: var(--soft); }
.menu-pop .danger { color: var(--err); }
.card-new { border: 1.5px dashed #C9CED8; background: transparent; min-height: 400px; align-items: center; justify-content: center; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text); }
.card-new:hover { background: var(--soft); }
.circle { width: 52px; height: 52px; border-radius: 50%; border: 1px solid #C9CED8; display: grid; place-items: center; color: var(--primary); }

/* Editor */
.editor { display: grid; grid-template-columns: minmax(0, 55fr) minmax(0, 45fr); gap: 32px; padding: 16px 32px 48px; max-width: 1440px; margin: 0 auto; }
.controls { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); text-decoration: none; font-weight: 600; height: 44px; align-self: flex-start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.lbl { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 500; }
.field { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--field); border-radius: 10px; background: #fff; font-size: 14px; color: var(--text); }
.field:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.narrow { width: 120px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { height: 36px; padding: 0 12px 0 8px; border-radius: 18px; border: 1px solid var(--field); background: #fff; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; }
.chip:hover { background: var(--soft); }
.sw { width: 18px; height: 18px; border-radius: 50%; border: 1px solid #9AA3B5; }
.positions { display: flex; flex-direction: column; gap: 12px; }
.pos-head { display: flex; align-items: center; gap: 10px; }
.num { width: 28px; height: 28px; border-radius: 8px; background: var(--soft); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.grow { flex: 1; }
.clip-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.trim { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.side { position: sticky; top: 16px; align-self: start; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.preview { height: min(calc(100vh - 210px), 720px); min-height: 320px; aspect-ratio: 9 / 16; border-radius: 20px; overflow: hidden; background: #000; max-width: 100%; }
.preview canvas { width: 100%; height: 100%; display: block; }
.player, .export, #msg { width: 100%; max-width: 405px; }
.player { display: flex; align-items: center; gap: 10px; }
.bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
#prog { height: 100%; width: 0; background: var(--primary); }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; min-width: 84px; text-align: right; }
.export { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#msg { text-align: center; min-height: 19px; }

@media (max-width: 1100px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; padding: 8px 16px 32px; }
  .side { position: static; order: -1; }
  .preview { height: 60vh; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page { padding: 24px 16px 48px; }
  .top { padding: 0 16px; }
}
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }
