:root {
  color-scheme: light;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #f7f6f1;
  color: #252d27;
  font-synthesis: none;
  --bg: #f7f6f1;
  --surface: #ffffff;
  --raised: #f0f2eb;
  --line: #d8ddd3;
  --muted: #535e54;
  --accent: #2e604c;
  --accent-ink: #ffffff;
  --error: #a1262a;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; min-height: 100vh; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, .file-picker:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
svg { height: 19px; width: 19px; flex: none; }
.startup { display: grid; min-height: 100dvh; padding: 24px; place-content: center; justify-items: center; gap: 13px; background: var(--bg); text-align: center; }
.startup img { border-radius: 24px; }
.startup strong { font-size: 26px; letter-spacing: .1em; }
.startup-status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.startup-spinner { width: 14px; height: 14px; border: 2px solid #bbcec1; border-top-color: var(--accent); border-radius: 50%; animation: startup-spin .8s linear infinite; }
@keyframes startup-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .startup-spinner { animation: none; } }
.muted { color: var(--muted); font-size: 14px; line-height: 1.6; }

.brand { display: flex; gap: 11px; align-items: center; }
.brand-mark { width: 39px; height: 39px; display: block; flex: none; border-radius: 11px; background: #faf9f6; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; font-weight: 750; letter-spacing: .065em; line-height: 1.18; }
.brand small { color: var(--muted); font-size: 10px; letter-spacing: .07em; margin-top: 3px; white-space: nowrap; }

.button, .icon-button { min-height: 42px; border: 1px solid transparent; border-radius: 9px; align-items: center; justify-content: center; }
.button { display: inline-flex; gap: 8px; padding: 0 15px; font-size: 14px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.primary { color: var(--accent-ink); background: var(--accent); }
.primary:hover { background: #254e3e; }
.secondary { border-color: var(--line); color: #252d27; background: var(--surface); }
.secondary:hover, .icon-button:hover { background: var(--raised); border-color: #9eaf9f; }
.icon-button { width: 42px; display: inline-grid; place-items: center; color: var(--muted); border-color: var(--line); background: var(--surface); padding: 0; }
.text-button { border: 0; background: transparent; color: var(--accent); font-size: 13px; padding: 7px 3px; }
.mobile-only { display: none; }

.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.26fr) minmax(0, 1fr); }
.auth-visual { min-height: 100%; position: relative; background: #ebece3 url('/studio-cover.jpg') 49% center / cover no-repeat; }
.auth-visual::after { position: absolute; inset: 0; content: ''; background: linear-gradient(140deg, #f7f6f12a, transparent 56%, #f7f6f135); }
.visual-frame { position: absolute; z-index: 1; inset: 27px; pointer-events: none; }
.visual-frame span { width: 23px; height: 23px; position: absolute; border: 1px solid #f7efde7c; }
.visual-frame span:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.visual-frame span:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.visual-frame span:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.visual-frame span:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.auth-panel { min-width: 0; position: relative; padding: 54px 38px 70px; display: grid; place-items: center; }
.auth-body { width: min(380px, 100%); }
.auth-heading { margin: 49px 0 29px; }
.auth-heading h1 { font-size: clamp(28px, 3.3vw, 42px); letter-spacing: -.035em; }
.auth-heading p { margin-top: 8px; font-size: 14px; color: var(--muted); }
.auth-foot { position: absolute; bottom: 26px; left: 38px; right: 38px; display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.auth-foot svg { width: 15px; height: 15px; }
.auth-submit { width: 100%; justify-content: space-between; padding: 0 16px; min-height: 47px; }
form label, .dialog-body > label { display: grid; gap: 7px; margin-bottom: 15px; font-size: 13px; font-weight: 650; }
input:not([type='checkbox'], [type='file']), select { min-width: 0; width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #ffffff; color: #252d27; font-size: 16px; }
input::placeholder { color: #69756b; font-size: 14px; }
input[type='checkbox'] { accent-color: var(--accent); width: 17px; height: 17px; }
.form-error { color: var(--error); font-size: 13px; line-height: 1.55; margin: 0 0 12px; overflow-wrap: anywhere; }
.form-error:empty { display: none; }
.secure-code { display: grid; gap: 8px; margin: 0 0 16px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.employee-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.audit-list { margin-bottom: 15px; }
.audit-item { display: grid; gap: 5px; padding: 10px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.audit-item small { color: var(--muted); }
.more-results { display: flex; justify-content: center; margin-top: 16px; }

.workspace { display: grid; grid-template-columns: 222px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { display: flex; position: sticky; top: 0; height: 100dvh; padding: 24px 17px 17px; flex-direction: column; border-right: 1px solid var(--line); background: #fffefa; }
.sidebar .brand { margin-left: 7px; }
.side-group { margin-top: 48px; }
.nav-label { display: block; margin: 0 0 9px 11px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .12em; }
.nav-button { display: flex; width: 100%; min-height: 42px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px; gap: 11px; align-items: center; margin: 4px 0; background: transparent; color: var(--muted); font-size: 14px; text-align: left; }
.nav-button:hover { background: var(--raised); }
.nav-button.selected { color: var(--accent); border-color: #c1d5c8; background: #e7eee7; }
.side-bottom { margin-top: auto; }
.storage-note { display: flex; align-items: center; gap: 9px; padding: 12px 8px 16px; color: #4a574e; font-size: 12px; }
.storage-note small, .profile small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.storage-icon { width: 32px; height: 32px; display: grid; place-items: center; color: var(--muted); border-radius: 8px; background: var(--raised); }
.storage-icon svg { width: 16px; height: 16px; }
.profile { width: 100%; display: flex; min-height: 58px; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); padding: 8px; text-align: left; }
.profile:hover { background: var(--raised); }
.profile .profile-name { min-width: 0; flex: 1; }
.profile strong, .employee-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.profile svg { width: 14px; height: 14px; color: var(--muted); }
.avatar { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; color: var(--accent); background: #e3eee5; border: 1px solid #c6d9cb; border-radius: 50%; font-size: 14px; font-weight: 700; }
.avatar.mobile-only { display: none; }

.desk { min-width: 0; }
.desk-header { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 3.4vw, 48px); border-bottom: 1px solid var(--line); }
.header-label, .header-actions { display: flex; gap: 9px; align-items: center; }
.header-label { color: #35453b; font-size: 14px; font-weight: 650; }
.header-label svg { color: var(--muted); }
.mobile-brand { display: none; }
.desk-content { padding: 24px clamp(20px, 3.4vw, 48px) 64px; max-width: 1550px; margin: auto; }
.cover { display: flex; min-height: 211px; align-items: center; padding: 28px 32px; overflow: hidden; border: 1px solid #cdd9cd; border-radius: 14px; background: linear-gradient(90deg, #edf2e7 5%, #edf2e7ee 30%, #edf2e71f 75%), url('/studio-cover.jpg') 58% 46% / cover #edf2e7; }
.cover-label { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 13px; color: #325e49; font-size: 12px; font-weight: 650; letter-spacing: .06em; }
.cover-label svg { width: 15px; height: 15px; }
.cover h1 { font-size: clamp(30px, 3.4vw, 50px); font-weight: 740; line-height: 1.13; letter-spacing: -.045em; }
.cover p { color: #414f45; font-size: 14px; margin-top: 10px; }
.toolbar { margin-top: 22px; display: flex; gap: 11px; justify-content: space-between; }
.searchbox { position: relative; width: min(410px, 100%); }
.searchbox svg { position: absolute; pointer-events: none; z-index: 1; top: 13px; left: 11px; color: var(--muted); }
.searchbox input { padding-left: 38px !important; }
.library-actions { display: flex; flex: none; gap: 8px; }
#upload-count { font-size: 12px; font-weight: 750; padding: 2px 5px; border-radius: 4px; background: #ffffff36; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 22px 0 11px; color: var(--muted); }
.breadcrumbs button { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 3px; border: 0; border-radius: 4px; background: transparent; color: inherit; font-size: 12px; overflow-wrap: anywhere; }
.breadcrumbs button:hover { color: var(--accent); }
.breadcrumbs svg { width: 14px; height: 14px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.section-heading h2 { font-size: 22px; font-weight: 700; overflow-wrap: anywhere; }
.section-heading p { margin-top: 6px; color: var(--muted); font-size: 12px; }
.sort-control { display: flex; gap: 6px; flex: none; align-items: center; font-size: 12px; color: var(--muted); white-space: nowrap; }
.sort-control select { width: auto; min-height: 36px; padding: 5px; font-size: 13px; }
.inline-error { color: var(--error); margin: 10px 0; font-size: 14px; }
.inline-error button { border: 0; padding: 7px; background: transparent; color: var(--accent); }
.folder-grid, .video-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); }
.video-grid { margin-top: 12px; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); }
.folder-card { width: 100%; min-width: 0; padding: 10px; min-height: 60px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); text-align: left; }
.folder-card:hover, .video-card:hover { border-color: #94ac9d; background: var(--raised); }
.folder-icon { color: var(--accent); background: #e6efe6; display: grid; width: 33px; height: 33px; place-items: center; border-radius: 7px; flex: none; }
.folder-card > span:nth-child(2) { flex: 1; min-width: 0; }
.folder-card strong, .folder-card small, .video-label strong, .video-label span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-card strong, .video-label strong { font-size: 13px; font-weight: 650; }
.folder-card small, .video-label span { color: var(--muted); font-size: 11px; margin-top: 5px; }
.folder-card > svg { color: var(--muted); width: 14px; }
.video-card { text-align: left; min-width: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; padding: 0; background: var(--surface); }
.thumb { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; background: linear-gradient(155deg, #edf1e8, #dce6df); }
.thumb img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; opacity: 0; }
.thumb img.frame-loaded { opacity: 1; }
.film-placeholder { color: #748e82; transform: rotate(-12deg); }
.film-placeholder svg { width: 73px; height: 73px; stroke-width: .65; }
.play-button { z-index: 1; width: 38px; height: 38px; top: 50%; left: 50%; position: absolute; transform: translate(-50%, -50%); display: grid; place-items: center; border: 1px solid #f7fbf6; border-radius: 50%; background: #f7fbf6ed; color: #26543d; }
.play-button svg { width: 21px; height: 21px; }
.format { position: absolute; z-index: 1; right: 7px; bottom: 7px; padding: 3px 5px; border-radius: 4px; background: #f7fbf6ed; color: #254034; font-size: 10px; font-weight: 650; }
.video-label { padding: 10px; }
.empty { border: 1px dashed #bdcdc0; border-radius: 11px; padding: 33px 14px 36px; text-align: center; display: grid; justify-items: center; gap: 8px; background: #fafbf8; }
.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; color: var(--accent); background: #e7eee7; border: 1px solid #c1d5c8; border-radius: 13px; margin-bottom: 3px; }
.empty-icon svg { width: 25px; height: 25px; }
.empty h3 { font-size: 16px; }
.empty p { color: var(--muted); font-size: 13px; }
.empty .button { margin-top: 7px; }

dialog { width: min(460px, calc(100% - 30px)); max-height: 90dvh; margin: auto; padding: 0; background: #fffefa; color: #252d27; border: 1px solid var(--line); border-radius: 14px; overflow-y: auto; box-shadow: 0 20px 70px #223c303b; }
dialog.wide-dialog { width: min(740px, calc(100% - 30px)); }
dialog::backdrop { background: #233a3066; }
.dialog-head { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 19px; overflow-wrap: anywhere; }
.dialog-head button { flex: none; width: 36px; min-height: 36px; }
.dialog-body { padding: 17px 18px 19px; }
.dialog-body > .muted { margin-bottom: 14px; }
.dialog-actions, .account-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.account-summary { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.account-summary .avatar { width: 42px; height: 42px; }
.player video { display: block; width: 100%; max-height: 63dvh; aspect-ratio: 16 / 9; border-radius: 7px; background: #0b0b0c; }
.player-feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 9px; color: var(--muted); font-size: 13px; }
.player-feedback span:empty { display: none; }
.player-quality { display: flex; gap: 6px; margin-top: 10px; }
.player-quality .button { min-height: 40px; }
.player-quality .button[aria-pressed="true"] { color: var(--accent); background: #e7eee7; border-color: #9eaf9f; }
.player-meta { display: flex; justify-content: space-between; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-size: 13px; }
.player .form-error:not(:empty) { margin-top: 10px; }
.employee-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.employee-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.employee-row .button { min-height: 33px; }
.employee-name small, .employee-role { color: var(--muted); font-size: 12px; }
form label.checkbox { display: flex; align-items: center; gap: 8px; }
.dialog-body .file-picker { position: relative; cursor: pointer; display: grid; justify-items: center; gap: 6px; padding: 19px 10px; border: 1px dashed #8eaf9e; border-radius: 9px; background: #f0f5ef; text-align: center; }
.file-picker svg { color: var(--accent); height: 25px; width: 25px; }
.file-picker small, .upload-help, .upload-item small { color: var(--muted); font-size: 12px; font-weight: 400; }
.file-picker input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.upload-help { margin-top: 13px; line-height: 1.6; }
.upload-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.upload-item { width: 0; min-width: 100px; flex: 1; }
.upload-item strong, .upload-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item strong { font-size: 13px; }
.upload-item small { margin-top: 3px; }
.upload-row progress { width: 100%; height: 9px; accent-color: var(--accent); }
.upload-row .form-error { width: 100%; margin-bottom: 0; }
#notice { position: fixed; z-index: 5; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: min(390px, calc(100% - 32px)); padding: 11px 15px; background: #ffffff; border: 1px solid #a6bdaf; box-shadow: 0 8px 24px #233a3020; border-radius: 9px; opacity: 0; pointer-events: none; font-size: 14px; }
#notice.visible { opacity: 1; }

@media (max-width: 850px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .header-label { display: none; }
  .mobile-brand { display: block; }
  .mobile-only { display: inline-grid; }
  .avatar.mobile-only { display: inline-grid; }
}

@media (max-width: 590px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-visual { display: none; }
  .auth-panel { padding: max(32px, env(safe-area-inset-top)) 23px 68px; }
  .auth-heading { margin: 24px 0 20px; }
  .auth-foot { bottom: 18px; }
  .desk-header { height: calc(62px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 15px 0; }
  .header-actions { gap: 6px; }
  .desk-content { padding: 14px 15px calc(36px + env(safe-area-inset-bottom)); }
  .cover { min-height: 112px; padding: 16px; border-radius: 12px; background: #edf2e7; }
  .cover-label { margin-bottom: 8px; font-size: 11px; }
  .cover p { margin-top: 7px; font-size: 12px; }
  .toolbar { flex-direction: column; margin-top: 13px; gap: 8px; }
  .searchbox { width: 100%; }
  .library-actions > button { flex: 1; }
  .breadcrumbs { margin-top: 16px; }
  .folder-grid, .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .folder-card { gap: 6px; padding: 7px; }
  .folder-card > svg { display: none; }
  .video-label { padding: 7px; }
  .video-label strong { font-size: 12px; }
  .employee-row { gap: 5px; }
  .employee-row .button { padding: 0 8px; }
}
