/* src/detail-primitives/detail-primitives.css */
.p4-detail-container {
  container-name: p4-detail;
  container-type: inline-size;
}

.p4-detail-cue {
  pointer-events: none;
  display: inline-block;
  opacity: 0;
  margin-inline-start: .5rem;
}

.p4-detail-row[data-detail-interactive] {
  cursor: pointer;
}

.p4-detail-row[data-detail-interactive]:hover {
  background: color-mix(in srgb, currentColor 8%, transparent);
  outline: none;
}

.p4-detail-row[data-detail-interactive]:focus-visible {
  background: color-mix(in srgb, currentColor 8%, transparent);
  outline: none;
}

.p4-detail-row[data-detail-selected] {
  background: color-mix(in srgb, currentColor 12%, transparent);
}

.p4-detail-row[data-detail-interactive]:not([data-detail-selected]):hover .p4-detail-cue {
  opacity: 1;
}

.p4-detail-row[data-detail-interactive]:not([data-detail-selected]):focus-visible .p4-detail-cue {
  opacity: 1;
}

@container p4-detail (width < 960px) {
  .p4-detail-wide {
    max-width: 100%;
  }
}

/* src/account-profile/accountProfile.css */
.account-profile-mount {
  flex-shrink: 0;
}

.account-profile-control {
  position: relative;
  display: flex;
  color: var(--muted-foreground);
  text-align: left;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 9px;
  align-items:  center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
}

.account-profile-control:hover {
  background: color-mix(in srgb, var(--muted), transparent 50%);
  color: var(--foreground);
}

.account-profile-control:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

.account-profile-close:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

.account-profile-update:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

.account-profile-control-avatar {
  display: inline-flex;
  border: 1px solid;
  border-radius: 50%;
  flex: 0 0 24px;
  justify-content: center;
  align-items:  center;
  width: 24px;
  height: 24px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.account-profile-control-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.account-profile-control-label {
  font-size: 13px;
  line-height: 1.2;
}

.account-profile-control-name {
  overflow: hidden;
  color: var(--muted-foreground);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  line-height: 1.2;
}

.account-profile-scrim {
  position: fixed;
  z-index: 50;
  display: flex;
  overflow: auto;
  background: color-mix(in srgb, var(--foreground), transparent 72%);
  justify-content: center;
  align-items:  center;
  min-width: 0;
  padding: 24px;
  transition: opacity .16s;
  inset: 0;
}

.account-profile-dialog {
  overflow: auto;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--surface-raised-shadow);
  width: min(420px, 100%);
  min-width: 0;
  max-width: 100%;
  max-height: 100%;
  padding: 18px;
  transition: opacity .16s, transform .16s;
}

.account-profile-dialog[data-account-profile-mutation="pending"] {
  cursor: progress;
}

.account-profile-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items:  flex-start;
  gap: 12px;
}

.account-profile-heading {
  min-width: 0;
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.25;
}

.account-profile-close {
  border: 1px solid var(--surface-border);
  color: var(--muted-foreground);
  cursor: pointer;
  background: none;
  border-radius: 50%;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.account-profile-close:hover, .account-profile-update:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--foreground);
}

.account-profile-status {
  color: var(--muted-foreground);
  min-height: 22px;
  margin: 12px 0 0;
  font-size: 12px;
}

.account-profile-status[data-account-profile-state="unavailable"] {
  color: var(--foreground);
  font-weight: 600;
}

.account-profile-incomplete {
  color: var(--foreground);
  margin: 14px 0 0;
  font-size: 13px;
}

.account-profile-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  margin-top: 18px;
}

.account-profile-label {
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 600;
}

.account-profile-input {
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
}

.account-profile-input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

.account-profile-input[aria-invalid="true"] {
  border-color: var(--foreground);
}

.account-profile-error {
  color: var(--foreground);
  margin: 0;
  font-size: 12px;
  font-weight: 600;
}

.account-profile-update {
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-pill);
  background: var(--foreground);
  color: var(--surface);
  cursor: pointer;
  justify-self: start;
  min-width: 0;
  padding: 8px 12px;
}

.account-profile-update:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.account-profile-dialog[data-account-profile-state="session-invalid"] {
  display: none;
}

.rail[data-rail-expanded="false"] .account-profile-mount {
  width: 36px;
}

.rail[data-rail-expanded="false"] .account-profile-control {
  justify-content: center;
  gap: 0;
  width: 36px;
  height: 36px;
  padding: 0;
}

.rail[data-rail-expanded="false"] .account-profile-control-copy {
  display: none;
}

@media (max-width: 320px) {
  .account-profile-scrim {
    align-items:  flex-start;
    padding: 8px;
  }

  .account-profile-dialog {
    width: 100%;
    padding: 14px;
  }

  .account-profile-update {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .account-profile-scrim, .account-profile-dialog {
    transition: none;
  }
}

/* src/surface-renderer/shell.css */
:root {
  --canvas: #eef0f2;
  --surface: #fafafa;
  --surface-raised: #fafafa;
  --surface-raised-shadow: 0 4px 12px #00000014;
  --surface-hover: #f2f2f5;
  --card: #f7f7f7;
  --muted: #f5f5f5;
  --foreground: #25282e;
  --muted-foreground: #71717a;
  --surface-border: #e5e5e5;
  --hairline: #00000017;
  --focus-ring: #71717a;
  --glyph-green: #00e676;
  --radius: 12px;
  --radius-sm: 7px;
  --radius-pill: 9999px;
  --gutter: clamp(16px, 3vw, 40px);
  --rail-expanded: 212px;
  --rail-collapsed: 56px;
  --font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --buncss-light: initial;
  --buncss-dark: ;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #08090a;
    --surface: #1c1e22;
    --surface-raised: #252830;
    --surface-raised-shadow: none;
    --surface-hover: #191b1e;
    --card: #111214;
    --muted: #1a1c1f;
    --foreground: #f0f0f3;
    --muted-foreground: #9ca0ab;
    --surface-border: #2d3340;
    --hairline: #ffffff1a;
    --focus-ring: #9ca0ab;
    --buncss-light: ;
    --buncss-dark: initial;
    color-scheme: dark;
  }
}

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

html, body {
  height: 100%;
}

body {
  background: var(--canvas);
  color: var(--foreground);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

button, input {
  font: inherit;
  color: inherit;
}

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

.shell {
  display: flex;
  height: 100vh;
  min-height: 0;
}

.shell-main {
  display: flex;
  background: var(--canvas);
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.shell-content {
  overflow: auto;
  padding: 20px var(--gutter);
  flex: 1;
  min-height: 0;
}

.rail {
  width: var(--rail-expanded);
  display: flex;
  background: var(--card);
  border-right: 1px solid var(--hairline);
  overflow: visible;
  flex-direction: column;
  flex-shrink: 0;
  align-items: stretch;
  gap: 1px;
  padding: 12px 10px;
  transition: width .18s;
}

.rail-top {
  display: flex;
  align-items:  center;
  gap: 4px;
}

.rail-workspace {
  position: relative;
  display: inline-flex;
  color: var(--foreground);
  border-radius: 9px;
  flex: 1;
  align-items:  center;
  gap: 4px;
  min-width: 0;
  padding: 8px 10px;
}

.rail-workspace-chip {
  display: inline-flex;
  background: var(--foreground);
  color: var(--card);
  border-radius: 7px;
  flex-shrink: 0;
  justify-content: center;
  align-items:  center;
  width: 26px;
  height: 26px;
  font-size: 11px;
  font-weight: 700;
}

.rail-workspace-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  font-size: 13px;
}

.rail-fold {
  display: inline-flex;
  color: var(--muted-foreground);
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 8px;
  flex-shrink: 0;
  justify-content: center;
  align-items:  center;
  width: 30px;
  height: 30px;
  padding: 0;
}

.rail-fold:hover {
  background: color-mix(in srgb, var(--muted), transparent 50%);
  color: var(--foreground);
}

.rail-fold:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

.rail-fold-glyph {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.rail-entry {
  position: relative;
  display: inline-flex;
  color: var(--muted-foreground);
  text-align: left;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 9px;
  justify-content: flex-start;
  align-items:  center;
  gap: 11px;
  width: auto;
  padding: 8px 10px;
  transition: background-color 75ms, color 75ms;
  font-weight: 400;
}

.rail-entry:hover {
  background: color-mix(in srgb, var(--muted), transparent 50%);
  color: var(--foreground);
}

.rail-entry:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

.rail-entry[aria-current="page"] {
  background: var(--muted);
  color: var(--foreground);
  font-weight: 600;
}

.rail-entry-glyph {
  display: inline-flex;
  color: inherit;
  flex-shrink: 0;
  justify-content: center;
  align-items:  center;
  width: 24px;
  height: 24px;
  margin: 0 -2.5px;
  font-size: 15px;
  line-height: 1;
}

.rail-entry-visible-label {
  font-size: 13px;
  font-weight: inherit;
  white-space: nowrap;
}

.rail-entry-focus-label, .rail-workspace-tip {
  display: none;
}

.rail-spacer {
  flex: 1;
}

.rail-help {
  display: inline-flex;
  color: var(--muted-foreground);
  text-align: left;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 9px;
  justify-content: flex-start;
  align-items:  center;
  gap: 11px;
  padding: 8px 10px;
  font-size: 13px;
}

.rail-help:hover {
  background: color-mix(in srgb, var(--muted), transparent 50%);
  color: var(--foreground);
}

.rail-help:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

.rail-help-glyph {
  display: inline-flex;
  flex-shrink: 0;
  justify-content: center;
  align-items:  center;
  width: 24px;
  height: 24px;
  margin: 0 -2.5px;
  font-size: 14px;
  line-height: 1;
}

.rail[data-rail-expanded="false"] {
  width: var(--rail-collapsed);
  align-items:  center;
  padding: 12px 0;
}

.rail[data-rail-expanded="false"] .rail-top {
  flex-direction: column;
  gap: 2px;
}

.rail[data-rail-expanded="false"] .rail-workspace, .rail[data-rail-expanded="false"] .rail-entry, .rail[data-rail-expanded="false"] .rail-help {
  flex: none;
  justify-content: center;
  gap: 0;
  width: 36px;
  height: 36px;
  padding: 0;
}

.rail[data-rail-expanded="false"] .rail-workspace-name, .rail[data-rail-expanded="false"] .rail-help-label {
  display: none;
}

.rail[data-rail-expanded="false"] .rail-entry-focus-label, .rail[data-rail-expanded="false"] .rail-workspace-tip {
  display: block;
  position: absolute;
  z-index: 30;
  border-radius: var(--radius-sm);
  background: var(--foreground);
  color: var(--card);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  padding: 6px 9px;
  transition: opacity .12s;
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  top: 50%;
  left: calc(100% + 18px);
  transform: translateY(-50%);
}

.rail[data-rail-expanded="false"] .rail-entry:hover .rail-entry-focus-label, .rail[data-rail-expanded="false"] .rail-workspace:hover .rail-workspace-tip {
  opacity: 1;
}

.rail[data-rail-expanded="false"] .rail-entry:focus-visible .rail-entry-focus-label {
  opacity: 1;
}

.composer-region {
  position: relative;
  background: var(--canvas);
  flex-shrink: 0;
}

.composer-ack {
  padding: 0 var(--gutter) 6px;
  color: var(--muted-foreground);
  min-height: 26px;
  font-size: 12px;
}

.composer-ack p {
  max-width: 68ch;
  margin: 0;
}

.composer-row {
  display: flex;
  padding: 0 var(--gutter) 16px;
  align-items:  center;
  gap: 8px;
}

.composer-plus {
  position: relative;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--foreground);
  cursor: pointer;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  font-size: 16px;
  line-height: 1;
}

.composer-plus:hover {
  background: var(--surface-hover);
}

.composer-plus:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

.composer-plus-tip {
  position: absolute;
  border-radius: var(--radius-sm);
  background: var(--foreground);
  color: var(--canvas);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  padding: 5px 8px;
  transition: opacity .12s;
  font-size: 11px;
  line-height: 1;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
}

.composer-plus:hover .composer-plus-tip {
  opacity: 1;
}

.composer-plus:focus-visible .composer-plus-tip {
  opacity: 1;
}

.composer-form {
  display: flex;
  flex: 1;
  align-items:  center;
  min-width: 0;
}

.composer-field {
  position: relative;
  display: flex;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  flex: 1;
  align-items:  center;
  min-width: 0;
}

.composer-field:focus-within {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

.composer-input {
  border-radius: var(--radius-pill);
  background: none;
  border: 0;
  flex: 1;
  min-width: 0;
  padding: 9px 44px 9px 15px;
}

.composer-input:focus-visible {
  outline: none;
}

.composer-input::placeholder {
  color: var(--muted-foreground);
}

.composer-send {
  position: absolute;
  display: inline-flex;
  border-radius: var(--radius-pill);
  color: var(--muted-foreground);
  cursor: pointer;
  background: none;
  border: 0;
  justify-content: center;
  align-items:  center;
  width: 30px;
  height: 30px;
  right: 5px;
}

.composer-send:before {
  content: "";
  position: absolute;
  border-radius: var(--radius-pill);
  inset: -7px;
}

.composer-send:hover {
  color: var(--foreground);
}

.composer-send:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

.composer-send-glyph {
  width: 22px;
  height: 22px;
}

.glyph-point {
  fill: var(--glyph-green);
}

.catalog {
  position: absolute;
  bottom: calc(100% - 10px);
  left: var(--gutter);
  width: min(360px, calc(100% - 2 * var(--gutter)));
  z-index: 20;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--surface-raised-shadow);
  padding: 5px;
}

.catalog-title {
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin: 0;
  padding: 6px 9px 4px;
  font-size: 10px;
  font-weight: 600;
}

.catalog-entry {
  display: flex;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  background: none;
  border: 0;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 7px 9px;
}

.catalog-entry:hover {
  background: var(--surface-hover);
}

.catalog-entry:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

.catalog-entry-label {
  font-family: var(--font-mono);
  flex: none;
  font-size: 11px;
}

.catalog-entry-description {
  color: var(--muted-foreground);
  font-size: 12px;
}

.catalog-empty {
  color: var(--muted-foreground);
  margin: 0;
  padding: 8px 9px 10px;
  font-size: 12px;
}

.catalog-dismiss {
  display: block;
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  text-align: left;
  cursor: pointer;
  background: none;
  border: 0;
  width: 100%;
  margin-top: 2px;
  padding: 7px 9px;
  font-size: 12px;
}

.catalog-dismiss:hover {
  background: var(--surface-hover);
  color: var(--foreground);
}

.catalog-dismiss:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

.help-scrim {
  position: fixed;
  z-index: 40;
  display: flex;
  background: #00000047;
  justify-content: center;
  align-items:  center;
  padding: 24px;
  inset: 0;
}

.help-dialog {
  overflow: auto;
  border-radius: var(--radius);
  background: var(--surface);
  width: min(420px, 100%);
  max-height: 100%;
  padding: 14px 16px 16px;
  box-shadow: 0 16px 48px #00000047;
}

.help-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.help-intro {
  color: var(--muted-foreground);
  margin: 6px 0 12px;
  font-size: 12px;
}

.help-actions {
  display: flex;
  gap: 6px;
}

.help-action {
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  background: none;
  padding: 5px 11px;
  font-size: 12px;
}

.help-action:hover {
  background: var(--surface-hover);
}

.help-action:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}
