:root { color-scheme: dark; font-family: system-ui, sans-serif; background: #0f0f0f; color: #f1f1f1; }
body { margin: 0; }
.admin { width: min(86rem, calc(100% - 2rem)); margin: 2.5rem auto; }
.admin.narrow { width: min(32rem, calc(100% - 2rem)); }
.admin-app { padding-bottom: calc(7rem + env(safe-area-inset-bottom, 0px)); }
html { scroll-padding-bottom: calc(7rem + env(safe-area-inset-bottom, 0px)); }
* { box-sizing: border-box; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); letter-spacing: -.04em; }
input, select, textarea, button { border: 1px solid #454d54; border-radius: .5rem; background: #20252a; color: #f1f1f1; }
input, select, textarea { max-width: 100%; min-width: 0; }
button { min-height: 44px; }
p { line-height: 1.55; }
.admin.narrow { padding: 2rem; margin-top: 12vh; border: 1px solid #30363b; border-radius: 1rem; background: #171a1d; }
section { margin-block: 2rem; padding: 1.25rem; border: 1px solid #444; border-radius: .75rem; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .75rem; border-bottom: 1px solid #444; text-align: left; }
form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
label { display: grid; gap: .25rem; }
input, select, button { min-height: 2.6rem; padding: .5rem .75rem; font: inherit; }
button { cursor: pointer; }
a { color: #9bd1ff; }
output { display: block; width: 100%; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: 2rem 1.1rem; margin-top: 2rem; }
.video-card { display: block; min-width: 0; color: inherit; text-decoration: none; border-radius: 1rem; outline: none; }
.video-thumbnail { position: relative; overflow: hidden; aspect-ratio: 9 / 16; border-radius: 1rem; background: #272727; box-shadow: 0 .15rem .5rem rgb(0 0 0 / .35); }
.video-thumbnail { -webkit-touch-callout: none; user-select: none; }
.video-thumbnail > img, .video-preview, .video-preview-player { position: absolute; inset: 0; width: 100%; height: 100%; }
.video-thumbnail > img, .video-preview-player { display: block; object-fit: cover; }
.video-preview { pointer-events: none; }
.video-duration { position: absolute; z-index: 2; right: .5rem; bottom: .5rem; padding: .18rem .35rem; border-radius: .3rem; background: rgb(0 0 0 / .82); color: #fff; font-size: .78rem; font-weight: 650; line-height: 1.2; }
.video-copy { padding: .75rem .2rem 0; }
.video-copy h2 { margin: 0; overflow: hidden; color: #f1f1f1; font-size: .98rem; line-height: 1.35; font-weight: 650; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.video-copy p { margin: .35rem 0 0; color: #aaa; font-size: .86rem; line-height: 1.35; }
.video-status { text-transform: capitalize; }
.status-ready { color: #8fd6a3; }
.status-failed { color: #ff9a9a; }
.video-card:is(:hover, :focus-visible) .video-thumbnail { box-shadow: 0 0 0 .16rem #f1f1f1, 0 .4rem 1rem rgb(0 0 0 / .55); }
.admin.reviewer-page { width: min(86rem, calc(100% - 2rem)); }
.reviewer-page, .reviewer-page * { box-sizing: border-box; }
.reviewer-eyebrow { margin: 0; color: #9bd1ff; font-size: .75rem; font-weight: 700; letter-spacing: .12em; }
.reviewer-help, .reviewer-note { color: #aaa; line-height: 1.55; }
#reviewer-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.reviewer-page .reviewer-section { min-width: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
.reviewer-form { display: grid; gap: 1.25rem; }
.reviewer-form label { min-width: 0; gap: .5rem; font-size: .9rem; font-weight: 600; }
.reviewer-form input, .reviewer-form select { width: 100%; min-width: 0; min-height: 48px; padding: .8rem; border: 1px solid #555; border-radius: .65rem; background: #222; color: #f1f1f1; font-size: 1rem; }
.reviewer-form input::placeholder { color: #999; }
.reviewer-form [data-reviewer-channel] { display: grid; gap: 1.25rem; }
.reviewer-form [data-reviewer-channel][hidden] { display: none; }
.reviewer-help { margin: -.5rem 0 0; font-size: .85rem; }
.reviewer-page button { min-height: 48px; border: 1px solid #555; border-radius: .65rem; font-weight: 600; }
.reviewer-page .reviewer-primary { width: fit-content; min-width: 8rem; background: #9bd1ff; border-color: #9bd1ff; color: #101820; }
.reviewer-archived { display: inline-block; color: #aaa; font-size: .85rem; }
.reviewer-empty { margin: 0; padding-block: 1rem; color: #aaa; }
.reviewer-note { margin-top: 1.5rem; font-size: .8rem; }
@media (max-width: 34rem) {
  .admin { width: min(100% - 1rem, 86rem); margin-top: 1rem; }
  .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem .65rem; }
  .video-thumbnail { border-radius: .75rem; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.reviewer-create > summary { min-height: 44px; display: flex; align-items: center; font-weight: 650; cursor: pointer; color: #9bd1ff; }
.reviewer-create[open] > summary { margin-bottom: 1rem; }
.reviewer-create .reviewer-form { max-width: 40rem; }
.reviewer-table-scroll { overflow-x: auto; }
.reviewer-table { min-width: 760px; font-size: .9rem; }
.reviewer-table th { background: #20252a; color: #aab6c0; font-size: .75rem; font-weight: 600; }
.reviewer-table :is(th, td) { padding: .85rem; border-bottom: 1px solid #30363b; vertical-align: top; }
.reviewer-table tr:last-child td { border-bottom: 0; }
.reviewer-table tbody tr:hover { background: #20252a; }
.reviewer-table tr[data-editing="true"] { background: #1e2c36; }
.reviewer-table td:first-child { min-width: 150px; }
.reviewer-table td:nth-child(3) { min-width: 220px; }
.reviewer-table td:nth-child(4) { min-width: 100px; }
.reviewer-table .cell-editor { display: none; }
.reviewer-table [data-editing="true"] .cell-value { display: none; }
.reviewer-table [data-editing="true"] .cell-editor { display: block; }
.reviewer-table :is(input, select) { width: 100%; min-height: 44px; padding: .5rem; font-size: 1rem; }
.reviewer-table .reviewer-route { display: block; margin: .3rem 0; overflow-wrap: anywhere; color: #aab6c0; }
.reviewer-channel { display: inline-block; padding: .3rem .55rem; border-radius: .4rem; background: #29333b; color: #c8e6ff; text-transform: capitalize; }
.reviewer-row-actions { min-width: 165px; }
.reviewer-row-actions button { min-height: 44px; padding: .5rem .7rem; font-size: .8rem; white-space: nowrap; }
.reviewer-row-actions form { margin: 0 0 .5rem; }
.reviewer-row-actions [data-reviewer-form] button { margin-bottom: .4rem; }
.reviewer-row-actions .reviewer-archive { color: #ffb4b4; border-color: #704343; }
.video-detail section { background: #171a1d; border-color: #30363b; }
.settings-page section { margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
.settings-page h2 { margin-top: 0; font-size: 1.25rem; }
.history-page li { padding: 1rem; border-bottom: 1px solid #30363b; }
@media (min-width: 64rem) { .video-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.5rem; } .video-detail > :is(a, h1, p) { grid-column: 1 / -1; } .settings-page section { max-width: 48rem; } }

.table-hint { margin-top: -.5rem; color: #aab6c0; font-size: .8rem; }
@media (min-width: 64rem) { .table-hint { display: none; } }

.reviewer-create { padding-bottom: 1.25rem; border-bottom: 1px solid #30363b; }
@media (min-width: 64rem) {
  .reviewer-create .reviewer-form { max-width: 52rem; grid-template-columns: 1fr 1fr; align-items: start; }
  .reviewer-form [data-reviewer-channel] { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .reviewer-help { grid-column: 1 / -1; }
}

#chatgpt-connection { max-width: 42rem; }
.settings-help { color: #aab6c0; font-size: .9rem; }
.connection-status { display: flex; align-items: center; gap: .55rem; }
.connection-dot { width: .5rem; height: .5rem; border-radius: 50%; background: #8fd6a3; }
.connection-dot.pending { background: #efc77e; }
.connection-email { margin: .5rem 0; overflow-wrap: anywhere; }
.settings-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1.5rem; }
.settings-actions a { font-size: .9rem; }
.settings-primary { color: #101820; background: #9bd1ff; border-color: #9bd1ff; font-weight: 650; }
.settings-link { display: inline-flex; align-items: center; min-height: 44px; padding: .65rem .9rem; border-radius: .5rem; text-decoration: none; }
.settings-danger { color: #ffb4b4; background: transparent; border-color: #704343; }
.settings-manage, .settings-fallback { margin-top: 1.5rem; padding-top: .75rem; border-top: 1px solid #30363b; }
.settings-page summary { display: flex; align-items: center; gap: .5rem; min-height: 44px; color: #aab6c0; cursor: pointer; font-size: .85rem; }
.settings-page summary svg { width: 18px; height: 18px; flex-shrink: 0; }
.settings-page details[open] > summary svg { transform: rotate(180deg); }
.settings-page details[open] > summary { margin-bottom: .75rem; }
.settings-fallback form { display: grid; align-items: start; }
.settings-fallback input { width: 100%; }
.settings-fallback button { justify-self: start; }
.settings-expiry { font-size: .8rem; }
.connection-message { padding: .75rem 0; border-block: 1px solid #30363b; font-size: .9rem; }
.connection-message[role="alert"] { color: #ffb4b4; }

/* Channel visibility is native; the server selects the submitted routing fields. */
:is(.reviewer-form, .reviewer-table tr):has(select[name="channel_type"] option[value="whatsapp"]:checked) [data-reviewer-channel="telegram"],
:is(.reviewer-form, .reviewer-table tr):has(select[name="channel_type"] option[value="telegram"]:checked) [data-reviewer-channel="whatsapp"] {
  display: none;
}

.video-grid-item { position: relative; min-width: 0; }
.preview-sound { position: absolute; z-index: 3; top: .5rem; right: .5rem; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: rgb(0 0 0 / .75); color: #fff; }
.preview-sound span { display: flex; }
.preview-sound[aria-pressed="true"] .preview-sound-on, .preview-sound[aria-pressed="false"] .preview-sound-off { display: none; }
.preview-sound:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Match the shared review page's contained video canvas above navigation. */
.app-frame .video-detail:has(.video-workspace) { display: block; width: 100%; margin: 0; padding: 0; }
.video-detail .video-workspace { position: relative; display: grid; place-items: center; height: calc(100dvh - 72px - 7rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); min-height: 12rem; margin: 0; padding: 0; border: 0; border-radius: 0; background: #000; }
.workspace-player { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.workspace-edit { position: absolute; top: 1rem; right: 1rem; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #454d54; border-radius: 8px; color: #f1f1f1; background: #20252a; }
@media (min-width: 64rem) { .video-detail .video-workspace { height: calc(100dvh - 76px); } }
.video-activity ol { list-style: none; padding: 0; }
.video-activity li { display: grid; gap: .25rem; padding: 1rem 0; border-bottom: 1px solid #30363b; }
.video-activity time { color: #a4adb5; font-size: 1rem; font-variant-numeric: tabular-nums; }
.video-activity li:last-child { border-bottom: 0; }
.video-detail > section:only-of-type { grid-column: 1 / -1; }
.asset-library > form, .asset-entry details form { display: grid; align-items: start; gap: 1rem; }
.asset-library label, .asset-library input, .asset-library textarea { min-width: 0; width: 100%; box-sizing: border-box; }
.asset-library input, .asset-library textarea { font: inherit; }
.asset-library [data-asset-list] { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: 1rem; margin-top: 1rem; }
.asset-library .asset-entry { margin: 0; overflow-wrap: anywhere; }
.asset-transfer ol { list-style: none; padding: 0; }
.asset-transfer li { padding: 1rem 0; border-bottom: 1px solid #30363b; overflow-wrap: anywhere; }
.asset-transfer li > span, .asset-transfer progress { display: block; width: 100%; margin-top: .5rem; }
.asset-transfer progress { accent-color: #9bd1ff; }
.asset-library input, .asset-library textarea, .asset-library button { min-height: 44px; }
.asset-library > form p { margin: .25rem 0; }

.asset-library h1 { font-size: 1.25rem; letter-spacing: -.02em; }
.asset-library > form { gap: .75rem; }
.asset-library > form label { font-size: .875rem; }
.asset-upload-options { grid-column: 1 / -1; font-size: .875rem; }
.asset-upload-options summary { min-height: 44px; padding-block: .75rem; cursor: pointer; }
.asset-upload-options label { display: block; margin-bottom: .75rem; }
.asset-library small, .asset-library [data-asset-stream-status], .asset-analysis-unavailable { color: #a4adb5; font-size: .875rem; }
.asset-entry { padding: 1rem; }
.asset-entry h2 { margin: .75rem 0 .25rem; font-size: 1rem; line-height: 1.4; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.asset-preview { display: grid; place-items: center; height: 160px; }
.asset-preview img { width: 100%; height: 160px; min-width: 0; object-fit: contain; }
.asset-entry p, .asset-entry summary, .asset-entry button { font-size: .875rem; }
.asset-entry summary { min-height: 44px; padding-block: .75rem; cursor: pointer; }
.asset-entry [data-asset-state] { color: #9bd1ff; font-weight: 600; }
.asset-entry[data-analysis-status="ready"] [data-asset-state] { color: #8fd6a3; }
.asset-entry [data-asset-error], .asset-entry[data-analysis-status="failed"] [data-asset-state] { color: #ff9a9a; }
.asset-entry .asset-description { margin-top: .5rem; }
.asset-analysis-progress { margin-top: 1.25rem; }
.asset-analysis-progress p { margin-bottom: .5rem; }
.asset-analysis-progress progress { width: 100%; height: .5rem; accent-color: #9bd1ff; }
.asset-entry[data-analysis-status="processing"] [data-asset-state]::before { content: ""; display: inline-block; width: .75rem; height: .75rem; margin-right: .5rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: asset-spin 1s linear infinite; }
@keyframes asset-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .asset-entry[data-analysis-status="processing"] [data-asset-state]::before { animation: none; } }
@media (min-width: 64rem) { .asset-library > form { grid-template-columns: 1fr 1fr; } .asset-library > form :is(small, noscript, [data-upload-error]) { grid-column: 1 / -1; } }
.ai-comment-form { display: grid; gap: .75rem; }
.ai-comment-form textarea { display: block; width: 100%; min-width: 0; box-sizing: border-box; font: inherit; font-size: 1rem; }
.ai-comment-form small { color: #a4adb5; }
.ai-comment-form summary { min-height: 44px; padding-block: .75rem; cursor: pointer; }
.ai-asset-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; max-height: 14rem; overflow-y: auto; margin-bottom: .75rem; }
.ai-asset-picker label { display: grid; gap: .25rem; padding: .5rem; border: 1px solid #454d54; border-radius: 8px; overflow-wrap: anywhere; cursor: pointer; }
.ai-asset-picker label:has(input:checked) { border-color: #9bd1ff; background: #223742; }
.ai-asset-picker input { width: 20px; height: 20px; }
.ai-asset-picker img { display: block; width: 100%; height: 64px; object-fit: contain; }
.ai-asset-picker span { font-size: .75rem; }
.workspace-comment-editor { max-height: calc(100dvh - 13rem); overflow-y: auto; }
.workspace-comment-editor summary { min-height: 44px; padding-block: .75rem; cursor: pointer; }
.workspace-comment-editor .ai-asset-picker { margin-top: .5rem; }
.video-workspace .comment-controls { bottom: calc(7rem + env(safe-area-inset-bottom, 0px)); }

::selection { color: #122332; background: #9bd1ff; }
input::placeholder, textarea::placeholder { color: #a4adb5; opacity: 1; }
.page-heading, .video-detail-heading, .section-heading { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.page-heading { margin-bottom: 2rem; }
.page-heading h1, .video-detail-heading h1, .section-heading h2 { margin: 0; }
.page-heading p, .video-detail-heading p { max-width: 70ch; margin: .4rem 0 0; color: #a4adb5; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.primary-link, .primary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .6rem .9rem; border: 1px solid #9bd1ff; border-radius: .5rem; background: #9bd1ff; color: #122332; font-weight: 650; text-decoration: none; }
.empty-state { max-width: 44rem; margin-inline: auto; text-align: center; }
.empty-state h2 { margin-top: 0; }
.project-home { display: grid; min-height: calc(100dvh - 8rem); place-items: center; }
.project-home-panel { width: min(38rem, 100%); margin: 0; }
.project-home-panel h1 { margin-top: 0; }
.project-chooser { display: grid; grid-template-columns: minmax(0, 1fr) auto; margin-top: 1.5rem; }
.project-chooser label { grid-column: 1 / -1; }
.project-chooser select { width: 100%; }
.project-video-workspace { max-height: 70dvh; }
.video-detail-heading { padding: 1.5rem max(1rem, calc((100vw - 86rem) / 2)); }
.review-history, .share-list, .invitation-list { padding: 0; list-style: none; }
.review-history li, .share-list li, .invitation-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 0; border-bottom: 1px solid #30363b; }
.review-history li > span, .share-list li > span, .invitation-list li > span { display: grid; gap: .25rem; }
.review-history small, .share-list small, .invitation-list small, .muted { color: #a4adb5; }
.version-tree :is(ol, ul) { list-style: none; }
.version-tree-roots { padding: 0; }
.version-tree li { position: relative; padding: 0 0 .65rem 1.25rem; border: 0; }
.version-tree li::before { content: ""; position: absolute; top: 0; bottom: 0; left: .35rem; border-left: 1px solid #454d54; }
.version-node { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 56px; padding: .7rem .8rem; border: 1px solid #30363b; border-radius: .5rem; background: #171a1d; color: #f1f1f1; text-decoration: none; }
.version-node[aria-current="page"] { border-color: #9bd1ff; background: #20252a; }
.version-node > span:first-child { display: grid; gap: .15rem; min-width: 0; }
.version-node small { color: #a4adb5; }
.editing-form { max-width: 52rem; }
.editing-form > label:first-child, .editing-form > label:first-child textarea { width: 100%; }
.replan-option { grid-template-columns: auto minmax(0, 1fr); align-items: start; padding: 1rem; border: 1px solid #454d54; border-radius: .5rem; }
.replan-option input { width: 20px; height: 20px; margin: .15rem 0 0; }
.replan-option span { display: grid; gap: .25rem; }
.replan-option small, .status-note { color: #a4adb5; }
.editing-job { margin-block: 1rem; }
.editing-job-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.editing-job-heading span { color: #a4adb5; }
.editing-job video { width: 100%; max-height: 60dvh; }
.permission-form { display: grid; align-items: start; max-width: 56rem; }
.permission-form > label, .permission-form > label input { width: 100%; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; width: 100%; padding: 1rem; border: 1px solid #454d54; border-radius: .5rem; }
.permission-grid legend { padding-inline: .35rem; font-weight: 650; }
.permission-grid label { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .65rem; min-height: 44px; padding: .35rem; }
.permission-grid input { width: 20px; height: 20px; }
.member-row { margin-block: .75rem; border-bottom: 1px solid #30363b; }
.member-row > summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 56px; cursor: pointer; }
.member-row > summary span { color: #a4adb5; font-size: .9rem; }
.member-row .permission-form { padding: 0 0 1.25rem; }
.one-time-result output { padding: .8rem; border: 1px solid #454d54; border-radius: .5rem; background: #20252a; user-select: all; }
.settings-form { display: grid; max-width: 36rem; }
.settings-form input { width: 100%; }
@media (max-width: 40rem) {
	.project-chooser { grid-template-columns: 1fr; }
	.project-chooser label { grid-column: auto; }
	.permission-grid { grid-template-columns: 1fr; }
	.version-tree :is(ol, ul) { padding-left: .5rem; }
	.version-node { align-items: flex-start; }
}
