:root {
  --bg: #0c0d10;
  --bg2: #121419;
  --panel: #171a21;
  --panel2: #1d2129;
  --line: #262b35;
  --line2: #323846;
  --text: #e8eaef;
  --muted: #8b93a3;
  --dim: #5f6676;
  --accent: #ff5a1f;
  --accent2: #ff7a45;
  --accent-soft: rgba(255, 90, 31, .14);
  --ok: #35c98a;
  --warn: #f2b33d;
  --err: #ff5c6c;
  --info: #5aa9ff;
  --r: 10px;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 "Segoe UI", Inter, system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
body.team #nav a[data-r="up"], body.team #nav a[data-r="cat"], body.team #nav a[data-r="cfg"], body.team .top .btn.primary { display: none; }
.detail.readonly { grid-template-columns: minmax(0, 1fr); max-width: 1000px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--bg2); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 12px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 22px; }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; font-size: 14px; color: #fff; }
.brand b { display: block; letter-spacing: .06em; font-size: 14px; }
.brand small { display: block; color: var(--muted); letter-spacing: .32em; font-size: 10px; }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a { display: flex; gap: 11px; align-items: center; padding: 9px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; }
#nav a i { font-style: normal; width: 18px; text-align: center; opacity: .8; }
#nav a:hover { background: var(--panel); color: var(--text); }
#nav a.on { background: var(--accent-soft); color: var(--text); }
#nav a.on i { color: var(--accent); opacity: 1; }
.side-foot { margin-top: auto; font-size: 12px; color: var(--dim); padding: 8px; }
.side-foot .pill { margin-bottom: 6px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; gap: 12px; align-items: center; padding: 12px 24px; background: rgba(12, 13, 16, .86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.gsearch { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; max-width: 760px; }
.gsearch:focus-within { border-color: var(--accent); }
.gsearch span { color: var(--muted); font-size: 17px; }
.gsearch input { flex: 1; background: none; border: 0; outline: 0; padding: 10px 0; min-width: 0; }
.menu { display: none; }
.view { padding: 24px; max-width: 1500px; width: 100%; }

/* ---------- elementos ---------- */
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
.sub { color: var(--muted); margin: 0 0 20px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line2); background: var(--panel2); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { color: var(--err); border-color: rgba(255, 92, 108, .35); background: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 18px; padding: 6px; color: var(--muted); }
input.in, select.in, textarea.in { width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; padding: 9px 11px; outline: 0; }
input.in:focus, select.in:focus, textarea.in:focus { border-color: var(--accent); }
textarea.in { resize: vertical; min-height: 90px; }
label.f { display: block; font-size: 12px; color: var(--muted); margin: 0 0 5px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.panel + .panel { margin-top: 16px; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 2px 9px; font-size: 11.5px; font-weight: 600; background: var(--panel2); border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: rgba(53, 201, 138, .35); background: rgba(53, 201, 138, .08); }
.pill.warn { color: var(--warn); border-color: rgba(242, 179, 61, .35); background: rgba(242, 179, 61, .08); }
.pill.err { color: var(--err); border-color: rgba(255, 92, 108, .35); background: rgba(255, 92, 108, .08); }
.pill.info { color: var(--info); border-color: rgba(90, 169, 255, .35); background: rgba(90, 169, 255, .08); }
.pill.acc { color: var(--accent2); border-color: rgba(255, 90, 31, .35); background: var(--accent-soft); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: var(--panel2); border: 1px solid var(--line2); border-radius: 6px; padding: 3px 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.tag:hover { color: var(--text); border-color: var(--accent); }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); border: 1px dashed var(--line2); border-radius: var(--r); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.notice { border: 1px solid rgba(242, 179, 61, .35); background: rgba(242, 179, 61, .07); color: #f6d58f; border-radius: var(--r); padding: 12px 14px; margin-bottom: 18px; }
.notice a { text-decoration: underline; }

/* ---------- dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.stat small { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.stat b { font-size: 28px; font-weight: 650; letter-spacing: -.02em; }
.stat .meta { color: var(--dim); font-size: 12px; margin-top: 2px; }
.stat.hl b { color: var(--accent2); }
.bar { height: 6px; background: var(--panel2); border-radius: 9px; overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.catbars { display: grid; gap: 8px; }
.catbar { display: grid; grid-template-columns: 180px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; cursor: pointer; }
.catbar:hover span:first-child { color: var(--text); }
.catbar span:first-child { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.catbar .bar { margin: 0; }
.catbar span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.two { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* ---------- grid de cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; position: relative; cursor: pointer; transition: border-color .12s, transform .12s; }
.card:hover { border-color: var(--line2); transform: translateY(-1px); }
.card.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.thumb { position: relative; aspect-ratio: 16 / 9; background: #07080a; display: grid; place-items: center; overflow: hidden; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb .ph { color: var(--dim); font-size: 30px; }
.thumb .dur { position: absolute; right: 7px; bottom: 7px; background: rgba(0, 0, 0, .78); padding: 1px 6px; border-radius: 4px; font-size: 11.5px; font-family: var(--mono); }
.thumb .ori { position: absolute; left: 7px; bottom: 7px; background: rgba(0, 0, 0, .78); padding: 1px 6px; border-radius: 4px; font-size: 11px; }
.thumb .st { position: absolute; left: 7px; top: 7px; }
.chk { position: absolute; right: 7px; top: 7px; width: 24px; height: 24px; border-radius: 6px; background: rgba(0, 0, 0, .6); border: 1px solid rgba(255, 255, 255, .35); display: grid; place-items: center; font-size: 14px; opacity: 0; transition: opacity .1s; z-index: 2; }
.card:hover .chk, .card.sel .chk, .selecting .chk { opacity: 1; }
.card.sel .chk { background: var(--accent); border-color: var(--accent); }
.card .body { padding: 10px 12px 12px; }
.card .name { font-family: var(--mono); font-size: 11.5px; color: var(--text); word-break: break-all; line-height: 1.35; max-height: 2.7em; overflow: hidden; }
.card .desc { color: var(--muted); font-size: 12.5px; margin: 6px 0 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.card .foot { display: flex; justify-content: space-between; gap: 6px; font-size: 11.5px; color: var(--dim); align-items: center; }
.card .foot .pill { max-width: 60%; overflow: hidden; text-overflow: ellipsis; }

/* ---------- biblioteca ---------- */
.lib { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: start; }
.filters { position: sticky; top: 80px; }
.ftoggle { display: none !important; }
.filters .field { margin-bottom: 12px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.selbar { position: sticky; top: 66px; z-index: 10; background: var(--accent); color: #fff; padding: 9px 14px; border-radius: 9px; display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.selbar .btn { background: rgba(0, 0, 0, .2); border-color: rgba(255, 255, 255, .3); color: #fff; }

/* ---------- detalhe ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.player { background: #000; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); display: grid; place-items: center; }
.player video, .player img { max-width: 100%; max-height: 72vh; display: block; }
.player audio { width: 90%; margin: 40px 0; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 7px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.fname { font-family: var(--mono); font-size: 14px; word-break: break-all; }
ul.apps { margin: 0; padding-left: 18px; color: var(--muted); }
ul.apps li { margin-bottom: 3px; }

/* ---------- upload ---------- */
.drop { border: 2px dashed var(--line2); border-radius: 14px; padding: 46px 20px; text-align: center; background: var(--bg2); transition: .12s; cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .big { font-size: 38px; color: var(--accent); }
.drop b { display: block; font-size: 16px; margin: 6px 0 2px; }
.uplist { display: grid; gap: 8px; margin-top: 16px; }
.up { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px 8px 8px; }
.up .t { width: 64px; height: 36px; border-radius: 5px; background: #000; overflow: hidden; display: grid; place-items: center; color: var(--dim); }
.up .t img { width: 100%; height: 100%; object-fit: cover; }
.up .n { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up .s { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up .bar { margin-top: 5px; }

/* ---------- copy match ---------- */
.cm-seg { border-left: 3px solid var(--accent); padding: 4px 0 4px 16px; margin: 0 0 26px; }
.cm-seg blockquote { margin: 0 0 4px; font-size: 15.5px; color: var(--text); }
.cm-seg .idea { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.cm-takes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.cm-take { display: grid; grid-template-columns: 136px 1fr; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; cursor: pointer; }
.cm-take:hover { border-color: var(--line2); }
.cm-take .thumb { border-radius: 6px; }
.cm-take .why { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.cm-take .rank { font-size: 11px; color: var(--accent2); font-weight: 700; letter-spacing: .05em; }

/* ---------- categorias ---------- */
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.catc h3 { margin: 0; font-size: 15px; }
.catc .code { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.subs { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.subs div { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 4px 6px; border-radius: 6px; color: var(--muted); }
.subs div:hover { background: var(--panel2); }
.subs .acts { display: none; gap: 2px; }
.subs div:hover .acts { display: flex; }
.subs .acts button { font-size: 12px; padding: 2px 5px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1000px 500px at 50% -10%, rgba(255, 90, 31, .14), transparent), var(--bg); }
.auth .box { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.auth .brand { padding: 0 0 18px; }
.auth .err { color: var(--err); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ---------- modal / toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal .box { width: 100%; max-width: 460px; background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; padding: 22px; }
.modal h2 { margin-bottom: 10px; }
.modal p { color: var(--muted); margin: 0 0 18px; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 8px; max-width: 380px; box-shadow: 0 8px 30px rgba(0, 0, 0, .4); font-size: 13px; }
.toast.err { border-left-color: var(--err); }
.toast.ok { border-left-color: var(--ok); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line2); border-top-color: var(--accent); border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) {
  .detail, .two { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; z-index: 40; width: 250px; transform: translateX(-100%); transition: transform .18s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .5); }
  .menu { display: block; }
  .top { padding: 10px 16px; }
  .top .btn.primary { display: none; }
  .view { padding: 16px; }
  .lib { grid-template-columns: 1fr; }
  .filters { position: static; display: none; }
  .filters.open { display: block; }
  .ftoggle { display: inline-flex !important; justify-self: start; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .catbar { grid-template-columns: 120px 1fr 32px; }
  .cm-take { grid-template-columns: 110px 1fr; }
  .kv { grid-template-columns: 110px 1fr; }
}
