html {
  font-size: 15px;
}

body {
  margin: 0;
  color: #1c2430;
  background:
    radial-gradient(circle at top left, rgba(47, 109, 156, 0.12), transparent 40%),
    linear-gradient(180deg, #f4f7fb 0%, #eef2f6 100%);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

.app-brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: #16324f;
  letter-spacing: 0.02em;
}

.page-hero {
  margin-bottom: 1.5rem;
}

.page-hero .kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: #4d657d;
  margin-bottom: 0.35rem;
}

.page-hero h1 {
  font-size: clamp(1.6rem, 2vw + 1rem, 2.2rem);
  margin-bottom: 0.5rem;
}

.page-hero .lede {
  max-width: 46rem;
  color: #445566;
}

.entry-form,
.draft-card,
.saved-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #d5dee8;
  border-radius: 0.5rem;
  padding: 1rem;
}

.password-field {
  position: relative;
}

.password-field__input {
  padding-right: 2.5rem;
}

.password-field__toggle {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #5a6b7d;
  padding: 0.25rem;
  line-height: 1;
}

.auth-shell {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

.auth-panel {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #d5dee8;
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.auth-form {
  display: grid;
  gap: 0.9rem;
}

.auth-heading .auth-kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: #4d657d;
}

.plan-body-shell {
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  background: #fff;
}

.plan-body-shell:focus-within {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.plan-body-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.5rem;
  background: #f8f9fa;
  border-bottom: 1px solid #ced4da;
}

.plan-body-toolbar__sep {
  width: 1px;
  height: 1.25rem;
  margin: 0 0.15rem;
  background: #ced4da;
}

.plan-body-toolbar__btn {
  min-width: 2rem;
  padding: 0.15rem 0.45rem;
  line-height: 1.2;
}

.plan-body-editor {
  min-height: 18rem;
  max-height: 32rem;
  overflow-y: auto;
  padding: 0.375rem 0.75rem;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  line-height: 1.5;
  border: 0;
  border-radius: 0;
  outline: 0;
  box-shadow: none;
}

.plan-body-editor:empty::before {
  content: attr(data-placeholder);
  color: #6c757d;
  pointer-events: none;
}

.plan-body-editor h1,
.plan-body-editor h2,
.plan-body-editor h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
}

.plan-body-editor h1 {
  font-size: 1.25rem;
}

.plan-body-editor ul,
.plan-body-editor ol {
  margin-bottom: 0.5rem;
  padding-left: 1.5rem;
}

.plan-body-editor ul ul,
.plan-body-editor ol ol,
.plan-body-editor ul ol,
.plan-body-editor ol ul {
  margin-top: 0.25rem;
  margin-bottom: 0;
}

.plan-body-editor p {
  margin-bottom: 0.5rem;
}

.auth-switch {
  margin-top: 1rem;
  margin-bottom: 0;
}

.saved-card--saved {
  border-color: #2e7d4f;
  box-shadow: 0 0 0 2px rgba(46, 125, 79, 0.25);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.plan-editor-actions .btn {
  flex-shrink: 0;
}

.plan-document-shell {
  border: 1px solid #c8c8c8;
  border-radius: 0.375rem;
  background: #fff;
  overflow: hidden;
}

.plan-toolbar {
  border: 1px solid #c8c8c8;
  border-radius: 0.375rem;
  background: #fff;
  padding: 0.85rem 1rem 1rem;
  margin-bottom: 1rem;
}

.plan-toolbar__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e8e8e8;
}

.plan-toolbar__current {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.plan-toolbar__label {
  color: #6c757d;
  font-size: 0.875rem;
}

.plan-toolbar__name {
  font-size: 1.05rem;
}

.plan-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.plan-toolbar__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem 1.5rem;
}

.plan-toolbar__group {
  min-width: 0;
}

.plan-toolbar__controls {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.plan-toolbar__controls .form-select,
.plan-toolbar__controls .form-control {
  flex: 1 1 auto;
  min-width: 0;
}

.plan-toolbar__controls .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.plan-toolbar__hint {
  margin-top: 0.65rem;
}

.plan-menu-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.25rem 0.75rem;
  background: linear-gradient(180deg, #f6f6f6 0%, #ececec 100%);
  border-bottom: 1px solid #c8c8c8;
  min-height: 2.25rem;
}

.plan-menu-bar__menu {
  border: 1px solid transparent;
  background: transparent;
  color: #1f1f1f;
  font-weight: 600;
  padding: 0.15rem 0.65rem;
  border-radius: 0.2rem;
}

.plan-menu-bar__menu:hover,
.plan-menu-bar__menu:focus,
.plan-menu-bar__menu.show {
  border-color: #b8b8b8;
  background: #e4e4e4;
}

.plan-menu-bar__dropdown {
  min-width: 11rem;
  border-radius: 0.25rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.plan-menu-bar__dropdown .dropdown-item {
  font-size: 0.95rem;
  padding: 0.4rem 1rem;
}

.plan-menu-bar__title {
  flex: 1 1 auto;
  font-weight: 600;
  color: #1f1f1f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-menu-bar__actions {
  margin-left: auto;
}

.plan-open-workspace__form,
.plan-empty-workspace {
  padding: 0.85rem 1rem 1rem;
}

.plan-empty-workspace {
  min-height: 10rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #4a4a4a;
  background: #fafafa;
}

.plan-open-workspace__status {
  min-height: 1.5rem;
  margin-bottom: 0.5rem;
}

.plan-dialog__dirty {
  padding: 0.65rem 0.75rem;
  border-radius: 0.375rem;
  background: #fff8e6;
  border: 1px solid #f0df9a;
}

.plan-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.plan-entry-hero__headline {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.5rem 2rem;
  align-items: start;
}

.plan-entry-hero__headline h1 {
  margin-bottom: 0;
  white-space: nowrap;
}

.plan-entry-hero__lede {
  max-width: none;
  margin-bottom: 0;
}

#plan-element-entry #status-alerts {
  block-size: 3.25rem;
  flex-shrink: 0;
}

#plan-element-entry #status-alerts .status-alerts-stack {
  block-size: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  overflow-y: auto;
}

#plan-element-entry #status-alerts .alert {
  margin: 0;
}

.plan-entry-llm-bar {
  margin-bottom: 1rem;
}

.plan-entry-llm-bar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  background: var(--bs-tertiary-bg, #f8f9fa);
}

.plan-entry-llm-bar__label {
  margin-bottom: 0;
  font-weight: 600;
  white-space: nowrap;
}

.plan-entry-llm-bar__select {
  width: auto;
  min-width: 14rem;
  max-width: 100%;
}

.plan-entry-llm-bar__hint {
  margin-bottom: 0;
  color: var(--bs-secondary-color);
}

.plan-entry-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 1.25rem;
  align-items: start;
}

.plan-entry-workspace__main,
.plan-entry-workspace__llm {
  min-width: 0;
}

.plan-entry-workspace__llm {
  position: sticky;
  top: 1rem;
}

.plan-editor-panel,
.llm-output-panel {
  height: 100%;
  margin-bottom: 0;
}

.plan-editor-panel .plan-body-shell {
  flex: 1;
}

.plan-editor-panel .plan-body-editor {
  min-height: 22rem;
}

.llm-output-panel {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.llm-prompt-panel {
  padding: 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  background: #fff;
}

.llm-exchange-empty {
  padding: 1rem;
}

.llm-prompt-panel__header {
  margin-bottom: 0.75rem;
}

.llm-prompt-panel__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  background: var(--bs-tertiary-bg, #f8f9fa);
}

.llm-prompt-panel__meta > div {
  min-width: 8rem;
}

.llm-prompt-panel__meta dt {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--bs-secondary-color);
}

.llm-prompt-panel__meta dd {
  margin: 0;
  font-weight: 600;
}

.llm-prompt-panel__section {
  margin-bottom: 0.65rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  background: #fff;
}

.llm-prompt-panel__section > summary {
  cursor: pointer;
  padding: 0.55rem 0.75rem;
  font-weight: 600;
}

.llm-prompt-panel__section-body {
  padding: 0 0.75rem 0.75rem;
}

.llm-prompt-panel__text {
  font-size: 0.85rem;
  line-height: 1.45;
  resize: vertical;
  min-height: 6rem;
}

.llm-prompt-panel__text--mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}

.llm-output-placeholder {
  flex: 1;
  min-height: 22rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem;
  border: 1px solid #1c2430;
  background: #fff;
  color: #445566;
  font-size: 1rem;
  text-align: center;
}

.llm-output-form {
  padding: 1rem;
  overflow-y: auto;
  max-height: calc(100vh - 10rem);
}

.llm-output-form .draft-card {
  padding: 0.75rem;
}

.draft-type-heading {
  margin: 0 0 0.35rem;
  font-weight: 600;
}

.draft-unstated {
  color: var(--bs-secondary-color, #6c757d);
  font-style: italic;
  padding: 0.25rem 0 0.5rem;
}

.draft-inferred-note {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--bs-secondary-color, #6c757d);
}

@media (max-width: 991.98px) {
  .plan-workspace {
    grid-template-columns: 1fr;
  }

  .plan-entry-hero__headline {
    grid-template-columns: 1fr;
  }

  .plan-entry-hero__headline h1 {
    white-space: normal;
  }

  .plan-entry-workspace {
    grid-template-columns: 1fr;
  }

  .plan-entry-workspace__llm {
    position: static;
  }

  .llm-output-placeholder {
    min-height: 14rem;
  }

  .llm-output-form {
    max-height: none;
  }

  .llm-prompt-panel {
    max-height: none;
  }
}

.btn--loading {
  position: relative;
  pointer-events: none;
  opacity: 0.75;
}

.btn--loading::after {
  content: "";
  position: absolute;
  right: 0.6em;
  top: 50%;
  width: 0.85em;
  height: 0.85em;
  margin: 0;
  display: block;
  transform: translateY(-50%);
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

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

.ajax-region-updating {
  opacity: 0.85;
  transition: opacity 0.15s ease;
}
