/* Framecast dashboard — "darkroom" UI
   photo paper white · developer ink · one safelight red */
:root {
  --paper: #FFFFFF;
  --ink: #111111;
  --red: #E0301E;
  --red-ink: #B8220F;
  --muted: #6B6B6B;
  --faint: #9A9A96;
  --sheet: #F3F3F1;
  --line: #E4E4E1;
  --ok: #1F9D55;
  --display: "Alexandria", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --body: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 14px; --r-sm: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 15px/1.6 var(--body); -webkit-font-smoothing: antialiased; }
body.noscroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
.mono { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.sm { font-size: 13px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
::selection { background: var(--red); color: #fff; }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 56px; background: rgba(255,255,255,.92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-start { display: flex; align-items: center; gap: 48px; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; direction: ltr; font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -.03em; }
.brand-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--red); flex: none; }
.nav { display: flex; align-items: center; gap: 32px; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--muted); font-size: 15px; padding: 4px 0; border-bottom: 2px solid transparent; white-space: nowrap; transition: color .15s; }
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--red); }
.top-end { display: flex; align-items: center; gap: 16px; flex: none; }
.top-stats { font-size: 13px; color: var(--muted); white-space: nowrap; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; transition: background .15s; }
.avatar:hover { background: var(--red); }
.avatar svg { width: 16px; height: 16px; }

.view { max-width: 1440px; margin: 0 auto; padding: 56px 56px 96px; }

/* ---------- type ---------- */
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; color: var(--red); direction: ltr; unicode-bidi: isolate; text-transform: uppercase; }
.display { font-family: var(--display); font-weight: 800; font-size: 56px; line-height: 1.38; letter-spacing: -.02em; }
.display.xl { font-size: 64px; line-height: 1.15; }
.display.md { font-size: 44px; line-height: 1.3; }
.display .light { font-weight: 300; color: #C9C9C4; }
.lead { font-size: 16px; line-height: 26px; color: var(--muted); max-width: 400px; }
.label { font-size: 14px; font-weight: 600; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 20px; border-radius: 12px; border: 1px solid transparent; background: var(--ink); color: #fff; font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap; transition: background .15s, transform .1s, opacity .15s; }
.btn:hover { background: #2A2A2A; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.red { background: var(--red); }
.btn.red:hover { background: var(--red-ink); }
.btn.soft { background: var(--sheet); color: var(--ink); }
.btn.soft:hover { background: #E8E8E5; }
.btn.line { background: transparent; color: var(--ink); border-color: #D6D6D2; }
.btn.line:hover { background: var(--sheet); }
.btn.sm { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn.display-btn { font-family: var(--display); font-weight: 700; }
.link { background: none; border: 0; padding: 0; font-weight: 600; font-size: 14px; color: var(--ink); cursor: pointer; }
.link:hover { color: var(--red); }
.link.danger { color: var(--red); }
.link.dim { color: var(--muted); font-weight: 500; }

input, select, textarea { font: inherit; color: var(--ink); }
.input { width: 100%; height: 48px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); outline: none; transition: border-color .15s; }
.input:focus { border-color: var(--ink); }
.input.sheet { background: var(--sheet); border-color: transparent; }
.input.sheet:focus { background: var(--paper); border-color: var(--ink); }

/* toggle switch (RTL: "on" moves knob to the left) */
.switch { position: relative; width: 40px; height: 24px; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.15); transition: transform .2s; }
.switch input:checked + i { background: var(--ink); }
.switch input:checked + i::after { transform: translateX(-16px); }
.switch input:focus-visible + i { outline: 2px solid var(--red); outline-offset: 2px; }

/* segmented control */
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--sheet); }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: var(--sheet); font-size: 13px; font-weight: 500; }
.pill button { border: 0; background: none; cursor: pointer; padding: 0 2px; color: var(--muted); font-size: 15px; line-height: 1; }
.pill button:hover { color: var(--red); }

/* ---------- row list (label · value · action) ---------- */
.rows { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.row > .k { width: 120px; flex: none; font-size: 14px; color: var(--muted); }
.row > .v { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row > .a { flex: none; display: flex; align-items: center; gap: 12px; }
.row.wide > .k { width: auto; flex: 1; font-size: 15px; color: var(--ink); }
.row .bare { border: 0; outline: none; background: transparent; font-size: 15px; font-weight: 500; padding: 4px 0; min-width: 0; width: 100%; }
.row .bare::placeholder { color: var(--faint); font-weight: 400; }
.row select.bare { appearance: none; -webkit-appearance: none; cursor: pointer; padding-left: 22px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") left 0 center / 14px no-repeat; width: auto; }
.row .swatch-mini { width: 18px; height: 18px; border-radius: 5px; background: var(--ink); display: grid; place-items: center; flex: none; }
.row .swatch-mini::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--sw, var(--red)); }
.tag-input { border: 0; outline: none; background: transparent; font-size: 14px; min-width: 110px; flex: 1; padding: 4px 0; }

/* ---------- create ---------- */
.create { display: flex; gap: 64px; align-items: flex-start; }
.create-form { width: 460px; flex: none; display: flex; flex-direction: column; gap: 36px; }
.create-head { display: flex; flex-direction: column; gap: 18px; }
.url-field { display: flex; flex-direction: column; gap: 10px; }
.url-box { display: flex; align-items: center; gap: 8px; height: 60px; padding: 6px 18px 6px 6px; border: 1.5px solid var(--ink); border-radius: 14px; transition: border-color .15s, box-shadow .15s; }
.url-box:focus-within { box-shadow: 0 0 0 4px rgba(17,17,17,.06); }
.url-box.bad { border-color: var(--red); }
.url-box input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-family: var(--mono); font-size: 15px; direction: ltr; text-align: left; }
.url-box input::placeholder { color: var(--faint); }
.url-box .btn { height: 46px; }
.url-meta { display: flex; align-items: center; gap: 8px; min-height: 20px; font-size: 13px; color: var(--muted); }
.url-meta .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }
.url-meta.bad .dot { background: var(--red); }
.url-meta.bad { color: var(--red); }
.cta { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 60px; padding: 0 24px; border: 0; border-radius: 14px; background: var(--red); color: #fff; cursor: pointer; transition: background .15s, transform .1s; }
.cta:hover { background: var(--red-ink); }
.cta:active { transform: translateY(1px); }
.cta:disabled { opacity: .55; cursor: default; }
.cta b { font-family: var(--display); font-weight: 700; font-size: 17px; }
.cta span { font-family: var(--mono); font-size: 13px; letter-spacing: .1em; opacity: .85; direction: ltr; }
.cta.done { background: var(--ink); }
.more-toggle { align-self: flex-start; }
.extra { display: none; }
.extra.open { display: block; }

.preview-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; padding-top: 40px; position: sticky; top: 104px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.size-tag { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: var(--muted); direction: ltr; }
.stage { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 72vh; border-radius: 18px; overflow: hidden; background: var(--ink); }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.stage-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #8A8A86; text-align: center; background: radial-gradient(60% 70% at 70% 25%, rgba(224,48,30,.22), transparent 70%), linear-gradient(160deg, #2A2624, #0B0A09); }
.stage-empty b { font-family: var(--display); color: #fff; font-size: 22px; font-weight: 700; }
.stage-empty .ring { width: 72px; height: 72px; border-radius: 50%; border: 1.5px dashed rgba(255,255,255,.35); display: grid; place-items: center; margin-bottom: 6px; }
.stage-empty .ring::after { content: ""; width: 22px; height: 22px; background: var(--red); clip-path: polygon(15% 0, 100% 50%, 15% 100%); }

.embed-strip { display: flex; align-items: center; gap: 16px; padding: 14px 14px 14px 20px; border-radius: 14px; background: var(--sheet); }
.embed-strip .es-k { width: 120px; flex: none; display: flex; flex-direction: column; }
.embed-strip .es-k span { font-size: 13px; color: var(--muted); }
.embed-strip code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13px; color: var(--faint); direction: ltr; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.embed-strip.ready code { color: var(--ink); }
.embed-strip .btns { display: flex; gap: 8px; flex: none; }

/* ---------- library ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 40px; flex-wrap: wrap; }
.head-tools { display: flex; align-items: center; gap: 12px; }
.search { position: relative; width: 280px; }
.search svg { position: absolute; right: 16px; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--muted); pointer-events: none; }
.search .input { padding-right: 44px; }
.folders { display: flex; align-items: center; gap: 28px; padding-bottom: 14px; margin-bottom: 40px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.folders button { border: 0; background: none; padding: 0; cursor: pointer; font-size: 15px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: baseline; gap: 6px; }
.folders button .mono { font-size: 12px; color: var(--faint); }
.folders button.on { color: var(--ink); font-weight: 600; }
.folders button.on .mono { color: var(--red); }
.folders .tagsel { margin-inline-start: auto; border: 0; background: none; font-size: 14px; color: var(--muted); cursor: pointer; }

.sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 40px 32px; }
.frame { display: flex; flex-direction: column; gap: 14px; }
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #1A1715; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease, filter .3s; }
.frame:hover .thumb img { transform: scale(1.03); filter: brightness(.7); }
.thumb .play { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; background: var(--red); display: grid; place-items: center; opacity: 0; transform: scale(.85); transition: .2s; }
.thumb .play svg { width: 22px; height: 22px; fill: #fff; margin-left: 3px; }
.frame:hover .thumb .play { opacity: 1; transform: none; }
.thumb .badge { position: absolute; right: 12px; top: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; }
.thumb .badge svg { width: 13px; height: 13px; }
.thumb .tools { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; opacity: 0; transform: translateY(-4px); transition: .2s; }
.frame:hover .thumb .tools, .thumb .tools:focus-within { opacity: 1; transform: none; }
.thumb .tools button { width: 36px; height: 36px; border-radius: 10px; border: 0; background: rgba(255,255,255,.94); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.thumb .tools button:hover { background: #fff; color: var(--red); }
.thumb .tools svg { width: 17px; height: 17px; }
.meta { display: flex; flex-direction: column; gap: 6px; }
.meta-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.meta-top .mono { font-size: 12px; letter-spacing: .12em; color: var(--red); }
.meta-top .folder { font-size: 13px; color: var(--muted); }
.meta h3 { unicode-bidi: plaintext; text-align: start; font-size: 17px; font-weight: 600; line-height: 26px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta .stats { font-size: 14px; color: var(--muted); }
.meta .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { padding: 96px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
.empty b { font-family: var(--display); font-size: 28px; color: var(--ink); }

/* ---------- player look ---------- */
.look { display: flex; gap: 64px; align-items: flex-start; }
.look-form { width: 440px; flex: none; display: flex; flex-direction: column; gap: 32px; }
.preset-tabs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.preset-tabs button { border: 0; padding: 7px 14px; border-radius: 999px; background: var(--sheet); font-size: 14px; font-weight: 500; cursor: pointer; }
.preset-tabs button.on { background: var(--ink); color: #fff; font-weight: 600; }
.preset-tabs button.add { background: none; color: var(--muted); font-weight: 600; padding: 7px 8px; }
.preset-tabs button.add:hover { color: var(--ink); }
.name-input { border: 0; outline: none; background: none; font-family: var(--display); font-weight: 800; font-size: 44px; line-height: 1.3; letter-spacing: -.02em; width: 100%; padding: 0; }
.group { display: flex; flex-direction: column; gap: 12px; }
.group-head { display: flex; align-items: center; justify-content: space-between; }
.group-head .mono { font-size: 12px; letter-spacing: .12em; color: var(--muted); }
.skins { display: flex; gap: 10px; }
.skin { flex: 1; display: flex; flex-direction: column; gap: 8px; cursor: pointer; text-align: center; font-size: 13px; color: var(--muted); }
.skin input { position: absolute; opacity: 0; pointer-events: none; }
.skin .art { position: relative; height: 64px; border-radius: 10px; background: var(--ink); overflow: hidden; transition: box-shadow .15s; }
.skin.on { color: var(--ink); font-weight: 600; }
.skin.on .art { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--red); }
.skin input:focus-visible + .art { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.skin .art i { position: absolute; left: 50%; top: 16px; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; background: var(--sw, var(--red)); }
.skin .art em { position: absolute; left: 0; right: 0; bottom: 0; }
.art.glass em { left: 8px; right: 8px; bottom: 7px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.28); }
.art.minimal i { background: none; border: 2px solid #fff; }
.art.minimal em { left: 8px; right: 8px; bottom: 8px; height: 2px; background: rgba(255,255,255,.6); }
.art.cinema i { width: 30px; margin-left: -15px; border-radius: 5px; }
.art.cinema em { height: 12px; background: #000; border-top: 2px solid var(--sw, var(--red)); }
.art.classic i { width: 36px; height: 18px; margin-left: -18px; top: 17px; border-radius: 999px; }
.art.classic em { height: 12px; background: #000; }
.swatches { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sw { width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; padding: 0; transition: box-shadow .15s, transform .1s; }
.sw:hover { transform: scale(1.06); }
.sw.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.hex { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px 0 12px; border-radius: 999px; border: 1px solid var(--line); }
.hex input[type=text] { width: 76px; border: 0; outline: none; font-family: var(--mono); font-size: 13px; direction: ltr; background: none; }
.hex input[type=color] { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; overflow: hidden; cursor: pointer; background: none; }
.hex input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.hex input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.range { width: 140px; accent-color: var(--ink); }
.save-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; position: sticky; bottom: 0; padding: 16px 0; background: linear-gradient(transparent, #fff 30%); }
.img-chip { display: inline-flex; align-items: center; gap: 8px; }
.img-chip img { height: 28px; max-width: 90px; object-fit: contain; border-radius: 6px; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 10px 10px; }
.img-chip.busy { opacity: .5; pointer-events: none; }
.size-inputs { display: flex; align-items: center; gap: 6px; direction: ltr; }
.size-inputs input { width: 72px; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-family: var(--mono); font-size: 13px; text-align: center; outline: none; }
.size-inputs input:focus { border-color: var(--ink); }
.ratios { display: flex; gap: 6px; }
.ratios button { border: 1px solid var(--line); background: none; border-radius: 8px; height: 30px; padding: 0 8px; font-family: var(--mono); font-size: 12px; cursor: pointer; direction: ltr; }
.ratios button:hover { border-color: var(--ink); }
.look-preview { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; padding-top: 8px; position: sticky; top: 104px; }

/* ---------- analytics ---------- */
.heroes { display: flex; align-items: flex-end; gap: 72px; flex-wrap: wrap; padding-bottom: 40px; margin-bottom: 48px; border-bottom: 1px solid var(--line); }
.hero { display: flex; flex-direction: column; gap: 6px; }
.hero .k { font-size: 14px; color: var(--muted); }
.hero .n { font-family: var(--display); font-weight: 300; font-size: 56px; line-height: 64px; }
.hero.main .n { font-weight: 800; font-size: 96px; line-height: 100px; letter-spacing: -.03em; }
.hero .d { font-size: 14px; font-weight: 600; }
.hero .d.up { color: var(--ok); }
.hero .d.down { color: var(--red); }
.hero .d.flat { color: var(--muted); font-weight: 500; }
.chart { display: flex; flex-direction: column; gap: 20px; margin-bottom: 56px; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; }
.chart-head h3 { font-size: 17px; font-weight: 600; }
.plot { position: relative; display: flex; align-items: flex-end; gap: var(--gap, 28px); height: 220px; padding: 0 12px; border-bottom: 1px solid var(--ink); }
.bar { position: relative; flex: 1; min-width: 4px; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.bar i { display: block; width: 100%; min-height: 2px; background: var(--ink); border-radius: 4px 4px 0 0; transition: opacity .15s; }
.bar.today i { background: var(--red); }
.plot:hover .bar i { opacity: .35; }
.plot .bar:hover i { opacity: 1; }
.bar .tip { position: absolute; bottom: calc(var(--h) + 10px); left: 50%; transform: translateX(-50%); padding: 7px 10px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 13px; line-height: 1.4; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 2; text-align: center; }
.bar .tip b { display: block; font-size: 15px; }
.bar:hover .tip { opacity: 1; }
.axis { display: flex; justify-content: space-between; padding: 0 12px; font-size: 13px; color: var(--muted); }
.axis .now { color: var(--ink); font-weight: 600; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-size: 13px; font-weight: 400; color: var(--muted); height: 44px; border-bottom: 1px solid var(--line); white-space: nowrap; padding: 0 12px 0 0; }
.table td { height: 64px; border-bottom: 1px solid var(--line); font-size: 15px; padding: 0 12px 0 0; white-space: nowrap; }
.table th:first-child, .table td:first-child { width: 64px; padding: 0; }
.table td.fr { font-family: var(--mono); font-size: 13px; color: var(--red); direction: ltr; text-align: right; }
.table td.title { font-weight: 600; white-space: normal; width: 100%; }
.table .meter { display: flex; align-items: center; gap: 10px; }
.table .meter span { position: relative; width: 120px; height: 6px; border-radius: 3px; background: var(--sheet); overflow: hidden; }
.table .meter span i { position: absolute; right: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--ink); }
.foot-note { margin-top: 16px; font-size: 13px; color: var(--muted); }

/* ---------- settings ---------- */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 56px 64px; }
.set { display: flex; flex-direction: column; gap: 16px; }
.set h3 { font-family: var(--display); font-size: 22px; font-weight: 700; }
.set p { font-size: 14px; line-height: 24px; color: var(--muted); }
.inline-add { display: flex; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; align-items: center; }

/* ---------- modal & toast ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(17,17,17,.45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal-card { width: min(720px, 100%); max-height: 92vh; overflow: auto; background: var(--paper); border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 20px; box-shadow: 0 40px 100px rgba(0,0,0,.25); }
.modal-card.narrow { width: min(440px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal-head h3 { font-family: var(--display); font-size: 22px; font-weight: 700; line-height: 1.4; }
.x { width: 36px; height: 36px; flex: none; border: 0; border-radius: 10px; background: var(--sheet); font-size: 20px; cursor: pointer; color: var(--muted); }
.x:hover { color: var(--ink); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: 28px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; display: inline-flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; transition: .22s; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.toast.bad::before { background: var(--red); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- login ---------- */
.login-body { min-height: 100vh; display: flex; }
.login-side { flex: 1; display: flex; flex-direction: column; justify-content: space-between; padding: 56px; }
.login-art { flex: 1.1; position: relative; overflow: hidden; background: radial-gradient(40% 50% at 65% 30%, rgba(242,181,138,.9), rgba(224,48,30,.35) 45%, transparent 70%), linear-gradient(160deg, #3A3430, #0B0A09); }
.login-art::before { content: ""; position: absolute; left: -10%; top: 58%; width: 70%; height: 70%; border-radius: 50%; background: #2A2522; }
.login-art::after { content: ""; position: absolute; left: 30%; top: 66%; width: 90%; height: 70%; border-radius: 50%; background: #181513; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 20px; }
.login-card label { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 600; }
.error { color: var(--red); font-size: 14px; font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .create, .look { flex-direction: column; }
  .create-form, .look-form { width: 100%; max-width: 560px; }
  .preview-col, .look-preview { position: static; width: 100%; padding-top: 0; }
  .look-preview { order: -1; }
  .top-stats { display: none; }
}
@media (max-width: 720px) {
  .top { padding: 14px 18px; gap: 12px; flex-wrap: wrap; }
  .top-start { gap: 20px; flex-wrap: wrap; }
  .nav { gap: 20px; }
  .view { padding: 32px 18px 72px; }
  .display { font-size: 40px; } .display.xl { font-size: 44px; } .display.md { font-size: 34px; }
  .name-input { font-size: 34px; }
  .search { width: 100%; } .head-tools { width: 100%; }
  .heroes { gap: 32px; } .hero.main .n { font-size: 64px; line-height: 72px; } .hero .n { font-size: 40px; line-height: 48px; }
  .login-art { display: none; }
  .login-side { padding: 28px; }
  .row > .k { width: 96px; }
  .table-wrap { overflow-x: auto; }
}

/* ---------- additions ---------- */
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.danger-line { background: transparent; color: var(--red); border-color: #F0C7C1; }
.btn.danger-line:hover { background: #FDF0EE; border-color: var(--red); }
.modal-card > p { font-size: 15px; line-height: 26px; }
.tvid { display: flex; align-items: center; gap: 14px; }
.tvid img { width: 88px; height: 50px; object-fit: cover; border-radius: 8px; flex: none; background: var(--sheet); }
.tvid span { unicode-bidi: plaintext; text-align: start; line-height: 1.5; }
.table td { height: 76px; }


/* ---------- settings: organize ---------- */
.page-head .lead { max-width: 420px; }
.org { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: start; }
.org-col { display: flex; flex-direction: column; gap: 20px; }
.org-head { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 14px; border-bottom: 1.5px solid var(--ink); }
.org-head h3 { font-family: var(--display); font-weight: 700; font-size: 24px; }
.org-head .mono { font-size: 13px; letter-spacing: .12em; color: var(--red); }
.org-list { display: flex; flex-direction: column; margin-top: -20px; }
.org-list .org-row { display: flex; align-items: center; gap: 14px; height: 60px; border-bottom: 1px solid var(--line); }
.org-list .org-row.ghost .org-name { color: var(--muted); font-weight: 500; }
.org-ico { width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--sheet); display: grid; place-items: center; color: var(--ink); }
.org-ico svg { width: 18px; height: 18px; }
.org-row.ghost .org-ico { background: none; border: 1px dashed #D6D6D2; color: var(--faint); }
.org-name { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; text-align: start; }
.org-count { width: 90px; flex: none; font-size: 14px; color: var(--muted); text-align: left; }
.org-acts { width: 76px; flex: none; display: flex; justify-content: flex-end; gap: 4px; opacity: 0; transition: opacity .15s; }
.org-row:hover .org-acts, .org-row:focus-within .org-acts { opacity: 1; }
.ic { width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.ic:hover { background: var(--sheet); color: var(--ink); }
.ic.danger:hover { background: #FDF0EE; color: var(--red); }
.ic svg { width: 17px; height: 17px; }
.org-rename { flex: 1; min-width: 0; height: 38px; border: 1.5px solid var(--ink); border-radius: 8px; padding: 0 10px; font-size: 15px; font-weight: 600; outline: none; }
.org-row.editing .org-acts { display: none; }
.org-add { display: flex; gap: 8px; }
.org-empty { padding: 28px 0; color: var(--muted); font-size: 14px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-chip { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px 0 16px; border-radius: 999px; background: var(--sheet); transition: background .15s; }
.tag-chip:hover { background: #EAEAE6; }
.tag-chip .org-name { flex: none; font-size: 15px; }
.tag-chip b { min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--paper); font-size: 13px; font-weight: 600; display: grid; place-items: center; }
.tag-chip .org-acts { width: auto; opacity: 1; display: none; }
.tag-chip:hover .org-acts, .tag-chip:focus-within .org-acts { display: flex; }
.tag-chip .ic { width: 30px; height: 30px; border-radius: 50%; }
.tag-chip .org-rename { height: 32px; width: 140px; flex: none; }
@media (max-width: 900px) { .org { grid-template-columns: 1fr; gap: 48px; } .org-acts { opacity: 1; } .tag-chip .org-acts { display: flex; } }
.save-row .muted.sm { order: 5; flex-basis: 100%; }
.save-row .btn.sm { height: 44px; }
.row[hidden], [hidden] { display: none !important; }


/* =====================================================================
   v3 — sidebar layout · library grid/list · login with email
   ===================================================================== */
body.app { display: flex; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; width: 264px; flex: none; display: flex; flex-direction: column; gap: 28px; padding: 28px 20px 22px; background: var(--ink); color: #fff; overflow-y: auto; scrollbar-width: none; z-index: 40; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.brand.light { color: #fff; }
.side-close { display: none; width: 36px; height: 36px; border: 0; border-radius: 10px; background: rgba(255,255,255,.08); color: #fff; font-size: 20px; cursor: pointer; }
.side-new { display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 16px; border-radius: 12px; background: var(--red); color: #fff; transition: background .15s, transform .1s; }
.side-new:hover { background: var(--red-ink); }
.side-new:active { transform: translateY(1px); }
.side-new b { font-family: var(--display); font-weight: 700; font-size: 15px; }
.side-new span { font-family: var(--mono); font-size: 20px; line-height: 1; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 10px; color: rgba(255,255,255,.62); font-size: 15px; transition: background .15s, color .15s; }
.side-nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.side-nav a.on { background: rgba(255,255,255,.09); color: #fff; font-weight: 600; }
.side-nav svg { width: 20px; height: 20px; flex: none; }
.side-nav span { flex: 1; }
.side-nav em { font-style: normal; font-size: 12px; color: rgba(255,255,255,.4); }
.side-nav a.on em { color: var(--red); }
.side-folders { flex: 1; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.side-label { font-size: 11px; letter-spacing: .16em; color: rgba(255,255,255,.4); padding: 0 12px 8px; text-align: right; }
.side-folder { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px; color: rgba(255,255,255,.62); font-size: 14px; }
.side-folder:hover { background: rgba(255,255,255,.05); color: #fff; }
.side-folder i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.4); flex: none; }
.side-folder span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-folder em { font-style: normal; font-size: 12px; color: rgba(255,255,255,.4); }
.side-folder.on { color: #fff; font-weight: 600; }
.side-folder.on i { background: var(--red); border-color: var(--red); }
.side-foot { display: flex; align-items: center; gap: 12px; padding: 16px 12px 0; border-top: 1px solid rgba(255,255,255,.1); }
.side-foot div { flex: 1; display: flex; flex-direction: column; }
.side-foot b { font-size: 14px; }
.side-foot span { font-size: 12px; color: rgba(255,255,255,.5); }
.side-out { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.08); display: grid; place-items: center; color: #fff; transition: background .15s; }
.side-out:hover { background: var(--red); }
.side-out svg { width: 16px; height: 16px; }
.side-scrim { display: none; }
.shell { flex: 1; min-width: 0; }
.mobile-bar { display: none; }
.view { max-width: 1280px; padding: 44px 48px 96px; }
.top { display: none; }
.create-form { width: 420px; }
.preview-col, .look-preview { top: 32px; }

/* ---------- library v2 ---------- */
.lib-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.lib-head .eyebrow { display: block; text-align: right; margin-bottom: 4px; }
.lib-head .display { font-size: 52px; }
.search { width: 300px; }
.search kbd { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--faint); padding: 2px 6px; border: 1px solid #D6D6D2; border-radius: 5px; background: var(--paper); }
.search .input { padding-left: 52px; }
.lib-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 20px; margin-bottom: 32px; border-bottom: 1px solid var(--line); }
.chips-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chips-row button { border: 0; padding: 7px 14px; border-radius: 999px; background: var(--sheet); font-size: 14px; cursor: pointer; transition: background .15s; }
.chips-row button:hover { background: #E8E8E5; }
.chips-row button.on { background: var(--ink); color: #fff; font-weight: 600; }
.lib-tools { display: flex; align-items: center; gap: 12px; }
.sortsel { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px 0 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; color: var(--muted); }
.sortsel select { border: 0; background: transparent; font-weight: 600; font-size: 14px; color: var(--ink); cursor: pointer; outline: none; }
.view-toggle button { display: inline-flex; align-items: center; gap: 6px; }
.view-toggle svg { width: 15px; height: 15px; }

.sheet { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 36px 28px; }
.frame .thumb .fr-badge { position: absolute; right: 10px; top: 10px; font-size: 11px; font-weight: 500; letter-spacing: .12em; color: #fff; background: var(--ink); padding: 4px 8px; border-radius: 6px; z-index: 1; }
.frame .thumb .dur-badge { position: absolute; left: 10px; bottom: 10px; font-size: 12px; font-weight: 500; color: #fff; background: rgba(17,17,17,.72); padding: 3px 7px; border-radius: 6px; }
.frame .thumb .badge { right: auto; left: 10px; top: 10px; background: #fff; color: var(--ink); font-size: 12px; }
.frame:hover .thumb .badge { opacity: 0; }
.frame .thumb .tools { left: 10px; top: 10px; }
.thumb .tools button.del:hover, .vrow .c-act button.del:hover { color: var(--red); }
.frame .meta { gap: 10px; }
.frame .meta h3 { font-size: 16px; line-height: 24px; transition: color .15s; }
.frame:hover .meta h3 { color: var(--red); }
.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.meta-row .pill { font-size: 12px; padding: 3px 9px; }
.pill.ghost { background: none; border: 1px dashed #D6D6D2; color: var(--faint); }
.mstats { display: inline-flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.mstats span { display: inline-flex; align-items: center; gap: 5px; }
.mstats svg { width: 15px; height: 15px; fill: currentColor; }
.mstats span:first-child svg { fill: none; }

.vlist { display: flex; flex-direction: column; margin-top: -32px; }
.vrow { display: flex; align-items: center; gap: 20px; min-height: 96px; padding: 12px 16px; border-bottom: 1px solid var(--line); border-radius: 0; cursor: default; transition: background .15s, border-radius .15s; }
.vrow:not(.head):hover { background: var(--sheet); border-radius: 14px; border-bottom-color: transparent; }
.vrow.head { min-height: 44px; padding-top: 0; padding-bottom: 0; font-size: 13px; color: var(--muted); }
.vrow .c-fr { width: 44px; flex: none; font-size: 13px; font-weight: 500; color: var(--red); }
.vrow.head .c-fr { font-size: 11px; letter-spacing: .14em; color: var(--faint); }
.vrow .c-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 16px; cursor: pointer; }
.vrow .c-n { width: 90px; flex: none; font-size: 15px; font-variant-numeric: tabular-nums; }
.vrow.head .c-n { font-size: 13px; }
.vrow .c-act { width: 120px; flex: none; display: flex; justify-content: flex-end; gap: 2px; }
.vrow .c-act button { width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.vrow .c-act button:hover { background: var(--paper); color: var(--ink); }
.vrow .c-act svg { width: 17px; height: 17px; }
.lthumb { position: relative; width: 128px; height: 72px; flex: none; border-radius: 10px; overflow: hidden; background: #1A1715; }
.lthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lthumb i { position: absolute; left: 6px; bottom: 6px; font-style: normal; font-size: 10px; font-weight: 500; color: #fff; background: rgba(17,17,17,.72); padding: 2px 5px; border-radius: 4px; }
.ltext { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ltext b { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; text-align: start; }
.vrow:hover .ltext b { color: var(--red); }
.lsub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.lsub .pill { font-size: 12px; padding: 2px 8px; }
.ltags { color: var(--faint); }
.lprot { display: inline-flex; align-items: center; gap: 4px; color: var(--red); font-weight: 600; }
.lprot svg { width: 12px; height: 12px; }

/* ---------- login with email ---------- */
.login-body { min-height: 100vh; display: flex; }
.login-side { width: 620px; flex: none; padding: 56px 80px 48px; }
.login-card { width: 420px; gap: 32px; }
.login-head { display: flex; flex-direction: column; gap: 16px; }
.login-head .eyebrow { align-self: flex-start; }
.login-head .display { font-size: 60px; line-height: 1.33; }
.login-fields { display: flex; flex-direction: column; gap: 18px; }
.login-input { position: relative; display: flex; align-items: center; height: 60px; border: 1px solid var(--line); border-radius: 14px; background: var(--sheet); transition: border-color .15s, background .15s; }
.login-input:focus-within { border: 1.5px solid var(--ink); background: var(--paper); }
.login-input input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; padding: 0 18px; font-family: var(--mono); font-size: 15px; text-align: left; }
.login-input input[type=password] { letter-spacing: .2em; }
.login-input > svg, .login-input .eye svg { width: 20px; height: 20px; color: var(--muted); }
.login-input > svg { margin-left: 18px; flex: none; }
.login-input .eye { border: 0; background: none; padding: 0 18px; height: 100%; cursor: pointer; display: grid; place-items: center; }
.login-input .eye.on svg { color: var(--red); }
.login-foot { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); }
.ok-dot { display: inline-flex; align-items: center; gap: 6px; }
.ok-dot::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.login-art { margin: 16px; border-radius: 24px; flex: 1; }
.login-art .strip { position: absolute; left: 40px; bottom: 40px; z-index: 2; display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 16px; background: rgba(17,17,17,.55); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); direction: ltr; }
.login-art .frames { display: flex; gap: 8px; }
.login-art .frames i { width: 96px; height: 54px; border-radius: 6px; background: linear-gradient(150deg, #5A4A3E, #1C1713); }
.login-art .frames i:nth-child(2) { background: linear-gradient(150deg, #E0301E, #7A140B); }
.login-art .frames i:nth-child(3) { background: linear-gradient(150deg, #3E4A52, #14181B); }
.login-art .labels { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: rgba(255,255,255,.7); }
.login-art .labels .hot { color: #F2B58A; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .view { padding: 36px 32px 80px; }
  .create, .look { flex-direction: column; }
  .create-form, .look-form { width: 100%; max-width: 560px; }
  .preview-col, .look-preview { position: static; width: 100%; padding-top: 0; }
  .vrow .c-n:nth-of-type(5) { display: none; }
}
@media (max-width: 900px) {
  .side { position: fixed; right: 0; top: 0; bottom: 0; transform: translateX(100%); transition: transform .25s ease; box-shadow: -20px 0 60px rgba(0,0,0,.3); }
  body.side-open .side { transform: none; }
  .side-close { display: grid; place-items: center; }
  .side-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(17,17,17,.4); opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.side-open .side-scrim { opacity: 1; pointer-events: auto; }
  .mobile-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 18px; background: rgba(255,255,255,.94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .burger { width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--sheet); display: grid; place-items: center; cursor: pointer; }
  .burger svg { width: 20px; height: 20px; }
  .view { padding: 28px 18px 72px; }
  .lib-head .display { font-size: 40px; }
  .search { width: 100%; }
  .vrow .c-n, .vrow.head .c-n { display: none; }
  .vrow .c-act { width: auto; }
  .lthumb { width: 104px; height: 58px; }
  .login-side { width: 100%; padding: 28px; }
  .login-card { width: 100%; }
  .login-head .display { font-size: 44px; }
}
