/* Сайт платформы — тот же вид, что у Клиента (client/studio_web/ui/css/app.css): светлый фон, белые карточки,
   зелёный акцент; тёмная тема — по системе. Работает и на телефоне. */
:root {
  --bg: #F3F5F4; --surface: #FFFFFF; --sunk: #F1F4F2; --hover: #F2F6F4;
  --ink: #18202A; --ink-2: #3B4651; --muted: #6B7480; --faint: #9AA3AB;
  --line: #E2E7E4; --line-2: #ECEFED;
  --accent: #0E7563; --accent-hover: #0A5F50; --accent-soft: #DDEFEA; --on-accent: #FFFFFF;
  --ok: #12945F; --ok-soft: #E1F4EA; --warn: #C86A10; --warn-soft: #FFF3E6; --bad: #C2372B; --bad-soft: #FCEBE9;
  --info: #2A6CB0; --info-soft: #E6EFF9;
  --radius: 14px; --radius-s: 10px;
  --shadow: 0 1px 2px rgba(24, 32, 42, .04), 0 1px 1px rgba(24, 32, 42, .03);
  --ui: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1417; --surface: #151D22; --sunk: #1A2329; --hover: #1C262C;
    --ink: #E4EAE8; --ink-2: #BAC4C2; --muted: #8A959C; --faint: #5E6970;
    --line: #27323A; --line-2: #1F292F;
    --accent: #3CCDB0; --accent-hover: #5BDCC2; --accent-soft: #163631; --on-accent: #062520;
    --ok: #45C98E; --ok-soft: #15322A; --warn: #F0A35A; --warn-soft: #382A1A; --bad: #F2766A; --bad-soft: #3A1F1D;
    --info: #6FAAEB; --info-soft: #172739;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--ui); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }
.muted { color: var(--muted); }
svg.i { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 2; display: flex; align-items: center; gap: 18px; padding: 12px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand svg { stroke: var(--accent); }
.tabs { display: flex; gap: 4px; flex: 1 1 auto; }
.tab { border: none; background: none; padding: 7px 12px; border-radius: var(--radius-s); color: var(--ink-2); text-decoration: none; }
.tab:hover { background: var(--hover); }
.tab[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.me { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.link { border: none; background: none; padding: 0; color: var(--accent); }

main { max-width: 1180px; margin: 0 auto; padding: 22px 16px 40px; }
.head h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.01em; text-wrap: balance; }
.head p { margin: 0 0 18px; max-width: 70ch; }
.note { padding: 10px 14px; border-radius: var(--radius-s); background: var(--info-soft); color: var(--info); margin-bottom: 14px; }
.note.bad { background: var(--bad-soft); color: var(--bad); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.empty { padding: 30px 0; }
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column; }
.shot { aspect-ratio: 16 / 9; max-width: 100%; background: var(--sunk); display: grid; place-items: center; color: var(--faint);
  font-size: 13px; position: relative; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.title { display: flex; align-items: baseline; gap: 10px; }
.title b { font-size: 17px; }
.state { font-size: 12.5px; padding: 2px 9px; border-radius: 20px; background: var(--sunk); color: var(--muted); white-space: nowrap; }
.state.free { background: var(--ok-soft); color: var(--ok); }
.state.busy, .state.connecting, .state.waiting { background: var(--warn-soft); color: var(--warn); }
.state.mine { background: var(--accent-soft); color: var(--accent); }
.meta { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: var(--radius-s); font-weight: 600; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .5; cursor: default; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); max-width: calc(100% - 32px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--radius-s); box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.problem { max-width: 60ch; padding-top: 60px; }

/* --- Файлы на NAS --- */
.segs { display: inline-flex; gap: 2px; padding: 3px; background: var(--sunk); border-radius: var(--radius-s); margin-bottom: 14px; }
.seg { padding: 6px 14px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 600; }
.seg[aria-current="page"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.crumbs { flex: 1 1 260px; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; font-size: 15px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs [aria-current] { font-weight: 600; overflow-wrap: anywhere; }
.crumbs .sep { color: var(--faint); }
.tools { display: flex; gap: 8px; flex-wrap: wrap; }
.search { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--radius-s);
  padding: 8px 12px; font: inherit; width: 200px; max-width: 100%; }
.search:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.why { margin: -2px 0 10px; font-size: 13px; }
.selbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 10px;
  background: var(--accent-soft); color: var(--accent); border-radius: var(--radius-s); font-weight: 600; font-variant-numeric: tabular-nums; }
.selbar span { flex: 1 1 auto; }

.drop { position: relative; }
.files { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.files[aria-busy="true"] { opacity: .6; }
.files .empty { padding: 28px 16px; text-align: center; }
.frow { display: grid; grid-template-columns: 40px minmax(0, 1fr) 96px 170px 44px; align-items: center; min-height: 44px;
  border-top: 1px solid var(--line-2); }
.frow:first-child { border-top: none; }
.frow:not(.fhead):hover { background: var(--hover); }
.frow.sel { background: var(--accent-soft); }
.fhead { min-height: 38px; background: var(--sunk); color: var(--muted); font-size: 12.5px; }
.fhead .sort { border: none; background: none; text-align: left; padding: 0; color: inherit; font-weight: 600; letter-spacing: .02em; }
.fhead .sort.on { color: var(--ink); }
.fhead .cell-size, .fhead .cell-date { padding-right: 12px; }
.pick { display: grid; place-items: center; height: 100%; cursor: pointer; }
.pick input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.cell-name { min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px 6px 0; }
.name { display: inline-flex; align-items: center; gap: 9px; min-width: 0; color: var(--ink); text-decoration: none; }
.name:hover .label { text-decoration: underline; color: var(--accent); }
.name .label { overflow-wrap: anywhere; }
.name svg.i { width: 20px; height: 20px; }
.ic-dir { stroke: var(--accent); fill: var(--accent-soft); }
.ic-file { stroke: var(--muted); }
.sub { color: var(--muted); font-size: 12.5px; display: block; overflow-wrap: anywhere; }
.badge { font-size: 11.5px; padding: 1px 8px; border-radius: 20px; background: var(--info-soft); color: var(--info); white-space: nowrap; }
.cell-size, .cell-date { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; padding-right: 12px; white-space: nowrap; }
.cell-size { text-align: right; }
.fhead .cell-size { text-align: right; }
.cell-act { display: grid; place-items: center; }
.icon-btn { border: none; background: none; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); font-size: 18px; line-height: 1; }
.icon-btn:hover { background: var(--sunk); color: var(--accent); }
.icon-btn svg.i { width: 18px; height: 18px; }
.drop-hint { display: none; position: absolute; inset: 0; border: 2px dashed var(--accent); border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-soft) 85%, transparent); color: var(--accent); font-weight: 700; font-size: 16px;
  place-items: center; pointer-events: none; }
.drop.over .drop-hint { display: grid; }
.hint { font-size: 12.5px; margin: 8px 2px 0; }

@media (max-width: 720px) {
  .frow { grid-template-columns: 36px minmax(0, 1fr) 40px; }
  .cell-date, .fhead .cell-size { display: none; }
  .cell-size { grid-column: 2; grid-row: 2; text-align: left; padding: 0 0 6px; margin-top: -6px; }
  .frow .cell-act { grid-column: 3; grid-row: 1 / span 2; }
  .search { width: 100%; }
  .tools { width: 100%; }
}

/* --- передачи на NAS --- */
.transfers { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: min(420px, calc(100% - 32px));
  max-height: min(60vh, 520px); display: flex; flex-direction: column; z-index: 3;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.18); }
.tr-head { display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px 8px; }
.tr-head b { font-size: 14px; }
.tr-tools { display: flex; align-items: center; gap: 10px; flex: none; }
.prog { height: 6px; border-radius: 3px; background: var(--sunk); overflow: hidden; }
.prog.total { margin: 0 14px 10px; }
.prog i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .25s; }
.tr-list { overflow: auto; border-top: 1px solid var(--line-2); padding: 4px 0; }
.tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; padding: 8px 14px; }
.tr-name { min-width: 0; overflow-wrap: anywhere; font-weight: 600; font-size: 13px; }
.tr-name .sub { font-weight: 400; }
.tr .prog { grid-column: 1 / -1; height: 4px; }
.tr-status { grid-column: 1 / -1; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tr.done .prog i { background: var(--ok); }
.tr.failed .prog i { background: var(--bad); }
.tr.failed .tr-status { color: var(--bad); }
.tr.cancelled { opacity: .55; }
.transfers.folded .tr-list { display: none; }
@media (max-width: 720px) { .tr-list { max-height: 38vh; } }
.transfers.folded [data-tr-fold] { transform: rotate(180deg); }
