:root {
  --bg: #0a0910;
  --bg2: #0f0d17;
  --card: #13111d;
  --card2: #181525;
  --line: #242036;
  --line2: #2e2945;
  --text: #ece9f6;
  --muted: #8f89a8;
  --dim: #5f5a78;
  --violet: #a855f7;
  --violet2: #7c3aed;
  --pink: #ec4899;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
  --blue: #3b82f6;
  --grad: linear-gradient(90deg, #9333ea, #ec4899);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 70% -10%, rgba(124, 58, 237, .10), transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 20px 12px; border-right: 1px solid var(--line); background: rgba(10, 9, 16, .75); display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; font-weight: 800; font-size: 18px; letter-spacing: -.3px; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 0 24px rgba(168, 85, 247, .45); }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: 0; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--card); color: var(--text); }
.nav a.on { background: linear-gradient(90deg, rgba(147, 51, 234, .28), rgba(147, 51, 234, .06)); color: #fff; box-shadow: inset 2px 0 0 var(--violet); }
.nav .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--dim); padding: 18px 12px 6px; }
.side .foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.main { padding: 26px 34px 80px; min-width: 0; }

.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 24px; letter-spacing: -.4px; background: linear-gradient(90deg, #d8b4fe, #f0abfc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.head .tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.demo-banner { background: linear-gradient(90deg, rgba(245, 158, 11, .15), rgba(245, 158, 11, .04)); border: 1px solid rgba(245, 158, 11, .35); color: #fcd34d; padding: 10px 14px; border-radius: 12px; margin-bottom: 18px; display: flex; gap: 10px; align-items: center; font-size: 13px; }
.demo-banner a { text-decoration: underline; }

/* ---------- cards / grid ---------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1250px) { .g5 { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1100px) { .g3, .g4, .g5 { grid-template-columns: repeat(2, 1fr); } .g2 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .app { grid-template-columns: 1fr; } .side { position: static; height: auto; } .g3, .g4, .g5 { grid-template-columns: 1fr; } .main { padding: 18px; } }
.card { background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card h3 { margin: 0 0 2px; font-size: 14.5px; }
.card .sub { color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }

.kpi { position: relative; overflow: hidden; }
.kpi .lbl { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.kpi .val { font-size: 27px; font-weight: 800; letter-spacing: -.6px; margin: 6px 0 2px; }
.kpi .hint { color: var(--dim); font-size: 11.5px; }
.kpi svg.spark { width: 100%; height: 42px; margin-top: 10px; display: block; }
.c-violet { color: #c084fc; } .c-green { color: #4ade80; } .c-pink { color: #f472b6; } .c-blue { color: #60a5fa; } .c-orange { color: #fbbf24; } .c-red { color: #f87171; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line2); background: var(--card2); padding: 8px 13px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap; transition: .15s; }
.btn:hover { border-color: #4b4470; background: #1d1a2c; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 24px -8px rgba(236, 72, 153, .6); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.danger { color: #fca5a5; border-color: rgba(239, 68, 68, .35); }
.btn.big { width: 100%; justify-content: center; padding: 14px; font-size: 15px; }
.btn.sm { padding: 5px 9px; font-size: 12px; border-radius: 8px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--card2); border-color: var(--line2); color: var(--text); }
.icon-btn.red:hover { color: #f87171; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; font-weight: 600; }
.field small { color: var(--dim); font-size: 11.5px; }
input[type=text], input[type=number], input[type=password], input[type=url], input[type=time], input:not([type]), select, textarea {
  background: #0d0b15; border: 1px solid var(--line2); border-radius: 10px; padding: 9px 11px; outline: none; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(168, 85, 247, .18); }
select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f89a8' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 12px; } .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.grow { flex: 1; }

.seg { display: inline-flex; background: #0d0b15; border: 1px solid var(--line2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 12.5px; }
.seg button.on { background: var(--grad); color: #fff; }
.seg.red button.on.paused { background: #e11d48; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { background: transparent; border: 0; padding: 10px 14px; color: var(--muted); cursor: pointer; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: 6px; }
.tabs button.on { color: #fff; border-color: var(--violet); }
.tabs .count { font-size: 11px; background: var(--card2); border: 1px solid var(--line2); padding: 0 6px; border-radius: 99px; color: var(--muted); }

.toggle { display: inline-block; vertical-align: middle; position: relative; width: 38px; height: 22px; flex: none; cursor: pointer; }
.toggle input { display: none; }
.toggle i { position: absolute; inset: 0; background: #2a2540; border-radius: 99px; transition: .2s; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.toggle input:checked + i { background: var(--green); }
.toggle input:checked + i::after { transform: translateX(16px); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; border: 1px solid; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.nodot::before { display: none; }
.b-green { color: #4ade80; border-color: rgba(34, 197, 94, .35); background: rgba(34, 197, 94, .08); }
.b-red { color: #f87171; border-color: rgba(239, 68, 68, .35); background: rgba(239, 68, 68, .08); }
.b-orange { color: #fbbf24; border-color: rgba(245, 158, 11, .35); background: rgba(245, 158, 11, .08); }
.b-violet { color: #c084fc; border-color: rgba(168, 85, 247, .35); background: rgba(168, 85, 247, .08); }
.b-blue { color: #60a5fa; border-color: rgba(59, 130, 246, .35); background: rgba(59, 130, 246, .08); }
.b-gray { color: var(--muted); border-color: var(--line2); background: rgba(255, 255, 255, .02); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .9px; color: var(--dim); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 10px; border-bottom: 1px solid rgba(36, 32, 54, .6); vertical-align: middle; }
.table tr:hover td { background: rgba(255, 255, 255, .015); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 460px; }

/* ---------- upload wizard ---------- */
.wizard { max-width: 780px; margin: 0 auto; }
.step { background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; transition: .2s; }
.step.locked { opacity: .45; pointer-events: none; }
.step-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.step-h .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: rgba(168, 85, 247, .18); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, .4); }
.step.done .step-h .n { background: var(--green); color: #052e12; border-color: transparent; }
.step-h h3 { margin: 0; font-size: 14.5px; flex: 1; }
.step-h .meta { font-size: 11.5px; color: var(--dim); display: flex; gap: 8px; align-items: center; }
.ok-strip { background: rgba(34, 197, 94, .08); border: 1px solid rgba(34, 197, 94, .3); color: #86efac; border-radius: 10px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 14px; display: flex; gap: 8px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11.5px; font-weight: 700; text-transform: uppercase; padding: 6px 10px; border-radius: 8px; background: #0d0b15; border: 1px solid var(--line2); cursor: pointer; letter-spacing: .3px; }
.chip:hover, .chip.on { border-color: var(--violet); color: #e9d5ff; background: rgba(168, 85, 247, .12); }
.filelist { border: 1px solid var(--line); border-radius: 12px; max-height: 320px; overflow: auto; }
.fileitem { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid rgba(36, 32, 54, .6); cursor: pointer; }
.fileitem:last-child { border-bottom: 0; }
.fileitem:hover { background: rgba(255, 255, 255, .02); }
.fileitem .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fileitem .idx { width: 22px; height: 22px; border-radius: 6px; background: var(--card2); border: 1px solid var(--line2); display: grid; place-items: center; font-size: 11px; color: var(--muted); flex: none; }
.drop { border: 1.5px dashed var(--line2); border-radius: 12px; padding: 30px; text-align: center; color: var(--muted); cursor: pointer; transition: .2s; }
.drop:hover, .drop.over { border-color: var(--violet); background: rgba(168, 85, 247, .05); color: var(--text); }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); margin: 10px 0; flex-wrap: wrap; }
.crumbs a { cursor: pointer; } .crumbs a:hover { color: #fff; }
.assign { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-bottom: 1px solid rgba(36, 32, 54, .6); }
.assign:last-child { border-bottom: 0; }
.assign .copytag { font-size: 11px; color: var(--dim); white-space: nowrap; }

/* ---------- jobs ---------- */
.live { display: flex; align-items: center; gap: 8px; background: rgba(245, 158, 11, .07); border: 1px solid rgba(245, 158, 11, .25); color: #fcd34d; padding: 8px 12px; border-radius: 10px; font-size: 12px; margin-bottom: 14px; font-family: ui-monospace, Menlo, monospace; }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fbbf24; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.jobrow { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin-bottom: 8px; }
.jobrow .t { font-family: ui-monospace, Menlo, monospace; font-weight: 700; }
.bar { height: 6px; background: #221e33; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--grad); border-radius: 99px; transition: width .4s; }
.console { background: #07060c; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; line-height: 1.7; max-height: 180px; overflow: auto; }
.console .ts { color: #7c3aed; } .console .st { color: #60a5fa; } .console .er { color: #f87171; } .console .okk { color: #4ade80; }

/* ---------- ad library ---------- */
.filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: 10px; align-items: end; margin-bottom: 12px; }
@media (max-width: 1100px) { .filters { grid-template-columns: repeat(3, 1fr); } }
.adgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 14px; }
.adcard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; transition: .15s; position: relative; }
.adcard:hover { border-color: #463f68; transform: translateY(-2px); }
.adcard.sel { border-color: var(--violet); box-shadow: 0 0 0 2px rgba(168, 85, 247, .35); }
.adcard .th { aspect-ratio: 1; background: #0d0b15 center/cover no-repeat; position: relative; }
.adcard .th .st { position: absolute; top: 8px; right: 8px; }
.adcard .th .ck { position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; border-radius: 6px; background: rgba(0, 0, 0, .55); border: 1.5px solid rgba(255, 255, 255, .6); cursor: pointer; display: grid; place-items: center; }
.adcard.sel .th .ck { background: var(--violet); border-color: var(--violet); }
.adcard .th .kind { position: absolute; bottom: 8px; left: 8px; background: rgba(0, 0, 0, .6); border-radius: 6px; padding: 3px 6px; font-size: 10.5px; display: flex; gap: 4px; align-items: center; }
.adcard .bd { padding: 10px 12px 12px; }
.adcard .nm { font-weight: 700; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adcard .cp { color: var(--dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 8px; }
.adcard dl { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; margin: 0; font-size: 11.5px; }
.adcard dt { color: var(--muted); } .adcard dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.adcard .acc { margin-top: 8px; font-size: 10.5px; color: var(--dim); }
.selbar { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1b1729; border: 1px solid var(--line2); border-radius: 14px; padding: 10px 12px 10px 18px; display: flex; gap: 10px; align-items: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .6); z-index: 20; }

/* ---------- automations ---------- */
.preset { display: flex; flex-direction: column; gap: 10px; }
.preset .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.preset .ic svg.i { width: 20px; height: 20px; }
.preset h3 { font-size: 15px; }
.preset .desc { color: var(--muted); font-size: 12.5px; flex: 1; }
.preset .bars { display: flex; gap: 2px; align-items: flex-end; height: 18px; }
.preset .bars i { width: 3px; background: currentColor; border-radius: 2px; opacity: .8; }
.ic-violet { background: rgba(168, 85, 247, .15); color: #c084fc; } .ic-green { background: rgba(34, 197, 94, .13); color: #4ade80; }
.ic-orange { background: rgba(245, 158, 11, .13); color: #fbbf24; } .ic-blue { background: rgba(59, 130, 246, .13); color: #60a5fa; } .ic-pink { background: rgba(236, 72, 153, .13); color: #f472b6; }
.autorow { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; margin-bottom: 8px; }
.autorow h4 { margin: 0 0 3px; font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.autorow .sm { font-size: 12px; color: var(--muted); }
.autorow .meta { font-size: 11.5px; color: var(--dim); margin-top: 5px; display: flex; gap: 12px; flex-wrap: wrap; }
.summary-box { background: linear-gradient(135deg, rgba(147, 51, 234, .18), rgba(236, 72, 153, .08)); border: 1px solid rgba(168, 85, 247, .35); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: #f3e8ff; display: flex; gap: 10px; }
.block { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: rgba(255, 255, 255, .01); }
.block-h { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; font-weight: 700; }
.block-h .bi { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 700px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { border: 1px solid var(--line2); border-radius: 10px; padding: 10px; cursor: pointer; background: #0d0b15; }
.tile b { display: block; font-size: 13px; } .tile small { color: var(--dim); font-size: 11px; }
.tile.on { border-color: var(--violet); background: rgba(168, 85, 247, .14); }
.cond { display: grid; grid-template-columns: 1.3fr .7fr 1fr 32px; gap: 8px; align-items: center; margin-bottom: 8px; }
.runrow { border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin-bottom: 8px; }
.runrow > .hd { display: flex; gap: 12px; align-items: center; padding: 12px 16px; cursor: pointer; }
.runrow .bd { border-top: 1px solid var(--line); padding: 12px 16px; }
.warn { background: rgba(245, 158, 11, .07); border: 1px solid rgba(245, 158, 11, .28); color: #fde68a; border-radius: 12px; padding: 10px 14px; font-size: 12.5px; margin-bottom: 16px; display: flex; gap: 10px; }

/* ---------- modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(4, 3, 8, .72); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #14121f; border: 1px solid var(--line2); border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.modal.wide { width: min(760px, 100%); }
.modal .mh { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #14121f; z-index: 2; }
.modal .mh h2 { margin: 0; font-size: 16px; }
.modal .mb { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal .mf { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: #14121f; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #1b1729; border: 1px solid var(--line2); border-radius: 12px; padding: 11px 14px; display: flex; gap: 9px; align-items: center; min-width: 260px; max-width: 420px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: tin .2s; font-size: 13px; }
.toast.ok svg { color: #4ade80; } .toast.err { border-color: rgba(239, 68, 68, .45); } .toast.err svg { color: #f87171; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty svg.i { width: 34px; height: 34px; color: var(--dim); margin-bottom: 8px; }
.skeleton { background: linear-gradient(90deg, #15121f 0%, #1d1a2b 50%, #15121f 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; }
@keyframes sk { to { background-position: -200% 0; } }
.spin { width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }
.feed .it { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid rgba(36, 32, 54, .6); }
.feed .it:last-child { border-bottom: 0; }
.feed .dot { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.chart { width: 100%; height: 190px; display: block; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.kbd { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; background: #0d0b15; border: 1px solid var(--line2); border-radius: 6px; padding: 1px 6px; }
ol.steps { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }

.tablewrap { overflow-x: auto; max-width: 100%; }
.main { overflow-x: hidden; }

/* ---------- sesion ---------- */
body.locked .app { display: none; }
.auth[hidden] { display: none; }
.auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; z-index: 40; overflow: auto; }
.auth-card { width: min(400px, 100%); background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line2); border-radius: 18px; padding: 26px; box-shadow: 0 30px 80px rgba(0, 0, 0, .55); }
.auth-card h2 { margin: 0 0 12px; font-size: 19px; }
.me { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.me .av { width: 28px; height: 28px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 12px; flex: none; }
.me b { display: block; font-size: 12.5px; color: var(--text); }

/* ---------- celular ---------- */
.topbar, .bottomnav, .scrim { display: none; }
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .app { display: block; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; background: rgba(10, 9, 16, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; font-size: 16px; gap: 8px; }
  .topbar .brand .logo { width: 26px; height: 26px; border-radius: 8px; }
  .topbar #top-title { margin-left: auto; max-width: 45%; text-align: right; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: 272px; height: 100%; z-index: 45; transform: translateX(-102%); transition: transform .22s ease; background: #0c0a13; overflow-y: auto; padding-top: calc(env(safe-area-inset-top) + 16px); padding-bottom: calc(env(safe-area-inset-bottom) + 12px); }
  body.nav-open .side { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .6); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(4, 3, 8, .6); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .nav a { padding: 11px 12px; }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(12, 10, 19, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px); }
  .bottomnav a, .bottomnav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border: 0; background: none; color: var(--dim); font-size: 10.5px; font-weight: 600; cursor: pointer; }
  .bottomnav .i { width: 21px; height: 21px; }
  .bottomnav .on { color: #e9d5ff; }
  .main { padding: 16px 14px calc(env(safe-area-inset-bottom) + 90px); }
  .head { margin-bottom: 14px; gap: 10px; }
  .head h1 { font-size: 21px; }
  .head .tools { width: 100%; }
  .card { padding: 14px; border-radius: 12px; }
  .toasts { left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 76px); }
  .toast { min-width: 0; max-width: none; }
  .modal-bg { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  input[type=text], input[type=number], input[type=password], input:not([type]), select, textarea { font-size: 16px; } /* evita el zoom de iPhone */
  /* tablas marcadas como .cards-sm: cada fila se vuelve una tarjeta */
  .table.cards-sm thead { display: none; }
  .table.cards-sm, .table.cards-sm tbody, .table.cards-sm tr, .table.cards-sm td { display: block; width: 100%; }
  .table.cards-sm tr { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; background: rgba(255, 255, 255, .015); }
  .table.cards-sm td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  .table.cards-sm td[data-l]::before { content: attr(data-l); color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; font-weight: 700; text-align: left; flex: none; }
  .table.cards-sm tr { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .table.cards-sm td { font-size: 13px; }
  .table.cards-sm td.t { grid-column: 1 / -1; order: -1; display: block; text-align: left; font-size: 15px; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  .table.cards-sm td.t::before { display: none; }
  .table.cards-sm td.t .clip { max-width: none !important; white-space: normal; }
  /* el resto de tablas: se desplazan de lado dentro de su tarjeta en vez de cortarse */
  .table:not(.cards-sm) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table.cards-sm td.num { justify-content: flex-end; }
  .table.cards-sm tr:hover td { background: none; }
}
.only-m { display: none; }
@media (max-width: 760px) {
  .only-m { display: block; }
  #m-alerts:empty { display: none; }
  #m-alerts { margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
  .malert { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; border: 1px solid; }
  .malert span { flex: 1; min-width: 0; }
  .malert b { display: block; font-size: 14px; }
  .malert small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .malert.red { border-color: rgba(239, 68, 68, .5); background: rgba(239, 68, 68, .1); } .malert.red > svg:first-child { color: #f87171; }
  .malert.green { border-color: rgba(34, 197, 94, .45); background: rgba(34, 197, 94, .08); } .malert.green > svg:first-child { color: #4ade80; }
}
