/* ==========================================================================
   E-commerce VATTEN — identidade visual
   Futurista, minimalista e profissional. Para ajustar cores, altere só :root.
   ========================================================================== */
:root {
  --bg: #0b111c;            /* fundo azul muito escuro */
  --surface: #111a29;       /* superfícies */
  --surface-2: #162236;     /* superfícies elevadas / campos */
  --surface-3: #1c2a42;
  --line: #24324a;          /* bordas finas */
  --line-strong: #31425f;
  --text: #e6edf7;
  --text-2: #a9b6c9;
  --muted: #7d8aa0;
  --primary: #22d3ee;       /* ciano — ações, seleção e foco */
  --primary-ink: #04151b;
  --primary-soft: rgba(34, 211, 238, 0.12);
  --violet: #8b5cf6;        /* detalhes pontuais */
  --violet-soft: rgba(139, 92, 246, 0.14);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --err: #f87171;
  --err-soft: rgba(248, 113, 113, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  --glow: 0 0 0 1px rgba(34, 211, 238, 0.5), 0 0 18px rgba(34, 211, 238, 0.18);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t: 160ms;
  color-scheme: dark;
}
@media (prefers-reduced-motion: reduce) {
  :root { --t: 0ms; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--primary); color: var(--primary-ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app { width: min(1200px, 100% - 32px); margin: 0 auto; padding: 28px 0 110px; outline: none; }

/* ------------------------------------------------------------- topo */
.topbar { position: sticky; top: 0; z-index: 40; background: rgba(11, 17, 28, 0.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-inner { width: min(1200px, 100% - 32px); margin: 0 auto; height: 60px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: .22em; font-size: .9rem; text-decoration: none !important; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, var(--primary), var(--violet)); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 5px; border-radius: 3px; background: var(--bg); clip-path: polygon(0 0, 50% 100%, 100% 0, 78% 0, 50% 62%, 22% 0); }
.tabs-main { display: flex; gap: 4px; flex: 1; }
.tab-link { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; text-decoration: none !important; transition: background var(--t) var(--ease), color var(--t); }
.tab-link svg { width: 18px; height: 18px; }
.tab-link:hover { background: var(--surface-2); color: var(--text); }
.tab-link.active { color: var(--primary); background: var(--primary-soft); }
.top-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: transparent; border: 1px solid transparent; color: var(--text-2); cursor: pointer; transition: background var(--t); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.save-indicator { font-size: .78rem; color: var(--muted); min-width: 64px; text-align: right; transition: opacity var(--t); }
.save-indicator.saving { color: var(--text-2); }
.save-indicator.saved { color: var(--ok); }
.save-indicator.error { color: var(--err); }
.activity { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--primary); padding: 5px 10px; border-radius: 999px; background: var(--primary-soft); text-decoration: none !important; }
.activity .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.ctx-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: .8rem; color: var(--text-2); max-width: 260px; }
.ctx-chip a { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-chip button { background: none; border: 0; color: var(--muted); cursor: pointer; width: 22px; height: 22px; border-radius: 50%; }
.ctx-chip button:hover { background: var(--surface-3); color: var(--text); }

.menu { position: absolute; right: 16px; top: 56px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 220px; padding: 6px; z-index: 60; animation: fade var(--t) var(--ease); }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--text); background: none; border: 0; text-align: left; cursor: pointer; text-decoration: none !important; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu .menu-head { padding: 8px 12px; color: var(--muted); font-size: .82rem; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
@keyframes fade { from { opacity: 0; transform: translateY(-4px); } }

.bottom-tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: rgba(17, 26, 41, 0.98); border-top: 1px solid var(--line); display: none; padding-bottom: env(safe-area-inset-bottom); }
.bottom-tabs .tab-link { flex: 1; flex-direction: column; gap: 2px; font-size: .7rem; padding: 8px 2px; border-radius: 0; justify-content: center; min-height: 56px; }
.bottom-tabs .tab-link.active { background: transparent; }

/* ------------------------------------------------------------- tipografia */
h1 { font-size: clamp(1.45rem, 3vw, 1.9rem); line-height: 1.2; margin: 0; letter-spacing: -.01em; font-weight: 650; }
h2 { font-size: 1.12rem; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: .98rem; margin: 0 0 8px; font-weight: 600; }
.sub { color: var(--text-2); margin: 6px 0 0; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.xs { font-size: .76rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------- superfícies */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.narrow { max-width: 760px; margin-left: auto; margin-right: auto; }
.divider { height: 1px; background: var(--line); margin: 18px 0; border: 0; }

/* ------------------------------------------------------------- botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font-weight: 550; cursor: pointer; text-decoration: none !important; transition: background var(--t), border-color var(--t), box-shadow var(--t), transform var(--t); white-space: nowrap; }
.btn:hover { border-color: #3e5274; background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 650; }
.btn.primary:hover { box-shadow: var(--glow); background: #3ddcf2; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--err); }
.btn.sm { min-height: 34px; padding: 5px 11px; font-size: .86rem; border-radius: 8px; }
.btn.lg { min-height: 52px; padding: 12px 24px; font-size: 1.02rem; border-radius: 12px; }
.btn.block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0; font: inherit; }
.link-btn:hover { text-decoration: underline; }

/* ------------------------------------------------------------- formulários */
label.field { display: block; font-weight: 550; margin-bottom: 6px; color: var(--text); }
.hint { color: var(--muted); font-size: .82rem; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); outline: none; transition: border-color var(--t), box-shadow var(--t);
}
input::placeholder, textarea::placeholder { color: #5f6d84; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.16); }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.counter { font-size: .76rem; color: var(--muted); text-align: right; margin-top: 4px; }
.counter.over { color: var(--err); font-weight: 600; }
.check { display: inline-flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.segmented { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.segmented.full { display: grid; width: 100%; }
.segmented label, .segmented button { position: relative; text-align: center; padding: 9px 14px; border-radius: 9px; cursor: pointer; color: var(--text-2); font-weight: 550; border: 0; background: transparent; transition: background var(--t), color var(--t); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked), .segmented button.on { background: var(--surface-3); color: var(--primary); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.45); }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }

details.more { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.more > summary { cursor: pointer; padding: 12px 16px; color: var(--text-2); font-weight: 550; list-style: none; display: flex; align-items: center; gap: 8px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+"; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--surface-2); color: var(--primary); font-weight: 700; }
details.more[open] > summary::before { content: "–"; }
details.more > .more-body { padding: 4px 16px 16px; }

/* ------------------------------------------------------------- upload */
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); padding: 30px 18px; text-align: center; cursor: pointer; transition: border-color var(--t), background var(--t); }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: #0f1b2a; }
.dropzone .dz-icon { width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.dropzone .dz-icon svg { width: 22px; height: 22px; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #0d1522; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(11, 17, 28, .85); color: var(--text); cursor: pointer; }
.thumb.selectable { cursor: pointer; }
.thumb.selectable.on { box-shadow: var(--glow); border-color: var(--primary); }
.thumb .tick { position: absolute; left: 4px; top: 4px; width: 20px; height: 20px; border-radius: 6px; background: rgba(11, 17, 28, .85); border: 1px solid var(--line-strong); display: grid; place-items: center; font-size: .75rem; color: var(--primary); }
.thumb .main-tag { position: absolute; left: 0; right: 0; bottom: 0; font-size: .66rem; text-align: center; background: rgba(11, 17, 28, .85); padding: 2px; color: var(--primary); }

/* ------------------------------------------------------------- avisos e etiquetas */
.notice { border-radius: 10px; padding: 11px 14px; font-size: .9rem; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); }
.notice.warn { border-color: rgba(251, 191, 36, .35); background: var(--warn-soft); color: #fde7a7; }
.notice.err { border-color: rgba(248, 113, 113, .4); background: var(--err-soft); color: #fecaca; }
.notice.ok { border-color: rgba(52, 211, 153, .35); background: var(--ok-soft); color: #bbf7d0; }
.notice.ai { border-color: rgba(139, 92, 246, .4); background: var(--violet-soft); color: #ddd6fe; }
.notice strong { color: inherit; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.tag.violet { background: var(--violet-soft); color: #c4b5fd; }
.tag.cyan { background: var(--primary-soft); color: var(--primary); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.done, .status.aprovado { background: var(--ok-soft); color: var(--ok); }
.status.running, .status.em_geracao { background: var(--primary-soft); color: var(--primary); }
.status.running::before, .status.em_geracao::before { animation: pulse 1.2s infinite; }
.status.failed, .status.falha { background: var(--err-soft); color: var(--err); }
.status.blocked, .status.aguardando_revisao { background: var(--warn-soft); color: var(--warn); }
.status.arquivado { background: var(--surface-3); color: var(--muted); }
.prio { font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--text-2); }
.prio.alta { border-color: rgba(248, 113, 113, .5); color: var(--err); }
.prio.media { border-color: rgba(251, 191, 36, .45); color: var(--warn); }

.progress { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--violet)); transition: width .5s var(--ease); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--primary); animation: spin .8s linear infinite; margin: 0 auto 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- subabas */
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 18px 0 18px; overflow-x: auto; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button, .subtabs a { background: none; border: 0; padding: 10px 14px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.subtabs .on { color: var(--primary); border-bottom-color: var(--primary); }
.subtabs .count { font-size: .72rem; color: var(--muted); margin-left: 4px; }

/* ------------------------------------------------------------- textos */
.text-field { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px; }
.text-field + .text-field { margin-top: 12px; }
.text-field .tf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.text-field .tf-head h3 { margin: 0; font-size: .9rem; color: var(--text-2); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .82rem; padding: 4px 10px; border-radius: 999px; background: var(--surface-3); color: var(--text); border: 1px solid var(--line); }
.desc { min-height: 300px; font-size: .92rem; }

/* ------------------------------------------------------------- mídia */
.media-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tile { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; text-align: left; padding: 0; color: inherit; transition: border-color var(--t), box-shadow var(--t), transform var(--t); }
.tile:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.tile:focus-visible { box-shadow: var(--glow); }
.tile .frame { aspect-ratio: 1/1; background: #0d1522; display: grid; place-items: center; }
.tile .frame img { width: 100%; height: 100%; object-fit: cover; }
.tile .frame .ph { color: var(--muted); font-size: .82rem; text-align: center; padding: 10px; }
.tile .cap { padding: 9px 11px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tile .cap b { font-size: .84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .num { color: var(--primary); font-weight: 700; font-size: .78rem; margin-right: 6px; }
.tile .badge-sel { position: absolute; top: 8px; left: 8px; }
.clips { display: grid; grid-template-columns: repeat(2, minmax(0, 340px)); gap: 18px; }
.clip { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.clip .vframe { background: #000; aspect-ratio: 9/16; display: grid; place-items: center; }
.clip .vframe.h { aspect-ratio: 16/9; }
.clip video { width: 100%; height: 100%; object-fit: contain; }
.clip .body { padding: 12px 14px; }

/* ------------------------------------------------------------- produtos */
.search-hero { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.search-hero input { font-size: 1.02rem; padding: 13px 16px 13px 44px; border-radius: 12px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%237d8aa0' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 15px center; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: inherit; text-decoration: none !important; display: flex; flex-direction: column; transition: border-color var(--t), transform var(--t); }
.pcard:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.pcard:focus-visible { box-shadow: var(--glow); }
.pcard .img { aspect-ratio: 1/1; background: #0d1522; display: grid; place-items: center; color: var(--muted); }
.pcard .img img { width: 100%; height: 100%; object-fit: cover; }
.pcard .body { padding: 11px 13px 13px; }
.pcard h3 { font-size: .92rem; margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .code { font-size: .76rem; color: var(--muted); margin-bottom: 8px; }
.phead { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.phead .pimg { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); background: #0d1522; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; align-items: center; }
.fact-row { display: grid; grid-template-columns: 1fr 1.5fr 150px 36px; gap: 8px; margin-bottom: 8px; }

/* ------------------------------------------------------------- radar */
.radar-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .82rem; margin-top: 10px; }
.summary-list { list-style: none; margin: 0; padding: 0; }
.summary-list li { padding: 8px 0 8px 18px; position: relative; color: var(--text); }
.summary-list li::before { content: ""; position: absolute; left: 2px; top: 16px; width: 6px; height: 6px; border-radius: 50%; background: var(--violet); }
.news-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ncard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: border-color var(--t); text-align: left; color: inherit; }
.ncard:hover { border-color: var(--line-strong); }
.ncard:focus-visible { box-shadow: var(--glow); }
.ncard h3 { margin: 0; font-size: .98rem; line-height: 1.35; }
.ncard .src { color: var(--muted); font-size: .8rem; }
.ncard p { margin: 0; color: var(--text-2); font-size: .9rem; }
.ncard .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; }

/* ------------------------------------------------------------- chat */
.chat { display: grid; grid-template-columns: 280px 1fr; gap: 0; height: calc(100vh - 60px - 28px - 40px); min-height: 520px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.chat.collapsed { grid-template-columns: 0 1fr; }
.chat-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: #0f1724; }
.chat-side .side-head { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.conv-list { overflow-y: auto; flex: 1; padding: 0 6px 10px; }
.conv { display: flex; align-items: center; gap: 4px; border-radius: 8px; }
.conv a { flex: 1; padding: 9px 10px; color: var(--text-2); text-decoration: none !important; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 8px; }
.conv.on a, .conv a:hover { background: var(--surface-2); color: var(--text); }
.conv .icon-btn { width: 30px; height: 30px; opacity: .7; }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chat-head .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msgs { flex: 1; overflow-y: auto; padding: 22px 18px; display: flex; flex-direction: column; gap: 18px; }
.msg { max-width: 760px; width: 100%; margin: 0 auto; }
.msg.user .bubble { margin-left: auto; max-width: 85%; width: fit-content; background: var(--surface-3); border: 1px solid var(--line-strong); padding: 10px 14px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.msg.assistant .bubble { color: var(--text); }
.msg .bubble p { margin: 0 0 10px; }
.msg .bubble p:last-child { margin-bottom: 0; }
.msg .bubble ul, .msg .bubble ol { margin: 0 0 10px; padding-left: 20px; }
.msg .tools { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.msg .refs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.msg .refs a { font-size: .76rem; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text-2); }
.msg .att { display: flex; gap: 6px; margin: 0 0 6px auto; justify-content: flex-end; }
.msg .att img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.action-card { border: 1px solid rgba(34, 211, 238, .35); background: var(--primary-soft); border-radius: 10px; padding: 12px; margin-top: 10px; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: pulse 1s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
.composer { border-top: 1px solid var(--line); padding: 12px 14px; }
.composer-box { max-width: 760px; margin: 0 auto; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface-2); padding: 8px; }
.composer-box:focus-within { border-color: var(--primary); }
.composer textarea { border: 0; background: transparent; box-shadow: none !important; min-height: 44px; max-height: 200px; resize: none; padding: 6px 8px; }
.composer .bar { display: flex; align-items: center; gap: 6px; }
.chat-empty { margin: auto; text-align: center; max-width: 520px; color: var(--text-2); }
.chat-empty .ex { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.chat-empty .ex button { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 14px; cursor: pointer; text-align: left; }
.chat-empty .ex button:hover { border-color: var(--line-strong); }

/* ------------------------------------------------------------- kanban */
.board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 8px; }
.col { background: #0f1724; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 200px; display: flex; flex-direction: column; gap: 8px; transition: border-color var(--t), background var(--t); }
.col.drop { border-color: var(--primary); background: #0f1b2a; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 6px; }
.col-head h2 { font-size: .9rem; margin: 0; color: var(--text-2); }
.col-head .n { font-size: .76rem; color: var(--muted); }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: grab; position: relative; transition: border-color var(--t), box-shadow var(--t), opacity var(--t); }
.tcard:hover { border-color: var(--line-strong); }
.tcard:focus-visible { box-shadow: var(--glow); }
.tcard.dragging { opacity: .4; }
.tcard .t { font-size: .9rem; font-weight: 550; padding-right: 26px; word-break: break-word; }
.tcard .m { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; font-size: .74rem; color: var(--muted); }
.tcard .m .late { color: var(--err); }
.tcard .more-btn { position: absolute; right: 4px; top: 4px; width: 28px; height: 28px; }
.avatar { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--violet-soft); color: #c4b5fd; font-size: .64rem; font-weight: 700; }
.quick-add input { background: transparent; border: 1px dashed var(--line-strong); }
.checklist-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.checklist-item input[type=text] { flex: 1; padding: 6px 8px; }
.comment { border-left: 2px solid var(--line-strong); padding: 4px 0 4px 12px; margin-bottom: 10px; }

/* ------------------------------------------------------------- modal */
.modal-bg { position: fixed; inset: 0; background: rgba(3, 7, 14, 0.72); z-index: 70; display: grid; place-items: center; padding: 16px; animation: fadein var(--t) var(--ease); }
@keyframes fadein { from { opacity: 0; } }
.modal { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; width: min(680px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow); animation: up var(--t) var(--ease); }
.modal.wide { width: min(1000px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 0; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 16px 20px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 20px; flex-wrap: wrap; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }
.viewer { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.viewer .big { background: #0d1522; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.viewer .big img { width: 100%; }

.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast { background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--text); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: .9rem; animation: up var(--t) var(--ease); pointer-events: auto; }
.toast.ok { border-color: rgba(52, 211, 153, .4); }
.toast.err { border-color: rgba(248, 113, 113, .5); color: #fecaca; }

.empty { text-align: center; padding: 56px 20px; color: var(--text-2); }
.empty .icon { width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; color: var(--primary); }
.empty .icon svg { width: 22px; height: 22px; }
.empty p { margin: 0 0 16px; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.table-wrap { overflow-x: auto; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(600px 300px at 50% 0%, rgba(34, 211, 238, 0.08), transparent), var(--bg); }
.login .card { width: min(400px, 100%); padding: 28px; }
.login .brand { justify-content: center; margin-bottom: 20px; font-size: 1.05rem; }

/* ------------------------------------------------------------- responsivo */
@media (max-width: 1000px) {
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .news-grid { grid-template-columns: 1fr; }
  .viewer { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  #app { width: calc(100% - 24px); padding-top: 18px; padding-bottom: 96px; }
  .topbar-inner { width: calc(100% - 24px); height: 54px; gap: 10px; }
  .tabs-main { display: none; }
  .bottom-tabs { display: flex; }
  .save-indicator { min-width: 0; }
  .ctx-chip { max-width: 150px; }
  .field-row { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 4px; }
  .fact-row { grid-template-columns: 1fr 1fr; }
  .clips { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 1fr; height: calc(100vh - 54px - 18px - 96px); }
  .chat .chat-side { display: none; }
  .chat.side-open .chat-side { display: flex; position: absolute; z-index: 30; inset: 54px 0 70px 0; }
  .board { grid-template-columns: repeat(4, 86%); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 38px; }
  .page-head { margin-bottom: 16px; }
  .menu { right: 8px; }
}
