/* Subtwine styles — every dialog (R6): the shared frame, fields and actions;
   the new-subtitles dialog with its cost; export; settings; the correction,
   naming, deletion and raw-response dialogs.
   Loaded from index.html in the order web_manifest.py declares. */
.dlg {
  border:0;
  padding:0;
  border-radius:16px;
  background:var(--surface);
  color:var(--ink);
  box-shadow:var(--shadow-dialog);
  width:min(520px,calc(100vw - 24px));
  max-width:calc(100vw - 24px);
  max-height:calc(100vh - 24px);
  overflow:auto;
}
.dlg.narrow {
  width:min(420px,calc(100vw - 24px));
}
.dlg.wide {
  width:min(900px,calc(100vw - 24px));
}
.dlg::backdrop {
  background:var(--scrim);
}
.dlg-body {
  padding:20px 22px;
  display:grid;
  /* One column that never grows past the dialog: a wide part (a table in
     its own scrolling box) scrolls inside, the dialog does not (T033). */
  grid-template-columns:minmax(0,1fr);
  gap:14px;
  min-width:0;
}
.dlg-head {
  display:flex;
  align-items:center;
  gap:12px;
}
.dlg-head h2 {
  font-size:18px;
  font-weight:650;
  flex:1 1 auto;
  min-width:0;
}
.dlg-head .icon-btn {
  margin:-6px -8px -6px 0;
}
.dlg p {
  margin:0;
}
.dlg-lead {
  color:var(--ink-2);
}
.dlg-fine {
  display:flex;
  gap:8px;
  font-size:12px;
  color:var(--muted);
  line-height:1.5;
}
.dlg-fine .i {
  margin-top:2px;
}
.dlg-actions,
.dialog-actions {
  display:flex;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.field {
  display:grid;
  gap:6px;
  min-width:0;
}
.field-label {
  font-size:13px;
  font-weight:600;
  color:var(--ink);
}
.field select,
.field input,
.field textarea,
.nr-add {
  width:100%;
  min-width:0;
  font-size:14px;
}
.field select,
.field input,
.nr-add {
  height:38px;
  padding:0 10px;
}
.field-help {
  font-size:12px;
  color:var(--muted);
  line-height:1.5;
}
.notice {
  margin:0;
  padding:10px 12px;
  border-radius:8px;
  background:var(--surface-2);
  color:var(--ink-2);
  font-size:12.5px;
}
.original-text {
  margin:0;
  padding:9px 11px;
  border-radius:8px;
  background:var(--surface-2);
  color:var(--ink-2);
  font-size:13px;
  overflow-wrap:anywhere;
}
.time-fields {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
#edit-translations {
  display:grid;
  gap:12px;
}
#edit-play {
  justify-self:start;
}
.raw-content {
  max-height:55vh;
  overflow:auto;
  margin:0;
  padding:12px;
  border-radius:8px;
  background:var(--surface-2);
  font:12px/1.55 ui-monospace,Menlo,Consolas,monospace;
  white-space:pre-wrap;
  word-break:break-word;
}

/* ---- new subtitles ---- */
.nr-file {
  display:flex;
  gap:12px;
  align-items:center;
  padding:10px;
  border-radius:10px;
  background:var(--sidebar);
  border:1px solid var(--line-soft);
  min-width:0;
}
.nr-file>div {
  display:grid;
  min-width:0;
}
.nr-file b {
  font-size:14px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.nr-file span {
  font-size:12.5px;
  color:var(--muted);
  font-variant-numeric:tabular-nums;
}
.nr-thumb {
  width:48px;
  height:36px;
  border-radius:7px;
  background:#1b1c24;
  display:grid;
  place-items:center;
  color:#fff;
  flex:none;
}
#process-mode-help {
  margin-top:-6px;
}
.nr-fields {
  display:grid;
  gap:12px;
}
.lang-chips {
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}
.lang-chips:empty {
  display:none;
}
.lang-chip {
  display:inline-flex;
  align-items:center;
  gap:6px;
  height:30px;
  padding:0 6px 0 12px;
  border-radius:99px;
  background:var(--accent-soft);
  color:var(--accent-ink);
  font-size:13px;
  font-weight:550;
  max-width:100%;
}
.lang-chip button {
  width:22px;
  height:22px;
  border-radius:50%;
  display:grid;
  place-items:center;
  color:inherit;
}
.lang-chip button:hover {
  background:color-mix(in srgb,var(--accent) 22%,transparent);
}
/* T041: the languages a material has, to switch on one by one. */
.lang-chip.pick {
  padding:0 12px;
  border:1px solid var(--line-strong);
  background:none;
  color:var(--ink-2);
  cursor:pointer;
}
.lang-chip.pick[aria-pressed=true] {
  border-color:var(--accent);
  background:var(--accent-soft);
  color:var(--accent-ink);
}
.lang-chip.pick:disabled {
  opacity:.45;
  cursor:default;
}
.lang-chip.pick .i {
  display:inline-grid;
}
.cost {
  border:1px solid var(--line);
  border-radius:12px;
  padding:12px 14px;
  display:grid;
  gap:8px;
}
.cost:empty {
  display:none;
}
.formula {
  font-size:13.5px;
  font-weight:600;
  color:var(--ink);
  padding:8px 10px;
  border-radius:8px;
  background:var(--sidebar);
  border:1px solid var(--line-soft);
  font-variant-numeric:tabular-nums;
  overflow-wrap:anywhere;
}
.cost-row {
  display:flex;
  justify-content:space-between;
  gap:10px;
  font-size:13.5px;
  flex-wrap:wrap;
}
.cost-row b {
  font-variant-numeric:tabular-nums;
}
.cost-row.big b {
  font-size:17px;
}
.cost-row .muted {
  font-size:12.5px;
}
.short-title {
  margin:0;
  color:var(--fail);
  font-weight:600;
  font-size:13.5px;
}
.nr-import {
  display:flex;
  align-items:center;
  gap:6px;
  font-size:12.5px;
  color:var(--muted);
  flex-wrap:wrap;
}
.nr-import .link {
  font-size:12.5px;
}

/* ---- export ---- */
.ex-sec {
  display:grid;
  gap:10px;
}
.ex-sec h3 {
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:var(--muted);
  font-weight:650;
}
.rights {
  display:flex;
  gap:8px;
  margin:0;
  font-size:12.5px;
  color:var(--ink-2);
  background:var(--sidebar);
  border:1px solid var(--line-soft);
  padding:9px 11px;
  border-radius:9px;
  line-height:1.5;
}
.rights .i {
  margin-top:2px;
  color:var(--accent);
}

/* ---- settings ---- */
.settings-dialog {
  width:min(560px,calc(100vw - 24px));
}
.st-panel {
  display:grid;
  gap:4px;
}
.st-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 0;
  border-bottom:1px solid var(--line-soft);
  flex-wrap:wrap;
}
.st-row>span,
.st-row>div:first-child {
  display:grid;
  min-width:0;
}
.st-row b {
  font-size:13.5px;
  font-weight:600;
}
.st-row small {
  font-size:12px;
  color:var(--muted);
}
.st-row select {
  max-width:240px;
}
.st-usage,
.st-block {
  display:grid;
  gap:6px;
  font-size:13px;
  padding:10px 0;
  border-bottom:1px solid var(--line-soft);
}
.st-usage span {
  color:var(--muted);
  font-size:12.5px;
}
.st-actions {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.st-panel p {
  margin:4px 0;
}
.st-links {
  display:flex;
  gap:16px;
  flex-wrap:wrap;
}
.st-links a {
  color:var(--accent);
  font-size:13px;
}

@media (max-width:640px) {
  .dlg-body {
    padding:16px;
  }
  .st-row select {
    max-width:100%;
    width:100%;
  }
}
/* T027: not enough minutes — only the first part, or the whole (which cannot start). */
.cut-opts {
  display:grid;
  gap:8px;
}
.cut-opt {
  position:relative;
  display:flex;
  gap:10px;
  text-align:start;
  padding:12px;
  border:1.5px solid var(--line);
  border-radius:12px;
  background:var(--surface);
  color:inherit;
  font:inherit;
  min-width:0;
  cursor:default;
}
.cut-opt[aria-checked="true"] {
  border-color:var(--accent);
  background:var(--row-active);
}
.cut-opt[aria-disabled="true"] {
  opacity:.6;
  cursor:not-allowed;
}
.cut-opt .radio {
  flex:none;
  margin-top:2px;
  width:16px;
  height:16px;
  border-radius:50%;
  border:1.5px solid var(--line-strong);
}
.cut-opt[aria-checked="true"] .radio {
  border:5px solid var(--accent);
}
.cut-opt > span:last-child {
  display:grid;
  gap:4px;
  min-width:0;
  flex:1;
}
.cut-opt b {
  font-size:14px;
}
.cut-opt small {
  font-size:12.5px;
  color:var(--ink-2);
  line-height:1.5;
}
.timeline {
  position:relative;
  display:block;
  height:10px;
  border-radius:99px;
  background:var(--surface-2);
  overflow:hidden;
  margin-top:6px;
}
.timeline .kept {
  position:absolute;
  left:0;
  top:0;
  bottom:0;
  background:var(--accent);
}
.timeline .cutoff {
  position:absolute;
  top:0;
  bottom:0;
  background:repeating-linear-gradient(135deg,var(--line-strong) 0 4px,transparent 4px 8px);
}
.tl-labels {
  position:relative;
  display:block;
  height:16px;
  font-size:11px;
  color:var(--muted);
  font-variant-numeric:tabular-nums;
}
.tl-labels span {
  position:absolute;
  top:0;
}
.tl-labels span:first-child {
  left:0;
}
.tl-labels span:nth-child(2) {
  transform:translateX(-50%);
  color:var(--accent-ink);
  font-weight:600;
}
.tl-labels span:last-child {
  right:0;
}
.tl-legend {
  display:flex;
  gap:12px;
  font-size:11px;
  color:var(--muted);
}
.tl-legend span::before {
  content:"";
  display:inline-block;
  width:10px;
  height:6px;
  border-radius:2px;
  margin-inline-end:4px;
  vertical-align:1px;
}
.tl-legend .lg-k::before {
  background:var(--accent);
}
.tl-legend .lg-c::before {
  background:repeating-linear-gradient(135deg,var(--line-strong) 0 2px,transparent 2px 4px);
}

/* Material packs (T029): what a pack holds, the video choice, the file it
   goes to, what an imported one brings, the choice for materials already
   here, and the materials that still need their video. */
.pack-list {
  list-style:none;
  padding:0;
  margin:0;
  border:1px solid var(--line);
  border-radius:12px;
  overflow:hidden;
  max-height:260px;
  overflow-y:auto;
}
.pack-list li {
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 14px;
  border-bottom:1px solid var(--line-soft);
  font-size:13.5px;
  min-width:0;
}
.pack-list li:last-child {
  border-bottom:0;
}
.pack-list li > .i {
  color:var(--ok);
  flex:none;
}
.pack-list li.off,
.pack-list li.off > .i {
  color:var(--faint);
}
.pack-list li > b,
.pack-list li > .name {
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.pack-list li > .meta {
  margin-inline-start:auto;
  color:var(--muted);
  font-size:12.5px;
  white-space:nowrap;
  flex:none;
}
.pack-list li > .btn {
  margin-inline-start:auto;
  flex:none;
}
.pack-list li.done > .meta {
  color:var(--ok);
}
.check-row {
  display:flex;
  align-items:center;
  gap:8px;
  font-size:13.5px;
}
.pack-file {
  display:flex;
  align-items:center;
  gap:8px;
  font-size:12.5px;
  color:var(--muted);
  min-width:0;
}
.pack-file code {
  font:12.5px ui-monospace,Menlo,monospace;
  color:var(--ink);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  min-width:0;
}
.dropzone.small {
  margin-bottom:0;
  padding:16px 18px;
}
.dropzone.small.over {
  border-color:var(--accent);
  background:var(--row-active);
}
.pi-result {
  border:1px solid var(--line);
  border-radius:12px;
  padding:12px 14px;
  display:grid;
  gap:6px;
  font-size:13.5px;
  min-width:0;
}
.pi-result[hidden],
.pack-conflict[hidden],
.pack-relink[hidden] {
  display:none;
}
.pi-result b {
  font-size:14px;
  overflow-wrap:anywhere;
}
.pi-result .ok {
  color:var(--ok);
  font-weight:600;
}
.pack-conflict {
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px 14px;
  margin:0;
  display:grid;
  gap:8px;
}
.pack-conflict legend {
  font-size:13px;
  font-weight:600;
  padding:0 4px;
}
.pack-relink {
  display:grid;
  gap:8px;
}
.pi-row {
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}
.pi-row > .i {
  display:inline-flex;
  color:var(--ok);
  flex:none;
}
.pi-row.off,
.pi-row.off > .i {
  color:var(--faint);
}
