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

html {
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", Times, serif;
  background: #fff;
  color: #1a1a1a;
  font-size: 14px;
  line-height: 1.5;
  touch-action: manipulation;
}

/* —— UI sans (labels, buttons, tables) —— */
.section-label,
.eyebrow,
.field-label,
.btn,
.header-title,
.meta,
.page-auth-status,
.ads-controls select,
.version-table thead th,
.artifact-table thead th,
.badge,
.count-pill,
.hint code,
.activity-log {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

code,
.url-row code,
.version-table td code {
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
}

:root {
  --ink: #1a1a1a;
  --muted: #888;
  --muted-light: #aaa;
  --border: #e0ddd5;
  --border-row: #e8e5de;
  --wash: #f9f8f3;
  --hover-row: #fafaf7;
  --live: #166534;
  --live-bg: #f0fdf4;
  --danger: #991b1b;
  --danger-bg: #fee2e2;
  --radius: 4px;
  --page-max: 1720px;
  --page-pad-x: 28px;
}

/* Attribute must override component display (e.g. .btn { display: inline-flex }). */
[hidden] {
  display: none !important;
}

/* Sticky header */
.sticky-bar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: #fff;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
  padding-top: env(safe-area-inset-top, 0px);
}

.sticky-bar.scrolled {
  border-color: var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.sticky-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding-left: max(var(--page-pad-x), env(safe-area-inset-left, 0px));
  padding-right: max(var(--page-pad-x), env(safe-area-inset-right, 0px));
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px 24px;
  padding: 18px 0 16px;
  margin-bottom: 0;
  flex-wrap: wrap;
}

.header-sticky {
  width: 100%;
}

.header-left {
  flex: 1 1 220px;
  min-width: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.header-logo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  object-fit: contain;
}

.header-brand-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
}

.header-brand-eyebrow {
  margin: 0 0 3px;
  line-height: 1.2;
}

.header-title {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
  color: var(--ink);
}

.header-right {
  flex-shrink: 0;
}

/* Page-level auth + detail back — aligned to top-right of viewport band */
.header-right-tools {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 14px 16px;
}

.header-help-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 50%;
  transition: color 0.15s ease-out, background 0.15s ease-out;
}
.header-help-link:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.06);
}
.header-help-link svg { flex-shrink: 0; }

.header-getting-started {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 2px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease-out, color 0.15s ease-out;
}
.header-getting-started:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.page-auth {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.page-auth--signed-in {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.page-auth--signed-in .page-auth-status {
  margin: 0;
  line-height: 1.35;
}

.page-auth-status {
  margin: 0;
  font-weight: 500;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  text-align: right;
  max-width: min(100vw - 48px, 320px);
  word-break: break-word;
}

.page-auth-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Google-branded sign-in (visual only; same Firebase popup as before). */
.btn-sign-in-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 18px 8px 14px;
  border-radius: 4px;
  border: 1px solid #747775;
  background: #fff;
  color: #1f1f1f;
  font-size: 14px;
  font-weight: 500;
  font-family: "Helvetica Neue", Helvetica, Arial, Roboto, sans-serif;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  transition:
    background 0.15s,
    box-shadow 0.15s,
    border-color 0.15s;
}

.btn-sign-in-google:hover {
  background: #f8f9fa;
  border-color: #5f6368;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.btn-sign-in-google:focus-visible {
  outline: 2px solid #4285f4;
  outline-offset: 2px;
}

.btn-sign-in-google:active {
  background: #f1f3f4;
}

.btn-sign-in-google__icon {
  display: flex;
  flex-shrink: 0;
  line-height: 0;
}

.btn-sign-in-google__label {
  line-height: 1.25;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

h1 {
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.5px;
  margin: 0;
  color: var(--ink);
}

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding-top: 8px;
  padding-bottom: max(80px, calc(24px + env(safe-area-inset-bottom, 0px)));
  padding-left: max(var(--page-pad-x), env(safe-area-inset-left, 0px));
  padding-right: max(var(--page-pad-x), env(safe-area-inset-right, 0px));
}

.tagline {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 14px;
  max-width: 56ch;
  line-height: 1.55;
}

/* Section chrome */
.section-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted-light);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.section-label-inline {
  margin-bottom: 0;
}

.section-label-danger {
  color: var(--danger);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.create-panel-title {
  margin: 0 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* Tabs + read-only brand tag; consistent gap to form whether brand row is shown */
.create-flow-top {
  margin-bottom: 26px;
}

.create-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
  max-width: 100%;
}

.create-tab {
  margin: 0;
  padding: 10px 18px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--wash);
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s ease-out, color 0.12s ease-out;
}

.create-tab:last-child {
  border-right: none;
}

.create-tab:hover:not(:disabled) {
  background: #f0f0ec;
  color: var(--ink);
}

.create-tab.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--ink);
}

.create-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.create-tab-panel-inner {
  margin-bottom: 0;
}

.create-shared-upload {
  margin-top: 26px;
}

/* Custom file control (replaces native “Choose File” chrome) */
.file-upload-modern {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  width: 100%;
}

.file-upload-modern:focus-within .file-upload-btn {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.file-upload-modern.file-upload-modern--dragover {
  outline: 2px dashed var(--ink);
  outline-offset: 4px;
  border-radius: 8px;
  background: var(--hover-row);
}

.file-drop-hint {
  margin-top: 8px;
}

.file-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.file-upload-btn {
  flex-shrink: 0;
  margin: 0;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.file-upload-filename {
  flex: 1;
  min-width: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-upload-filename.has-file {
  color: var(--ink);
  font-weight: 500;
}

.create-form-row-two {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

@media (min-width: 720px) {
  .create-form-row-two {
    grid-template-columns: 1fr 1fr;
  }
}

/* Create modal — selects share one visual system */
.create-modal-body select {
  width: 100%;
  max-width: 100%;
  min-height: 40px;
  padding: 10px 40px 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}

.create-modal-body select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

.create-modal-body select:disabled {
  cursor: not-allowed;
}

/* Add version from artifact detail — target is fixed; match read-only brand chip (no chevron) */
.create-modal--version-only .create-target-field select:disabled {
  opacity: 1;
  cursor: default;
  color: #3d4a5c;
  font-weight: 600;
  background-color: #eef2f7;
  background-image: none;
  border-color: #d8e0eb;
  padding: 10px 14px;
  box-shadow: none;
}

.required-mark {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--muted);
  font-size: 11px;
}

.create-stack-hint {
  margin: -4px 0 0;
  max-width: 52ch;
}

.field-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.field-hint code {
  font-size: 11px;
  background: var(--wash);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--ink);
}

/* Upload help: tight to file control; info icon opens sample tree */
.upload-hint-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 10px;
  margin-top: 6px;
}

.field-file .upload-hint-row {
  margin-top: 6px;
}

.field-hint--upload-help {
  margin: 0;
  flex: 1 1 180px;
  min-width: 0;
  font-size: 11px;
  line-height: 1.55;
  color: #9a9a9a;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.upload-info-anchor {
  position: relative;
  flex-shrink: 0;
  align-self: center;
}

.upload-sample-popover {
  position: absolute;
  z-index: 300;
  /* Anchor trailing edge to icon so the panel grows left inside modals (avoids overflow-x clip). */
  left: auto;
  right: 0;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: min(92vw, 320px);
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.upload-info-anchor:hover .upload-sample-popover,
.upload-info-anchor:focus-within .upload-sample-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.upload-sample-title {
  margin: 0 0 8px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #444;
}

.upload-sample-title code {
  font-size: 10px;
}

.upload-sample-tree {
  margin: 0;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  line-height: 1.45;
  color: #333;
  white-space: pre;
  overflow-x: auto;
}

.detail-upload-panel .upload-hint-row {
  margin-top: 8px;
}

.field-hint--upload-help strong {
  font-weight: 600;
  color: #7d7d7d;
}

.field-hint--upload-help code {
  font-size: 10px;
  background: #efefef;
  color: #6b6b6b;
  padding: 1px 4px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px 22px;
  margin-bottom: 0;
  background: #fff;
}

.list-panel {
  margin-top: 0;
}

.list-section-label {
  margin: 0 0 14px;
}

.log-panel-details {
  margin-top: 24px;
}

.log-panel-summary {
  list-style: none;
  cursor: pointer;
  padding: 0;
  margin: 0 0 0;
  user-select: none;
}

.log-panel-summary::-webkit-details-marker {
  display: none;
}

.log-panel-summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 8px;
  border-left: 5px solid var(--muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transform: rotate(0deg);
  transition: transform 0.15s ease;
  vertical-align: middle;
}

.log-panel-details[open] .log-panel-summary::before {
  transform: rotate(90deg);
}

.log-panel-summary-label {
  display: inline-block;
  vertical-align: middle;
}

.log-panel-body {
  padding-top: 12px;
}

.hint,
.log-hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.hint code {
  font-size: 11px;
  background: var(--wash);
  color: var(--ink);
  padding: 2px 6px;
  border-radius: 3px;
}

hr.divider {
  border: none;
  border-top: 1px solid var(--border-row);
  margin: 36px 0;
}

/* Session panel — brand picker only (auth lives in sticky header) */
.toolbar-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px 24px;
}

.toolbar-brand {
  flex: 1 1 100%;
  min-width: 0;
  max-width: 520px;
}

.toolbar-brand-hint {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.toolbar-brand-controls {
  max-width: 420px;
}

.session-panel {
  margin-bottom: 0;
}

.brand-scoped-panels {
  margin-top: 24px;
}

/* Library — brands sidebar + main list (single expanded brand accordion) */
.library-shell {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 16px;
  min-height: 280px;
}

.library-sidebar {
  flex: 0 0 var(--sidebar-width, 360px);
  max-width: 100%;
  padding: 10px 6px 12px;
  margin: 0;
  overflow: auto;
  max-height: min(70vh, 720px);
  transition: flex-basis 0.15s ease;
}

/* Collapsed state: narrow the sidebar to just the toggle-button column.
   Everything else in the sidebar is hidden, so the toggle button stays at
   the same physical position whether the sidebar is open or collapsed. */
.library-shell.sidebar-collapsed .library-sidebar {
  flex-basis: 40px;
  overflow: hidden;
}

.library-shell.sidebar-collapsed .library-sidebar-label,
.library-shell.sidebar-collapsed .library-sidebar-toolbar,
.library-shell.sidebar-collapsed .sidebar-tree {
  display: none;
}

.library-sidebar-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
}

/* Harmonize with .library-main-breadcrumb so the two top-of-panel labels
   read at the same visual weight instead of tiny-uppercase vs body text. */
.library-sidebar-header .library-sidebar-label {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #5c5c5c;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

.library-sidebar-toolbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.library-sidebar-search {
  flex: 1 1 auto;
  min-width: 0;
  box-sizing: border-box;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid rgba(26, 26, 26, 0.15);
  border-radius: 6px;
  background: var(--panel, #fff);
  color: var(--ink);
}

.library-sidebar-search::placeholder {
  color: rgba(26, 26, 26, 0.45);
}

.library-sidebar-search:focus {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.library-sidebar-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  gap: 2px;
}

.sidebar-recents-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 8px);
  margin: 0 4px 8px;
  padding: 7px 10px 7px 7px;
  border: none;
  border-left: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: rgba(26, 26, 26, 0.72);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.sidebar-recents-btn:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--ink);
}

.sidebar-recents-btn.is-active {
  border-left-color: var(--ink);
  font-weight: 600;
  color: var(--ink);
}

.sidebar-recents-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.sidebar-recents-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: rgba(26, 26, 26, 0.45);
}

.sidebar-recents-btn.is-active .sidebar-recents-icon {
  color: var(--ink);
}

.library-shell.sidebar-collapsed .sidebar-recents-btn {
  display: none;
}

.library-recents-hint {
  margin: 0 0 10px;
}

.artifact-table col.artifact-col-brand {
  width: 18%;
}

.artifact-table td.artifact-table-brand {
  font-size: 13px;
  color: #5c5c5c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
}

.library-sidebar-icon-btn {
  padding: 4px 6px;
  min-width: 28px;
  color: var(--muted);
}

/* Two-class specificity wins over the .btn-ghost rule later in the file. */
.btn-ghost.library-sidebar-icon-btn {
  border-color: transparent;
}

.btn-ghost.library-sidebar-icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
  border-color: transparent;
}

.library-sidebar-icon-btn:disabled svg {
  opacity: 0.35;
}

.sidebar-folder-row {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  position: relative;
}

.sidebar-folder-chevron {
  flex-shrink: 0;
  width: var(--sidebar-chevron-col);
  min-height: 22px;
  margin-top: 0;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 9px;
  line-height: 1;
  color: var(--muted);
  align-self: center;
}

.sidebar-folder-chevron:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
}

.sidebar-folder-chevron:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.sidebar-folder-chevron--spacer {
  display: block;
  flex-shrink: 0;
  width: var(--sidebar-chevron-col);
  pointer-events: none;
}

.sidebar-folder-row .sidebar-tree-row {
  flex: 1;
  min-width: 0;
}

.sidebar-folder-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-artifact-row {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}

.sidebar-artifact-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-right: 4px;
  color: rgba(26, 26, 26, 0.45);
}

.sidebar-artifact-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 450;
  color: rgba(26, 26, 26, 0.82);
}

.sidebar-artifact-name.is-active {
  color: var(--ink);
}

.sidebar-artifact-lock {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-left: 4px;
  color: rgba(26, 26, 26, 0.45);
}

.sidebar-artifact-node + .sidebar-tree-node,
.sidebar-tree-node + .sidebar-artifact-node {
  margin-top: 1px;
}

/* Row right-side trio (count, +, •••). Equal 22px hit areas with uniform
   6px left-margin on each, so the spacing between them matches visually. */
.sidebar-folder-count {
  flex-shrink: 0;
  margin-left: 6px;
  min-width: 14px;
  text-align: right;
  font-size: 11px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: rgba(26, 26, 26, 0.45);
}

.sidebar-folder-quick,
.sidebar-folder-menu {
  position: relative;
  flex-shrink: 0;
  margin-left: 6px;
}

.sidebar-folder-quick > summary.sidebar-folder-icon-btn {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.sidebar-folder-quick > summary.sidebar-folder-icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
}

.sidebar-folder-quick > summary.sidebar-folder-icon-btn::-webkit-details-marker {
  display: none;
}

.sidebar-folder-flyout {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 52;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-width: 158px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  text-align: left;
}

.sidebar-folder-flyout.library-row-menu-panel--flip {
  top: auto;
  bottom: calc(100% + 4px);
}

.sidebar-folder-flyout-btn {
  margin: 0;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.sidebar-folder-flyout-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.sidebar-folder-menu-trigger {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  padding: 0;
  color: var(--muted);
}

/* Two-class specificity wins over the .btn-ghost rule later in the file. */
.btn-ghost.sidebar-folder-menu-trigger {
  border-color: transparent;
}

.btn-ghost.sidebar-folder-menu-trigger:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
  border-color: transparent;
}

.sidebar-folder-menu-panel {
  min-width: min(260px, calc(100vw - 48px));
}

.sidebar-tree {
  --sidebar-rail: rgba(26, 26, 26, 0.11);
  --sidebar-rail-nested: rgba(26, 26, 26, 0.09);
  --sidebar-chevron-col: 16px;
  --sidebar-h-gap: 2px;
  --sidebar-accent-w: 2px;
  font-size: 13px;
  line-height: 1.35;
}

.sidebar-brand-block {
  margin-bottom: 6px;
}

.sidebar-brand-block:last-child {
  margin-bottom: 0;
}

.sidebar-brand-header {
  display: flex;
  align-items: flex-start;
  gap: var(--sidebar-h-gap);
}

.sidebar-chevron {
  flex-shrink: 0;
  width: var(--sidebar-chevron-col);
  height: var(--sidebar-chevron-col);
  margin-top: 3px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 9px;
  line-height: 1;
  color: var(--muted);
}

.sidebar-chevron:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
}

.sidebar-brand-block:not(.sidebar-brand-block--current) .sidebar-chevron {
  color: rgba(26, 26, 26, 0.42);
}

.sidebar-brand-block:not(.sidebar-brand-block--current) .sidebar-chevron:hover {
  color: rgba(26, 26, 26, 0.75);
}

.sidebar-chevron:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

/* Brand row: accent uses border-left so padding never shifts between states */
.sidebar-brand-label {
  flex: 1;
  min-width: 0;
  text-align: left;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 10px 6px 7px;
  border-left: var(--sidebar-accent-w) solid transparent;
  border-radius: 0;
  color: rgba(26, 26, 26, 0.5);
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.sidebar-brand-block:not(.sidebar-brand-block--current) .sidebar-brand-label:hover {
  color: rgba(26, 26, 26, 0.72);
}

/* Library open in main pane — full contrast; subfolder selection does not dim this */
.sidebar-brand-label--current {
  font-weight: 600;
  color: var(--ink);
}

/* Browsing a subfolder: subtle rail = “this brand’s library”, full rail stays on the folder row */
.sidebar-brand-label--current:not(.is-active) {
  border-left-color: rgba(26, 26, 26, 0.22);
}

.sidebar-brand-label.is-active {
  border-left-color: var(--ink);
}

.sidebar-brand-label:hover,
.sidebar-tree-row:hover {
  background: rgba(0, 0, 0, 0.03);
}

/* Folder tree under a brand: first-level rows sit flush-left with the brand
   header to save horizontal space; deeper nesting picks up the rail via
   .sidebar-tree-children (border-left + padding). */
.sidebar-brand-body {
  position: relative;
  margin: 1px 0 1px 0;
  padding: 1px 0 2px 4px;
}

.sidebar-brand-body::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 2px;
  width: 1px;
  background: var(--sidebar-rail);
  border-radius: 1px;
}

.sidebar-tree-node {
  margin: 0;
}

.sidebar-tree-node + .sidebar-tree-node {
  margin-top: 1px;
}

.sidebar-tree-children {
  margin: 0;
  padding: 0 0 2px 8px;
  border-left: 1px solid var(--sidebar-rail-nested);
}

.sidebar-tree-row {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  padding: 1px 6px;
  border-left: var(--sidebar-accent-w) solid transparent;
  border-radius: 0;
  cursor: pointer;
  color: var(--ink);
  transition: border-color 0.12s ease, background 0.12s ease, font-weight 0.12s ease;
}

.sidebar-tree-row.is-active {
  border-left-color: var(--ink);
  font-weight: 600;
}

.sidebar-tree-row:focus {
  outline: none;
}

.sidebar-tree-row:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.sidebar-loading,
.sidebar-error {
  margin: 6px 0;
  font-size: 12px;
}

.library-main {
  flex: 1;
  min-width: 0;
}

.library-main-panel.list-panel {
  margin: 0;
}

.library-main-head {
  margin-bottom: 10px;
}

.library-main-breadcrumb {
  margin: 0 0 8px;
  max-width: 100%;
  font-size: 13px;
  line-height: 1.45;
  color: #5c5c5c;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 0;
}

.library-crumb-sep {
  color: #b0b0b0;
  font-weight: 400;
  padding: 0 6px;
  user-select: none;
}

.library-crumb-brand,
.library-crumb-folder {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: inherit;
  line-height: inherit;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  text-align: left;
}

.library-crumb-brand:hover,
.library-crumb-folder:hover {
  text-decoration: underline;
  color: var(--ink);
}

.library-crumb-here {
  font-weight: 600;
  color: var(--ink);
}

.library-main-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.library-main-title-block {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.library-main-title {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.02em;
  font-family: Georgia, "Times New Roman", Times, serif;
  color: var(--ink);
  min-width: 0;
  width: 100%;
}

.library-main-head-right {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-end;
  margin-left: auto;
  flex: 0 0 auto;
  align-self: flex-start;
}

.brand-viewer-head {
  display: flex;
  justify-content: flex-end;
}

.brand-viewer-modal-info {
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.02);
}

.brand-viewer-modal-info-summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
}

.brand-viewer-modal-info-body {
  margin: 0.5rem 0 0;
  padding: 0;
}

.brand-viewer-modal .brand-viewer-modal-hint {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
}

.brand-viewer-modal .brand-viewer-modal-current-label {
  margin: 0 0 0.25rem;
}

.brand-viewer-modal-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.artifact-password-reuse-list {
  display: flex;
  flex-direction: column;
  margin: 0 0 1rem;
  padding: 0;
  max-height: 12rem;
  overflow: auto;
  border: 1px solid var(--border, #e0ddd5);
  border-radius: 6px;
  background: #fff;
}

.artifact-password-reuse-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: none;
  border-bottom: 1px solid var(--border, #e0ddd5);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}

.artifact-password-reuse-row:last-child {
  border-bottom: none;
}

.artifact-password-reuse-row:hover {
  background: rgba(0, 0, 0, 0.03);
}

.artifact-password-reuse-row.is-selected {
  background: rgba(0, 0, 0, 0.06);
  box-shadow: inset 2px 0 0 var(--ink);
}

.artifact-password-reuse-pw {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  word-break: break-all;
}

.artifact-password-reuse-meta {
  font-size: 12px;
  color: var(--muted, #888);
  line-height: 1.4;
}

.artifact-password-also-update {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
}

.artifact-password-also-update input {
  margin-top: 3px;
}

.library-main-folder-id-line {
  margin: 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted-light);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.library-main-layout {
  margin-top: 8px;
}

.link-folder-open {
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.link-folder-open:hover {
  text-decoration: underline;
}

.folder-table-name {
  font-family: inherit;
}

.create-brand-picker-wrap {
  margin-bottom: 12px;
}

.create-brand-picker-wrap[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .library-shell {
    flex-direction: column;
  }

  .library-sidebar {
    flex: none;
    width: 100%;
    max-height: 42vh;
  }
}

.toolbar-brand-controls-with-action {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  max-width: 100%;
}

.toolbar-add-artifact {
  flex-shrink: 0;
}

/* Add artifact — native dialog */
.create-modal {
  border: none;
  padding: 0;
  max-width: min(560px, 96vw);
  width: 100%;
  background: transparent;
}

.create-modal::backdrop {
  background: rgba(15, 15, 15, 0.45);
}

.create-modal-surface {
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.14);
  padding: 28px 32px 32px;
  max-height: min(90vh, 920px);
  overflow-x: hidden;
  overflow-y: auto;
}

.create-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 4px;
}

.create-modal-head .create-modal-title.create-panel-title {
  margin: 0;
}

.create-modal-title {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.create-modal-close {
  flex-shrink: 0;
}

.create-modal .create-panel.create-modal-body {
  margin-top: 0;
}

/* Detail page opens modal with only “new version” — hide New artifact / New version tabs */
.create-modal--version-only .create-tabs {
  display: none;
}

.create-modal--version-only .create-flow-top {
  margin-bottom: 4px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ads-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.ads-filter-wrap {
  position: relative;
  min-width: 180px;
  flex: 1;
}

.ads-filter-wrap select {
  width: 100%;
  font-size: 12px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.create-actions {
  margin-top: 28px;
  padding-top: 4px;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

/* Form */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.create-panel .form-grid {
  gap: 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-inline {
  flex: 1 1 200px;
  min-width: 0;
}

.create-panel .field {
  gap: 10px;
}

.field-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.create-panel .field-label {
  letter-spacing: 0.1em;
  color: #6a6a6a;
  margin-bottom: 2px;
}

.optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--muted-light);
}

input[type="text"] {
  width: 100%;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input[type="text"]:focus {
  border-color: var(--ink);
}

input[type="file"]:not(.file-upload-input) {
  font-size: 12px;
  width: 100%;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.checkbox-field {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: #333;
}

.checkbox-field input {
  margin-top: 3px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease-out, color 0.15s ease-out, border-color 0.15s ease-out;
  text-decoration: none;
}

.btn-primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.btn-primary:hover {
  background: #333;
  border-color: #333;
}

.btn-secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--hover-row);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #7f1d1d;
  border-color: #7f1d1d;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}

.btn-ghost:hover {
  background: var(--ink);
  color: #fff;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.open-link {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  text-decoration: none;
}

.open-link:hover {
  background: var(--hover-row);
}

.meta {
  color: var(--muted);
  font-size: 12px;
}

.count-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 3px;
  background: var(--wash);
  border: 1px solid var(--border);
  color: var(--muted);
}

/* Active brand — label above read-only tag (matches other fields) */
.create-brand-line {
  margin: 0;
}

.create-brand-line[hidden] {
  display: none !important;
}

.create-brand-field {
  margin: 0;
}

.create-brand-field .create-brand-tag {
  display: block;
  width: 100%;
  margin-top: 0;
}

.create-brand-tag {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  font-weight: 600;
  color: #3d4a5c;
  padding: 10px 14px;
  border-radius: 6px;
  background: #eef2f7;
  border: 1px solid #d8e0eb;
  line-height: 1.45;
  word-break: break-word;
}

/* Artifact list — data table */
.artifact-list {
  display: block;
}

.artifact-list.artifact-list--file-dragover .artifact-table-wrap {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.28) inset;
  background: #f8fafc;
}

.artifact-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  /* overflow-x: auto clips overflow-y; extra bottom padding gives scroll room when a menu opens downward. */
  padding-bottom: clamp(7rem, 28vh, 20rem);
  position: relative;
}

.artifact-table {
  --artifact-col-date: 9.75rem;
  --artifact-col-uploader: 11.5rem;
  --artifact-col-actions: 10.25rem;
  --artifact-col-name-min: 12rem;
  width: 100%;
  min-width: calc(
    var(--artifact-col-name-min) + var(--artifact-col-date) + var(--artifact-col-uploader) +
      var(--artifact-col-actions)
  );
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
}

.artifact-col-name {
  width: calc(
    100% - var(--artifact-col-date) - var(--artifact-col-uploader) - var(--artifact-col-actions)
  );
}

.artifact-col-date {
  width: var(--artifact-col-date);
}

.artifact-col-uploader {
  width: var(--artifact-col-uploader);
}

.artifact-col-actions {
  width: var(--artifact-col-actions);
}

.artifact-table thead th {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  padding: 10px 12px;
  border-bottom: 1.5px solid var(--ink);
  text-align: left;
  white-space: nowrap;
  vertical-align: bottom;
}

.artifact-table thead th:last-child {
  text-align: right;
  padding-right: 10px;
}

.table-sort-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.table-sort-btn:hover {
  color: var(--ink);
}

.table-sort-btn.is-active {
  color: var(--ink);
}

.table-sort-indicator {
  display: inline-block;
  min-width: 0.8em;
}

.artifact-table tbody tr.artifact-row {
  border-bottom: 1px solid var(--border-row);
  cursor: pointer;
  transition: background 0.12s ease;
}

.artifact-table tbody tr.artifact-row:last-child {
  border-bottom: none;
}

.artifact-table tbody tr.artifact-row:hover {
  background: var(--hover-row);
}

.artifact-table tbody tr.artifact-row:focus {
  outline: none;
}

.artifact-table tbody tr.artifact-row:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
  position: relative;
  z-index: 1;
}

.artifact-table tbody th,
.artifact-table tbody td {
  padding: 10px 12px;
  vertical-align: middle;
  text-align: left;
  color: #333;
  overflow: hidden;
}

.artifact-table tbody th.artifact-table-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
}

/* Shared name column: fixed glyph column so folder emoji and file labels align. */
.library-name-row {
  display: grid;
  /* Match folder emoji column width on both row types so labels line up. */
  grid-template-columns: 1.65em minmax(0, 1fr);
  align-items: center;
  column-gap: 6px;
  min-width: 0;
}

.library-name-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05em;
  line-height: 1;
  user-select: none;
}

.library-name-glyph--spacer {
  pointer-events: none;
}

.library-name-glyph--lock {
  pointer-events: none;
  color: #4a5568;
}

.library-name-glyph--lock svg {
  display: block;
}

.library-name-body {
  min-width: 0;
}

.library-name-row--folder .link-folder-open {
  font-weight: 600;
}

/* Artifacts: slightly lighter than folders = subtle “file vs container” hierarchy. */
.library-name-row--file .artifact-name-text {
  font-weight: 500;
}

.artifact-name-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.artifact-name-text {
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

.artifact-version-pill {
  flex-shrink: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #3d4a5c;
  border: 1px solid #d8e0eb;
}

.artifact-table tbody td.artifact-table-date,
.artifact-table tbody td.artifact-table-uploader {
  font-size: 12px;
  color: #444;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.artifact-table tbody td.artifact-table-uploader {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: -0.01em;
}

.artifact-table tbody td.artifact-table-actions {
  text-align: right;
  white-space: nowrap;
  overflow: visible;
  padding-right: 10px;
  box-sizing: border-box;
  width: var(--artifact-col-actions);
}

.artifact-table tbody tr.folder-row,
.artifact-table tbody tr.artifact-row {
  overflow: visible;
}

.artifact-row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.library-actions-cluster {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: nowrap;
}

.library-actions-cluster > .btn,
.library-actions-cluster > .open-link {
  flex-shrink: 0;
}

.library-actions-cluster a.open-link {
  text-decoration: none;
  color: inherit;
}

/* Overflow row menu (⋯) — library table */
.library-row-menu {
  position: relative;
  display: inline-block;
  text-align: right;
  z-index: 1;
}

.library-row-menu[open] {
  z-index: 50;
}

.library-row-menu summary {
  list-style: none;
}

.library-row-menu summary::-webkit-details-marker {
  display: none;
}

.library-row-menu-trigger {
  min-width: 38px;
}

.library-row-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 51;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  min-width: 200px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  text-align: left;
}

/* Open above the ⋯ control when the panel would extend past the scroll/clipping box (see syncLibraryRowMenuFlip). */
.library-row-menu-panel.library-row-menu-panel--flip {
  top: auto;
  bottom: calc(100% + 4px);
}

@media (max-width: 900px) {
  /* On narrow layouts, keep row action panels inline to avoid overlapping nearby controls. */
  .library-row-menu-panel,
  .library-row-menu-panel.library-row-menu-panel--flip {
    position: static;
    top: auto;
    right: auto;
    bottom: auto;
    margin-top: 8px;
    box-shadow: none;
  }
  .sidebar-folder-flyout,
  .sidebar-folder-flyout.library-row-menu-panel--flip {
    position: static;
    top: auto;
    right: auto;
    bottom: auto;
    margin-top: 8px;
    box-shadow: none;
  }
}

.library-row-menu-panel--folder {
  min-width: 300px;
  max-width: min(420px, calc(100vw - 24px));
}

.library-row-menu-folder-id-line {
  margin: 0 0 2px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted-light);
  line-height: 1.35;
  word-break: break-all;
}

.library-row-menu-panel--artifact {
  min-width: 240px;
}

.library-row-menu-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

select.library-folder-move.library-row-menu-select,
select.library-artifact-move.library-row-menu-select {
  width: 100%;
  max-width: none;
  min-height: 36px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.35;
}

.library-row-menu-link {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--border);
}

.library-row-menu-link:hover {
  background: var(--hover-row);
}

.library-row-menu-btn {
  width: 100%;
  justify-content: center;
}

.library-row-menu-danger {
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.35);
}

.library-row-menu-danger:hover {
  background: rgba(180, 35, 24, 0.06);
}

.library-row-menu-icon-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
}

/* Equal columns across mixed children (<details> + <button>). */
.library-row-menu-icon-row > * {
  min-width: 0;
}

.library-row-menu-icon-row > .library-row-menu-move {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.library-row-menu-icon-row .btn,
.library-row-menu-icon-row .library-row-menu-move summary {
  width: 100%;
  max-width: 100%;
  justify-content: center;
  min-width: 0;
  box-sizing: border-box;
}

.library-row-menu-move {
  position: relative;
  display: block;
}

.library-row-menu-move summary.library-row-menu-move-trigger {
  list-style: none;
  width: 100%;
  max-width: 100%;
  justify-content: center;
  flex: 0 0 auto;
}

.library-row-menu-move summary.library-row-menu-move-trigger::-webkit-details-marker {
  display: none;
}

.library-row-menu-move[open] .library-row-menu-move-select {
  margin-top: 8px;
}

.library-row-menu-move-select {
  width: 100%;
  max-width: none;
  min-height: 36px;
}

.library-row-menu-icon-btn.library-row-menu-danger-icon {
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.35);
}

.library-row-menu-icon-btn.library-row-menu-danger-icon:hover {
  background: rgba(180, 35, 24, 0.06);
  color: #991b1b;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.open-link-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.open-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  min-width: 38px;
  line-height: 0;
  border: 1px solid var(--ink);
  border-radius: 3px;
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  background: #fff;
  box-sizing: border-box;
}

.open-link-icon:hover {
  background: var(--hover-row);
}

.open-link-icon svg {
  display: block;
}

.open-link-icon--sm {
  min-width: 34px;
  padding: 4px 8px;
}

.btn-icon-tight {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  min-width: 38px;
  line-height: 0;
  box-sizing: border-box;
}

.btn-icon-tight svg {
  display: block;
}

.btn-edit-password {
  gap: 7px;
}

.btn-edit-password svg {
  flex-shrink: 0;
  display: block;
}

.btn-edit-password-label {
  line-height: 1.2;
}

/* Detail view */
.detail-view {
  padding-bottom: 24px;
}

.detail-tagline {
  margin-bottom: 20px;
}

.link-back {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--ink);
  text-decoration: underline;
  cursor: pointer;
  font-size: 14px;
}

.link-back:hover {
  color: var(--muted);
}

/* Artifact detail: multiple .panel siblings (like Activity), not one mega-card */
.detail-page-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-summary-panel .detail-main-head {
  margin-bottom: 10px;
}

.detail-summary-panel .detail-summary-breadcrumb {
  margin-bottom: 0;
}

.detail-summary-panel .detail-head {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.detail-head {
  display: block;
  min-width: 0;
}

.detail-title-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
}

.detail-title-primary {
  flex: 1 1 200px;
  min-width: 0;
}

.detail-title-primary--stack {
  flex: 1 1 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-title-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  width: 100%;
}

.detail-title-block {
  flex: 1 1 200px;
  min-width: 0;
}

.detail-head-badges {
  flex-shrink: 0;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .detail-head-badges {
    justify-content: flex-start;
  }
}

.detail-meta-lines {
  margin-top: 16px;
  padding-top: 0;
  border-top: none;
}

.detail-meta-row {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

.detail-meta-item {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
  min-width: 0;
}

.detail-meta-label {
  flex-shrink: 0;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted-light);
}

.detail-meta-value {
  color: #333;
  word-break: break-word;
}

.detail-meta-divider {
  color: #d0d0d0;
  user-select: none;
}

.detail-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

/* Pencil: calm until hover (ghost btn is loud by default on detail chrome). */
.detail-rename-trigger {
  border-color: transparent !important;
  color: #8a8a8a;
  background: transparent;
  opacity: 0.92;
}

.detail-rename-trigger:hover {
  color: var(--ink);
  opacity: 1;
  background: rgba(0, 0, 0, 0.05) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

.detail-rename-trigger:focus-visible {
  color: var(--ink);
  opacity: 1;
  border-color: var(--ink) !important;
}

.detail-rename-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.detail-rename-input {
  flex: 1;
  min-width: 160px;
  max-width: 420px;
  padding: 8px 10px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 3px;
}

.detail-head-url {
  margin-top: 12px;
}

.detail-head-url.url-row {
  margin-bottom: 0;
  display: block;
}

.detail-url-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  width: 100%;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  box-sizing: border-box;
}

.detail-url-password-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  max-width: 100%;
}

/* No chrome around row — label + standard pill switch only */
.detail-password-switch-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border: none;
  background: transparent;
  box-sizing: border-box;
  min-height: 32px;
  user-select: none;
}

.detail-password-switch-card:has(.detail-password-switch:disabled) {
  opacity: 0.65;
}

.detail-password-label-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 500;
  white-space: nowrap;
  color: var(--ink);
}

.detail-password-lock {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.detail-password-lock svg {
  display: block;
}

.detail-password-switch {
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 11px;
  background: #e9e9ea;
  cursor: pointer;
  box-sizing: border-box;
  transition: background 0.15s ease;
}

.detail-password-switch:hover:not(:disabled) {
  background: #dcdcdf;
}

.detail-password-switch:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.35);
  outline-offset: 2px;
}

.detail-password-switch:disabled {
  cursor: wait;
}

.detail-password-switch.is-on {
  background: var(--ink);
}

.detail-password-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}

.detail-password-switch.is-on .detail-password-switch-thumb {
  transform: translateX(16px);
}

.detail-head-url .detail-url-cluster code.detail-url-code {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  word-break: break-all;
  font-size: 12px;
  line-height: 1.45;
  color: #333;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

.detail-head-url .url-actions--tight {
  flex-shrink: 0;
  gap: 6px;
  margin-left: auto;
}

.detail-head-url .open-link-icon--detail {
  min-width: 36px;
  padding: 5px 8px;
}

.detail-head-text {
  min-width: 0;
}

.detail-title {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.02em;
  font-family: Georgia, "Times New Roman", serif;
}

.detail-subline {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.detail-subline code {
  font-size: 12px;
}

.detail-upload-lead {
  margin: 0 0 14px;
  max-width: 52ch;
  line-height: 1.5;
  font-size: 13px;
  color: var(--muted);
}

.detail-upload-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.detail-upload-actions input[type="file"] {
  width: 100%;
  max-width: 420px;
  min-width: 0;
}

.detail-url-row {
  margin-bottom: 0;
}

.detail-summary-panel .detail-versions-embedded {
  margin-top: 20px;
}

.detail-summary-panel .detail-versions-embedded .library-toolbar {
  margin-top: 0;
  margin-bottom: 12px;
}

.detail-version-table-wrap {
  padding-bottom: 0;
}

/* Fixed layout; favor a wide actions col so Restore + icons + delete stay on-screen */
.detail-version-table col.detail-version-col-version {
  width: 10%;
}

.detail-version-table col.detail-version-col-filename {
  width: 28%;
}

.detail-version-table col.artifact-col-date {
  width: 11%;
}

.detail-version-table col.artifact-col-uploader {
  width: 14%;
}

.detail-version-table col.artifact-col-actions {
  width: 37%;
}

.detail-version-table td.detail-version-filename {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #333;
}

.detail-version-table .detail-version-filesize {
  color: #888;
  font-weight: 400;
  font-size: 11px;
}

.detail-version-table tbody tr.detail-version-row {
  border-bottom: 1px solid var(--border-row);
}

.detail-version-table tbody tr.detail-version-row:last-child {
  border-bottom: none;
}

.detail-version-table tbody tr.detail-version-row:hover {
  background: var(--hover-row);
}

.detail-version-table thead th:first-child {
  width: 10%;
  min-width: 7rem;
}

.detail-version-table tbody th.detail-version-name {
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  white-space: nowrap;
  vertical-align: middle;
  min-width: 7rem;
  box-sizing: border-box;
}

.detail-version-table .detail-version-name-inner {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.detail-version-table tbody th.detail-version-name code {
  font: inherit;
  background: rgba(0, 0, 0, 0.04);
  padding: 2px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}

.detail-version-table .live--in-version-col {
  flex-shrink: 0;
  margin: 0;
}

.detail-version-table .artifact-table-actions {
  white-space: nowrap;
  vertical-align: middle;
  /* Room for Restore + 3 icon btns + delete without clipping */
  min-width: 17.5rem;
}

.detail-version-table .version-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}

.detail-version-table .version-actions .btn-sm {
  padding-left: 6px;
  padding-right: 6px;
  font-size: 11px;
}

.detail-version-table .version-actions .btn-icon-tight {
  min-width: 32px;
  padding: 4px 6px;
}

/* Same vertical padding as .btn-icon-tight / .open-link-icon--sm in this row */
.detail-version-table .version-actions .btn-restore-version {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  line-height: 1;
  box-sizing: border-box;
}

.detail-version-table .version-actions .open-link-icon--sm {
  min-width: 30px;
  padding: 4px 6px;
}

.detail-version-table thead th,
.detail-version-table tbody th,
.detail-version-table tbody td {
  padding-left: 8px;
  padding-right: 8px;
}

.detail-version-table thead th:last-child,
.detail-version-table tbody td.artifact-table-actions {
  padding-left: 6px;
  padding-right: 6px;
}

.detail-version-table .detail-version-empty td {
  padding: 18px 12px;
  text-align: center;
}

.panel.detail-danger-panel {
  background: #fff;
  border-color: var(--border);
}

.detail-danger-desc {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  max-width: 62ch;
}

.btn-danger-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-danger-icon svg {
  flex-shrink: 0;
}

.btn-danger-label {
  font-size: 13px;
}

.empty-state {
  margin: 0;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--hover-row);
}

.copy-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  margin: 0;
  padding: 10px 20px;
  max-width: min(90vw, 320px);
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #fff;
  background: var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.copy-toast[hidden] {
  display: none !important;
}

.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;
}

.artifact-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.artifact-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 18px;
  background: var(--wash);
  border-bottom: 1px solid var(--border);
}

.artifact-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.artifact-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 2px;
  vertical-align: middle;
  background: var(--wash);
  color: var(--muted);
}

.badge-live {
  background: var(--live-bg);
  color: var(--live);
}

.artifact-card > .url-row,
.artifact-card > .artifact-meta,
.artifact-card > .upload-row,
.artifact-card > .version-table-wrap {
  padding-left: 18px;
  padding-right: 18px;
}

.artifact-card > .url-row {
  padding-top: 14px;
}

.url-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.url-row code {
  word-break: break-all;
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  background: var(--wash);
  color: var(--ink);
  border-radius: 3px;
  border: 1px solid var(--border);
}

.url-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.artifact-meta {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.artifact-meta strong {
  color: var(--ink);
  font-weight: 700;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 0;
  padding-top: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-row);
}

.upload-row label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.upload-row input[type="file"] {
  flex: 1;
  min-width: 200px;
}

.version-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  padding-bottom: 18px;
}

.version-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.version-table thead th {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  padding: 10px 12px;
  border-bottom: 1.5px solid var(--ink);
  text-align: right;
  white-space: nowrap;
}

.version-table thead th:first-child {
  text-align: left;
}

.version-table thead th:nth-child(2),
.version-table thead th:nth-child(3) {
  text-align: left;
}

.version-table tbody tr {
  border-bottom: 1px solid var(--border-row);
}

.version-table tbody tr:hover {
  background: var(--hover-row);
}

.version-table tbody tr:last-child {
  border-bottom: 2px solid var(--ink);
}

.version-table tbody td {
  padding: 10px 12px;
  vertical-align: middle;
  text-align: right;
  color: #333;
}

.version-table tbody td:first-child {
  text-align: left;
  font-size: 12px;
  word-break: break-word;
  max-width: 120px;
}

.version-table tbody td:nth-child(2),
.version-table tbody td:nth-child(3) {
  text-align: left;
  font-size: 11px;
}

.version-cell-actions--live {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.version-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.live {
  color: var(--live);
  font-weight: 700;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Library — folders + artifact tree */
.library-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.library-toolbar-field {
  min-width: 140px;
}

.library-toolbar-field .field-label {
  font-size: 10px;
}

.library-toolbar-actions {
  align-items: center;
}

.folder-modal-path {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.folder-modal-actions {
  margin-top: 8px;
  justify-content: flex-end;
  gap: 10px;
}

.library-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.library-tree {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.library-folder-block {
  margin: 0;
  padding-left: calc(var(--library-depth, 0) * 14px);
}

.library-folder-inner {
  padding-left: 12px;
  border-left: 1px solid var(--border);
  margin-left: 6px;
}

.library-folder-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 4px;
  border: 1px solid transparent;
}

.library-folder-head:hover {
  background: var(--hover-row);
}

.library-folder-icon {
  flex-shrink: 0;
}

.library-folder-name {
  font-weight: 600;
  font-size: 13px;
  margin-right: auto;
}

select.library-folder-move {
  max-width: 220px;
  font-size: 11px;
  padding: 4px 8px;
}

.library-drop-target.library-drop-hover {
  border-color: var(--ink);
  background: rgba(0, 0, 0, 0.04);
}

.library-artifact-block {
  margin-bottom: 16px;
  padding-left: calc(var(--library-depth, 0) * 14px);
}

.library-artifact-block .artifact-table-wrap {
  margin-top: 4px;
}

.artifact-row.is-dragging {
  opacity: 0.55;
}

.detail-folder-line {
  margin-top: 4px;
}

.detail-folder-line strong {
  font-weight: 600;
}

/* Activity log — monospace strip, light ground */
.activity-log {
  margin: 0;
  background: var(--wash);
  color: #333;
  padding: 14px 18px;
  border-radius: 3px;
  border: 1px solid var(--border);
  min-height: 100px;
  max-height: 280px;
  overflow: auto;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  -webkit-overflow-scrolling: touch;
}

/* —— Mobile / narrow viewports —— */
@media (min-width: 1100px) {
  .artifact-table {
    --artifact-col-date: 10.5rem;
    --artifact-col-uploader: 14rem;
    --artifact-col-actions: 10.5rem;
  }
}

@media (max-width: 720px) {
  :root {
    --page-pad-x: 16px;
  }

  h1 {
    font-size: 22px;
    line-height: 1.2;
  }

  .header-title {
    font-size: 1.15rem;
  }

  .header-logo {
    width: 40px;
    height: 40px;
  }

  .header {
    padding: 14px 0 12px;
    flex-direction: column;
    align-items: stretch;
  }

  .header-left {
    flex: none;
  }

  .header-right-tools {
    width: 100%;
    justify-content: space-between;
    align-items: flex-start;
  }

  .header-help-link {
    min-width: 44px;
    min-height: 44px;
  }

  .header-getting-started {
    min-height: 44px;
    align-items: center;
  }

  .page-auth {
    align-items: flex-end;
    flex: 1 1 auto;
    min-width: 0;
  }

  .page-auth--signed-in {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 12px;
  }

  .page-auth--signed-in .btn-sign-out {
    flex-shrink: 0;
    min-height: 36px;
  }

  .page-auth--signed-in .page-auth-status {
    text-align: left;
  }

  .page-auth-status {
    text-align: left;
    max-width: none;
  }

  .page-auth-actions {
    justify-content: flex-end;
  }

  .page-auth-actions .btn,
  .page-auth-actions .btn-sign-in-google {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 44px;
  }

  .panel {
    padding: 14px 16px 16px;
  }

  .create-panel-title {
    font-size: 20px;
  }

  .create-tabs {
    width: 100%;
  }

  .create-tab {
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    padding: 12px 14px;
    font-size: 13px;
  }

  /* Prevent iOS zoom on focus; keep controls readable */
  input[type="text"],
  input[type="file"]:not(.file-upload-input),
  select,
  textarea,
  .detail-rename-input {
    font-size: 16px !important;
  }

  .file-upload-filename {
    font-size: 15px;
  }

  .file-upload-btn {
    min-height: 44px;
  }

  .ads-filter-wrap select,
  .create-modal-body select,
  #folderModalName,
  #createName {
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .btn {
    min-height: 44px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .btn-sm {
    min-height: 40px;
    padding: 8px 14px;
  }

  .btn-icon-tight,
  .open-link-icon {
    min-width: 44px;
    min-height: 44px;
  }

  .open-link-icon--sm {
    min-width: 40px;
    min-height: 40px;
  }

  .create-actions .btn {
    width: 100%;
  }

  hr.divider {
    margin: 24px 0;
  }

  .toolbar-brand-controls {
    max-width: none;
  }

  .ads-filter-wrap {
    max-width: none;
  }

  .artifact-table thead th,
  .artifact-table tbody th,
  .artifact-table tbody td {
    padding: 8px 10px;
  }

  .artifact-table tbody th.artifact-table-name {
    max-width: none;
    font-size: 13px;
  }

  .version-table thead th,
  .version-table tbody td {
    padding: 8px 10px;
  }

  .version-actions {
    justify-content: flex-start;
  }

  .detail-title {
    font-size: 18px;
  }

  .detail-upload-actions {
    width: 100%;
  }

  .detail-upload-actions .btn-primary {
    width: 100%;
    min-height: 48px;
  }

  .library-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .library-toolbar-field {
    flex: none;
    min-width: 0;
    width: 100%;
  }

  .library-toolbar .btn {
    align-self: flex-start;
    width: 100%;
    max-width: 100%;
  }

  .library-folder-block,
  .library-artifact-block {
    padding-left: calc(var(--library-depth, 0) * 10px);
  }

  .library-folder-inner {
    margin-left: 4px;
    padding-left: 8px;
  }

  .library-folder-head {
    padding: 10px;
    gap: 10px;
  }

  select.library-folder-move,
  select.library-artifact-move {
    width: 100%;
    max-width: none;
    min-height: 44px;
    font-size: 16px;
    padding: 8px 10px;
  }

  .library-folder-name {
    width: 100%;
    margin-right: 0;
  }

  .upload-sample-popover {
    right: auto;
    left: 0;
    max-width: min(calc(100vw - 48px), 280px);
  }

  /* Modal: tighter padding reclaims ~24px of content width on 375px screens */
  .create-modal-surface {
    padding: 20px 20px 24px;
  }

  /* Brand viewer modal: share the button row evenly so 3 buttons don't crowd */
  .brand-viewer-modal-actions .btn {
    flex: 1 1 auto;
  }

  /* Sidebar: cap height so the artifact list is reachable without excessive scrolling */
  .library-sidebar {
    max-height: 28vh;
    min-height: 140px;
  }

  /* Brand panel header: let "API keys" wrap below the title cleanly */
  .library-main-head-right {
    width: 100%;
  }

  .brand-viewer-head {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }

  .btn-edit-password {
    flex: 1 1 auto;
  }

  /* Table: hide the "Uploaded by" column to reduce required horizontal scroll */
  .artifact-col-uploader,
  .artifact-table-uploader,
  .artifact-table-uploader-th {
    display: none;
  }

  .artifact-col-name {
    width: calc(100% - var(--artifact-col-date) - var(--artifact-col-actions));
  }

  /* ─── Detail view: URL cluster — stack vertically so URL doesn't compete with password toggle ─── */
  .detail-url-cluster {
    flex-direction: column;
    align-items: stretch;
  }

  .detail-head-url .url-actions--tight {
    margin-left: 0;
  }

  /* ─── Detail version table: fix action-button overflow on mobile ─── */

  /* Root cause: min-width: 17.5rem forces the table wider than the viewport */
  .detail-version-table .artifact-table-actions {
    min-width: 0;
    white-space: normal;
  }

  /* Allow buttons to wrap within their cell instead of overflowing */
  .detail-version-table .version-actions {
    flex-wrap: wrap;
    gap: 4px;
  }

  /* Hide the filename column — it's truncated to "Thrive Cause…" anyway */
  .detail-version-filename-th,
  .detail-version-table .detail-version-filename {
    display: none;
  }

  /* Collapse hidden col allocations so they don't eat fixed-layout space */
  .detail-version-table col.detail-version-col-filename,
  .detail-version-table col.artifact-col-uploader {
    width: 0;
  }

  /* Redistribute the freed space: version | date | actions */
  .detail-version-table col.detail-version-col-version {
    width: 22%;
  }

  .detail-version-table col.artifact-col-date {
    width: 30%;
  }

  .detail-version-table col.artifact-col-actions {
    width: 48%;
  }

  /* Allow date to wrap ("5/28/2026," + "4:15 AM") rather than overflow */
  .detail-version-table .artifact-table-date {
    white-space: normal;
  }
}

@media (max-width: 400px) {
  :root {
    --page-pad-x: 12px;
  }

  h1 {
    font-size: 20px;
  }

  .create-tab {
    font-size: 12px;
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* Footer (legal links) */
.site-footer {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 1rem var(--page-pad-x) 2rem;
  border-top: 1px solid var(--border);
}

.site-footer-inner {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: var(--muted);
}

.site-footer a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-footer a:hover {
  color: var(--muted);
}

.site-footer-sep {
  margin: 0 0.35rem;
  color: var(--muted);
  user-select: none;
}

/* --- API Keys modal --- */

.api-keys-modal {
  max-width: min(720px, 96vw);
}

.api-keys-table td,
.api-keys-table th {
  padding: 0.35rem 0.5rem;
  vertical-align: top;
}

.api-keys-table tbody tr {
  border-bottom: 1px solid var(--border, #e0ddd5);
}

.brand-viewer-head {
  gap: 0.5rem;
}

/* Global focus ring — visible for keyboard users, hidden for mouse */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Suppress focus ring on elements that define their own */
.btn:focus-visible,
input[type="text"]:focus-visible,
.sidebar-tree-row:focus-visible,
.detail-rename-trigger:focus-visible,
.detail-password-switch:focus-visible {
  outline: none;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
