/* Ruflux Portal: the Ruflux Studio look, slimmed. Near-black canvas, one lime accent. */
@font-face { font-family: "Archivo"; src: url("fonts/archivo-var-latin.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
:root {
  color-scheme: dark;
  --bg: #0a0a0b; --panel: #111114; --surface: #16161a; --surface-2: #1d1d22; --surface-3: #25252b;
  --line: #222227; --line-2: #2f2f36; --line-3: #3b3b43;
  --text: #f2f2ee; --text-2: #b4b4ae; --text-3: #8d8d87; --text-inv: #0a0a0b;
  --lime: #c8f000; --lime-hover: #d5ff1a; --lime-press: #b2d600; --lime-soft: rgba(200,240,0,.12); --lime-line: rgba(200,240,0,.42);
  --ok: #43d68a; --ok-soft: rgba(67,214,138,.14); --warn: #f2b440; --warn-soft: rgba(242,180,64,.14); --err: #ff6166; --err-soft: rgba(255,97,102,.14); --info: #86b7ff; --info-soft: rgba(134,183,255,.14);
  --r-xs: 6px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Archivo", var(--font-ui);
  --shadow-pop: 0 14px 36px -10px rgba(0,0,0,.72), 0 3px 10px rgba(0,0,0,.42);
  --ease: cubic-bezier(.16,1,.3,1);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; min-height: 100dvh; }
a { color: var(--lime); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea { font: inherit; color: inherit; }
img, video { max-width: 100%; display: block; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

/* ---------------------------------------------------------- top bar */
.rp-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; height: 60px; padding: 0 max(20px, env(safe-area-inset-left)); background: rgba(10,10,11,.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.rp-logo { height: 26px; width: auto; }
.rp-co { color: var(--text-2); font-size: 13px; padding-left: 14px; border-left: 1px solid var(--line-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-top .sp { flex: 1; }
.rp-bal { display: inline-flex; align-items: baseline; gap: 8px; padding: 7px 14px; border-radius: var(--r-pill); background: var(--lime-soft); border: 1px solid var(--lime-line); color: var(--lime); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-bal small { color: var(--text-2); font-weight: 500; font-size: 11.5px; }
.rp-nav { display: flex; gap: 4px; padding: 0 max(20px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); background: var(--bg); overflow-x: auto; scrollbar-width: none; }
.rp-nav::-webkit-scrollbar { display: none; }
.rp-nav button { appearance: none; background: none; border: 0; padding: 13px 14px 12px; color: var(--text-3); font-weight: 600; font-size: 13.5px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.rp-nav button:hover { color: var(--text); }
.rp-nav button[aria-current="page"] { color: var(--text); border-bottom-color: var(--lime); }
.rp-nav .badge { margin-left: 6px; }

.rp-main { max-width: 1160px; margin: 0 auto; padding: 24px max(20px, env(safe-area-inset-left)) 80px; }
.rp-h1 { font-family: var(--font-display); font-stretch: 112%; font-weight: 700; font-size: 26px; letter-spacing: -.01em; margin: 0 0 4px; }
.rp-h2 { font-family: var(--font-display); font-stretch: 108%; font-weight: 650; font-size: 17px; margin: 0 0 12px; }
.rp-sub { color: var(--text-3); margin: 0 0 20px; }

/* ---------------------------------------------------------- surfaces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.card + .card { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 13px; }
.note.lime { background: var(--lime-soft); border-color: var(--lime-line); color: var(--text); }
.note.err { background: var(--err-soft); border-color: rgba(255,97,102,.35); color: #ffd6d7; }
.note svg { flex: none; margin-top: 2px; }

/* ---------------------------------------------------------- forms */
.field { display: block; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.input, textarea.input { width: 100%; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 11px 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--lime-line); box-shadow: 0 0 0 3px var(--lime-soft); }
textarea.input { min-height: 120px; resize: vertical; line-height: 1.55; }
.input::placeholder { color: var(--text-3); }
.counter { text-align: right; font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

.btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 13.5px; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--surface-3); border-color: var(--line-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--lime); border-color: var(--lime); color: var(--text-inv); }
.btn.primary:hover { background: var(--lime-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface); color: var(--text); }
.btn.danger { color: var(--err); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn.lg { min-height: 50px; padding: 0 22px; font-size: 15px; border-radius: 14px; }
.btn.block { width: 100%; }

/* ---------------------------------------------------------- themed dropdown (no native <select>) */
.dd { position: relative; }
.dd-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 0 12px 0 13px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); cursor: pointer; text-align: left; }
.dd-btn:hover { border-color: var(--line-3); }
.dd.open .dd-btn { border-color: var(--lime-line); box-shadow: 0 0 0 3px var(--lime-soft); }
.dd-btn .v { display: flex; flex-direction: column; min-width: 0; }
.dd-btn .v b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-btn .v i { font-style: normal; font-size: 11.5px; color: var(--text-3); }
.dd-btn svg { flex: none; color: var(--text-3); transition: transform .2s var(--ease); }
.dd.open .dd-btn svg { transform: rotate(180deg); }
.dd-btn:disabled { opacity: .5; cursor: not-allowed; }
.dd-list { position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 6px); min-width: 180px; max-height: 300px; overflow: auto; padding: 6px; margin: 0; list-style: none; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-md); box-shadow: var(--shadow-pop); animation: ddIn .16s var(--ease); }
.dd.up .dd-list { top: auto; bottom: calc(100% + 6px); }
@keyframes ddIn { from { opacity: 0; transform: translateY(-4px); } }
.dd-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; }
.dd-list li .t { display: flex; flex-direction: column; }
.dd-list li .t i { font-style: normal; font-size: 11.5px; color: var(--text-3); }
.dd-list li .r { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.dd-list li:hover, .dd-list li.act { background: var(--surface-3); }
.dd-list li[aria-selected="true"] { color: var(--lime); }
.dd-list li[aria-selected="true"]::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--lime); flex: none; }

/* ---------------------------------------------------------- composer */
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tier { appearance: none; text-align: left; padding: 13px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-2); cursor: pointer; transition: border-color .15s, background .15s; }
.tier:hover { border-color: var(--line-3); }
.tier[aria-pressed="true"] { border-color: var(--lime); background: var(--lime-soft); }
.tier b { display: block; font-family: var(--font-display); font-stretch: 110%; font-size: 15.5px; }
.tier .chip { display: inline-block; margin: 6px 0 6px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 600; }
.tier[aria-pressed="true"] .chip { background: rgba(200,240,0,.18); color: var(--lime); }
.tier .from { display: block; color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.tier .bl { display: block; color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
.opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid2 > *, .opts > *, .tiers > * { min-width: 0; }
.dd-btn .v i { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drop { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px dashed var(--line-3); border-radius: var(--r-md); background: var(--surface); cursor: pointer; transition: border-color .15s; }
.drop:hover, .drop.over { border-color: var(--lime-line); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .thumb { width: 64px; height: 64px; flex: none; border-radius: var(--r-sm); background: var(--surface-3) center/cover no-repeat; display: grid; place-items: center; color: var(--text-3); }
.drop .tx b { display: block; font-weight: 600; }
.drop .tx span { font-size: 12px; color: var(--text-3); }
.drop .x { position: relative; z-index: 2; margin-left: auto; }
.pricebox { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(200,240,0,.09), rgba(200,240,0,.03)); border: 1px solid var(--lime-line); }
.pricebox .p { font-family: var(--font-display); font-stretch: 112%; font-size: 30px; font-weight: 700; color: var(--lime); font-variant-numeric: tabular-nums; line-height: 1.1; }
.pricebox .s { font-size: 12px; color: var(--text-2); }
.pricebox.low { background: var(--err-soft); border-color: rgba(255,97,102,.4); }
.pricebox.low .p { color: var(--err); }

/* ---------------------------------------------------------- jobs + history */
.jobs { display: flex; flex-direction: column; gap: 10px; }
.job { display: flex; gap: 14px; align-items: center; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.job .ic { width: 38px; height: 38px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.job .bd { flex: 1; min-width: 0; }
.job .pr { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
.job .mt { font-size: 12px; color: var(--text-3); }
.bar { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--lime); border-radius: 4px; transition: width .6s var(--ease); }
.bar.ind i { width: 30% !important; animation: ind 1.4s ease-in-out infinite; }
@keyframes ind { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 650; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge.run { background: var(--lime-soft); color: var(--lime); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.run .dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.vcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; }
.vcard .media { aspect-ratio: 16/9; background: #000; display: grid; place-items: center; position: relative; }
.vcard .media video { width: 100%; height: 100%; object-fit: contain; }
.vcard .media .ph { color: var(--text-3); font-size: 12.5px; text-align: center; padding: 16px; }
.vcard .bd { padding: 13px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.vcard .pr { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5px; }
.vcard .mt { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 12px; color: var(--text-3); }
.vcard .ft { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 4px; }

.empty { text-align: center; padding: 42px 20px; color: var(--text-3); border: 1px dashed var(--line-2); border-radius: var(--r-lg); }
.empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }

/* pagination */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pager button { min-width: 36px; height: 36px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-variant-numeric: tabular-nums; }
.pager button:hover:not(:disabled) { border-color: var(--line-3); }
.pager button[aria-current="page"] { background: var(--lime); border-color: var(--lime); color: var(--text-inv); font-weight: 700; }
.pager button:disabled { opacity: .4; cursor: default; }
.pager .gap { color: var(--text-3); padding: 0 2px; }
.pager .info { width: 100%; text-align: center; font-size: 12px; color: var(--text-3); }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .pos { color: var(--ok); }
.tbl .neg { color: var(--text-2); }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { padding: 16px; border-radius: var(--r-md); background: var(--panel); border: 1px solid var(--line); }
.stat .k { font-size: 12px; color: var(--text-3); font-weight: 600; }
.stat .v { font-family: var(--font-display); font-stretch: 110%; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; }
.stat .v.lime { color: var(--lime); }
.stat .s { font-size: 12px; color: var(--text-3); }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.66); display: grid; place-items: center; padding: 20px; animation: fade .18s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(480px, 100%); max-height: calc(100dvh - 40px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; padding: 22px; box-shadow: var(--shadow-pop); animation: pop .22s var(--ease); }
.modal.wide { width: min(760px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal h3 { margin: 0 0 6px; font-family: var(--font-display); font-stretch: 110%; font-size: 19px; }
.modal .acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13.5px; margin: 14px 0; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; text-align: right; }
.toasts { position: fixed; z-index: 90; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: var(--r-md); background: var(--surface-3); border: 1px solid var(--line-3); box-shadow: var(--shadow-pop); font-size: 13.5px; animation: pop .2s var(--ease); }
.toast.ok { border-color: rgba(67,214,138,.45); }
.toast.err { border-color: rgba(255,97,102,.5); }
.copybox { display: flex; gap: 8px; }
.copybox .input { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

/* ---------------------------------------------------------- login */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 18px; background: radial-gradient(900px 500px at 50% -10%, rgba(200,240,0,.10), transparent 70%), var(--bg); }
.auth-card { width: min(410px, 100%); }
.auth-card .logo { height: 40px; margin: 0 auto 26px; }
.auth-card .card { padding: 26px; }
.auth-card h1 { font-family: var(--font-display); font-stretch: 112%; font-size: 22px; margin: 0 0 4px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.gbtn { display: flex; justify-content: center; min-height: 44px; }
.auth .foot { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 18px; }

.spin { width: 16px; height: 16px; border: 2px solid rgba(0,0,0,.25); border-top-color: currentColor; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.skel { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: var(--r-md); }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------------------------------------------------------- mobile */
@media (max-width: 900px) {
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .rp-top { height: 56px; gap: 10px; padding: 0 14px; }
  .rp-logo { height: 22px; }
  .rp-co { display: none; }
  .rp-bal { padding: 6px 11px; font-size: 13px; }
  .rp-bal small { display: none; }
  .rp-nav { padding: 0 8px; }
  .rp-nav button { padding: 12px 10px 11px; font-size: 13px; }
  .rp-main { padding: 18px 14px 80px; }
  .rp-h1 { font-size: 22px; }
  .card { padding: 16px; border-radius: 14px; }
  .opts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .opts > :first-child { grid-column: 1 / -1; }
  .tiers { grid-template-columns: minmax(0, 1fr); }
  .tier { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; align-items: center; }
  .tier b { grid-column: 1; }
  .tier .chip { grid-column: 1; justify-self: start; margin: 4px 0 2px; }
  .tier .from { grid-column: 2; grid-row: 1 / span 2; text-align: right; }
  .tier .bl { grid-column: 1 / -1; }
  .pricebox .p { font-size: 26px; }
  .vgrid { grid-template-columns: minmax(0, 1fr); }
  .job { flex-wrap: wrap; }
  .job > .row { flex-direction: row !important; align-items: center !important; justify-content: space-between; width: 100%; padding-left: 52px; }
  .modal { padding: 18px; }
  .modal .acts .btn { flex: 1; }
}
