/* HARNESS-ONLY STYLES: the standalone page's status bar and Settings dialog
   (ruling UI-R1), copied from ai-voice-ui dev @ 0b167a2 public/harness.css
   (itself platform-admin's, itself pos-ui's), value for value, then brought to
   platform-admin dev @ 51ab428 src/styles.css: the dialog's border and shadow,
   the Environment tabs, the one row height and the copy buttons. The rail foot's
   Live/Demo pair is left out: this repository's chrome.css already has it.

   ★ NOT IN THE FEDERATED SHEET, ON PURPOSE. This file lives in public/ and is
   linked from index.html, so Vite never bundles it and remoteEntry.js never
   names it: none of these classes (.modal, .status-bar, .chip…) can reach a
   host page (im#1220 rule 3). Uses chrome.css's tokens. */

/* ---- Layout: the screen plus the status bar beneath it, one column ---- */

.app-main-column {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---- Status bar (components/StatusBar.jsx) ---- */

.status-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  /* Console and session, left | backend, right | the Settings gear. */
  grid-template-columns: 1fr auto auto auto;
  align-items: baseline;
  gap: 0.1rem 1rem;
  padding: 0.3rem 1rem;
  /* Gold, like the rail's dividers (pos-ui's is a light gray rule). */
  border-top: 1px solid var(--gold);
  /* Light gray, inset (founder, 2026-09-25): a status bar, not a banner. */
  background: #eceef0;
  box-shadow:
    inset 0 2px 4px -1px rgba(16, 24, 40, 0.14),
    inset 0 -1px 0 rgba(255, 255, 255, 0.7);
  color: var(--forest-deep, #14483a);
  font-size: 0.8rem;
  line-height: 1.35;
}

.status-bar-console {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.1rem 0.5rem;
}

.status-bar-name {
  font-weight: 700;
}

.status-bar-field {
  font-weight: 500;
  color: rgba(22, 32, 28, 0.72);
}

.status-bar-field::before {
  content: '·';
  margin-right: 0.5rem;
  color: rgba(22, 32, 28, 0.45);
}

.status-bar-backend {
  justify-self: end;
  text-align: right;
  font-weight: 500;
  color: rgba(22, 32, 28, 0.62);
  font-variant-numeric: tabular-nums;
}

/* Labels in gold, hosts in the bar's own ink; the mode in light blue (pos-ui's). */
.status-bar-label {
  color: var(--gold, #b08a3e);
  font-weight: 700;
}

.status-bar-label-blue {
  color: #5aaee8;
}

@media (max-width: 767px) {
  .status-bar {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .status-bar-backend {
    justify-self: center;
    text-align: center;
  }
}

/* Settings from the bar: the hosts' gray at rest, the labels' blue on hover (pos-ui's). */
.status-bar .status-bar-gear {
  align-self: center;
  display: inline-flex;
  padding: 0.15rem;
  border: 0;
  border-radius: 4px;
  background: none;
  box-shadow: none;
  color: rgba(22, 32, 28, 0.62);
  cursor: pointer;
}

.status-bar .status-bar-gear:hover,
.status-bar .status-bar-gear:focus-visible {
  transform: none;
  background: none;
  box-shadow: none;
  color: #5aaee8;
}

/* ---- Dialog (components/Modal.tsx) — pos-ui's .modal-backdrop / .modal-plain recipe ---- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(38, 42, 40, 0.58);
  backdrop-filter: grayscale(0.7) blur(1px);
}

/* Settings over the screen it was opened from: a light scrim with no greyscale, so a Display
   change shows behind it in its real colours. */
.modal-backdrop-see-through {
  padding: 0.5rem;
  background: rgba(38, 42, 40, 0.16);
  backdrop-filter: none;
}

/* Clear of the left nav (212px) on a wide screen, so the rail stays in view. */
@media (min-width: 900px) {
  .modal-backdrop-see-through {
    padding-left: calc(212px + 0.5rem);
  }
}

.modal.modal-plain {
  width: min(42rem, 100%);
  min-height: 17rem;
  max-height: 90vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.2rem 1.2rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-paper, 4px);
  box-shadow: var(--shadow);
}

.modal.modal-plain.modal-settings {
  width: min(84rem, 100%);
  /* platform-admin's (the founder, 2026-10-07): taller, 3rem inside the window. */
  height: min(58rem, calc(100vh - 3rem));
  max-height: none;
  /* The nav's right edge, as it reads: 1px of the same ink at 45% so it shows,
     and the nav's soft shadow carried all round the sheet. */
  border: 1px solid rgba(22, 32, 28, 0.45);
  box-shadow:
    0 0 12px -3px rgba(20, 50, 41, 0.35),
    0 18px 48px rgba(16, 24, 40, 0.28);
}

.modal-settings .settings-layout {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* The .panel-header band, pulled to the sheet's edges — with a gold rule beneath it, matching
   the rail's dividers. */
.modal-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: -1rem -1.2rem 0.9rem;
  padding: 0.9rem 1.2rem 0.7rem;
  background:
    linear-gradient(
      0deg,
      #fcfdfb 0%,
      rgba(230, 236, 221, 0.82) 40%,
      rgba(197, 209, 180, 0.9) 100%
    ),
    url('/images/abstract-bg-white-1-thin.jpg') center/cover no-repeat;
  border-radius: var(--radius-paper, 4px) var(--radius-paper, 4px) 0 0;
  border-bottom: 1px solid var(--gold);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.modal-head-text {
  flex: 1;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.modal-head .modal-close {
  border: none;
  background: transparent;
  box-shadow: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-faded);
  padding: 0 0.25rem;
}

.modal-head .modal-close:hover {
  transform: none;
  background: transparent;
  box-shadow: none;
}

.modal-actions {
  margin-top: auto;
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gold);
}

.modal-actions .modal-ok,
.modal-actions .modal-cancel {
  min-width: 8rem;
}

/* ---- Settings: the section rail beside the section (pos-ui's) ---- */

.settings-layout {
  display: flex;
  min-height: 100%;
  min-width: 0;
}

.settings-rail {
  width: 14rem;
  flex-shrink: 0;
  padding: 1.125rem 0.875rem;
  background: #fff;
  border-right: 1px solid var(--gold);
  overflow-y: auto;
}

.settings-rail-kicker {
  padding: 0 12px 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.09375rem;
  text-transform: uppercase;
  color: var(--ink-faded);
}

.settings-section {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(22, 32, 28, 0.15);
  border-radius: 0.625rem;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
  background: rgba(210, 218, 199, 0.12);
  box-shadow:
    0 14px 30px -12px rgba(20, 50, 41, 0.5),
    0 3px 8px -4px rgba(20, 50, 41, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition:
    transform 0.25s,
    box-shadow 0.25s,
    background 0.25s;
}

.settings-section:hover {
  transform: translateY(-2px);
}

.settings-section.is-current {
  background: var(--forest-tint);
  color: var(--forest);
  font-weight: 600;
}

.settings-section-icon {
  display: inline-flex;
  opacity: 0.7;
}

.settings-section.is-current .settings-section-icon {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .settings-section {
    transition: none;
  }
  .settings-section:hover {
    transform: none;
  }
}

.settings-rail-hint {
  margin: 0.875rem 0 0;
  padding: 0 12px;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink-faded);
}

.settings-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 0 1.25rem 1.25rem;
}

.settings-content h2 {
  margin-top: 0.25rem;
}

@media (max-width: 640px) {
  .settings-layout {
    flex-direction: column;
  }
  .settings-rail {
    width: auto;
    border-right: none;
    border-bottom: 1px solid var(--gold);
  }
  .settings-content {
    padding: 1rem 0 0;
  }
}

/* ---- Settings → Display (pos-ui's switch list) ---- */

.display-settings-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
  max-width: 40rem;
}

.display-setting {
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.display-setting-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  font-weight: 600;
}

.display-setting-row input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--forest);
}

.display-setting-state {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(22, 32, 28, 0.62);
}

.display-setting-note {
  margin: 0.35rem 0 0 1.7rem;
  font-size: 0.82rem;
  color: rgba(22, 32, 28, 0.7);
}

/* ---- Settings → Environment ---- */

.facts-list {
  margin: 1rem 0 0;
  max-width: 44rem;
  border-top: 1px solid var(--line);
}

.facts-row {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.facts-row dt {
  font-weight: 600;
  color: var(--ink-faded);
}

.facts-row dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.env-chip {
  margin-left: 8px;
}

/* ---- Small shared pieces the Settings sections use ---- */

.row-subtle {
  font-size: 0.75rem;
  color: var(--ink-faded);
}

.chip {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  vertical-align: middle;
}

.chip-neutral {
  color: var(--ink-faded);
  border-color: var(--card-border);
}

/* ---- platform-admin's element-level composites, scoped to the dialog ---- */

.modal h2,
.settings-content h2 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

/* platform-admin's bare `h2` size and foot gap, for the section headings. */
.settings-content h2 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.modal-actions .modal-ok,
.modal-actions .modal-cancel {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  /* platform-admin's bare `button` padding — the piece the size came from. */
  padding: 0.5rem 1.1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background:
    linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.65),
        rgba(255, 255, 255, 0) 48%
      )
      padding-box,
    linear-gradient(180deg, #f7faf2 0%, #dce3d0 46%, #b9c6a8 100%) padding-box,
    linear-gradient(
        180deg,
        rgba(148, 179, 194, 0.5) 0%,
        rgba(148, 179, 194, 0.85) 40%,
        rgba(84, 116, 132, 0.9) 100%
      )
      border-box;
  color: var(--forest-deep);
  box-shadow:
    0 14px 30px -12px rgba(20, 50, 41, 0.5),
    0 3px 8px -4px rgba(20, 50, 41, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition:
    transform 0.25s,
    box-shadow 0.25s,
    background 0.25s,
    border-color 0.25s;
}

.modal-actions .modal-ok:hover,
.modal-actions .modal-cancel:hover {
  transform: translateY(-2px);
  background:
    linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.4),
        rgba(255, 255, 255, 0) 55%
      )
      padding-box,
    linear-gradient(180deg, #d2dac7 0%, #bcc9ae 50%, #a6b794 100%) padding-box,
    linear-gradient(180deg, #94b3c2 0%, #5f8296 100%) border-box;
}

/* ---- Settings → Environment: the build variables, Variable | Value ----
   Lined up with the facts list above it (founder, 2026-10-06): the same
   width, the same 14rem first column, and a visible divider under every row. */

.settings-content .facts-list,
.env-vars {
  max-width: 44rem;
}

.settings-content .facts-list {
  border-top-color: rgba(22, 32, 28, 0.16);
}

.settings-content .facts-row {
  grid-template-columns: 14rem 1fr;
  border-bottom-color: rgba(22, 32, 28, 0.16);
}

#environment-variables-heading {
  margin-top: 1.75rem;
}

.env-vars {
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
  table-layout: fixed;
}

.env-vars th,
.env-vars td {
  text-align: left;
}

.env-vars thead th {
  padding: 0 0 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faded);
  border-bottom: 1px solid rgba(22, 32, 28, 0.16);
}

.env-vars thead th:first-child {
  width: clamp(8rem, 24%, 14rem);
}

/* Every row gets its divider, the last one included. */
.env-vars tbody th,
.env-vars tbody td {
  padding: 0;
  vertical-align: middle;
  font-weight: 400;
  border-bottom: 1px solid rgba(22, 32, 28, 0.16);
}

.env-vars thead th + th,
.env-vars tbody td {
  padding-left: 1rem;
}

.env-var-name {
  display: block;
  text-align: left;
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.env-vars .env-var-input {
  width: 100%;
  box-sizing: border-box;
  height: 1.75rem;
  padding: 0 10px;
  border: 1px solid rgba(22, 32, 28, 0.2);
  border-radius: 8px;
  background: #f6f7f8;
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-size: 0.8rem;
  color: var(--ink);
  cursor: default;
}

.env-vars .env-var-input::placeholder {
  font-family: 'Manrope', sans-serif;
  font-style: italic;
  color: #8b938e;
}

.env-vars .env-var-input:focus-visible {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(31, 74, 61, 0.15);
}

.env-vars-foot {
  margin-top: 12px;
}

/* UI-R1 version facts in the status bar. */
.status-bar-version {
  justify-self: end;
  font-weight: 500;
  color: rgba(22, 32, 28, 0.62);
  font-variant-numeric: tabular-nums;
}

.status-bar-latest {
  color: #1f7a4d;
  font-weight: 700;
}

.status-bar .status-bar-reload {
  padding: 0 6px;
  border: 1px solid #b26b00;
  border-radius: 999px;
  background: #fff6e0;
  box-shadow: none;
  color: #8a5a00;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* Settings → Environment: the Reload offer beside the published build. */
.facts-row .env-reload {
  margin-left: 4px;
  padding: 1px 8px;
  border: 1px solid #b26b00;
  border-radius: 999px;
  background: #fff6e0;
  box-shadow: none;
  color: #8a5a00;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

/* ---- platform-admin dev @ 51ab428: Settings → Environment as two folder tabs ---- */

@media (max-width: 767px) {
  .status-bar-version {
    justify-self: center;
    text-align: center;
  }
}

/* The tabs fill the dialog (the founder, 2026-10-07: "responsive with full panel
   within dialog"): the section is a column, the folder panel takes the rest of
   the height and the full width. */
.environment-settings {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.environment-settings .facts-list,
.environment-settings .env-vars {
  max-width: none;
}

/* One row height for every line (the founder, 2026-10-07): a fact and a build
   variable are each one line, 2.25rem high; a longer value ends in an ellipsis,
   and its copy button carries the whole. */
.settings-content .env-row {
  grid-template-columns: clamp(8rem, 24%, 14rem) minmax(0, 1fr) 2rem;
  align-items: center;
  height: 2.25rem;
  padding: 0;
  gap: 0.75rem;
}

.settings-content .env-row dt,
.settings-content .env-row dd {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.environment-settings .folder-tabpanel .facts-list {
  margin-top: 0;
}

.env-vars tbody tr {
  height: 2.25rem;
}

.env-vars thead th.env-vars-copy,
.env-vars td.env-vars-copy {
  width: 2.75rem;
  text-align: right;
}

.env-vars-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.env-vars-head .row-subtle {
  margin: 0;
}

/* platform-admin's bare `button` look, scoped: this harness has no element rules. */
.env-vars-head .env-download {
  flex-shrink: 0;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(22, 32, 28, 0.45);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0) 48%) padding-box,
    linear-gradient(180deg, #f7faf2 0%, #dce3d0 46%, #b9c6a8 100%) padding-box;
  color: var(--forest-deep);
  cursor: pointer;
}

@media (max-width: 640px) {
  .env-vars-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* One copy control per line: quiet at rest, the forest on hover. */
.copy-button {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.35rem;
  border: 1px solid rgba(22, 32, 28, 0.18);
  border-radius: 6px;
  background: #fff;
  box-shadow: none;
  color: rgba(22, 32, 28, 0.6);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.copy-button:hover,
.copy-button:focus-visible {
  transform: none;
  border-color: var(--forest);
  color: var(--forest);
}

/* ---- Folder tabs (components/FolderTabs.jsx), pos-ui's via platform-admin.
   The selected tab opens into its panel with no line between. ---- */

.folder-tabs,
.folder-tabpanel {
  --folder-rule: rgba(22, 32, 28, 0.28);
}

.folder-tabs {
  display: flex;
  flex-wrap: nowrap;
  container-type: inline-size;
  align-items: stretch;
  gap: 0.6rem;
  min-width: 0;
  margin-top: 0.75rem;
  padding: 4px 4px 0 calc(var(--radius-panel) + 0.4rem);
  margin-bottom: -1px;
}

.folder-tab {
  display: block;
  flex: 0 1 clamp(6rem, 24cqw, 14rem);
  min-width: 0;
  min-height: 40px;
  padding: 0.385em 1rem 0.29em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border: 1px solid rgba(22, 32, 28, 0.22);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  margin-top: 3px;
  background: linear-gradient(0deg, #f4f6ef 0%, #e9ede0 40%, #dfe4d4 100%);
  box-shadow: none;
  color: var(--ink-faded);
  font: inherit;
  font-size: clamp(0.8rem, calc(0.6cqw + 0.65rem), 1rem);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.folder-tab:hover:not(.active) {
  transform: none;
  color: var(--ink);
}

.folder-tab:focus-visible {
  outline: 2px solid var(--forest);
  outline-offset: 2px;
}

.folder-tab.active {
  margin-top: 0;
  padding-bottom: 0.34em;
  border-color: var(--folder-rule);
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 55%),
    linear-gradient(0deg, #d2dac7 0%, #bcc9ae 50%, #a6b794 100%);
  color: var(--forest-deep);
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.folder-tabpanel {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.75rem clamp(0.6rem, 2vw, 1.2rem) 1rem;
  border: 1px solid var(--folder-rule);
  border-radius: var(--radius-panel);
  background: #fdfdfb;
  box-shadow: var(--card-shadow);
}
