:root {
  --ink: #171717;
  --muted: #747474;
  --line: #aaa;
  --soft-line: #d7d7d2;
  --paper: #fff;
  --wash: #fafaf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  font: 14px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

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

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

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

.login-view {
  position: relative;
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  place-items: center;
}

.login-form {
  width: min(360px, 100%);
  transform: translateY(-4vh);
}

.login-form h1 {
  margin: 0 0 15px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
  text-transform: lowercase;
}

.password-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px auto;
  min-height: 40px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.password-line input {
  min-width: 0;
  padding: 9px 11px;
  border: 0;
  outline: 0;
  background: transparent;
}

.password-line input:focus-visible {
  outline: 0;
  box-shadow: inset 0 0 0 1px var(--ink);
}

.password-line button,
.quiet-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.password-line button {
  padding: 8px 11px;
  color: var(--muted);
  border-left: 1px solid var(--soft-line);
}

.password-visibility {
  display: grid;
  padding: 0 !important;
  place-items: center;
}

.password-visibility svg {
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.password-visibility .eye-slash {
  display: none;
}

.password-visibility[aria-pressed="true"] .eye-slash {
  display: block;
}

.password-line button:hover,
.quiet-button:hover {
  color: var(--ink);
  background: var(--wash);
}

.password-line button:disabled,
.password-line input:disabled {
  cursor: wait;
  opacity: 0.55;
}

.login-status {
  min-height: 1.4em;
  margin: 9px 1px 0;
  color: #9b1424;
  font-size: 0.76rem;
  text-align: center;
}

.last-edited {
  position: absolute;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 50%;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: normal;
  white-space: nowrap;
  transform: translateX(-50%);
}

.application {
  width: 100%;
  min-height: 100vh;
  padding: 20px;
}

.command-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  min-height: 38px;
  gap: 14px;
}

.terminal-frame {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: min(480px, calc(100vw - 112px));
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid #999;
}

.terminal-prompt {
  color: #888;
}

#terminal {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

#terminal:focus-visible {
  outline: 0;
}

.terminal-status {
  flex: 1;
  min-width: 0;
  margin: 8px 0 0;
  overflow: hidden;
  color: #247036;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-status.error {
  color: #9b1424;
}

.quiet-button {
  min-height: 34px;
  margin-left: auto;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.workspace {
  width: 100%;
  margin-top: 22px;
}

.page-homepage {
  min-height: calc(100vh - 96px);
}

.page-heading,
.component-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.page-heading {
  margin-bottom: 18px;
}

.page-heading h1,
.component-heading h1 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.eyebrow,
.component-id {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.component-count {
  color: var(--muted);
  font-size: 0.76rem;
}

.component-layout,
.component-group-body {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 18px;
}

.component-layout-row {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: flex-start;
  gap: 16px;
}

.component-layout-row > .component,
.component-layout-row > .component-group {
  flex: 1 1 0;
  min-width: 0;
}

.component-group {
  padding: 10px;
  border: 1px solid #777;
  background: var(--wash);
}

.component-group .component-group {
  background: var(--paper);
}

.component-catalog {
  border-top: 1px solid var(--line);
}

.catalog-item {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(180px, 1fr) minmax(120px, 0.7fr);
  gap: 18px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 10px 8px;
  border: 0;
  border-bottom: 1px solid var(--soft-line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.catalog-item:hover {
  background: var(--wash);
}

.catalog-id {
  font-weight: 700;
}

.catalog-description,
.catalog-command {
  color: var(--muted);
  font-size: 0.78rem;
}

.catalog-command {
  text-align: right;
}

.component {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
}

.component-heading {
  min-height: 62px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--soft-line);
  background: var(--wash);
}

.component-content {
  width: 100%;
  overflow-x: auto;
}

.component-loading,
.component-error {
  min-height: 160px;
  margin: 0;
  display: grid;
  color: var(--muted);
  font-size: 0.78rem;
  place-items: center;
}

.component-error {
  color: #9b1424;
}

.component-table {
  width: 100%;
  min-width: 580px;
  border-collapse: collapse;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

.component-table th,
.component-table td {
  height: 45px;
  padding: 8px 12px;
  border-right: 1px solid var(--soft-line);
  border-bottom: 1px solid var(--soft-line);
  text-align: right;
  white-space: nowrap;
}

.component-table tr:last-child th,
.component-table tr:last-child td {
  border-bottom: 0;
}

.component-table th:last-child,
.component-table td:last-child {
  border-right: 0;
}

.component-table thead th {
  height: 39px;
  color: var(--muted);
  background: #fdfdfc;
  font-size: 0.72rem;
  font-weight: 700;
}

.component-table thead th:first-child,
.component-table tbody th {
  width: 28%;
  text-align: left;
}

.component-table tbody th {
  font-size: 0.82rem;
  font-weight: 600;
}

.component-value {
  display: block;
  min-height: 1.2em;
}

.holdings-frame {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.holdings-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.holdings-table th,
.holdings-table td {
  min-width: 88px;
  height: 42px;
  padding: 7px 9px;
  border-right: 1px solid var(--soft-line);
  border-bottom: 1px solid var(--soft-line);
  text-align: right;
  white-space: nowrap;
}

.holdings-table thead th {
  color: var(--muted);
  background: #fdfdfc;
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
}

.holdings-table .holdings-ticker-heading,
.holdings-table tbody th {
  min-width: 180px;
  text-align: left;
}

.holdings-table tbody th {
  background: var(--paper);
  font-size: 0.78rem;
  font-weight: 600;
}

.holdings-table tr:last-child th,
.holdings-table tr:last-child td {
  border-bottom: 0;
}

.holdings-table th:last-child,
.holdings-table td:last-child {
  border-right: 0;
}

.column-group-toggle {
  display: inline-flex;
  max-width: 190px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 3px 7px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  white-space: normal;
}

.column-group-toggle:hover,
.column-group-toggle:focus-visible {
  color: var(--ink);
  background: #f0f0ec;
}

.column-group-caret {
  color: #888;
  font-size: 0.88em;
}

.holdings-search-wrap {
  padding: 10px 12px;
  border-top: 1px solid var(--soft-line);
  background: var(--wash);
}

.holdings-search {
  width: min(210px, 100%);
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid #aaa;
  border-radius: 0;
  background: var(--paper);
  font-size: 0.76rem;
}

@media (max-width: 680px) {
  .application {
    padding: 14px;
  }

  .command-header {
    flex-wrap: wrap;
    gap: 5px 8px;
  }

  .terminal-frame {
    width: calc(100% - 62px);
  }

  .quiet-button {
    order: 2;
  }

  .terminal-status {
    order: 3;
    flex-basis: 100%;
    margin: 2px 2px 0;
  }

  .workspace {
    margin-top: 15px;
  }

  .catalog-item {
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
  }

  .catalog-description {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}
