      *, *::before, *::after { box-sizing: border-box; }

      body {
        margin: 0;
        font-size: 1rem;
        line-height: 1.6;
        font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
        color: var(--text);
        background: var(--bg);
        -webkit-font-smoothing: antialiased;
      }

      a { color: var(--accent); text-decoration: none; }
      a:hover { text-decoration: underline; }

      /* ── Typography ── */
      h1 { font-size: 1.875rem; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.02em; line-height: 1.3; }
      h2 { font-size: 1rem; font-weight: 600; margin: 0 0 12px; color: var(--text); }
      h3 { font-size: 0.875rem; font-weight: 600; margin: 0 0 8px; }
      p { margin: 0 0 12px; }
      p:last-child { margin-bottom: 0; }

      code {
        font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
        font-size: 0.75rem;
        background: var(--surface-2);
        border: 1px solid var(--border);
        border-radius: 3px;
        padding: 1px 5px;
      }

      /* ── Page header ── */
      .page-header { margin-bottom: 28px; }
      .page-header h1 { margin-bottom: 4px; }
      .page-header .subtitle { color: var(--muted); font-size: 0.875rem; margin: 0; }

      /* ── Section ── */
      .section { margin-top: 36px; }
      .section-header {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        margin-bottom: 14px;
      }
      .section-header h2 { margin: 0; }

      /* ── Stat cards ── */
      .stats-grid {
        display: grid;
        gap: 12px;
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        margin-bottom: 36px;
      }
      .stat-card {
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        padding: 24px;
      }
      .stat-value {
        font-size: 2rem;
        font-weight: 700;
        line-height: 1;
        margin-bottom: 6px;
        letter-spacing: -0.03em;
        color: var(--text);
      }
      .stat-label { font-size: 0.75rem; color: var(--muted); font-weight: 500; }

      /* ── Cards ── */
      .card {
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        padding: 24px;
      }
      .card + .card { margin-top: 12px; }
      .card > h2:first-child { margin-bottom: 16px; }

      /* ── Tables ── */
      .table-wrapper {
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        overflow-x: auto;
      }
      table { width: 100%; border-collapse: collapse; }
      thead { background: var(--surface); }
      th {
        padding: 12px 18px;
        text-align: left;
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--muted);
        border-bottom: 1px solid var(--border);
        white-space: nowrap;
      }
      td {
        padding: 18px;
        vertical-align: middle;
        border-bottom: 1px solid var(--border);
        font-size: 0.875rem;
      }
      tr:last-child td { border-bottom: 0; }
      tbody tr:hover { background: var(--surface); }
      .table-note {
        padding: 12px 18px;
        font-size: 0.75rem;
        color: var(--muted);
        background: var(--surface);
        border-top: 1px solid var(--border);
      }
      .cell-primary { font-weight: 500; color: var(--text); }
      .cell-secondary { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }

      /* ── Badges ── */
      .badge {
        display: inline-flex;
        align-items: center;
        padding: 2px 7px;
        border-radius: 99px;
        font-size: 0.75rem;
        font-weight: 500;
        line-height: 1.5;
        white-space: nowrap;
      }
      .badge-green  { background: var(--success-bg); color: var(--success); }
      .badge-yellow { background: var(--warning-bg); color: var(--warning); }
      .badge-red    { background: var(--danger-bg); color: var(--danger); }
      .badge-blue   { background: var(--info-bg); color: var(--info); }
      .badge-gray   { background: var(--surface-2); color: var(--muted); }

      /* ── Forms ── */
      form { margin: 0; }
      form p { margin: 0 0 18px; }
      form p:last-of-type { margin-bottom: 24px; }
      label,
      form p label {
        display: block;
        font-size: 0.875rem;
        font-weight: 600;
        margin-bottom: 5px;
        color: var(--text);
      }
      input[type="text"],
      input[type="email"],
      input[type="password"],
      input[type="number"],
      input[type="file"],
      select,
      textarea {
        display: block;
        width: 100%;
        max-width: 560px;
        padding: 8px 11px;
        border: 1px solid var(--border-strong);
        border-radius: var(--radius);
        font: inherit;
        font-size: 0.875rem;
        background: var(--bg);
        color: var(--text);
        outline: none;
        transition: border-color 0.15s, box-shadow 0.15s;
        -webkit-appearance: none;
        appearance: none;
      }
      input:focus, select:focus, textarea:focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 3px color-mix(in srgb,var(--focus) 15%,transparent);
      }
      textarea { resize: vertical; min-height: 96px; }
      select {
        background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 10px center;
        padding-right: 30px;
      }
      input[type="file"] { padding: 6px 10px; cursor: pointer; font-size: 0.75rem; }
      .helptext { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
      .errorlist { margin: 0 0 6px; padding: 0; list-style: none; font-size: 0.75rem; color: var(--danger); }

      /* ── Buttons ── */
      /* Base: shared layout for all button variants — change padding/size/radius here only */
      button, .btn, .button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: var(--btn-padding);
        border: 1px solid transparent;
        border-radius: var(--radius);
        font: inherit;
        font-size: var(--btn-font-size);
        font-weight: 500;
        cursor: pointer;
        white-space: nowrap;
        transition: background 0.1s, border-color 0.1s, opacity 0.1s;
        text-decoration: none;
      }
      /* Primary (default for bare <button> and .button) */
      button[type="submit"]:not([class]),
      button:not([class]),
      .btn-primary,
      .button {
        background: var(--accent);
        border-color: var(--accent);
        color: #fff;
      }
      button[type="submit"]:not([class]):hover,
      button:not([class]):hover,
      .btn-primary:hover,
      .button:hover {
        background: var(--accent-dark);
        border-color: var(--accent-dark);
        text-decoration: none;
        color: #fff;
      }
      /* Secondary */
      .btn-secondary,
      .button.secondary,
      button.secondary {
        background: var(--bg);
        border-color: var(--border-strong);
        color: var(--text);
      }
      .btn-secondary:hover,
      .button.secondary:hover,
      button.secondary:hover { background: var(--surface); color: var(--text); }
      /* Danger */
      .btn-danger,
      button.danger {
        background: var(--danger);
        border-color: var(--danger);
        color: #fff;
      }
      .btn-danger:hover,
      button.danger:hover { opacity: 0.88; }

      /* ── Alerts ── */
      .messages { margin: 0 0 24px; padding: 0; list-style: none; }
      .messages li {
        padding: 11px 16px;
        border-radius: var(--radius);
        margin-bottom: 8px;
        font-size: 0.875rem;
        background: var(--surface);
        border: 1px solid var(--border);
        color: var(--text);
      }
      .messages li.success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
      .messages li.error   { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger); }
      .messages li.warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
      .messages li.info    { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }

      /* ── Pre / code blocks ── */
      pre {
        margin: 0;
        white-space: pre-wrap;
        overflow-wrap: anywhere;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 14px 16px;
        font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
        font-size: 0.75rem;
        line-height: 1.7;
        color: var(--text);
        max-height: 280px;
        overflow-y: auto;
      }

      /* ── Comparison layout ── */
      .split {
        display: grid;
        gap: 16px;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      }
      .split-label {
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--muted);
        margin-bottom: 8px;
      }

      /* ── Actions row ── */
      .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

      /* ── Asset grid ── */
      .asset-grid {
        display: grid;
        gap: 14px;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      }
      .asset-card {
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        overflow: hidden;
        background: var(--bg);
      }
      .asset-card img {
        width: 100%;
        aspect-ratio: 16 / 9;
        object-fit: cover;
        display: block;
        border-bottom: 1px solid var(--border);
      }
      .asset-card-body { padding: 11px 12px 12px; }
      .asset-card-name {
        font-size: 0.75rem;
        font-weight: 500;
        color: var(--text);
        margin-bottom: 3px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .asset-card-tags { font-size: 0.75rem; color: var(--muted); margin-bottom: 10px; min-height: 16px; }

      /* ── Connection status ── */
      .connection-row {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        border-radius: var(--radius);
        font-size: 0.875rem;
      }
      .connection-row.connected    { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success); }
      .connection-row.disconnected { background: var(--danger-bg);  border: 1px solid var(--danger-border);  color: var(--danger); }

      /* ── Video meta panel ── */
      .meta-panel {
        display: flex;
        flex-wrap: wrap;
        gap: 24px;
        padding: 16px 20px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        margin-bottom: 28px;
      }
      .meta-item {}
      .meta-label {
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.07em;
        color: var(--muted);
        margin-bottom: 3px;
      }
      .meta-value { font-size: 0.875rem; font-weight: 500; }

      /* ── Clip review grid ── */
      .clip-grid {
        display: grid;
        gap: 14px;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: start;
      }
      .clip-grid .card + .card { margin-top: 0; }
      .clip-card {
        padding: 14px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        min-width: 0;
      }
      .clip-card-archived { opacity: 0.92; }
      .clip-preview video,
      .clip-preview .empty-state {
        width: 100%;
        aspect-ratio: 9 / 16;
        max-height: 520px;
        background: #000;
        border-radius: var(--radius);
        display: block;
      }
      .clip-preview .empty-state {
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--surface);
      }
      .clip-card-body {
        display: grid;
        gap: 10px;
        min-width: 0;
      }
      .clip-card-heading {
        display: grid;
        gap: 6px;
      }
      .clip-card-heading h2 {
        margin: 0;
        line-height: 1.35;
        overflow-wrap: anywhere;
      }
      .clip-badges,
      .clip-task-stack,
      .clip-actions {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 6px;
      }
      .clip-task-note {
        width: 100%;
        padding: 7px 9px;
        border: 1px solid var(--info-border);
        border-radius: var(--radius);
        background: var(--info-bg);
        color: var(--info);
        font-size: 0.75rem;
        font-weight: 600;
      }
      .clip-task-note .cell-secondary {
        margin-left: 6px;
        color: var(--info);
      }
      .clip-meta { margin-bottom: 0; }
      .clip-card input,
      .clip-card select,
      .clip-card textarea {
        max-width: none;
      }
      .clip-upload-form,
      .clip-control-form,
      .clip-upload-summary {
        display: grid;
        gap: 10px;
      }
      .clip-control-form {
        padding-top: 10px;
        border-top: 1px solid var(--border);
      }
      .clip-form-grid,
      .clip-rerender-grid {
        display: grid;
        gap: 10px;
      }
      .clip-rerender-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
      }
      .clip-upload-title {
        margin: 0;
        font-weight: 600;
        overflow-wrap: anywhere;
      }
      .revision-drawer {
        margin-top: 18px;
        border: 1px dashed var(--border-strong);
        border-radius: var(--radius-lg);
        padding: 12px 14px 14px;
        background: var(--surface);
      }
      .revision-drawer summary {
        cursor: pointer;
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--text);
      }
      .revision-grid { margin-top: 14px; }
      @media (max-width: 980px) {
        .clip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      }
      @media (max-width: 680px) {
        .clip-grid { grid-template-columns: 1fr; }
      }

      /* ── Utilities ── */
      .muted { color: var(--muted); font-size: 0.875rem; }
      .text-sm  { font-size: 0.875rem; }
      .text-xs  { font-size: 0.75rem; }
      .text-danger  { color: var(--danger); }
      .text-success { color: var(--success); }

      /* ── Empty state ── */
      .empty-state {
        padding: 40px 24px;
        text-align: center;
        color: var(--muted);
        font-size: 0.875rem;
        border-radius: var(--radius-lg);
        border: 1px dashed var(--border-strong);
      }

      /* ── Nav badge ── */
      .nav-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 17px;
        height: 17px;
        padding: 0 5px;
        border-radius: 99px;
        font-size: 0.75rem;
        font-weight: 700;
        background: var(--danger);
        color: #fff;
        line-height: 1;
        margin-left: 4px;
      }

      /* ── Responsive table columns ── */
      @media (max-width: 860px) {
        .col-hide { display: none; }
      }

/* Shared layout utilities extracted from staff and workspace templates. */
.u-align-center{text-align:center}
.u-bg-000{background:#000}
.u-bg-warning-bg{background:var(--warning-bg)}
.u-border-2px-solid-transparent{border:2px solid transparent}
.u-border-color-success-border{border-color:var(--success-border)}
.u-border-top-1px-solid-border{border-top:1px solid var(--border)}
.u-break-break-all{word-break:break-all}
.u-color-muted{color:var(--muted)}
.u-color-success{color:var(--success)}
.u-color-warning{color:var(--warning)}
.u-cursor-pointer{cursor:pointer}
.u-direction-column{flex-direction:column}
.u-display-block{display:block}
.u-display-flex{display:flex}
.u-display-grid{display:grid}
.u-fit-cover{object-fit:cover}
.u-flex-1{flex:1}
.u-gap-12px{gap:12px}
.u-gap-16px{gap:16px}
.u-gap-24px{gap:24px}
.u-gap-32px{gap:32px}
.u-gap-6px{gap:6px}
.u-gap-8px{gap:8px}
.u-height-68px{height:68px}
.u-items-center{align-items:center}
.u-items-flex-start{align-items:flex-start}
.u-justify-space-between{justify-content:space-between}
.u-margin-0{margin:0}
.u-max-height-420px{max-height:420px}
.u-max-width-100{max-width:100%}
.u-max-width-360px{max-width:360px}
.u-mb-10px{margin-bottom:10px}
.u-mb-12px{margin-bottom:12px}
.u-mb-14px{margin-bottom:14px}
.u-mb-16px{margin-bottom:16px}
.u-mb-20px{margin-bottom:20px}
.u-mb-28px{margin-bottom:28px}
.u-mb-3px{margin-bottom:3px}
.u-mb-4px{margin-bottom:4px}
.u-mb-8px{margin-bottom:8px}
.u-min-width-200px{min-width:200px}
.u-mt-0{margin-top:0}
.u-mt-12px{margin-top:12px}
.u-mt-16px{margin-top:16px}
.u-mt-20px{margin-top:20px}
.u-mt-8px{margin-top:8px}
.u-opacity-0-7{opacity:0.7}
.u-pad-5px-10px{padding:5px 10px}
.u-pad-7px-14px{padding:7px 14px}
.u-pt-16px{padding-top:16px}
.u-rounded-4px{border-radius:4px}
.u-rounded-6px{border-radius:6px}
.u-shrink-0{flex-shrink:0}
.u-text-uppercase{text-transform:uppercase}
.u-tracking-0-06em{letter-spacing:0.06em}
.u-type-12px{font-size:12px}
.u-type-14px{font-size:14px}
.u-type-20px{font-size:20px}
.u-weight-600{font-weight:600}
.u-weight-700{font-weight:700}
.u-width-100{width:100%}
.u-width-120px{width:120px}
.u-wrap-wrap{flex-wrap:wrap}
