/* PJTA theme — inspired by C2L Journey (dark header, light content, accent CTA). */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --pjta-font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --pjta-header-bg: #0a0a0a;
  --pjta-header-border: rgba(255, 255, 255, 0.1);
  --pjta-nav-bg: #111111;
  --pjta-footer-bg: #111111;
  --pjta-cta: #f97316;
  --pjta-cta-hover: #ea580c;
  --pjta-cta-muted: rgba(249, 115, 22, 0.12);
  --pjta-page-bg: #f7f7f8;
  --pjta-elevated: #ffffff;
  --pjta-border: #e8e8ea;
  --pjta-text: #2a2a2d;
  --pjta-text-secondary: #696a6d;
  --pjta-link-on-dark: rgba(255, 255, 255, 0.75);
  --pjta-link-on-dark-hover: #ffffff;
  --pjta-radius: 12px;
  --pjta-radius-sm: 8px;
  --pjta-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  font-family: var(--pjta-font);
  font-size: 14px;
  color: var(--pjta-text);
  background: var(--pjta-page-bg);
  line-height: 1.5;
}

/* ----- App shell (index.html) ----- */
.pjta-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.pjta-app {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Top bar — matches C2L sticky dark header */
.shell-bar {
  background: var(--pjta-header-bg);
  color: #fff;
  padding: 0.65rem 1.5rem;
  min-height: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--pjta-header-border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.shell-bar a {
  color: var(--pjta-link-on-dark);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.shell-bar a:hover {
  color: var(--pjta-link-on-dark-hover);
  text-decoration: underline;
}

.shell-bar__title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  letter-spacing: 0.01em;
}

.pjta-brand {
  font-size: calc(1.125rem * 1.3);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pjta-brand__mark {
  color: var(--pjta-cta);
}

.pjta-brand__name {
  color: #fff;
}

/* Sidebar */
.pjta-nav {
  width: 220px;
  flex-shrink: 0;
  background: var(--pjta-nav-bg);
  color: rgba(255, 255, 255, 0.92);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--pjta-header-border);
}

.pjta-nav__brand {
  padding: 0.85rem 1rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid var(--pjta-header-border);
}

.pjta-nav__hint {
  padding: 0.5rem 1rem 0.85rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.4;
  border-bottom: 1px solid var(--pjta-header-border);
}

.pjta-nav__links {
  padding: 0.5rem 0;
  flex: 1;
  overflow-y: auto;
}

.pjta-nav__link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.7rem 1rem;
  border: none;
  background: transparent;
  color: var(--pjta-link-on-dark);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border-left: 3px solid transparent;
}

.pjta-nav__link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.pjta-nav__link.is-active {
  background: rgba(249, 115, 22, 0.12);
  border-left-color: var(--pjta-cta);
  color: #fff;
  font-weight: 600;
}

.pjta-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--pjta-page-bg);
}

.pjta-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--pjta-page-bg);
  display: block;
}

.pjta-shell-footer {
  flex-shrink: 0;
  background: var(--pjta-footer-bg);
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.75rem;
  padding: 0.5rem 1.5rem;
  text-align: center;
  border-top: 1px solid var(--pjta-header-border);
}

/* ----- Page layout (inner pages) ----- */
.page-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 2.5rem;
}

.page-content--wide {
  max-width: 1200px;
}

.page-content--narrow {
  max-width: 720px;
}

/* Hero block — left accent bar like Journey page-h1 area */
.pjta-hero {
  border-left: 4px solid var(--pjta-cta);
  padding-left: 1.25rem;
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem 0;
  color: var(--pjta-text);
}

.page-subtitle {
  color: var(--pjta-text-secondary);
  margin: 0 0 1rem 0;
  font-size: 0.9375rem;
  max-width: 52rem;
}

.pjta-lead {
  font-size: 1rem;
  color: var(--pjta-text-secondary);
  margin: 0;
  max-width: 48rem;
}

/* Cards */
.card {
  background: var(--pjta-elevated);
  border-radius: var(--pjta-radius);
  border: 1px solid var(--pjta-border);
  box-shadow: var(--pjta-shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.card__title {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.65rem;
  border-bottom: 2px solid var(--pjta-cta);
  color: var(--pjta-text);
}

.meta-row {
  margin: 0.35rem 0;
}

.meta-row strong {
  color: var(--pjta-cta);
  min-width: 8rem;
  display: inline-block;
  font-weight: 600;
}

.project-context {
  margin: 0;
  padding: 0.85rem 1rem;
  background: #fafafa;
  border: 1px solid var(--pjta-border);
  border-radius: var(--pjta-radius-sm);
  font-size: 0.875rem;
  word-break: break-word;
  max-height: 360px;
  overflow: auto;
}

.project-context :first-child {
  margin-top: 0;
}

.project-context :last-child {
  margin-bottom: 0;
}

.project-context h1 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0.75rem 0 0.35rem;
  color: var(--pjta-text);
}

.project-context h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0.65rem 0 0.3rem;
  color: var(--pjta-text);
}

.project-context h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0.5rem 0 0.25rem;
}

.project-context p {
  margin: 0.35rem 0;
}

.project-context ul,
.project-context ol {
  margin: 0.35rem 0;
  padding-left: 1.35rem;
}

.project-context li {
  margin: 0.15rem 0;
}

.project-context code {
  font-size: 0.8125rem;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

.project-context pre {
  font-size: 0.8125rem;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.5rem;
  border-radius: var(--pjta-radius-sm);
  overflow-x: auto;
  white-space: pre-wrap;
}

.project-context pre code {
  background: none;
  padding: 0;
}

.project-context strong {
  color: var(--pjta-cta-hover);
}

.project-context em {
  color: var(--pjta-text-secondary);
  font-size: 0.8125rem;
}

.err {
  color: #dc2626;
  font-size: 0.875rem;
}

/* Buttons */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--pjta-radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn--primary {
  background: var(--pjta-cta);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--pjta-cta-hover);
}

.btn--primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--secondary {
  background: #ececee;
  color: var(--pjta-text);
  border: 1px solid var(--pjta-border);
}

.btn--secondary:hover:not(:disabled) {
  background: #e0e0e4;
}

.btn--secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Upload table */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

input[type="file"] {
  display: none;
}

.file-table-wrap {
  overflow: auto;
  border: 1px solid var(--pjta-border);
  border-radius: var(--pjta-radius-sm);
  max-height: 420px;
}

table.file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.file-table th,
.file-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--pjta-border);
}

.file-table th {
  background: #f4f4f6;
  font-weight: 600;
  position: sticky;
  top: 0;
}

.file-table tr:last-child td {
  border-bottom: none;
}

.status-new {
  color: var(--pjta-text-secondary);
}

.status-busy {
  color: var(--pjta-cta-hover);
  font-style: italic;
}

.status-done {
  color: #15803d;
  font-weight: 600;
}

.status-err {
  color: #dc2626;
}

/* Conversation */
.shell-bar__left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.page-head .page-title {
  margin: 0;
  flex: 1;
  min-width: 10rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.conversation-list {
  min-height: 200px;
  max-height: 50vh;
  overflow-y: auto;
}

.turn {
  margin-bottom: 1rem;
}

.turn__label {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--pjta-cta-hover);
  margin-bottom: 0.25rem;
}

.turn__content {
  padding: 0.75rem;
  border-radius: var(--pjta-radius-sm);
  background: #fafafa;
  border-left: 3px solid var(--pjta-cta);
}

.turn--user .turn__content {
  background: var(--pjta-cta-muted);
  border-left-color: var(--pjta-cta-hover);
}

.turn__content p {
  margin: 0 0 0.5rem 0;
}

.turn__content p:last-child {
  margin-bottom: 0;
}

.turn__content ul,
.turn__content ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.turn__content pre,
.turn__content code {
  font-size: 0.8125rem;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.125rem 0.25rem;
  border-radius: 4px;
}

.turn__content pre {
  padding: 0.5rem;
  overflow-x: auto;
}

.turn__content table {
  border-collapse: collapse;
  width: 100%;
}

.turn__content th,
.turn__content td {
  padding: 0.25rem 0.4rem;
  vertical-align: top;
}

.turn__content th {
  text-align: left;
  border-bottom: 1px solid var(--pjta-border);
}

.turn__content td:first-child,
.turn__content th:first-child {
  white-space: nowrap;
}

/* References panel: keep original SAP-like grays and blue links (not theme CTA orange). */
.references-panel {
  min-height: 200px;
  max-height: 50vh;
  overflow-y: auto;
  font-size: 0.75rem;
  color: #6a6d70;
}

.references-panel__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.references-panel__item {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--pjta-border);
  word-break: break-word;
}

.references-panel__item:last-child {
  border-bottom: none;
}

.references-panel__link {
  color: #0a6ed1;
  text-decoration: none;
  cursor: pointer;
}

.references-panel__link:hover {
  text-decoration: underline;
  color: #0854a0;
}

.references-panel__empty {
  color: #6a6d70;
  font-style: italic;
}

.doc-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.doc-modal-overlay.is-open {
  display: flex;
}

.doc-modal {
  background: var(--pjta-elevated);
  border-radius: var(--pjta-radius);
  border: 1px solid var(--pjta-border);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
  max-width: 700px;
  max-height: 85vh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.doc-modal__header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--pjta-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.doc-modal__title {
  font-weight: 600;
  font-size: 0.9375rem;
  word-break: break-word;
  margin: 0;
}

.doc-modal__close {
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--pjta-text-secondary);
  border: none;
  background: none;
}

.doc-modal__close:hover {
  color: var(--pjta-text);
}

.doc-modal__body {
  padding: 1rem 1.25rem;
  overflow: auto;
  font-size: 0.8125rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.ask-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.ask-row input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--pjta-border);
  border-radius: var(--pjta-radius-sm);
  font-family: inherit;
  font-size: 1rem;
  background: #fff;
}

.ask-row input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.loading {
  color: var(--pjta-text-secondary);
  font-style: italic;
}

/* Support / FAQ */
.faq-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.faq-item {
  background: var(--pjta-elevated);
  border-radius: var(--pjta-radius);
  border: 1px solid var(--pjta-border);
  box-shadow: var(--pjta-shadow);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}

.faq-item__q {
  font-weight: 600;
  color: var(--pjta-cta-hover);
  margin: 0 0 0.35rem 0;
  font-size: 0.9375rem;
}

.faq-item__a {
  margin: 0;
  font-size: 0.875rem;
  color: var(--pjta-text);
}

.contact {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--pjta-cta);
  font-size: 0.9375rem;
}

.contact a {
  color: var(--pjta-cta);
  font-weight: 600;
}

.contact a:hover {
  color: var(--pjta-cta-hover);
}

@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .pjta-app {
    flex-direction: column;
    min-height: 0;
  }

  .pjta-nav {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    max-height: none;
  }

  .pjta-nav__brand {
    border-bottom: none;
    flex: 1;
    min-width: 120px;
  }

  .pjta-nav__hint {
    display: none;
  }

  .pjta-nav__links {
    display: flex;
    flex: 1 1 100%;
    padding: 0.25rem 0;
    gap: 0.25rem;
  }

  .pjta-nav__link {
    flex: 1;
    text-align: center;
    border-left: none;
    border-bottom: 3px solid transparent;
    padding: 0.5rem;
  }

  .pjta-nav__link.is-active {
    border-left: none;
    border-bottom-color: var(--pjta-cta);
  }
}
