:root {
  color-scheme: dark;
  --ai-bg: #07090d;
  --ai-panel: #11151b;
  --ai-border: rgba(255, 255, 255, 0.12);
  --ai-text: #edf1f7;
  --ai-muted: #9aa3ae;
  --ai-accent: #67e8c2;
  --ai-danger: #ff6976;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--ai-bg);
  color: var(--ai-text);
  font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.ui-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.centrum-ai-shell {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--ai-viewport-width, 100vw);
  height: 100vh;
  height: 100dvh;
  height: var(--ai-viewport-height, 100dvh);
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  transform: translate3d(
    var(--ai-viewport-offset-left, 0px),
    var(--ai-viewport-offset-top, 0px),
    0
  );
}

.centrum-ai-header {
  position: relative;
  min-height: 58px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 8px) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--ai-border);
  background: #0c0f14;
}

.centrum-ai-header__actions {
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.centrum-ai-header h1 {
  margin: 0;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.centrum-ai-icon-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--ai-border);
  border-radius: 8px;
  background: #151a21;
  color: var(--ai-text);
  cursor: pointer;
  text-decoration: none;
}

#centrum-ai-wake-lock.is-active {
  color: var(--ai-accent);
  border-color: var(--ai-accent);
}

#centrum-ai-wake-lock.has-error {
  color: var(--ai-danger);
}

#centrum-ai-wake-lock:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (min-width: 601px) {
  #centrum-ai-wake-lock,
  .centrum-ai-wake-status {
    display: none;
  }
}

.centrum-ai-wake-status {
  position: absolute;
  top: 100%;
  right: 8px;
  left: 8px;
  z-index: 10;
  margin: 4px 0;
  padding: 10px;
  border: 1px solid var(--ai-border);
  border-radius: 8px;
  background: #151a21;
  font-size: 0.85rem;
  text-align: center;
  pointer-events: none;
}

.centrum-ai-access {
  align-self: center;
  justify-self: center;
  width: min(420px, calc(100% - 32px));
  display: grid;
  justify-items: stretch;
  gap: 18px;
  padding: 26px 0;
  text-align: center;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.centrum-ai-access p {
  margin: 0;
}

.centrum-ai-access p {
  color: var(--ai-muted);
  line-height: 1.5;
}

.centrum-ai-spinner {
  width: 38px;
  height: 38px;
  justify-self: center;
  border: 3px solid rgba(255, 255, 255, 0.13);
  border-top-color: var(--ai-accent);
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
}

.centrum-ai-mfa {
  gap: 20px;
  padding: 24px 2px;
}

html.ai-mfa-input-active .centrum-ai-mfa {
  align-self: start;
  gap: 14px;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: 16px;
  scroll-padding-block: 12px;
}

.centrum-ai-mfa__heading {
  display: grid;
  gap: 7px;
}

.centrum-ai-mfa__heading h2,
.centrum-ai-mfa__recovery h2 {
  margin: 0;
  font-size: 1.12rem;
}

.centrum-ai-mfa__form {
  display: grid;
  gap: 10px;
  text-align: left;
}

.centrum-ai-mfa__form label {
  color: var(--ai-muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.centrum-ai-mfa__form input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--ai-border);
  border-radius: 7px;
  outline: 0;
  background: #11161d;
  color: var(--ai-text);
  font-size: 1rem;
}

.centrum-ai-mfa__form input:focus {
  border-color: var(--ai-accent);
  box-shadow: 0 0 0 3px rgba(103, 232, 194, 0.12);
}

.centrum-ai-mfa__form button,
.centrum-ai-mfa__recovery button {
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid rgba(103, 232, 194, 0.38);
  border-radius: 7px;
  background: #16372f;
  color: #eafff8;
  cursor: pointer;
  font-weight: 700;
}

.centrum-ai-mfa__form button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.centrum-ai-mfa__setup {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.centrum-ai-mfa__setup img {
  display: block;
  width: min(280px, 68vw);
  height: auto;
  aspect-ratio: 1;
  border: 8px solid #fff;
  border-radius: 6px;
  background: #fff;
}

.centrum-ai-mfa__manual {
  width: 100%;
  display: grid;
  gap: 6px;
}

.centrum-ai-mfa__manual span {
  color: var(--ai-muted);
  font-size: 0.78rem;
}

.centrum-ai-mfa__manual code {
  overflow-wrap: anywhere;
  color: var(--ai-text);
  font: 600 0.86rem/1.5 "SFMono-Regular", Consolas, monospace;
}

.centrum-ai-mfa__recovery {
  display: grid;
  gap: 12px;
}

.centrum-ai-mfa__recovery-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.centrum-ai-mfa__recovery-codes code {
  color: var(--ai-text);
  font: 650 0.84rem/1.5 "SFMono-Regular", Consolas, monospace;
  white-space: nowrap;
}

.centrum-ai-mfa__message {
  min-height: 1.5em;
  color: #ff9aa3 !important;
  font-size: 0.84rem;
}

.centrum-ai-terminal {
  height: 100%;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.terminal-toolbar {
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 50px;
  border-bottom: 1px solid var(--ai-border);
  background: #0d1117;
}

.terminal-tabs {
  min-width: 0;
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
}

.terminal-automation-warning {
  margin: 0;
  padding: 10px 14px;
  color: #fff;
  background: #a51d2d;
  border-top: 1px solid #ec5767;
  font-size: 13px;
  line-height: 1.45;
}

.terminal-tab {
  min-width: 0;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-right: 1px solid var(--ai-border);
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ai-muted);
  cursor: pointer;
  font-weight: 650;
}

.terminal-tab__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-tab__label--short {
  display: none;
}

.terminal-tab:last-child {
  border-right: 0;
}

.terminal-tab.is-active {
  border-bottom-color: var(--ai-accent);
  background: #12171e;
  color: var(--ai-text);
}

.terminal-tab__dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #6f7782;
}

.terminal-tab[data-state="connecting"] .terminal-tab__dot {
  background: #f7cf68;
}

.terminal-tab[data-state="connected"] .terminal-tab__dot {
  background: #67e8a5;
  box-shadow: 0 0 9px rgba(103, 232, 165, 0.52);
}

.terminal-tab[data-state="error"] .terminal-tab__dot,
.terminal-tab[data-state="closed"] .terminal-tab__dot {
  background: var(--ai-danger);
}

.terminal-stage {
  grid-row: 3;
  min-width: 0;
  min-height: 0;
  position: relative;
  height: 100%;
  overflow: hidden;
  background: var(--ai-bg);
}

.terminal-container {
  position: absolute;
  inset: 0;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  overflow: hidden;
  touch-action: none;
}

/* Keep inactive screens measurable so xterm can fit and receive output before selection. */
.terminal-container.is-inactive {
  visibility: hidden;
  pointer-events: none;
}

.terminal-container .xterm {
  height: 100%;
  min-height: 0;
  padding: 0;
  touch-action: none;
}

.terminal-container .xterm-viewport {
  overscroll-behavior: contain;
  scrollbar-color: #414955 transparent;
  scrollbar-width: thin;
  touch-action: none;
}

/* Mobile only: a plain text field keeps the phone keyboard's dictionary, autocorrect and dictation. */
.terminal-composer {
  grid-row: 4;
  display: none;
}

.terminal-composer__keys {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.terminal-composer__keys button {
  flex: 1 0 32px;
  min-width: max-content;
  min-height: 40px;
  padding: 0 4px;
  border: 1px solid var(--ai-border);
  border-radius: 7px;
  background: #151a21;
  color: var(--ai-text);
  cursor: pointer;
  font: 650 0.85rem/1 "SFMono-Regular", Consolas, monospace;
  touch-action: manipulation;
}

.terminal-composer__keys button[data-key="esc"] {
  color: var(--ai-accent);
}

.terminal-composer__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 6px;
}

.terminal-composer__input {
  width: 100%;
  min-height: 42px;
  max-height: 128px;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid var(--ai-border);
  border-radius: 8px;
  background: var(--ai-bg);
  color: var(--ai-text);
  font-family: inherit;
  /* 16 px keeps iOS from zooming the page when the field gets focus. */
  font-size: 16px;
  line-height: 1.35;
  overflow-y: auto;
  resize: none;
}

.terminal-composer__input:focus {
  border-color: var(--ai-accent);
  outline: none;
}

.terminal-composer__send {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(103, 232, 194, 0.4);
  border-radius: 8px;
  background: #16372f;
  color: #effff9;
  cursor: pointer;
  font-weight: 750;
  touch-action: manipulation;
}

.terminal-composer__keys button:disabled,
.terminal-composer__input:disabled,
.terminal-composer__send:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.terminal-notice {
  grid-row: 2;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(247, 207, 104, 0.28);
  background: rgba(247, 207, 104, 0.08);
  color: #f7d986;
  font-size: 0.84rem;
  text-align: center;
}

.centrum-ai-statusbar {
  min-height: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 0 max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-left));
  background: #0c0f14;
}

.centrum-ai-message {
  min-width: 0;
  margin: 0;
  padding: 6px 4px;
  color: var(--ai-muted);
  font-size: 0.78rem;
  text-align: center;
}

.centrum-ai-message:empty {
  visibility: hidden;
}

.centrum-ai-message[data-type="error"] {
  color: #ff9aa3;
}

.centrum-ai-reconnect {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ai-accent);
  cursor: pointer;
}

.centrum-ai-reconnect .ui-icon {
  width: 19px;
  height: 19px;
}

.upload-dialog {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding:
    max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
}

.upload-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.upload-dialog__panel {
  position: relative;
  width: min(500px, 100%);
  max-height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #10141a;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.upload-dialog__header {
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 18px;
  border-bottom: 1px solid var(--ai-border);
  background: #0c0f14;
}

.upload-dialog__header p,
.upload-dialog__header h2 {
  margin: 0;
}

.upload-dialog__header p {
  margin-bottom: 3px;
  color: var(--ai-accent);
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
}

.upload-dialog__header h2 {
  font-size: 1.08rem;
}

.upload-dialog__close {
  width: 40px;
  height: 40px;
}

.upload-dialog__close:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.upload-dialog__body {
  min-height: 0;
  display: grid;
  gap: 18px;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.upload-targets {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.upload-targets legend {
  margin-bottom: 8px;
  color: var(--ai-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.upload-targets__control {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  overflow: hidden;
  border: 1px solid var(--ai-border);
  border-radius: 7px;
}

.upload-targets__control button {
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  overflow: hidden;
  border: 0;
  border-right: 1px solid var(--ai-border);
  background: #151a21;
  color: var(--ai-muted);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-targets__control button:last-child {
  border-right: 0;
}

.upload-targets__control button.is-active {
  background: #1b342f;
  color: #eafff8;
  box-shadow: inset 0 -2px var(--ai-accent);
}

.upload-file-picker {
  min-height: 132px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 18px;
  overflow: hidden;
  border: 1px dashed rgba(103, 232, 194, 0.42);
  border-radius: 8px;
  background: #121820;
  color: var(--ai-text);
  cursor: pointer;
  text-align: center;
}

.upload-file-picker .ui-icon {
  width: 28px;
  height: 28px;
  color: var(--ai-accent);
}

.upload-file-picker span,
.upload-file-picker small {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.upload-file-picker span {
  font-size: 0.92rem;
  font-weight: 700;
}

.upload-file-picker small {
  color: var(--ai-muted);
  font-size: 0.76rem;
}

.upload-primary-button,
.upload-secondary-button {
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 750;
}

.upload-primary-button {
  border: 1px solid rgba(103, 232, 194, 0.4);
  background: #16372f;
  color: #effff9;
}

.upload-secondary-button {
  border: 1px solid var(--ai-border);
  background: #191e26;
  color: var(--ai-text);
}

.upload-primary-button:disabled,
.upload-secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.upload-progress {
  gap: 14px;
}

.upload-progress__file {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
}

.upload-progress__file strong {
  min-width: 0;
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-progress__file span {
  color: var(--ai-muted);
  font-size: 0.75rem;
}

.upload-progress__track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: #282f39;
}

.upload-progress__track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--ai-accent);
  transition: width 180ms ease;
}

.upload-progress__status {
  min-height: 1.35em;
  margin: -4px 0 0;
  color: #dce3ec;
  font-size: 0.82rem;
  font-weight: 650;
}

.upload-steps {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.upload-steps li {
  position: relative;
  min-width: 0;
  min-height: 49px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 11px;
  padding: 4px 0 8px;
  color: #6f7884;
}

.upload-steps li::after {
  content: "";
  position: absolute;
  top: 21px;
  bottom: -1px;
  left: 7px;
  width: 1px;
  background: #303741;
}

.upload-steps li:last-child::after {
  display: none;
}

.upload-steps li > span {
  z-index: 1;
  width: 15px;
  height: 15px;
  margin-top: 2px;
  border: 2px solid #4b545f;
  border-radius: 50%;
  background: #10141a;
}

.upload-steps li > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.upload-steps strong,
.upload-steps small {
  overflow-wrap: anywhere;
}

.upload-steps strong {
  font-size: 0.82rem;
}

.upload-steps small {
  color: inherit;
  font-size: 0.72rem;
  line-height: 1.35;
}

.upload-steps li.is-active {
  color: #edf1f7;
}

.upload-steps li.is-active > span {
  border-color: #f7cf68;
  background: #f7cf68;
  box-shadow: 0 0 9px rgba(247, 207, 104, 0.4);
}

.upload-steps li.is-complete {
  color: #b9c7c3;
}

.upload-steps li.is-complete > span {
  border-color: var(--ai-accent);
  background: var(--ai-accent);
}

.upload-steps li.is-failed {
  color: #ff9aa3;
}

.upload-steps li.is-failed > span {
  border-color: var(--ai-danger);
  background: var(--ai-danger);
}

.upload-progress__message {
  min-height: 1.4em;
  margin: 0;
  color: #ff9aa3;
  font-size: 0.8rem;
  line-height: 1.4;
}

.upload-progress__message[data-type="success"] {
  color: #8cf0bd;
}

.upload-results {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.upload-results li {
  min-width: 0;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--ai-border);
  border-radius: 6px;
  background: #151a21;
  color: #c8d1dc;
  font-size: 0.76rem;
  line-height: 1.35;
}

.upload-results li::before {
  content: "";
  width: 9px;
  height: 9px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--ai-accent);
}

.upload-results li[data-status="failed"]::before,
.upload-results li[data-status="cancelled"]::before {
  background: var(--ai-danger);
}

.upload-results span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.upload-dialog__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.upload-dialog__actions > button:only-child {
  grid-column: 1 / -1;
}

@keyframes ai-spin {
  to { transform: rotate(360deg); }
}

.ai-notes-dialog {
  position: fixed;
  inset: auto;
  top: calc(var(--ai-viewport-offset-top, 0px) + max(8px, env(safe-area-inset-top)));
  left: calc(var(--ai-viewport-offset-left, 0px) + var(--ai-viewport-width, 100vw) / 2);
  transform: translateX(-50%);
  width: min(620px, calc(var(--ai-viewport-width, 100vw) - 16px));
  max-width: none;
  max-height: calc(var(--ai-viewport-height, 100dvh) - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
  margin: 0;
  padding: 0;
  border: 1px solid var(--ai-border);
  border-radius: 10px;
  background: var(--ai-panel);
  color: var(--ai-text);
  overflow: hidden;
}

.ai-notes-dialog[open] { display: flex; flex-direction: column; }
.ai-notes-dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
.ai-notes-dialog .upload-dialog__header { flex-shrink: 0; }
.ai-notes-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px; }
.ai-notes-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ai-notes-dialog .upload-primary-button, .ai-notes-dialog .upload-secondary-button {
  min-height: 30px; padding: 5px 8px; border-radius: 6px; font-size: 12px; line-height: 18px; white-space: nowrap;
}
.ai-notes-dialog .centrum-ai-icon-button { width: 30px; height: 30px; min-width: 30px; min-height: 30px; padding: 4px; }
.ai-notes-form { display: grid; gap: 10px; margin-top: 18px; }
.ai-notes-form h3 { margin: 0; font-size: 18px; }
.ai-notes-form select, .ai-notes-form textarea {
  width: 100%; min-width: 0; padding: 12px; border: 1px solid var(--ai-border);
  border-radius: 7px; background: var(--ai-bg); color: var(--ai-text); font: inherit; font-size: 16px;
}
.ai-notes-form textarea { resize: vertical; min-height: 100px; }
.ai-notes-message { color: var(--ai-muted); overflow-wrap: anywhere; }
.ai-notes-list { display: grid; gap: 10px; padding: 0; list-style: none; }
.ai-notes-list li { min-width: 0; padding: 10px; border: 1px solid var(--ai-border); border-radius: 8px; }
.ai-notes-list strong { color: var(--ai-accent); }
.ai-notes-list p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.ai-notes-list small { display: block; color: var(--ai-muted); margin-bottom: 12px; }

/* Six tabs: full names need about 180 px each, so below 1100 px the short names (Plan, W1–W3, A1, A2) are shown. */
@media (max-width: 1099px) {
  .terminal-tab.has-short-label .terminal-tab__label--full {
    display: none;
  }

  .terminal-tab__label--short {
    display: inline;
  }
}

@media (max-width: 600px) {
  /* Six tabs share a phone row: the status dot moves to the corner to leave the width to the name. */
  .terminal-tab {
    position: relative;
    padding: 0 4px;
    font-size: 0.8rem;
  }

  .terminal-tab__dot {
    position: absolute;
    top: 7px;
    right: 6px;
    width: 6px;
    height: 6px;
  }

  .terminal-composer {
    display: grid;
    gap: 6px;
    padding: 6px max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--ai-border);
    background: #0d1117;
  }

  /* The composer sits below the terminal; the status bar already keeps the bottom inset. */
  .terminal-container {
    padding-bottom: 10px;
  }

  .upload-targets__control button {
    padding-inline: 4px;
    font-size: 0.75rem;
  }
}

@media (max-width: 360px) {
  .centrum-ai-header {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 6px;
    padding-inline: max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-right));
  }

  .centrum-ai-header__actions {
    gap: 4px;
  }

  .centrum-ai-header h1 {
    font-size: 0.9rem;
  }

  .terminal-container {
    padding-inline: 6px;
  }

  .centrum-ai-access {
    width: calc(100% - 24px);
  }

  .centrum-ai-mfa__recovery-codes {
    grid-template-columns: 1fr;
  }

  .upload-dialog {
    padding-inline: max(6px, env(safe-area-inset-left));
  }

  .upload-dialog__body {
    gap: 14px;
    padding: 16px 14px;
  }

  .upload-dialog__header {
    min-height: 62px;
    padding-left: 14px;
  }

  .upload-file-picker {
    min-height: 112px;
  }

  .upload-steps li {
    min-height: 46px;
  }
}

@media (min-width: 900px) {
  .centrum-ai-header {
    min-height: 64px;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    padding-inline: 18px;
  }

  .terminal-toolbar {
    width: 100%;
  }

  .terminal-container {
    padding: 14px 18px 18px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .centrum-ai-icon-button:hover,
  .terminal-tab:hover,
  .upload-targets__control button:hover,
  .upload-file-picker:hover,
  .upload-primary-button:hover,
  .upload-secondary-button:hover {
    filter: brightness(1.14);
  }
}

@media (prefers-reduced-motion: reduce) {
  .centrum-ai-spinner {
    animation-duration: 1.8s;
  }

  .upload-progress__track span {
    transition: none;
  }
}

.ai-notes-help { color: var(--ai-muted); font-size: 13px; line-height: 1.45; }
.ai-notes-photos { margin: 8px 0; }
.ai-notes-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; margin-bottom: 8px; }
.ai-notes-gallery:empty { display: none; }
.ai-notes-gallery figure { min-width: 0; margin: 0; max-width: 130px; }
.ai-notes-gallery a { display: block; border-radius: 7px; overflow: hidden; background: #e8edf1; }
.ai-notes-gallery img { display: block; width: 100%; height: 88px; object-fit: contain; border-radius: 6px; }
.ai-notes-gallery button { margin-top: 4px; width: 100%; }
.ai-notes-draft-gallery:not(:empty) { margin-top: 8px; }

/* Login page of the standalone app (bookloft-centrum-ai 1.0.0). */
.centrum-ai-login {
  display: grid;
  place-items: center;
}

.centrum-ai-login__icon {
  justify-self: center;
  border-radius: 18px;
}
