/* Support Portal — Bytes & Books brand theme.

   Canonical brand palette (the named color card):
     Inkwell        #2C3639   Lunar Eclipse  #3F4E4F
     Crème Brûlée   #A27B5B   Au Lait        #DCD7C9
   plus Foreground #111A19 for text. Every semantic token below is anchored to
   these — surfaces, borders, and muted text are the only derived tints, and
   they are tints OF the palette. Type: League Spartan. Light-only, on an
   Inkwell page ground: default text is Au Lait (light), and the light card
   surfaces re-assert Foreground (dark) text — see the ground section at the
   end of this file. */

:root {
  /* --- brand palette (single source of truth) --- */
  --inkwell: #2C3639;
  --lunar-eclipse: #3F4E4F;
  --creme-brulee: #A27B5B;
  --au-lait: #DCD7C9;
  --foreground: #111A19;

  /* --- semantic tokens, anchored to the palette --- */
  --bg: var(--au-lait);
  --surface: #EFEBE1;   /* Au Lait, lifted for cards */
  --border: #C2B6A2;    /* Au Lait, deepened for edges */
  --text: var(--foreground);
  --muted: #52584F;     /* Lunar Eclipse, softened for secondary text */
  /* Buttons follow the homepage CTA: Lunar Eclipse fill, Au Lait text, Crème Brûlée hover. */
  --btn-bg: var(--lunar-eclipse);
  --btn-fg: var(--au-lait);
  --btn-hover-bg: var(--creme-brulee);
  --btn-hover-fg: var(--foreground);
  --link: #75513A;      /* Crème Brûlée, darkened for legible links */
  --bronze: var(--creme-brulee);
  --highlight-bg: #CEC3AC;   /* Au Lait / Crème Brûlée blend */
  --highlight-fg: var(--inkwell);
  --topbar-bg: var(--inkwell);
  --topbar-fg: var(--au-lait);
  --topbar-muted: #A8B0A8;
  --danger: #A2402F;
  --status-new-bg: #DCE3EC;   --status-new-fg: #33517B;
  --status-prog-bg: #E9DFC8;  --status-prog-fg: #6E5414;
  --status-done-bg: #D9E4D6;  --status-done-fg: #33603A;
  --status-warn-bg: #F0DBC4;  --status-warn-fg: #8A4F17;
  --status-bad-bg: #EDD5D0;   --status-bad-fg: #8E3325;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 12px 28px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'League Spartan', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--inkwell);
  color: var(--au-lait);
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 0.25rem; text-wrap: balance; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.error { color: var(--danger); }

button, .button {
  font: inherit;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.primary, .button.primary {
  background: var(--btn-bg);
  border-color: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
}
button.primary:hover:not(:disabled), .button.primary:hover {
  background: var(--btn-hover-bg);
  border-color: var(--btn-hover-bg);
  color: var(--btn-hover-fg);
}
button:disabled { opacity: 0.6; cursor: default; }
button.link { border: 0; background: none; color: var(--link); padding: 0; font-weight: 500; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--bronze);
  outline-offset: 2px;
}

input, textarea, select {
  font: inherit;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
input:focus, textarea:focus, select:focus { border-color: var(--bronze); }
label { display: block; font-weight: 600; font-size: 0.85rem; margin: 0.9rem 0 0.3rem; }

/* ----- login ----- */
.center { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
.login-card { width: min(24rem, 100%); }
.login-card button.primary { width: 100%; margin-top: 1rem; }
.login-alt { margin-top: 0.75rem; text-align: center; }
.login-alt button.link { color: var(--link); font-size: 0.9rem; }
.form-msg { min-height: 1.2em; font-size: 0.9rem; color: var(--muted); }

/* ----- shell ----- */
.layout { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.7rem 1.25rem;
  background: var(--topbar-bg);
  color: var(--topbar-fg);
  border-bottom: 2px solid var(--bronze);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 0.6rem; }
.brand-name { font-weight: 700; letter-spacing: 0.01em; }
.org-name { color: var(--topbar-muted); font-size: 0.9rem; }
.project-nav { display: flex; gap: 0.25rem; flex: 1; }
.project-nav a {
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  color: var(--topbar-fg);
  font-weight: 500;
}
.project-nav a:hover { text-decoration: none; background: rgba(162, 123, 91, 0.25); }
.project-nav a.active { background: var(--bronze); color: #16110B; }
.user-menu { display: flex; align-items: center; gap: 0.75rem; }
.user-menu .muted { color: var(--topbar-muted); }
.user-menu .user-account { color: var(--topbar-fg); font-weight: 500; }
.user-menu .user-account:hover { text-decoration: underline; }
.user-menu button.link { color: var(--bronze); }
.content { width: min(52rem, 100%); margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }

/* ----- issue list ----- */
.toolbar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chips { display: flex; gap: 0.25rem; }
.chip {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
}
.chip:hover { text-decoration: none; border-color: var(--bronze); }
.chip-active { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-fg); }
.search { flex: 1; min-width: 10rem; }
.issue-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.issue-row {
  display: grid;
  grid-template-columns: 6rem 1fr auto 6.5rem;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.issue-row:last-child { border-bottom: 0; }
.issue-row:hover { background: var(--highlight-bg); text-decoration: none; }
.issue-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; color: var(--muted); }
.issue-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date { font-size: 0.85rem; text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 3rem 0; }
.pager { display: flex; justify-content: space-between; margin-top: 1rem; }

.pill {
  padding: 0.18rem 0.6rem 0.12rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
/* Portal statuses, colored by lane semantics. pill-new / pill-indeterminate /
   pill-done remain for the admin UI (user + connection states). */
.pill-new, .pill-todo { background: var(--status-new-bg); color: var(--status-new-fg); }
.pill-indeterminate, .pill-in_progress, .pill-bb_testing, .pill-approved {
  background: var(--status-prog-bg); color: var(--status-prog-fg);
}
.pill-done, .pill-confirmed { background: var(--status-done-bg); color: var(--status-done-fg); }
.pill-org_requirements, .pill-org_testing, .pill-deployed { background: var(--status-warn-bg); color: var(--status-warn-fg); }
.pill-rejected { background: var(--status-bad-bg); color: var(--status-bad-fg); }

.tag {
  margin-left: 0.5rem;
  padding: 0.08rem 0.45rem 0.02rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--highlight-bg);
  color: var(--highlight-fg);
  vertical-align: middle;
}

/* ----- swim lanes (board) ----- */
.content.board { width: min(80rem, 100%); }
.toolbar select { width: auto; min-width: 11rem; }
.lanes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: start;
}
.lane {
  background: var(--creme-brulee);
  /* Borderless: match the lane's own fill so no edge shows. */
  border: 1px solid var(--creme-brulee);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.lane-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.lane-head h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--au-lait); }
.lane-count {
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--highlight-bg);
  color: var(--highlight-fg);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
}
.lane-cards { display: flex; flex-direction: column; gap: 0.5rem; }
.lane-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.6rem 0.7rem;
  /* Borderless at rest: match the card's own fill so no edge shows; the hover
     rule flips the border to bronze for the affordance. */
  border: 1px solid var(--bg);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}
.lane-card:hover { text-decoration: none; border-color: var(--bronze); }
.lane-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.lane-card-summary { font-size: 0.92rem; overflow-wrap: break-word; }
.lane-card .date { font-size: 0.78rem; }
.lane-empty { text-align: center; padding: 1rem 0; margin: 0; }
.lane-more { font-size: 0.85rem; text-align: center; padding-top: 0.25rem; }

@media (max-width: 1000px) { .lanes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .lanes { grid-template-columns: 1fr; } }

/* ----- epic dropdown + lane window ----- */
.toolbar select { max-width: 18rem; }
.lane-window { font-size: 0.72rem; text-transform: none; letter-spacing: 0; }
button.lane-more { align-self: center; }

/* ----- docs (Confluence) ----- */
.doc-layout { display: flex; gap: 1.25rem; align-items: flex-start; }
.doc-rail {
  width: 16rem;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.75rem;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}
.doc-rail h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.5rem; }
.doc-tree, .doc-tree ul { list-style: none; margin: 0; padding: 0; }
.doc-tree ul { padding-left: 0.85rem; }
.doc-link { display: block; padding: 0.3rem 0.5rem; border-radius: 6px; color: var(--text); font-size: 0.92rem; }
.doc-link:hover { text-decoration: none; background: var(--highlight-bg); }
.doc-active { background: var(--highlight-bg); border-left: 2px solid var(--bronze); font-weight: 600; }
.doc-main {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.75rem;
}
.doc-body { max-width: 65ch; }
.doc-body .adf-p { margin: 0 0 0.9rem; }
.doc-body h2, .doc-body h3, .doc-body h4 { margin: 1.4rem 0 0.5rem; }
.doc-body ul, .doc-body ol { padding-left: 1.4rem; margin: 0 0 0.9rem; }
.doc-body blockquote { border-left: 3px solid var(--border); margin: 0 0 0.9rem; padding: 0.1rem 1rem; color: var(--muted); }
.adf-code { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; overflow-x: auto; }
.adf-panel { border: 1px solid var(--border); border-left: 3px solid var(--bronze); border-radius: 0 var(--radius) var(--radius) 0; padding: 0.6rem 1rem; margin: 0 0 0.9rem; background: var(--bg); }
.adf-panel-warning { border-left-color: var(--status-warn-fg); }
.adf-panel-error { border-left-color: var(--danger); }
.adf-panel-success { border-left-color: var(--status-done-fg); }
.adf-table-wrap { overflow-x: auto; margin: 0 0 0.9rem; }
.adf-table { border-collapse: collapse; width: 100%; }
.adf-table th, .adf-table td { border: 1px solid var(--border); padding: 0.4rem 0.6rem; text-align: left; }
.adf-table th { background: var(--bg); font-weight: 600; }
.adf-tasks { list-style: none; padding-left: 0; }
.adf-task { display: flex; align-items: baseline; gap: 0.5rem; }
.adf-placeholder { font-style: italic; }
.adf-expand { margin: 0 0 0.9rem; }

@media (max-width: 800px) {
  .doc-layout { flex-direction: column; }
  .doc-rail { width: 100%; position: static; max-height: none; }
}

/* ----- admin status-mapping editor ----- */
.status-editor {
  margin: 0.25rem 0 0.75rem 1rem;
  padding: 0.5rem 0.9rem 0.75rem;
  border-left: 3px solid var(--bronze);
  background: var(--bg);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.status-map-row select { width: auto; min-width: 14rem; }
.status-map-row > :first-child { min-width: 12rem; }

/* ----- issue detail ----- */
.back { display: inline-block; margin-bottom: 1rem; font-size: 0.9rem; }
.detail-head { margin-bottom: 1rem; }
.detail-meta { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.description {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  max-width: 65ch;
}
/* ----- subtasks (collapsible, on the parent task's detail) ----- */
.subtasks { margin-top: 1.5rem; }
.subtasks summary {
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.25rem 0;
  list-style-position: inside;
}
.subtasks summary:hover { color: var(--link); }
.subtasks .issue-list { margin-top: 0.5rem; }
.issue-row-static { cursor: default; }
.issue-row-static:hover { background: transparent; }

.comments { margin-top: 2rem; display: flex; flex-direction: column; gap: 0.75rem; }
.comment {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}
.comment-jira_agent { border-left: 3px solid var(--bronze); }
.comment header { display: flex; align-items: baseline; gap: 0.6rem; font-size: 0.85rem; margin-bottom: 0.25rem; }
.tag-agent { margin-left: 0; }
.comment-body { margin: 0; white-space: pre-wrap; overflow-wrap: break-word; }
.comment-form { margin-top: 1rem; }
.form-row { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.6rem; }

.new-issue { max-width: 40rem; }

/* ----- admin + team ----- */
.admin { display: flex; flex-direction: column; gap: 1.25rem; }
.org-card h3, .team-card h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 1.25rem 0 0.5rem;
}
.org-head { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.org-head h2 { font-size: 1.15rem; }
.rows { display: flex; flex-direction: column; }
.mapping-row, .user-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.mapping-row > :first-child, .user-row > :first-child { min-width: 8rem; }
.mapping-row .muted, .user-row .muted { flex: 1; }
.user-disabled > :first-child { text-decoration: line-through; color: var(--muted); }
.inline-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 0.75rem; }
.inline-form input { width: auto; flex: 1; min-width: 12rem; }
.inline-form button { white-space: nowrap; }
.link.danger { color: var(--danger); }
.team-card { margin-top: 0.5rem; }
.team-card .rows { margin-top: 0.5rem; }

@media (max-width: 640px) {
  .issue-row { grid-template-columns: 1fr auto; }
  .issue-key, .date { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .chip, button, .button, .project-nav a { transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease; }
}

/* ----- Inkwell page ground: contrast reassertions -----
   The body ground is Inkwell (dark) with an Au Lait (light) default text
   color, so bare-on-ground text (headings, empty states, the back link) is
   legible. The light card surfaces below re-assert Foreground (dark) text for
   their contents, and muted text that sits on the dark ground switches to the
   topbar's light muted tone (dark --muted would vanish on Inkwell). */
.card, .description, .comment, .doc-rail { color: var(--text); }
.empty, .pager .muted, .detail-meta .muted, .detail-meta .issue-key { color: var(--topbar-muted); }
.back { color: var(--au-lait); }
.lane-empty { color: var(--au-lait); }
