:root {
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color: #18201e;
  background: #f3f5f3;
  font-size: 14px;
  letter-spacing: 0;
  --ink: #18201e;
  --muted: #68736f;
  --faint: #8f9995;
  --line: #dde3df;
  --soft-line: #e9eeeb;
  --surface: #ffffff;
  --surface-soft: #f7f9f7;
  --forest: #176448;
  --forest-dark: #104b37;
  --forest-soft: #e8f2ed;
  --coral: #d76048;
  --coral-soft: #faece8;
  --blue: #39758a;
  --blue-soft: #e9f2f5;
  --amber: #a76a18;
  --amber-soft: #fbf2df;
  --sidebar: 236px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: #f3f5f3; color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: 0; }
button, a, label, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
.iconless { border: 0; background: transparent; padding: 0; text-align: left; color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #7ab59f; outline-offset: 2px; }
svg { width: 18px; height: 18px; stroke-width: 1.8; flex: 0 0 auto; }
[hidden] { display: none !important; }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 28px; position: relative; overflow: hidden; }
.login-backdrop { position: absolute; inset: 0; background: rgba(13, 24, 21, .64) url("/assets/login.jpg") center/cover; background-blend-mode: multiply; }
.login-panel { position: relative; width: min(100%, 414px); background: rgba(255,255,255,.97); border: 1px solid rgba(255,255,255,.72); box-shadow: 0 22px 80px rgba(0,0,0,.28); border-radius: 8px; padding: 34px; }
.login-brand, .brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 11px; font-size: 18px; font-weight: 750; }
.login-brand small, .brand small { display: block; color: var(--muted); font-size: 10px; font-weight: 500; margin-top: 2px; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; color: white; background: var(--forest); }
.brand-mark svg { width: 17px; fill: currentColor; }
.login-heading { margin: 48px 0 26px; }
.login-heading h1 { font-size: 26px; margin: 8px 0 0; }
.login-panel label, .dialog label { display: grid; gap: 8px; font-size: 12px; color: #46514d; font-weight: 600; margin-bottom: 16px; }
input, select, textarea { width: 100%; border: 1px solid #d5dcd8; border-radius: 6px; background: #fff; padding: 11px 12px; min-height: 42px; transition: border-color .16s, box-shadow .16s; }
input:hover, select:hover, textarea:hover { border-color: #b9c6bf; }
input:focus, select:focus, textarea:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(23,100,72,.1); outline: 0; }
textarea { resize: vertical; line-height: 1.6; }
.eyebrow { color: var(--faint); font-size: 10px; font-weight: 750; letter-spacing: 0; }
.form-error { min-height: 19px; color: #b23a31; font-size: 12px; margin: 2px 0 10px; }
.demo-hint { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: 11px; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: #fbfcfb; border-right: 1px solid var(--line); padding: 24px 18px 18px; display: flex; flex-direction: column; z-index: 30; }
.brand { padding: 0 8px; }
.workspace-switch { margin: 28px 0 18px; border: 1px solid var(--line); background: #fff; min-height: 42px; border-radius: 6px; display: flex; align-items: center; justify-content: space-between; padding: 0 11px; font-size: 12px; font-weight: 650; }
.workspace-switch svg { width: 15px; color: var(--muted); }
nav { display: grid; gap: 5px; }
nav button { border: 0; background: transparent; color: #63706b; border-radius: 6px; display: flex; align-items: center; gap: 12px; min-height: 43px; padding: 0 12px; text-align: left; }
nav button:hover { background: #f0f3f1; color: var(--ink); }
nav button.active { background: var(--forest-soft); color: var(--forest-dark); font-weight: 700; }
nav button b { margin-left: auto; min-width: 24px; background: rgba(255,255,255,.78); border: 1px solid rgba(23,100,72,.12); border-radius: 4px; padding: 2px 6px; font-size: 10px; text-align: center; }
.storage-card { margin-top: auto; border-top: 1px solid var(--line); padding: 18px 6px 16px; }
.storage-card > div:first-child { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.storage-card strong { color: var(--ink); }
.storage-track { height: 5px; background: #e1e7e3; border-radius: 2px; margin: 10px 0 8px; overflow: hidden; }
.storage-track span { display: block; width: 0; height: 100%; background: var(--forest); transition: width .3s; }
.storage-card p { margin: 0; color: var(--faint); font-size: 10px; }
.account-menu { display: grid; grid-template-columns: 34px 1fr 32px; gap: 9px; align-items: center; border-top: 1px solid var(--line); padding: 17px 4px 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #dae6e0; color: var(--forest-dark); font-size: 12px; font-weight: 750; }
.account-menu strong { display: block; font-size: 12px; }
.account-menu small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }

.app-main { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { height: 70px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.95); display: flex; align-items: center; gap: 12px; padding: 0 30px; position: sticky; top: 0; z-index: 20; }
.breadcrumb { display: flex; align-items: center; gap: 7px; color: var(--faint); font-size: 11px; white-space: nowrap; }
.breadcrumb svg { width: 13px; }
.breadcrumb strong { color: #45504c; font-weight: 600; }
.global-search { position: relative; width: min(520px, 42vw); margin-left: auto; }
.global-search input { height: 39px; min-height: 39px; padding: 0 62px 0 38px; background: var(--surface-soft); }
.global-search > svg { position: absolute; width: 16px; left: 12px; top: 11px; color: var(--muted); z-index: 1; }
kbd { position: absolute; right: 9px; top: 9px; border: 1px solid #d8dfdb; background: white; color: var(--faint); border-radius: 4px; font: 10px inherit; padding: 3px 6px; }
.button { min-height: 38px; border: 1px solid #d4ddd8; background: #fff; color: #394742; border-radius: 6px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 650; font-size: 12px; white-space: nowrap; transition: background .16s, border-color .16s, transform .16s; }
.button:hover { background: #f5f8f6; border-color: #bdc9c2; }
.button:active { transform: translateY(1px); }
.button.primary { background: var(--forest); border-color: var(--forest); color: white; }
.button.primary:hover { background: var(--forest-dark); border-color: var(--forest-dark); }
.button.danger { background: #fff; border-color: #ecc7c0; color: #b74334; }
.button.wide { width: 100%; }
.icon-button { width: 34px; height: 34px; border: 0; background: transparent; color: var(--muted); border-radius: 6px; display: inline-grid; place-items: center; padding: 0; }
.icon-button:hover { background: #eef2ef; color: var(--ink); }
.menu-button { display: none; }

.page { padding: 30px; max-width: 1700px; margin: 0 auto; }
.page-heading { min-height: 62px; display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 22px; }
.page-heading h1 { font-size: 25px; line-height: 1.2; margin: 7px 0 5px; font-weight: 720; }
.page-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.page-actions { display: flex; gap: 8px; align-items: center; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { min-height: 102px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 16px; }
.stat > div { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.stat-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 5px; background: var(--forest-soft); color: var(--forest); }
.stat:nth-child(2) .stat-icon { background: var(--blue-soft); color: var(--blue); }
.stat:nth-child(3) .stat-icon { background: var(--amber-soft); color: var(--amber); }
.stat:nth-child(4) .stat-icon { background: var(--coral-soft); color: var(--coral); }
.stat-icon svg { width: 15px; }
.stat strong { display: block; font-size: 24px; line-height: 1; margin-top: 13px; }
.stat small { display: block; color: var(--faint); font-size: 10px; margin-top: 7px; }

.library-toolbar { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 11px; display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.library-toolbar .filter-control { min-width: 132px; width: auto; min-height: 36px; height: 36px; padding: 0 30px 0 10px; font-size: 11px; background: var(--surface-soft); }
.library-toolbar .result-count { color: var(--muted); font-size: 11px; margin-left: 3px; }
.period-filter { display: flex; align-items: center; gap: 6px; min-width: 242px; }
.period-filter > .filter-control { min-width: 128px; flex: 1; padding-right: 8px; }
.period-mode { display: flex; align-items: center; gap: 2px; height: 36px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #eef2ef; }
.period-mode button { height: 28px; padding: 0 9px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 10px; white-space: nowrap; }
.period-mode button.active { background: #fff; color: var(--forest); box-shadow: 0 1px 3px rgba(27,43,36,.1); }
.view-toggle { display: flex; align-items: center; gap: 3px; margin-left: auto; padding: 3px; background: #eef2ef; border-radius: 6px; }
.view-toggle button { width: 30px; height: 28px; border: 0; border-radius: 4px; color: var(--muted); background: transparent; display: grid; place-items: center; }
.view-toggle button.active { background: #fff; color: var(--forest); box-shadow: 0 1px 3px rgba(27,43,36,.1); }
.view-toggle svg { width: 15px; }

.tag-strip { display: flex; align-items: center; gap: 7px; overflow-x: auto; padding: 1px 0 13px; scrollbar-width: none; }
.tag-strip::-webkit-scrollbar { display: none; }
.tag-chip { border: 1px solid var(--line); background: #fff; color: #56635e; border-radius: 5px; padding: 7px 10px; font-size: 11px; white-space: nowrap; }
.tag-chip.active { background: #26332e; border-color: #26332e; color: white; }

.video-grid { display: grid; grid-template-columns: repeat(4, minmax(210px, 1fr)); gap: 14px; }
.video-card { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; min-width: 0; transition: border-color .16s, transform .16s, box-shadow .16s; }
.video-card:hover { transform: translateY(-2px); border-color: #bdc9c2; box-shadow: 0 9px 24px rgba(24,32,30,.08); }
.pagination { margin-top: 18px; padding: 11px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); font-size: 11px; }
.pagination-controls { display: flex; align-items: center; gap: 5px; }
.pagination .icon-button, .page-button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--muted); display: grid; place-items: center; font-size: 11px; }
.pagination button:disabled { opacity: .38; cursor: default; }
.page-button.active { background: var(--forest); border-color: var(--forest); color: #fff; }
.pagination-controls label { display: flex; align-items: center; gap: 6px; margin-left: 7px; white-space: nowrap; }
.pagination-controls select { width: 62px; min-height: 32px; height: 32px; padding: 0 22px 0 8px; font-size: 11px; }
.video-thumb { width: 100%; aspect-ratio: 16/9; border: 0; padding: 0; display: block; position: relative; overflow: hidden; background: #26312d; text-align: left; }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.video-card:hover .video-thumb img { transform: scale(1.025); }
.video-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: #dbe6e0; background-color: #2c3934; background-image: linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px); background-size: 30px 30px; }
.video-fallback svg { width: 40px; height: 40px; }
.video-play { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; background: rgba(9,17,14,.25); transition: opacity .16s; color: white; }
.video-card:hover .video-play { opacity: 1; }
.video-play span { width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.93); color: var(--forest-dark); display: grid; place-items: center; }
.video-play svg { width: 18px; fill: currentColor; }
.duration { position: absolute; right: 8px; bottom: 8px; background: rgba(12,17,15,.82); color: white; border-radius: 4px; padding: 3px 6px; font-size: 10px; }
.demo-badge { position: absolute; left: 8px; top: 8px; background: rgba(255,255,255,.92); color: #52605a; border-radius: 4px; padding: 4px 6px; font-size: 9px; }
.video-card-body { padding: 13px; }
.video-card-title { display: flex; gap: 7px; align-items: flex-start; }
.video-card-title button { flex: 1; border: 0; background: transparent; padding: 0; text-align: left; font-weight: 700; font-size: 13px; line-height: 1.45; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-card-title .icon-button { flex: 0 0 28px; width: 28px; height: 28px; margin-top: -5px; }
.video-meta { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--faint); font-size: 10px; white-space: nowrap; overflow: hidden; }
.video-meta span { overflow: hidden; text-overflow: ellipsis; }
.video-tags { display: flex; gap: 5px; margin-top: 11px; overflow: hidden; }
.video-tags span { background: #f0f3f1; color: #64706b; border-radius: 4px; padding: 4px 6px; font-size: 9px; white-space: nowrap; }

.video-table-wrap, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { height: 42px; background: var(--surface-soft); color: var(--muted); font-size: 10px; font-weight: 650; padding: 0 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid var(--soft-line); font-size: 11px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfcfb; }
.table-video { display: grid; grid-template-columns: 82px minmax(150px, 1fr); gap: 11px; align-items: center; }
.table-video-thumb { width: 82px; aspect-ratio: 16/9; border-radius: 5px; object-fit: cover; background: #2c3934; }
.table-video strong { display: block; font-size: 12px; }
.table-video small { color: var(--faint); display: block; margin-top: 4px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-actions { display: flex; justify-content: flex-end; gap: 3px; }

.tag-index { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tag-index-card { border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 16px; display: grid; grid-template-columns: 38px 1fr auto; gap: 11px; align-items: center; text-align: left; }
.tag-index-card:hover { border-color: #bac8c0; box-shadow: 0 5px 15px rgba(24,32,30,.05); }
.tag-index-card > span:first-child { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 6px; background: var(--forest-soft); color: var(--forest); }
.tag-index-card strong { display: block; font-size: 12px; }
.tag-index-card small { display: block; color: var(--muted); margin-top: 4px; font-size: 10px; }
.tag-index-card > strong { font-size: 20px; }

.panel-heading { min-height: 64px; padding: 14px 17px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-heading h2 { font-size: 14px; margin: 0; }
.panel-heading p { color: var(--muted); margin: 5px 0 0; font-size: 10px; }
.permission-grid { display: grid; grid-template-columns: minmax(160px, 1.6fr) repeat(3, minmax(100px, .7fr)); }
.permission-grid > div { min-height: 54px; display: flex; align-items: center; padding: 0 18px; border-bottom: 1px solid var(--soft-line); }
.permission-grid .permission-head { min-height: 39px; background: var(--surface-soft); color: var(--muted); font-size: 10px; font-weight: 650; }
.permission-grid > div:not(:nth-child(4n+1)) { justify-content: center; border-left: 1px solid var(--soft-line); }
.permission-grid strong { display: block; font-size: 12px; }
.permission-grid small { display: block; color: var(--muted); margin-top: 4px; font-size: 10px; }
.permission-grid input { width: 17px; height: 17px; min-height: 17px; accent-color: var(--forest); }
.permissions-layout { display: grid; gap: 16px; }
.role-pill { display: inline-flex; align-items: center; border-radius: 4px; padding: 4px 7px; background: var(--forest-soft); color: var(--forest-dark); font-size: 10px; }
.member-row select { width: 128px; min-height: 34px; height: 34px; padding: 0 29px 0 9px; font-size: 11px; }

.log-filters { display: flex; gap: 8px; }
.log-filters select { width: 150px; min-height: 35px; height: 35px; padding: 0 28px 0 9px; font-size: 11px; }
.action-badge { border-radius: 4px; padding: 5px 7px; display: inline-block; font-size: 10px; color: var(--blue); background: var(--blue-soft); }
.action-badge.delete { color: var(--coral); background: var(--coral-soft); }
.action-badge.upload { color: var(--forest); background: var(--forest-soft); }
.action-badge.permission { color: var(--amber); background: var(--amber-soft); }

.empty-state { min-height: 300px; display: grid; place-items: center; text-align: center; background: var(--surface); border: 1px dashed #cad3ce; border-radius: 7px; padding: 36px; }
.empty-state span { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--forest-soft); color: var(--forest); margin: auto; }
.empty-state span svg { width: 23px; height: 23px; }
.empty-state h2 { font-size: 15px; margin: 15px 0 6px; }
.empty-state p { color: var(--muted); margin: 0 0 16px; font-size: 11px; }

.scrim { position: fixed; inset: 0; background: rgba(11,18,15,.48); z-index: 39; }
.dialog { border: 0; padding: 0; border-radius: 8px; width: min(94vw, 650px); max-height: 92vh; box-shadow: 0 26px 90px rgba(0,0,0,.28); overflow: auto; }
.dialog:not([open]) { display: none; }
.dialog::backdrop { background: rgba(11,18,15,.5); }
.dialog form, .compact-dialog { padding: 24px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 21px; }
.dialog-heading h2 { font-size: 19px; margin: 5px 0 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.drop-zone { min-height: 170px; display: flex !important; flex-direction: column; align-items: center; justify-content: center; border: 1px dashed #b9c8c0; background: var(--surface-soft); border-radius: 7px; padding: 22px; text-align: center; cursor: pointer; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--forest); background: var(--forest-soft); }
.drop-zone input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop-zone .drop-icon { width: 45px; height: 45px; display: grid; place-items: center; color: var(--forest); background: #fff; border: 1px solid var(--line); border-radius: 7px; margin-bottom: 12px; }
.drop-zone strong { font-size: 13px; }
.drop-zone small { color: var(--muted); margin-top: 6px; font-size: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 13px; }
.span-2 { grid-column: span 2; }
.upload-progress { margin: 16px 0 0; }
.upload-progress > div { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 7px; }
progress { appearance: none; width: 100%; height: 7px; border: 0; border-radius: 3px; overflow: hidden; }
progress::-webkit-progress-bar { background: #e2e8e4; }
progress::-webkit-progress-value { background: var(--forest); }
progress::-moz-progress-bar { background: var(--forest); }

.video-dialog { width: min(94vw, 1080px); display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, .85fr); overflow: hidden; }
.video-player { min-height: 560px; background: #131916; display: grid; place-items: center; color: #dbe4df; }
.video-player video { width: 100%; height: 100%; max-height: 70vh; object-fit: contain; background: #0e1210; }
.video-player img { width: 100%; height: 100%; object-fit: cover; }
.video-unavailable { text-align: center; padding: 30px; }
.video-unavailable svg { width: 42px; height: 42px; }
.video-unavailable strong { display: block; margin-top: 12px; }
.video-unavailable small { display: block; margin-top: 6px; color: #98a6a0; }
.video-detail { padding: 24px; overflow: auto; }
.detail-description { color: #52605a; font-size: 12px; line-height: 1.7; margin: 0 0 17px; }
.detail-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 17px 0; }
.detail-facts div { background: var(--surface-soft); border: 1px solid var(--soft-line); border-radius: 6px; padding: 10px; }
.detail-facts span { display: block; color: var(--muted); font-size: 9px; }
.detail-facts strong { display: block; font-size: 11px; margin-top: 5px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 80; max-width: min(420px, calc(100vw - 32px)); background: #202a26; color: white; border: 1px solid #3a4b44; border-radius: 6px; box-shadow: 0 12px 36px rgba(0,0,0,.25); padding: 12px 15px; font-size: 12px; }

@media (max-width: 1250px) {
  .library-toolbar { flex-wrap: wrap; }
  .video-grid { grid-template-columns: repeat(3, minmax(210px, 1fr)); }
  .global-search { width: min(430px, 38vw); }
  .breadcrumb { display: none; }
}

@media (max-width: 980px) {
  :root { --sidebar: 220px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .video-grid { grid-template-columns: repeat(2, minmax(210px, 1fr)); }
  .tag-index { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { padding: 0 20px; }
  .topbar > .button span { display: none; }
  .global-search { width: auto; flex: 1; }
  .video-dialog { grid-template-columns: 1fr; }
  .video-player { min-height: min(52vh, 480px); }
}

@media (max-width: 720px) {
  .sidebar { transform: translateX(-101%); transition: transform .22s; box-shadow: 12px 0 40px rgba(0,0,0,.16); }
  .sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .menu-button { display: inline-grid; }
  .topbar { height: 62px; padding: 0 12px; gap: 7px; }
  .global-search kbd { display: none; }
  .global-search input { padding-right: 10px; }
  .topbar > .button { width: 36px; min-width: 36px; padding: 0; }
  .page { padding: 20px 14px; }
  .page-heading { min-height: auto; margin-bottom: 17px; }
  .page-heading h1 { font-size: 22px; }
  .page-actions { align-self: center; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { min-height: 92px; padding: 13px; }
  .stat strong { font-size: 21px; }
  .library-toolbar { flex-wrap: wrap; }
  .library-toolbar .filter-control { flex: 1; min-width: 120px; }
  .library-toolbar .period-filter { width: 100%; min-width: 0; }
  .library-toolbar .period-filter > .filter-control { min-width: 0; }
  .library-toolbar .result-count { order: 3; width: calc(100% - 82px); }
  .video-grid { grid-template-columns: 1fr; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .pagination-controls { width: 100%; flex-wrap: wrap; }
  .pagination-controls label { margin-left: auto; }
  .tag-index { grid-template-columns: 1fr; }
  .video-table-wrap { overflow-x: auto; }
  table { min-width: 720px; }
  .permission-grid { grid-template-columns: minmax(125px, 1.3fr) repeat(3, minmax(70px, .7fr)); min-width: 480px; }
  .panel.permission-panel { overflow-x: auto; }
  .permission-grid > div { padding: 0 10px; }
  .dialog { width: 100vw; max-width: none; max-height: 94vh; margin: auto 0 0; border-radius: 8px 8px 0 0; }
  .dialog form, .compact-dialog, .video-detail { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .video-dialog { width: 100vw; }
  .video-player { min-height: 34vh; }
  .toast { left: 16px; right: 16px; bottom: 16px; }
}

@media (max-width: 410px) {
  .stats { grid-template-columns: 1fr; }
  .page-heading p { display: none; }
  .global-search input::placeholder { color: transparent; }
  .detail-facts { grid-template-columns: 1fr; }
}
