:root {
  --orange: #f28c06; --orange-dark: #d77a00; --orange-soft: #fdf3e6;
  --green: #669900; --red: #c0392b;
  --ink: #23262b; --muted: #6b6f76; --line: #e7e4de; --bg: #f6f5f2; --card: #fff;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 16px; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 12px; }

.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.bar { max-width: 1200px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 24px; }
.product { font-weight: 600; font-size: 13px; color: var(--muted); border-left: 1px solid var(--line); padding-left: 12px; }
nav { display: flex; gap: 4px; flex: 1; }
.tab { all: unset; cursor: pointer; padding: 8px 12px; border-radius: 8px; font-weight: 500; color: var(--muted); }
.tab:hover { background: var(--bg); color: var(--ink); }
.tab.active { color: var(--ink); background: var(--orange-soft); box-shadow: inset 0 -2px 0 var(--orange); }
.tab:focus-visible { outline: 2px solid var(--orange); }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin-left: auto; }

main { max-width: 1200px; margin: 0 auto; padding: 28px 24px 64px; }
.view { display: flex; flex-direction: column; gap: 20px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.card.flush { padding: 0; overflow: hidden; }

label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; }
input[type=email], input[type=search], input:not([type]), input[type=text] {
  width: 100%; font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(242,140,6,.18); }
input:disabled { background: var(--bg); color: var(--muted); }
input[type=file] { font: inherit; max-width: 100%; }

.btn { font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: 9px 16px; border: 1px solid transparent; }
.btn.primary { background: var(--orange); color: #fff; }
.btn.primary:hover { background: var(--orange-dark); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: transparent; border-color: #f0d2ce; color: var(--red); }
.btn.danger:hover { background: #fdf1ef; }
.btn.link { background: none; color: var(--muted); padding: 8px 0; font-weight: 500; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.block { width: 100%; margin-top: 14px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.login { max-width: 420px; margin: 48px auto; width: 100%; }
.login h1 { margin-bottom: 6px; }
.login p.muted { margin: 0 0 22px; }
.otp { font-size: 22px !important; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.msg { min-height: 1.5em; margin: 12px 0 0; font-size: 13px; }
.msg.error { color: var(--red); }
.msg.ok { color: var(--green); }

.guide { background: var(--orange-soft); border-left: 3px solid var(--orange); border-radius: 8px; padding: 14px 18px; margin-bottom: 20px; }
.guide p { margin: 0; }
.guide ul { margin: 8px 0 10px; padding-left: 18px; }
.guide li { margin: 4px 0; }
.guide code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: #fff; padding: 1px 5px; border-radius: 4px; }
.hint.warn { color: #a65c00; }
.upload { display: grid; grid-template-columns: 1fr 1fr auto; gap: 16px; align-items: end; }
.field .hint { display: block; margin-top: 4px; min-height: 18px; }
.actions { display: flex; gap: 10px; align-items: center; }
.actions.end { justify-content: flex-end; margin-top: 16px; }
.actions.end .hint { margin-right: auto; }
.upload .actions { padding-bottom: 22px; }
.progress { margin-top: 12px; }
.progress-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; }
.track { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--orange); transition: width .2s; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fbfaf8; white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.table td.num { white-space: nowrap; color: var(--muted); }
.table td.acts { text-align: right; white-space: nowrap; }
.table td.acts .btn + .btn { margin-left: 6px; }
.vname { all: unset; cursor: pointer; font-weight: 600; }
.vname:hover { color: var(--orange-dark); text-decoration: underline; }
.vname:focus-visible { outline: 2px solid var(--orange); }
.sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); }
.badge.res { background: #eef5e3; color: #4d7300; }
.badge.coll { background: var(--orange-soft); color: var(--orange-dark); }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; margin: 0; }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.opt { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 14px; cursor: pointer; margin: 0; font-weight: 400; }
.opt:has(input:checked) { border-color: var(--orange); background: var(--orange-soft); }
.opt input { accent-color: var(--orange); margin-top: 3px; }
.opt small { display: block; color: var(--muted); font-size: 12px; }
#coll-title-field { margin-bottom: 14px; }
.filter { margin: 10px 0; }
.picker { border: 1px solid var(--line); border-radius: 10px; max-height: 420px; overflow: auto; }
.prow { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.prow:last-child { border-bottom: 0; }
.prow.on { background: #fffaf2; }
.prow input[type=checkbox], .prow input[type=radio] { width: 18px; height: 18px; accent-color: var(--orange); margin: 0; }
.prow .pname { margin: 0; font-weight: 500; cursor: pointer; }
.order { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 99px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; margin-right: 6px; padding: 0 5px; }

.links { display: flex; flex-direction: column; gap: 12px; }
.link-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: 18px 20px; }
.link-card h3 { margin: 0; font-size: 15px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-card .url { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--orange-dark); overflow-wrap: anywhere; }
.link-card ol { margin: 6px 0 0; padding-left: 20px; color: var(--muted); font-size: 13px; }
.link-card ol .orig { font-size: 12px; opacity: .8; }
.link-card .acts { display: flex; gap: 6px; align-items: flex-start; }

.dlg { border: 0; border-radius: 14px; padding: 18px; width: min(520px, calc(100vw - 32px)); box-shadow: 0 30px 60px -20px rgba(0,0,0,.4); }
.dlg.wide { width: min(960px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(20, 20, 22, .55); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.dlg video { width: 100%; max-height: 70vh; background: #000; border-radius: 8px; display: block; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.dlg a { color: var(--orange-dark); font-weight: 500; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); z-index: 50; max-width: calc(100vw - 32px); }
.toast.error { background: var(--red); }

@media (max-width: 800px) {
  .bar { flex-wrap: wrap; gap: 10px 16px; padding: 10px 16px; }
  nav { order: 3; flex-basis: 100%; }
  main { padding: 20px 16px 48px; }
  .upload { grid-template-columns: 1fr; }
  .upload .actions { padding-bottom: 0; }
  .choice { grid-template-columns: 1fr; }
  .prow { grid-template-columns: 24px 1fr; }
  .prow .dname { grid-column: 2; }
  .link-card { grid-template-columns: 1fr; }
  .product { display: none; }
}
