* { box-sizing: border-box; }
:root { color-scheme: light; --ink: #221c32; --muted: #61586f; --line: #e2ddeb; --accent: #5437bb; --soft: #eee9fd; --panel: #f7f5fb; --paper: #fff; }
body { margin: 0; font: 15px/1.5 "Segoe UI", system-ui, sans-serif; color: var(--ink); background: var(--paper); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(28px, 4vw, 42px); letter-spacing: -.05em; line-height: 1.1; }
h2 { font-size: 19px; letter-spacing: -.025em; }
h3 { font-size: 15px; }
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
button, .button, input, textarea, select { border: 1px solid var(--line); border-radius: 8px; background: var(--paper); padding: 8px 12px; }
button, .button { cursor: pointer; font-weight: 600; white-space: normal; text-decoration: none; }
button:hover:enabled, .button:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--accent); border-color: var(--accent); color: white; }
.danger { background: #9d303e; border-color: #9d303e; color: white; }
.label, small, .top { color: var(--muted); }
label { display: grid; gap: 5px; font-size: 14px; }
textarea { min-height: 92px; resize: vertical; }
select, textarea, input { width: 100%; min-width: 0; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.stack, form { display: grid; gap: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.spread { justify-content: space-between; }
.shell { display: grid; grid-template-columns: 188px minmax(0,1fr); min-height: 100vh; }
.sidebar { padding: 21px 15px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 24px; }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#menu-toggle { display: none; }
#studio-nav { display: flex; flex: 1; flex-direction: column; gap: 24px; }
.content, .row > *, #studio-nav { min-width: 0; overflow-wrap: anywhere; }
.content { grid-template-columns: minmax(0, 1fr); }
main { min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 750; color: var(--ink); text-decoration: none; }
.brand-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: white; font-size: 12px; }
nav, .account { display: grid; gap: 4px; }
nav button { text-align: left; background: transparent; border-color: transparent; }
nav button[aria-current=page] { color: var(--accent); background: var(--soft); }
#account-folders button { display: flex; justify-content: space-between; gap: 10px; overflow-wrap: anywhere; min-width: 0; }
.device-picker { padding: 9px; }
.account { margin-top: auto; font-size: 13px; }
.top { min-height: 64px; border-bottom: 1px solid var(--line); padding: 12px clamp(16px,4vw,46px); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.top button { font-size: 13px; color: var(--accent); background: var(--soft); }
.content { max-width: 1320px; margin: auto; padding: 26px clamp(16px,4vw,46px) 56px; display: grid; gap: 18px; }
.tabs { display: flex; flex-wrap: wrap; gap: 12px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-radius: 0; padding: 10px 2px; }
.tabs button[aria-pressed=true] { color: var(--accent); box-shadow: inset 0 -2px var(--accent); }
.provider { display: grid; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; }
.check { display: flex; align-items: center; }
.batch-controls select { width: auto; max-width: 100%; }
.batch-status { background: var(--soft); }
.batch-meter { position: relative; overflow: hidden; border-radius: 6px; background: #ded5f3; }
.batch-meter progress { display: block; appearance: none; width: 100%; height: 8px; border: 0; background: transparent; }
.batch-meter progress::-webkit-progress-bar { background: transparent; }
.batch-meter progress::-webkit-progress-value { background: #286b55; border-radius: 6px; }
.batch-meter progress::-moz-progress-bar { background: #286b55; border-radius: 6px; }
.batch-motion { position: absolute; inset: 0 auto 0 0; width: 30%; border-radius: 6px; background: #765bdc; animation: batch-slide 1.25s ease-in-out infinite; }
@keyframes batch-slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(335%); }
}
@media (prefers-reduced-motion: reduce) {
  .batch-motion { animation: none; inset: auto 0 0 0; width: 100%; height: 2px; }
}
.problem { color: #9d303e; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(225px,100%),1fr)); gap: 12px; align-items: start; }
.tile { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: white; min-width: 0; }
.tile:has(.pick input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.picture { position: relative; }
.pick, .source-badge { position: absolute; background: var(--paper); border: 1px solid var(--line); border-radius: 7px; }
.pick { top: 9px; left: 9px; display: grid; place-items: center; cursor: pointer; width: 40px; height: 40px; }
.pick input { margin: 0; }
.source-badge { bottom: 8px; left: 8px; padding: 2px 7px; }
.tile img, .tile video { display: block; width: 100%; aspect-ratio: 1 / 1.05; object-fit: contain; background: var(--panel); }
.tile video { aspect-ratio: 9/16; max-height: 330px; background: #17121e; }
.tile-body { padding: 10px; overflow-wrap: anywhere; }
.tile-body details summary { cursor: pointer; font-weight: 600; }
.tile-body details textarea { margin-top: 8px; }
.panel { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 16px; }
.panel > summary { cursor: pointer; font-weight: 600; }
.folder-actions[open] > .row { margin-top: 8px; }
.legacy-import { margin-top: 12px; }
dialog { width: min(480px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); padding: 20px; }
dialog::backdrop { background: #211b3570; }
.empty { border: 1px dashed var(--line); border-radius: 12px; padding: 28px; grid-column: 1/-1; }
.item { padding: 11px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.login { max-width: 400px; margin: max(32px,10vh) auto; padding: 24px; display: grid; gap: 24px; }
#notice { position: fixed; left: 50%; bottom: 15px; transform: translateX(-50%); background: #2b2045; color: white; width: max-content; max-width: calc(100vw - 26px); border-radius: 9px; padding: 10px 16px; box-shadow: 0 6px 24px #211b3540; z-index: 2; }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0,1fr); grid-template-rows: auto 1fr; }
  .sidebar { position: static; height: auto; overflow: visible; gap: 0; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  #menu-toggle { display: block; }
  #studio-nav { display: none; }
  .sidebar:has(#menu-toggle[aria-expanded=true]) #studio-nav { display: flex; padding: 12px 0; gap: 16px; }
  #account-folders, #studio-nav nav[aria-label=Workspace] { grid-template-columns: repeat(auto-fit, minmax(min(165px, 100%), 1fr)); }
  .account { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .top { min-height: 52px; padding-block: 5px; }
  button, .button, summary, .check, .pick, select { min-height: 44px; }
  .pick { width: 44px; }
  summary { align-content: center; }
  input:not([type=checkbox]), select, textarea { font-size: 16px; }
  .content { padding-top: 18px; }
  dialog { max-height: calc(100dvh - 24px); overflow: auto; }
}
@media (max-width: 540px) {
  .content { gap: 12px; }
  .tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; }
  .tabs button { padding: 6px 2px; line-height: 1.25; }
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .tile img { aspect-ratio: 4/3; max-height: 300px; }
  .panel { padding: 12px; }
  .batch-controls > .row { flex: 1 1 100%; }
  .batch-controls select { width: 100%; }
  .batch-controls button { flex: 1 1 auto; }
}
