:root {
  --bg: #f1f4f1;
  --surface: #ffffff;
  --surface-soft: #e8eeea;
  --rail: #153b36;
  --primary: #236e5c;
  --primary-hover: #195343;
  --text: #173b34;
  --muted: #536b64;
  --line: #d5dfd9;
  --selection: #d3e9de;
  --ok: #25634b;
  --bad: #ab3434;
  --warning: #805515;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
::selection { background: var(--selection); color: var(--text); }
* { scrollbar-width: thin; scrollbar-color: #9db2a7 transparent; }
a { color: var(--primary); text-underline-offset: 4px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; }
button, .button-link { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 11px 18px; background: var(--primary); color: white; border: 1px solid transparent; border-radius: 8px; font-weight: 600; cursor: pointer; text-decoration: none; transition: background 160ms ease, border-color 160ms ease; }
button:hover, .button-link:hover { background: var(--primary-hover); }
button.secondary, button.ghost { color: var(--text); background: transparent; border-color: var(--line); }
button.secondary:hover, button.ghost:hover { background: var(--surface-soft); border-color: #a5bbae; }
button:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 3px solid #71a88c; outline-offset: 3px; }
input, select, textarea { width: 100%; min-width: 0; min-height: 46px; border: 1px solid #b8c9bf; border-radius: 8px; padding: 11px 13px; background: var(--surface); color: var(--text); caret-color: var(--primary); }
input::placeholder, textarea::placeholder { color: #60746c; opacity: 1; }
input:hover, textarea:hover { border-color: #7c9e8e; }
input[type=number], input[type=time] { font-variant-numeric: tabular-nums; }
input[type=file] { font-size: 13px; padding: 8px; }
input::file-selector-button { border: 0; border-radius: 5px; background: var(--surface-soft); color: var(--text); padding: 7px 10px; font: inherit; margin-right: 10px; cursor: pointer; }
textarea { min-height: 110px; resize: vertical; }
label { display: grid; gap: 8px; font-size: 14px; font-weight: 500; }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
legend, .field-label { font-size: 14px; font-weight: 600; padding: 0; margin-bottom: 10px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { text-wrap: balance; }
h2 { font-size: clamp(28px, 3vw, 40px); line-height: 1.2; letter-spacing: -.03em; font-weight: 650; margin-bottom: 10px; }
h3 { font-size: 20px; font-weight: 600; line-height: 1.3; margin-bottom: 25px; letter-spacing: -.015em; }
.shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100dvh; }
.rail { background: var(--rail); color: #edf5f0; padding: 36px 18px 24px; display: flex; flex-direction: column; gap: 54px; position: sticky; top: 0; height: 100dvh; }
.brand-mark { display: flex; align-items: center; gap: 12px; color: inherit; font-size: 29px; font-weight: 650; letter-spacing: -.04em; text-decoration: none; padding: 0 13px; }
.brand-symbol { width: 20px; height: 25px; display: inline-block; background: #b6d7bb; clip-path: polygon(0 0, 48% 0, 48% 42%, 100% 0, 100% 50%, 52% 100%, 0 100%); }
.rail nav { display: grid; gap: 7px; }
.rail button.nav { text-align: left; justify-content: flex-start; padding: 13px 14px; color: #c5dbd2; background: transparent; font-weight: 500; font-size: 14px; }
.rail button.nav:hover { background: #224d44; color: white; }
.rail button.nav.active { background: #d3e9de; color: #173b34; }
.rail .foot { margin-top: auto; padding: 18px 13px 0; display: grid; gap: 9px; border-top: 1px solid #386054; font-size: 13px; }
.rail .foot .muted { color: #c5dbd2; }
.rail .secondary { color: #edf5f0; border-color: #52796a; justify-self: start; min-height: 36px; padding: 6px 13px; }
.rail .secondary:hover { background: #224d44; }
.engine-pill { color: #c5dbd2; font-size: 12px; }
.main { min-width: 0; padding: 46px clamp(24px, 4vw, 60px) 60px; }
.main > section { max-width: 1320px; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 36px; }
.hint { color: var(--muted); margin: 0; font-size: 15px; max-width: 65ch; }
.creation-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 26px; align-items: start; }
.work-area, .panel { background: var(--surface); border-radius: 16px; padding: 28px; }
.work-area { min-width: 0; }
.source-area { min-height: 478px; }
.options-area { display: grid; gap: 23px; }
.options-area h3 { margin-bottom: 1px; }
.range-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.range-pair label { font-size: 12px; color: var(--muted); gap: 5px; }
.range-pair input { font-size: 17px; color: var(--text); }
.or-divider { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; margin: 24px 0; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.file-drop { background: #f6f9f6; border: 1px dashed #9cb6a7; padding: 28px 20px; border-radius: 12px; justify-items: center; gap: 10px; text-align: center; }
.file-drop svg { width: 30px; height: 30px; color: var(--primary); margin-bottom: 6px; }
.file-drop strong { font-size: 18px; font-weight: 600; }
.file-drop input { margin-top: 12px; background: transparent; max-width: 340px; }
.field-note { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 15px 0 0; }
.options-area .field-note { margin: 0; }
.primary-action { width: 100%; justify-content: space-between; }
.form-grid { display: grid; gap: 20px; }
.form-grid > button[type=submit] { justify-self: start; }
.direct-panel { max-width: 760px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row > label { min-width: 120px; }
.stack { display: grid; gap: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 38px; padding: 7px 12px; background: #f4f7f4; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; font-weight: 500; }
.chip:hover { background: var(--surface-soft); }
.chip.on { color: #194c3b; background: var(--selection); border-color: #7eaa92; }
.muted { color: var(--muted); }
.mono { font: inherit; font-size: 12px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; border-radius: 5px; padding: 3px 8px; background: #edf1ee; color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: #e4f0e7; color: var(--ok); }
.badge.bad { background: #fbe7e4; color: var(--bad); }
.badge.run { background: #f7edda; color: var(--warning); }
.err { color: var(--bad); background: #fff0ed; border-radius: 8px; padding: 10px 12px; font-size: 13px; overflow-wrap: anywhere; }
.ok { color: var(--ok); }
.short-card { display: grid; gap: 10px; padding: 18px 0; border-top: 1px solid var(--line); }
.progress { height: 5px; background: var(--surface-soft); border-radius: 5px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); transition: width 500ms cubic-bezier(.16,1,.3,1); }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 24px; align-items: start; }
.library-card { background: var(--surface); border-radius: 16px; overflow: hidden; min-width: 0; }
.library-video { width: 100%; height: 340px; display: block; object-fit: contain; background: #13251e; }
.library-meta { padding: 18px; display: grid; gap: 16px; min-width: 0; }
.library-heading { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; min-width: 0; }
.library-heading h3 { font-size: 16px; margin: 0; line-height: 1.4; }
.library-actions { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.library-actions button { font-size: 13px; padding: 9px 12px; min-height: 40px; }
.library-download { font-size: 14px; }
.library-open { display: inline-flex; align-items: center; min-height: 40px; padding: 9px 12px; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.library-open:hover { background: var(--surface-soft); }
.library-links { display: grid; gap: 8px; font-size: 13px; }
.library-links a { overflow-wrap: anywhere; }
.library-details { border-top: 1px solid var(--line); padding-top: 12px; min-width: 0; }
.library-details summary { color: var(--muted); font-size: 12px; cursor: pointer; width: fit-content; }
.library-detail-content { display: grid; gap: 14px; padding-top: 16px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.library-detail-content p { margin: 0; }
.library-detail-content p > span { display: block; margin-bottom: 4px; }
.library-publication { display: grid; gap: 5px; }
.library-publication strong { color: var(--text); font-weight: 500; }
.library-publication .err { margin-top: 5px; }
.account-layout { display: grid; gap: 24px; margin-top: 24px; }
.account-list { grid-row: 1; overflow-x: auto; }
.manual-connect summary { font-weight: 600; cursor: pointer; padding: 2px 0; }
.manual-connect[open] summary { margin-bottom: 25px; }
.manual-connect .form-grid { max-width: 600px; }
#settingsForm { grid-template-columns: 1fr 1fr; margin-top: 22px; align-items: end; }
#settingsForm > .row { grid-column: 1/-1; }
#settingsForm > .err, #settingsForm > .ok { grid-column: 1/-1; }
#view-accounts > .panel { margin-top: 24px; }
.table { border-collapse: collapse; width: 100%; text-align: left; font-size: 14px; }
.table th { color: var(--muted); font-size: 12px; font-weight: 500; padding: 0 12px 12px 0; border-bottom: 1px solid var(--line); }
.table td { padding: 20px 12px 20px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td.row { display: table-cell; min-width: 260px; }
.table td.row button { min-height: 34px; padding: 6px 9px; font-size: 12px; margin: 0 3px 6px 0; }
.rename-form { display: grid; gap: 12px; padding-top: 16px; max-width: 340px; }
.empty-state { padding: 64px 28px; text-align: center; background: var(--surface); border-radius: 16px; grid-column: 1/-1; }
.empty-state h3 { margin-bottom: 10px; }
.empty-state p { color: var(--muted); max-width: 45ch; margin: 0 auto 24px; }
.login-wrap { min-height: 100dvh; background: var(--rail); display: grid; place-items: center; padding: 28px; }
.login-card { background: var(--surface); width: min(460px, 100%); padding: 40px; border-radius: 16px; display: grid; gap: 22px; }
.login-card .brand-mark { padding: 0; color: var(--primary); margin-bottom: 18px; }
.login-card h1 { font-size: 33px; line-height: 1.15; font-weight: 600; letter-spacing: -.03em; margin: 0; }
.login-card p { color: var(--muted); margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (min-width: 1600px) { .main { padding-top: 58px; } }
@media (max-width: 1150px) { .shell { grid-template-columns: 210px minmax(0,1fr); } .rail { padding-inline: 12px; } .main { padding: 32px 24px; } .creation-layout { grid-template-columns: 1fr; } .source-area { min-height: 0; } .file-drop { padding: 24px; } .topbar { flex-wrap: wrap; } }
@media (max-width: 720px) {
  .shell { display: block; }
  .rail { position: static; height: auto; padding: 20px 16px 14px; gap: 20px; }
  .brand-mark { padding: 0; font-size: 25px; }
  .rail nav { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 6px; }
  .rail button.nav { flex: 0 0 auto; white-space: nowrap; padding: 10px 13px; font-size: 13px; }
  .rail .foot { display: flex; align-items: center; flex-wrap: wrap; padding: 12px 0 0; gap: 14px; }
  .rail .foot .secondary { margin-left: auto; }
  .main { padding: 28px 16px 40px; }
  .topbar { margin-bottom: 24px; gap: 16px; }
  .work-area, .panel { padding: 22px; }
  .creation-layout { gap: 18px; }
  .file-drop { padding: 20px 12px; }
  .hint { font-size: 14px; }
  #settingsForm { grid-template-columns: 1fr; }
  .topbar .row .button-link { padding: 10px 12px; font-size: 13px; }
  .login-card { padding: 28px; }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px),1fr)); gap: 18px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
.callback-page { min-height: 100dvh; display: grid; place-items: center; padding: 28px; text-align: center; }
.callback-page p { max-width: 55ch; }
/* Keep the main action in reach on compact desktop screens. */
@media (min-width: 1151px) and (max-height: 800px) {
  .main { padding-top: 34px; }
  .topbar { margin-bottom: 26px; }
  .options-area { gap: 17px; }
  .options-area .range-pair input { min-height: 42px; padding-block: 8px; }
  .options-area .range-pair label { gap: 3px; }
}
@media (max-width: 720px) {
  .rail { gap: 16px; }
  .rail nav { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); overflow: visible; }
  .rail button.nav { white-space: normal; padding: 9px 10px; min-height: 40px; font-size: 12px; }
  .rail button.nav:last-child { grid-column: 1/-1; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table thead { display: none; }
  .table tr { padding: 18px 0; border-bottom: 1px solid var(--line); }
  .table tr:last-child { border: 0; }
  .table td { padding: 0 0 12px; border: 0; }
  .table td.row { display: block; min-width: 0; padding-bottom: 0; }
  .rename-form { max-width: 100%; }
}
select {
  appearance: none;
  padding-right: 46px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%23536b64' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
}
#settingsForm > label { grid-column: 1/-1; max-width: 560px; }
.settings-actions { grid-column: 1/-1; display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; min-height: 46px; }
.settings-actions button { flex-shrink: 0; }
.settings-actions .ok { font-size: 13px; }

.brand-icon { width:26px; height:24px; object-fit:contain; filter:brightness(0) invert(1); }
.login-card .brand-icon { filter:none; }
.login-legal { display:flex; flex-wrap:wrap; justify-content:center; gap:12px 24px; padding:12px 24px 24px; margin:0; min-height:64px; position:relative; font-size:12px; color:#d3e9de; }
.login-legal a { color:inherit; }

.login-page { background:var(--rail); }
.login-page .login-wrap { min-height:calc(100dvh - 64px); }
