  /* ---------- app shell ---------- */

  .brand { display: flex; align-items: center; gap: 10px; }
  /* My services: the logo's yellow */
  /* the Important notice's cream, so the top-left box is the same colour signed in or not */
  .services-box { width: 100%; border: 1px solid var(--notice-border); background: var(--notice-bg); border-radius: 14px; padding: 9px 10px 9px 14px; }
  .cap-btn.services-btn { width: 100%; border: 0; background: transparent; padding: 0; align-items: flex-start; gap: 7px; }   /* the logo-sized icon takes its room from this gap and the box's right edge */
  .services-box .cap-btn.services-btn:not(.soon):hover, .services-box .cap-btn.services-btn.active { background: transparent; }   /* not a button: no hover (beats the menu buttons' one) */
  .services-box .cap-btn.services-btn { cursor: default; }
  .cap-btn.services-btn .cap-label > span:first-child { color: var(--text); font-weight: 600; }
  /* label on the left, the count in a pill on the right, in one column */
  .services-btn .cap-label { flex: 1; min-width: 0; }
  /* the box's icon: the logo's size (34px), its left edge in line with the logo below */
  .services-btn > .cap-icon { width: 34px; height: 34px; border-radius: 9px; margin-left: 2px; }
  .services-btn > .cap-icon svg { width: 19px; height: 19px; }
  /* the rows hang under My services on the same line as the menu's tree */
  .services-btn .svc-rows { display: flex; flex-direction: column; gap: 0; margin: 1px 0 0 4px; padding-left: 14px; }   /* every row and both links within the banner's height */
  .services-btn .svc-row { position: relative; }
  .services-btn .svc-row::before { content: ""; position: absolute; left: -14px; top: -2px; bottom: 0; border-left: 1.5px solid var(--border-strong); }
  .services-btn .svc-row:last-child::before { bottom: 50%; }
  .services-btn .svc-row::after { content: ""; position: absolute; left: -14px; top: 50%; width: 10px; border-top: 1.5px solid var(--border-strong); }
  .services-btn .svc-row { display: grid; grid-template-columns: 1fr auto 34px; align-items: center; column-gap: 5px; font-size: 12px; color: var(--text-muted); line-height: 1.3; }
  .services-btn .svc-row > .count-pill:not(.wait) { grid-column: 3; justify-self: stretch; }   /* every count in one column */
  .services-btn .svc-row > .count-pill.wait { grid-column: 3; justify-self: stretch; border: 0; box-shadow: inset 0 0 0 1px #d99a1e; }   /* the outline inside: as tall as the other pills */
  .services-btn .svc-row[hidden] { display: none; }
  .count-pill { display: inline-block; min-width: 26px; text-align: center; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
    font-variant-numeric: tabular-nums; background: rgba(0,0,0,.06); color: var(--text); }
  .count-pill.ok { background: #1f9c5a; color: #fff; }
  .count-pill.some { background: #d64545; color: #fff; }   /* some offline: red, like the offline dot */
  .count-pill.wait { background: transparent; border: 1px solid #d99a1e; color: #8a5a00; font-weight: 600; }
  .count-pill.info { background: #2f7fd6; color: #fff; }   /* a plain count: the blue of the "new" dot */
  .count-pill.half { background: linear-gradient(90deg, #1f9c5a 50%, #d64545 50%); color: #fff; }   /* some online, some offline: as the menu's dot */
  .count-pill.orange { background: #e07b1a; color: #fff; }   /* requests waiting for a decision */
  .count-pill.rest { background: #8a95ab; color: #fff; }   /* outside opening hours: resting by design, not broken */
  .count-pill.half.resting { background: linear-gradient(90deg, #1f9c5a 50%, #8a95ab 50%); }
  .count-pill[hidden] { display: none; }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .count-pill:not(.ok):not(.some):not(.wait):not(.info):not(.half):not(.orange):not(.rest) { background: rgba(255,255,255,.1); } :root:not([data-theme="light"]) .count-pill.wait { color: #f3c56b; } }
  :root[data-theme="dark"] .count-pill:not(.ok):not(.some):not(.wait):not(.info):not(.half):not(.orange):not(.rest) { background: rgba(255,255,255,.1); } :root[data-theme="dark"] .count-pill.wait { color: #f3c56b; }
  .services-box .svc-request { margin: 0 0 0 61px; font-size: 12px; font-weight: 600; }   /* lined up with the rows' labels */
  .services-box .svc-request::after { content: " →"; }
  /* the box fills the banner's height: 7 lines (a person's: the pending row shown) a little smaller, 6 lines (an admin's) a little bigger */
  .services-box:has(#svc-waiting-row:not([hidden])) .services-btn .svc-row,
  .services-box:has(#svc-waiting-row:not([hidden])) .svc-request { font-size: 11.5px; }
  .services-box:has(#svc-waiting-row[hidden]) .services-btn .svc-rows { gap: 2px; margin-top: 4px; }
  .services-box:has(#svc-waiting-row[hidden]) .services-btn .svc-row,
  .services-box:has(#svc-waiting-row[hidden]) .svc-request { font-size: 12.5px; }
  .services-box:has(#svc-waiting-row[hidden]) .svc-request { margin-top: 5px; }
  /* the link is the tree's last branch: the line runs on down to it */
  .services-box .svc-request { position: relative; overflow: visible; }
  .services-box .svc-request::before { content: ""; position: absolute; left: -14px; top: -7px; bottom: 50%; border-left: 1.5px solid var(--border-strong); }
  .services-box:has(#services-request:not([hidden])) .svc-row:last-child::before { bottom: 0; }
  /* My settings, under My services on the same branch */
  .services-box #services-request, .services-box #settings-request { display: block; width: max-content; }
  .services-box:has(#settings-request:not([hidden])) #services-request::before { bottom: -4px; }
  .services-box #settings-request { margin-top: 4px; color: #2563eb; } .services-box #settings-request::before { top: -4px; }
  .services-box .svc-request > .branch { position: absolute; left: -14px; top: 50%; width: 10px; border-top: 1.5px solid var(--border-strong); }
  img.brand-mark { display: block; object-fit: cover; }
  .brand-mark {
    width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    display: grid; place-items: center; color: var(--accent-text-on);
    font-family: "Sora", sans-serif; font-weight: 700; font-size: 15px;
  }
  .brand-name { font-family: "Sora", sans-serif; font-weight: 600; font-size: 17px; }
  .brand-sub { font-size: 12px; color: var(--text-faint); }

  :root { --sidebar-w: 350px; }   /* the left column, the same on the sign-in pages and in the Studio */


  /* Sidebar: the studio's name is the root of a tree; each group (Text,
     Image, Speech) hangs off it, and each service off its group. */
  .sidebar {   /* the gold strip along its top, as on the sign-in page's left column */
    background: var(--surface); border: 1px solid var(--border); border-top: 4px solid #d4a72c; border-radius: 14px;
    padding: 14px 10px 10px; position: sticky; top: 20px; display: flex; flex-direction: column; min-width: 0;
  }
  .tree-root { padding: 0 6px 6px; align-items: center; background: none; border: 0; text-align: left; color: var(--text); cursor: pointer; font: inherit; border-radius: 10px; }
  .tree-root:hover .brand-name { color: var(--accent-strong); }
  /* Auto: one section open at a time (on by default) */
  .tree-head { display: flex; align-items: flex-start; gap: 6px; }
  .tree-head .tree-root { flex: 1; min-width: 0; }
  .menu-auto { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 3px 4px 3px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-muted); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; flex-shrink: 0; }
  .menu-auto:hover { border-color: var(--accent); color: var(--accent-strong); }
  .menu-auto .track { position: relative; width: 24px; height: 14px; border-radius: 999px; background: var(--border-strong); transition: background .15s; }
  .menu-auto .knob { position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: #fff; transition: left .15s; }
  .menu-auto[aria-pressed="true"] { color: var(--accent-strong); }
  .menu-auto[aria-pressed="true"] .track { background: var(--accent); }
  .menu-auto[aria-pressed="true"] .knob { left: 12px; }
  .code-input { font-size: 22px; letter-spacing: .35em; text-align: center; }
  .skip-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; max-width: 260px; }
  #pick-view .actions { align-items: flex-start; }
  .i2t-head { display: flex; gap: 12px; align-items: center; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
  .i2t-head img { width: 56px; height: 56px; object-fit: cover; border-radius: 7px; flex-shrink: 0; }
  .i2t-head .grow { flex: 1; min-width: 0; }
  #i2t-thread { min-height: 120px; max-height: min(55vh, 560px); }
  .tree-root .brand-name { font-size: 15px; line-height: 1.25; }
  /* Icons get smaller down the tree: the logo 34px, a section 28px, a service 22px */
  .tree-children .cap-icon { width: 22px; height: 22px; border-radius: 6px; }
  .tree-children .cap-icon svg { width: 13px; height: 13px; }
  nav.switcher { display: flex; flex-direction: column; }
  nav.tree { --tree-line: var(--border-strong); padding-left: 22px; }  /* 22px = under the logo's centre */
  .tree-group { position: relative; padding-left: 14px; }
  .tree-group::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1.5px solid var(--tree-line); }
  .tree-group:last-child::before { bottom: auto; height: 22px; }
  .tree-group::after { content: ""; position: absolute; left: 0; top: 22px; width: 16px; border-top: 1.5px solid var(--tree-line); }   /* up to just before the arrow */
  /* the person's folder: first on the tree, its own branch (like a section) */
  .tree-mine > .cap-btn { margin-left: 2px; position: relative; overflow: visible; }
  .tree-mine::after { top: 50%; width: 22px; }   /* two-line rows: the branch meets the middle, up to just before the icon */
  /* a section's own dot, on its branch where the line meets it */
  .switcher-label { position: relative; overflow: visible; }
  .switcher-label > .section-dot { left: -18px; top: 22px; margin-top: -4px; }   /* on the dash, on phones too */
  .tree-mine > .cap-btn .svc-dot { left: -20px; top: 50%; margin-top: -4px; }   /* on the tree line where its branch starts */
  .tree-mine > .cap-btn .cap-icon { width: 28px; height: 28px; border-radius: 8px; }
  .tree-mine > .cap-btn .cap-name { font-weight: 600; }
  .tree-children { display: flex; flex-direction: column; margin-left: 12px; padding-left: 14px; }  /* its line runs down from the section's arrow */
  .tree-children > .cap-btn { position: relative; overflow: visible; margin-left: 12px; width: calc(100% - 12px); }   /* a dash in from the line: the services sit in from the section's icon */
  .tree-children > .cap-btn::before { content: ""; position: absolute; left: -26px; top: 0; bottom: 0; border-left: 1.5px solid var(--tree-line); }
  .tree-children > .cap-btn:last-child::before { bottom: 50%; }
  .tree-children > .cap-btn::after { content: ""; position: absolute; left: -26px; top: 50%; width: 32px; border-top: 1.5px solid var(--tree-line); }   /* line, dot, dash, icon */
  .tree-children > .cap-btn.active::after { width: 20px; }
  .tree-children > .cap-btn > .svc-dot { left: -4px; top: 50%; margin-top: -4px; }   /* under the centre of the section's icon */   /* the selected one: line and dot, then its highlight (no dash inside it) */
  /* Phones: the same tree as on a computer, folded behind a Menu button
     (shut by default; choosing a page shuts it again). */
  .menu-toggle { display: none; }
  @media (max-width: 760px) {
    .sidebar { position: static; padding: 10px; }
    .tree-head { align-items: center; }
    .tree-root { padding-bottom: 0; }
    .menu-auto { display: none; }   /* sections still close by Auto; the switch itself stays on computers */
    .menu-toggle { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px;
      background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; max-width: 55%; }
    .menu-toggle svg { width: 16px; height: 16px; flex: none; }
    .menu-toggle .menu-here { color: var(--text-muted); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .menu-toggle[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-strong); }
    .sidebar:not(.menu-open) nav.switcher { display: none; }
    .sidebar:not(.menu-open) .svc-legend { display: none; }   /* it explains the menu: shown with it */
    .sidebar.menu-open nav.switcher { margin-top: 8px; }
    .tree-children > .cap-btn { width: calc(100% - 12px); }   /* its 12px step in stays inside the box */
  }
  .tree-sublabel { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint);
    font-weight: 600; padding: 8px 6px 2px 10px; }
  .switcher-label {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-faint); font-weight: 600; padding: 12px 6px 6px; line-height: 14px;
  }
  /* Each section's name opens and closes it (computers; phones show one flat row). */
  button.switcher-label { display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: 0; cursor: pointer; font-family: inherit; text-align: left; border-radius: 6px; }
  button.switcher-label .group-icon { width: 28px; height: 28px; border-radius: 8px; flex: none; }
  button.switcher-label .group-icon svg { width: 16px; height: 16px; }
  button.switcher-label { padding: 8px 6px 6px; color: var(--text-muted); font-size: 11px; }
  button.switcher-label:hover { color: var(--accent-strong); }
  button.switcher-label .chev { width: 12px; height: 12px; transition: transform .15s; flex: none; }
  .tree-group.collapsed button.switcher-label .chev { transform: rotate(-90deg); }
  .tree-group.collapsed .tree-children { display: none; }
  .tree-group.collapsed::before { bottom: auto; height: 19px; }
  .cap-btn {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
    border: none; background: transparent; color: var(--text-muted); cursor: pointer;
    font-size: 13px; font-weight: 500; white-space: nowrap; width: 100%; text-align: left;
  }
  .cap-btn:not(.soon):not(.active):hover { background: var(--surface-alt); color: var(--text); }
  .cap-btn.active { background: var(--accent-soft); color: var(--text); }
  .cap-btn.active .flow { color: var(--accent-strong); }
  .cap-btn.soon { opacity: .5; cursor: not-allowed; }
  /* Only Coming soon is faded. A service that's offered but not yet yours looks like the rest;
     its dot says where the request stands. */
  .cap-icon {
    width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center;
    color: #fff; font-family: "IBM Plex Mono", monospace; font-size: 9px; font-weight: 600;
  }
  .cap-icon svg { width: 16px; height: 16px; display: block; }
  .cap-label { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
  .cap-name { white-space: normal; line-height: 1.25; }
  #menu-folder .cap-label { flex: 1; min-width: 0; }
  #menu-folder .folder-name { display: flex; gap: 4px; min-width: 0; white-space: nowrap; }
  #menu-folder .folder-owner { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #menu-folder .folder-suffix { flex-shrink: 0; }
  .session-mark { display: inline-flex; vertical-align: -2px; margin-right: 4px; color: var(--text-faint); }
  .session-mark.on { color: var(--accent-strong); }
  .session-mark svg { width: 13px; height: 13px; }
  .status-pill { align-self: flex-start; margin-top: 3px; font-size: 10.5px; font-weight: 600; line-height: 1; padding: 3px 7px; border-radius: 999px;
    border: 1px solid var(--border); color: var(--text-muted); background: var(--bg); }
  .status-pill.pending { color: #8a5a00; border-color: #e7c36a; background: #fff6de; }
  .status-pill.rejected { color: #9b2c2c; border-color: #eab0b0; background: #fdecec; }
  .status-pill.none { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); }
  .flow { font-size: 11.5px; color: var(--text-faint); white-space: normal; line-height: 1.3; }
  /* In the menu a service is two lines at most: its name, then its notation or its status; hover shows it all */
  .tree-children .cap-name, .tree-children .flow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tree-children .status-pill { margin-top: 2px; }
  /* each service's own status: a dot where the tree's line meets it -- green running, amber resting */
  .svc-dot { position: absolute; left: -14px;   /* on the dash, right under the section's ">" */ top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; z-index: 1;
    box-shadow: 0 0 0 2px var(--surface); }
  /* One dot beside each service: green yours and online, red yours and offline
     now, yellow pending approval, blue not requested yet (the legend above the menu) */
  .svc-dot.up, .lg-dot.up { background: #1f9c5a; }
  .svc-dot.down, .lg-dot.down { background: #d64545; }
  .svc-dot.wait, .lg-dot.wait { background: #e0a800; }
  .svc-dot.new, .lg-dot.new { background: #2f7fd6; }
  .svc-dot.some, .lg-dot.some { background: linear-gradient(90deg, #1f9c5a 50%, #d64545 50%); }   /* some online, some offline */
  .svc-dot.soon, .lg-dot.soon { background: #9aa3ad; }
  .svc-legend { margin: 0 6px 10px; padding: 0 0 9px; border-bottom: 1px solid var(--border); font-size: 11.5px; color: var(--text-muted); }
  .svc-legend p { margin: 0 0 4px; }
  .svc-legend ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; gap: 3px 8px; white-space: nowrap; }   /* availability on the first row, where you stand on the second */
  .svc-legend li { display: flex; align-items: center; gap: 5px; color: var(--text); }
  .svc-legend .lg-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
  @media (max-width: 760px) { .svc-dot { left: 3px; top: 8px; margin-top: 0; } }

  main { min-width: 0; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 16px; padding: 18px; }
  @media (max-width: 760px) { main { padding: 14px; } }

  /* Every service tab: a full-width Settings row, then prompt | answer */
  main { overflow-anchor: none; }
  .workspace { display: flex; flex-direction: column; gap: 18px; }
  .work-row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 18px; align-items: start; }
  @media (max-width: 900px) { .work-row { grid-template-columns: 1fr; } }
  .panel.settings { gap: 12px; padding: 14px 18px; }
  .settings-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 20px; align-items: start; }
  .settings-grid .span-2 { grid-column: span 2; }
  /* nothing to choose in a slot: a fact about the service instead */
  .settings-grid .fact { background: var(--surface-alt); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.45; color: var(--text); }
  .settings-grid .fact b { display: block; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 2px; }
  .segmented.src-pick { margin-bottom: 12px; }
  [data-panel="age"] .settings-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .i2i-rewrite-field > .switch, .sum1-setting > .switch { min-height: 38px; justify-content: center; }
  .age-count-control, .age-show-age-control { height: 38px; display: flex; align-items: center; }
  .age-count-control input { width: 100%; margin: 0; accent-color: var(--accent); }
  .age-count-marks { display: flex; justify-content: space-between; padding: 0 8px; font-size: 12px; color: var(--text-muted); }
  .age-show-age-field > .field-label { text-align: center; }
  .age-show-age-control { justify-content: center; }
  .age-show-age-control .switch { justify-content: center; }
  .age-action-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
  .age-action-head .panel-title { margin: 0; }
  .age-estimate { margin-left: auto; text-align: right; font-size: 12px; color: var(--text-muted); }
  @media (max-width: 560px) { [data-panel="age"] .settings-grid.two { grid-template-columns: minmax(0, 1fr); } }
  .settings-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }   /* three equal settings */
  .settings-grid .span-3 { grid-column: span 3; }
  /* Text to video: the progress and the clip, in the result box at its usual size */
  .svc-result .result-body .output-stage.t2v-progress { display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 12px; padding: 24px; text-align: left; }
  .t2v-progress > * { width: 100%; }
  .t2v-progress-title { font-weight: 600; }
  .t2v-bar { height: 12px; border-radius: 6px; background: var(--border-strong, var(--border)); overflow: hidden; }
  .t2v-bar > div { height: 100%; background: var(--accent); transition: width .6s ease; }
  .t2v-progress-row { display: flex; justify-content: space-between; gap: 12px; }
  .t2v-progress .hint { margin: 0; }
  .t2v-video { display: block; max-width: 100%; max-height: 100%; margin: auto; border-radius: 6px; background: #000; }
  .settings-note { font-size: 12.5px; line-height: 1.5; padding-top: 2px; }
  @media (max-width: 700px) {
    .settings-grid, .settings-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .settings-grid .span-3 { grid-column: span 2; }
  }
  @media (max-width: 440px) {
    .settings-grid, .settings-grid.three { grid-template-columns: minmax(0, 1fr); }
    .settings-grid .span-2, .settings-grid .span-3 { grid-column: auto; }
  }
  /* Settings fold to one summary line on phones; always open on wider screens */
  .settings-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  /* "<service> / Settings" on computers; phones keep just "Settings" (no room beside the summary) */
  @media (max-width: 760px) { .settings-head .set-svc { display: none; } }
  .settings-toggle {
    display: none; border: 1px solid var(--border); background: var(--surface-alt); color: var(--text-muted);
    border-radius: 8px; padding: 6px 10px; font-size: 12px; cursor: pointer; min-width: 0; gap: 6px; align-items: center;
  }
  .settings-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  @media (max-width: 700px) {
    .settings-toggle { display: inline-flex; max-width: 75%; }
    .panel.settings.collapsed > :not(.settings-head) { display: none !important; }
    .panel.settings:not(.collapsed) .settings-toggle span[aria-hidden] { transform: rotate(180deg); }
  }

