:root {
  --bg: #00788a;
  --bg-deep: #004e61;
  --panel: #f8fbfc;
  --panel-soft: #f2f7f9;
  --line: #e4edf0;
  --line-strong: #d7e3e7;
  --text: #162432;
  --muted: #61717d;
  --teal: #05aee0;
  --teal-dark: #018fb8;
  --success: #16d6a0;
  --shadow: 0 20px 48px rgba(3, 33, 43, 0.18);
  --shadow-soft: 0 8px 22px rgba(12, 49, 63, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--text);
  font-family: "Inter", Arial, sans-serif;
  background:
    radial-gradient(circle at 12% 88%, rgba(255, 255, 255, 0.12), transparent 30rem),
    linear-gradient(145deg, var(--bg-deep), var(--bg) 68%, #00889a);
}

html {
  min-height: 100%;
  overflow-y: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  overflow: visible;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 76px;
  padding: 14px 56px;
  background: #ffffff;
  border-bottom: 1px solid rgba(0, 35, 48, 0.06);
  box-shadow: 0 3px 14px rgba(0, 35, 48, 0.07);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 168px;
  font-size: 16px;
  line-height: 1.1;
}

.brand span:last-child {
  display: grid;
}

.brand-mark,
.avatar {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 800;
}

.brand-mark {
  background: linear-gradient(135deg, #00a9c8, #1dd7a3);
  font-size: 12px;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  font-size: 12px;
  color: #4e5d68;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.main-nav a:hover,
.main-nav a.active {
  color: #ffffff;
  background: var(--teal);
  box-shadow: 0 6px 14px rgba(0, 169, 200, 0.2);
}

.main-nav a:hover {
  transform: translateY(-1px);
}

.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  justify-content: flex-end;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  min-width: 0;
  max-width: min(200px, 32vw);
  text-align: right;
  line-height: 1.2;
}

.profile-primary,
.profile-secondary {
  display: block;
  max-width: 100%;
}

.profile-primary {
  font-size: 11px;
  font-weight: 800;
  color: var(--text);
  word-break: break-word;
}

.profile-secondary {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  word-break: break-all;
}

.profile .avatar {
  width: 36px;
  height: 36px;
  font-size: 12px;
}

.profile .text-button {
  flex-shrink: 0;
  font-size: 11px;
  white-space: nowrap;
}

.avatar {
  background: var(--success);
}

.page-frame {
  padding: 34px 28px 48px;
  overflow: visible;
}

.hero-card {
  width: min(1060px, 100%);
  margin: 0 auto;
  padding: 22px;
  background: rgba(248, 251, 252, 0.985);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 13px;
  box-shadow: var(--shadow);
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  padding: 0 0 20px;
  border-bottom: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.44em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.lede {
  max-width: 740px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.metric {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 160px;
  color: var(--teal-dark);
  text-align: center;
}

.metric strong {
  font-size: 30px;
}

.metric span {
  color: #335365;
}

.view-section {
  display: none;
}

.view-section[hidden] {
  display: none !important;
}

.active-view {
  display: block;
}

.chat-panel {
  display: grid;
  gap: 18px;
  max-width: 720px;
  margin-top: 24px;
  padding: 24px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.chatgpt-panel {
  max-width: 980px;
  min-height: 560px;
  align-content: space-between;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfc 100%);
}

.chat-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.chat-thread {
  display: grid;
  align-content: start;
  gap: 16px;
  min-height: 360px;
  max-height: 58vh;
  overflow-y: auto;
  padding-right: 6px;
}

.chat-message {
  max-width: 820px;
  padding: 14px 16px;
  color: var(--text);
  line-height: 1.6;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 14px;
  white-space: pre-wrap;
}

.chat-message strong,
.chat-message span {
  display: block;
}

.chat-message strong {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 13px;
}

.chat-message.user {
  justify-self: end;
  color: #fff;
  background: var(--teal-dark);
}

.chat-message.user strong {
  color: #fff;
}

.chat-message.bot {
  justify-self: start;
}

.chat-composer {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 10px;
  padding-top: 10px;
  background: linear-gradient(180deg, rgba(248, 251, 252, 0), #f8fbfc 26%);
}

.chat-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  background: var(--panel-soft);
  border-radius: 999px;
}

.chat-form {
  display: grid;
  gap: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(17, 56, 70, 0.08);
}

.chat-form textarea {
  width: 100%;
  resize: vertical;
  padding: 8px;
  color: var(--text);
  font: inherit;
  background: transparent;
  border: 0;
  border-radius: 12px;
  outline: 0;
}

.chat-form textarea:focus {
  box-shadow: none;
}

.chat-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.settings-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 18px;
}

.settings-subnav,
.settings-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}

.settings-subnav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  align-self: start;
  gap: 0;
  padding: 8px;
  overflow: hidden;
}

.settings-subnav-item {
  min-height: 56px;
  padding: 9px 14px;
  color: #425665;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  background: #ffffff;
  border: 1px solid transparent;
  border-radius: 9px;
  box-shadow: none;
  cursor: pointer;
}

.settings-subnav-item:last-child {
  border-bottom: 1px solid transparent;
}

.settings-subnav-item.active,
.settings-subnav-item:hover {
  color: var(--text);
  background: #ffffff;
  border-color: var(--line-strong);
  box-shadow: 0 8px 18px rgba(12, 49, 63, 0.08);
}

.settings-panel {
  display: none;
  overflow: hidden;
}

.settings-panel.active {
  display: block;
  min-width: 0;
}

.settings-panel-heading {
  display: grid;
  gap: 7px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.settings-panel-heading .eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.28em;
}

.settings-panel-heading h2,
.settings-panel-heading p {
  margin: 0;
}

.settings-panel-heading p:not(.eyebrow) {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.stage-gates-layout {
  display: grid;
  gap: 0;
  padding: 0;
  min-width: 0;
}

.stage-gates-layout > .list-heading {
  margin: 0;
  border-radius: 12px 12px 0 0;
}

.stage-gates-layout > .settings-table-wrap {
  border-radius: 0 0 12px 12px;
  border-top: 0;
}

.settings-form {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.settings-form[hidden] {
  display: none;
}

.client-form {
  margin: 20px 22px 0;
}

.settings-form label {
  display: grid;
  gap: 7px;
  color: #425665;
  font-size: 12px;
  font-weight: 800;
}

.settings-form input,
.settings-form select,
.settings-form textarea {
  width: 100%;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: 0;
}

.settings-form input,
.settings-form select {
  min-height: 36px;
  padding: 0 12px;
}

.settings-form textarea {
  resize: vertical;
  padding: 10px 12px;
}

.settings-form input:focus,
.settings-form textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 169, 200, 0.14);
}

.settings-form .checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-form .checkbox-field input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.permission-grid legend {
  padding: 0 6px;
  color: #425665;
  font-size: 13px;
  font-weight: 800;
}

.permission-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.permission-grid input {
  flex: 0 0 auto;
  width: 14px;
  min-width: 14px;
  min-height: 14px;
  height: 14px;
  padding: 0;
}

.permission-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.permission-option span {
  display: grid;
  gap: 2px;
}

.permission-option strong,
.permission-option small {
  display: block;
}

.permission-option small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.permission-option-all {
  grid-column: 1 / -1;
  background: rgba(0, 169, 200, 0.08);
  border-color: rgba(0, 127, 156, 0.24);
}

.external-api-summary {
  margin: 0;
  padding: 18px;
}

.settings-table-wrap {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.settings-table-wrap.project-table-wrap {
  padding: 0;
  background: #ffffff;
}

.settings-table {
  min-width: 0;
}

.settings-table th:first-child,
.settings-table td:first-child {
  width: 90px;
  min-width: 90px;
}

.project-table.settings-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}

.project-table.settings-table th,
.project-table.settings-table td {
  vertical-align: top;
}

.project-table.settings-table td:first-child,
.project-table.settings-table th:first-child {
  width: 56px;
  min-width: 56px;
  max-width: 72px;
  text-align: center;
  white-space: nowrap;
}

.project-table.settings-table td:nth-child(2),
.project-table.settings-table th:nth-child(2) {
  width: 18%;
  min-width: 0;
  white-space: normal;
  word-break: break-word;
}

.project-table.settings-table td:nth-child(3),
.project-table.settings-table th:nth-child(3) {
  width: 32%;
  min-width: 0;
  white-space: normal;
  word-break: break-word;
}

.project-table.settings-table td:nth-child(4),
.project-table.settings-table th:nth-child(4) {
  width: 26%;
  min-width: 0;
  white-space: normal;
}

.project-table.settings-table td:last-child,
.project-table.settings-table th:last-child {
  width: 148px;
  min-width: 120px;
  white-space: normal;
}

.project-table.settings-table .permission-pills {
  flex-wrap: wrap;
  gap: 6px;
}

.project-table.settings-table .project-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.table-card {
  margin-top: 24px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.template-table {
  display: grid;
  grid-template-columns: 110px minmax(230px, 1.1fr) minmax(320px, 2fr) 88px;
  gap: 28px;
  align-items: center;
}

.header-row {
  min-height: 38px;
  padding: 0 16px;
  color: #687887;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #fbfdfe;
  border-bottom: 1px solid var(--line);
}

.template-row {
  min-height: 98px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--line);
}

.template-row:last-child {
  border-bottom: 0;
}

.template-row > div:first-child {
  display: grid;
  gap: 6px;
  color: #607280;
  font-size: 13px;
  line-height: 1.2;
}

.domain-code {
  color: var(--teal-dark);
  font-size: 16px;
  line-height: 1;
}

h2 {
  margin: 0 0 7px;
  font-size: 16px;
  line-height: 1.24;
}

code {
  color: #50616e;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.template-row p {
  margin: 0;
  color: #536675;
  font-size: 14px;
  line-height: 1.55;
}

.pill-button {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 32px;
  padding: 0 15px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  background: var(--teal);
  border-radius: 7px;
  box-shadow: 0 7px 15px rgba(0, 169, 200, 0.22);
}

.pill-button:hover {
  background: var(--teal);
}

.projects-layout {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.project-form,
.project-list-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

.project-form {
  display: grid;
  gap: 14px;
  align-self: start;
  padding: 18px;
}

.project-form[hidden] {
  display: none;
}

.project-detail {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

.project-detail[hidden] {
  display: none;
}

.project-detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.project-detail-heading .eyebrow {
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.28em;
}

.project-detail-heading h2,
.project-detail-summary h3 {
  margin: 0;
}

.documents-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
  padding-top: 0;
  border-bottom: 1px solid var(--line);
}

.documents-subtab {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin-bottom: -1px;
  padding: 0 14px;
  color: #425665;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  cursor: pointer;
}

.documents-subtab.active {
  color: var(--text);
  background: #ffffff;
  border-bottom-color: #ffffff;
}

.documents-tab-panels {
  display: grid;
  gap: 18px;
}

.documents-tab-panel[hidden] {
  display: none;
}

.gap-analysis-panel {
  margin-top: 18px;
}

.gap-analysis-form {
  margin: 18px;
}

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

.gap-drop-zone {
  position: relative;
  min-height: 150px;
  align-content: center;
  justify-items: center;
  padding: 22px;
  color: #425665;
  text-align: center;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    repeating-linear-gradient(135deg, rgba(1, 143, 184, 0.6) 0 9px, rgba(22, 214, 160, 0.46) 9px 18px) border-box;
  border: 1px dashed transparent;
  border-radius: 12px;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.gap-drop-zone:hover,
.gap-drop-zone.drag-over {
  background:
    linear-gradient(#f6fcfe, #f6fcfe) padding-box,
    repeating-linear-gradient(135deg, rgba(1, 143, 184, 0.92) 0 9px, rgba(22, 214, 160, 0.72) 9px 18px) border-box;
  box-shadow: 0 12px 26px rgba(0, 127, 156, 0.16);
  transform: translateY(-1px);
}

.gap-drop-title,
.gap-drop-copy,
.gap-drop-file {
  display: block;
}

.gap-drop-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.gap-drop-copy {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.gap-drop-file {
  margin-top: 12px;
  max-width: 100%;
  padding: 6px 10px;
  overflow: hidden;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--panel-soft);
  border-radius: 999px;
}

.gap-drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.compact-state {
  padding: 0;
}

.gap-result {
  margin: 0 18px 18px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

.gap-result .list-heading {
  padding: 14px 16px;
}

.gap-result pre {
  margin: 0;
  padding: 18px;
  color: #263f4c;
  font: 13px/1.6 "Inter", Arial, sans-serif;
  white-space: pre-wrap;
  background: #ffffff;
}

.project-detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 4px;
  border-bottom: 1px solid var(--line);
}

.project-detail-tab {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin-bottom: -1px;
  padding: 0 18px;
  color: #425665;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
}

.project-detail-tab.active {
  color: var(--text);
  background: #ffffff;
  border-bottom-color: #ffffff;
}

.project-detail-panel {
  display: grid;
  gap: 18px;
}

.project-detail-panel[hidden] {
  display: none;
}

.kanban-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: 14px;
  padding-bottom: 8px;
  overflow-x: auto;
}

.dashboard-kanban-board {
  min-height: 300px;
}

.dashboard-fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  background: linear-gradient(145deg, var(--bg-deep), var(--bg));
}

.dashboard-fullscreen-header {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px 14px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 18px rgba(0, 35, 48, 0.08);
}

.dashboard-fullscreen-header-main {
  flex: 1;
  min-width: min(100%, 320px);
}

.dashboard-fullscreen-header-main h2 {
  margin: 6px 0 0;
  font-size: clamp(20px, 2.4vw, 28px);
}

.dashboard-fullscreen-lede {
  margin: 8px 0 0;
  max-width: 640px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.dashboard-fullscreen-header-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.dashboard-fullscreen-metric {
  margin: 0;
}

.dashboard-fullscreen-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px 22px 28px;
  -webkit-overflow-scrolling: touch;
}

.dashboard-fullscreen-scroll .dashboard-fullscreen-kanban-slot {
  min-height: min(720px, calc(100dvh - 140px));
}

.dashboard-fullscreen-scroll .dashboard-fullscreen-board {
  grid-auto-columns: minmax(280px, 1fr);
  min-height: min(680px, calc(100dvh - 160px));
}

.dashboard-fullscreen-scroll .kanban-column {
  min-height: min(620px, calc(100dvh - 180px));
}

body.dashboard-fullscreen-open {
  overflow: hidden;
}

.kanban-column {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 320px;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.kanban-column-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  border-radius: 14px 14px 0 0;
}

.kanban-column-header h4 {
  margin: 6px 0 0;
}

.kanban-column-body {
  display: grid;
  gap: 10px;
  padding: 14px;
  align-content: start;
}

.kanban-tile {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 16px rgba(0, 35, 48, 0.06);
}

.kanban-tile-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.kanban-tile-heading strong {
  display: block;
  font-size: 14px;
}

.kanban-tile-meta {
  color: var(--muted);
  font-size: 12px;
}

.kanban-tile-actions {
  display: flex;
  justify-content: flex-end;
}

.kanban-fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  background: linear-gradient(145deg, var(--bg-deep), var(--bg));
}

.kanban-fullscreen-header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 18px rgba(0, 35, 48, 0.08);
}

.kanban-fullscreen-header h2 {
  margin: 6px 0 0;
  font-size: clamp(18px, 2.2vw, 24px);
}

.kanban-fullscreen-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px 24px 28px;
  -webkit-overflow-scrolling: touch;
}

.kanban-fullscreen-scroll .kanban-board {
  grid-auto-columns: minmax(260px, 1fr);
  min-height: min(640px, calc(100dvh - 120px));
  padding-bottom: 12px;
}

.kanban-fullscreen-scroll .kanban-column {
  min-height: min(560px, calc(100dvh - 140px));
}

body.kanban-fullscreen-open {
  overflow: hidden;
}

.document-fill-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  background: linear-gradient(145deg, var(--bg-deep), var(--bg));
}

.document-fill-header {
  display: flex;
  flex-shrink: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 18px rgba(0, 35, 48, 0.08);
}

.document-fill-header h2 {
  margin: 6px 0 0;
  font-size: clamp(17px, 2vw, 22px);
}

.document-fill-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.document-fill-body {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  padding: 16px 18px 24px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.document-fill-panel {
  width: 100%;
  max-width: 920px;
  min-height: min(560px, calc(100dvh - 140px));
}

.document-fill-panel .chat-thread {
  max-height: min(62vh, 620px);
}

body.document-fill-open {
  overflow: hidden;
}

.project-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
}

.project-detail-grid div {
  padding: 14px;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.project-detail-grid dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.project-detail-grid dd {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.project-detail-summary {
  display: grid;
  gap: 8px;
}

.project-detail-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.project-stage-timeline {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-stage-timeline li {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.stage-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  background: var(--teal-dark);
  border-radius: 999px;
}

.project-stage-timeline strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.project-stage-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0 0;
  border-bottom: 1px solid var(--line);
}

.project-stage-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin-bottom: -1px;
  padding: 0 14px;
  color: #425665;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
}

.project-stage-tab span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  color: var(--teal-dark);
  font-size: 12px;
  background: var(--panel-soft);
  border-radius: 999px;
}

.project-stage-tab.active {
  color: var(--text);
  background: #ffffff;
  border-bottom-color: #ffffff;
}

.project-stage-tab.active span {
  color: #ffffff;
  background: var(--teal-dark);
}

.project-stage-panels {
  padding-top: 16px;
}

.project-stage-panel {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: start;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.project-stage-panel[hidden] {
  display: none;
}

.project-stage-panel h4 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 16px;
}

.stage-template-card {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding: 14px;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.stage-template-card strong,
.stage-template-card span,
.stage-template-card p {
  margin: 0;
}

.stage-template-card strong {
  color: var(--text);
}

.stage-template-card span:not(.status-pill) {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stage-template-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.stage-template-picker-list .empty-state {
  padding: 12px 0 0;
}

.stage-template-list > div,
.stage-template-list li {
  display: grid;
  gap: 5px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.settings-form small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.settings-form .form-fieldset {
  margin: 0 0 16px;
  padding: 12px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.settings-form .form-fieldset legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 700;
}

.settings-form .inline-choice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.35;
}

.settings-form .inline-choice input {
  margin-top: 3px;
}

.status-pill-muted {
  opacity: 0.75;
  border-style: dashed;
}

.template-meta-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(0, 105, 105, 0.12);
  color: var(--teal-dark);
  white-space: nowrap;
}

.template-meta-pill.muted {
  background: rgba(0, 0, 0, 0.06);
  color: var(--muted);
}

.good-sample-panel {
  margin: 20px 0 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdfe;
}

.good-sample-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
  color: #1a2b36;
}

.good-sample-lede {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.good-sample-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.template-markup {
  margin-top: 10px;
}

.template-markup summary {
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.template-markup pre {
  max-height: 220px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 12px;
  color: #263f4c;
  font: 12px/1.5 "SFMono-Regular", Consolas, monospace;
  white-space: pre-wrap;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.form-heading h2,
.list-heading h2 {
  margin: 0 0 5px;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.form-heading p,
.list-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.project-form label {
  display: grid;
  gap: 7px;
  color: #425665;
  font-size: 12px;
  font-weight: 800;
}

.project-form input,
.project-form select,
.project-form textarea {
  width: 100%;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: 0;
}

.project-form input,
.project-form select {
  min-height: 36px;
  padding: 0 12px;
}

.project-form textarea {
  resize: vertical;
  padding: 10px 12px;
}

.project-form input:focus,
.project-form select:focus,
.project-form textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 169, 200, 0.14);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-actions,
.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

button {
  cursor: pointer;
  border: 0;
}

.text-button {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 6px;
  color: var(--teal-dark);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  background: transparent;
}

.project-list-panel {
  overflow: hidden;
}

.project-list-panel[hidden] {
  display: none;
}

.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 18px;
  background: #fbfdfe;
  border-bottom: 1px solid var(--line);
}

.list-heading .pill-button {
  white-space: nowrap;
}

.project-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 14px 18px 0;
  background: #fbfdfe;
  border-bottom: 1px solid var(--line);
}

.project-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  margin-bottom: -1px;
  padding: 0 14px;
  color: #425665;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  background: transparent;
  border: 1px solid var(--line);
  border-bottom-color: transparent;
  border-radius: 8px 8px 0 0;
  box-shadow: none;
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease;
}

.project-tab:hover {
  color: var(--teal-dark);
  background: #ffffff;
}

.project-tab.active {
  color: var(--text);
  background: #ffffff;
  border-color: var(--line);
  border-bottom-color: #ffffff;
}

.project-tab span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  min-height: 24px;
  padding: 0 7px;
  color: var(--teal-dark);
  background: var(--panel-soft);
  border-radius: 999px;
}

.project-tab.active span {
  color: #ffffff;
  background: var(--teal-dark);
}

.project-list {
  display: grid;
}

.project-list[hidden] {
  display: none;
}

.project-table-wrap {
  width: 100%;
  overflow-x: auto;
  padding: 16px 18px;
  background: #ffffff;
}

.project-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  text-align: left;
}

.project-list .project-table {
  min-width: 820px;
}

.user-directory-wrap {
  overflow-x: hidden;
  padding: 16px 18px;
}

.user-directory-table {
  table-layout: fixed;
  min-width: 0;
}

.user-directory-table th,
.user-directory-table td {
  padding-right: 10px;
  padding-left: 10px;
}

.project-table th {
  padding: 12px 12px 10px;
  color: #687887;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #fbfdfe;
  border-bottom: 1px solid var(--line);
}

.project-table td {
  padding: 13px 12px;
  color: #425665;
  font-size: 13px;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.project-table tbody tr:last-child td {
  border-bottom: 0;
}

.project-list .project-table td:first-child {
  width: 48%;
  min-width: 340px;
}

.project-list .project-table th:nth-child(2),
.project-list .project-table td:nth-child(2) {
  width: 14%;
}

.project-list .project-table th:nth-child(3),
.project-list .project-table td:nth-child(3),
.project-list .project-table th:nth-child(4),
.project-list .project-table td:nth-child(4) {
  width: 13%;
  white-space: nowrap;
}

.project-list .project-table th:last-child,
.project-list .project-table td:last-child {
  width: 12%;
  white-space: nowrap;
}

.project-list .project-table td:first-child strong,
.project-list .project-table td:first-child span {
  display: block;
}

.project-list .project-table td:first-child strong {
  color: var(--text);
  font-size: 15px;
}

.project-list .project-table td:first-child span {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.user-directory-table th:first-child,
.user-directory-table td:first-child {
  width: 43%;
  min-width: 0;
}

.user-directory-table th:nth-child(2),
.user-directory-table td:nth-child(2) {
  width: 20%;
  white-space: normal;
}

.user-directory-table th:nth-child(3),
.user-directory-table td:nth-child(3) {
  width: 13%;
  white-space: normal;
}

.user-directory-table th:last-child,
.user-directory-table td:last-child {
  width: 24%;
  white-space: normal;
}

.user-directory-table td {
  overflow-wrap: anywhere;
}

.user-directory-table .project-actions {
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  gap: 6px;
}

.user-directory-table .text-button {
  justify-content: center;
  min-width: 74px;
  padding: 0 8px;
}

.template-library-wrap {
  overflow-x: auto;
  padding: 16px 18px;
}

.template-library-table {
  table-layout: fixed;
  min-width: 0;
}

.template-library-table th,
.template-library-table td {
  padding-right: 10px;
  padding-left: 10px;
}

.template-library-table th:first-child,
.template-library-table td:first-child {
  width: 30%;
  min-width: 0;
}

.template-library-table th:nth-child(2),
.template-library-table td:nth-child(2) {
  width: 18%;
  white-space: normal;
}

.template-library-table th:nth-child(3),
.template-library-table td:nth-child(3) {
  width: 12%;
  white-space: normal;
}

.template-library-table th:nth-child(4),
.template-library-table td:nth-child(4) {
  width: 22%;
  min-width: 168px;
  vertical-align: top;
  white-space: normal;
}

.template-library-table th:nth-child(5),
.template-library-table td:nth-child(5) {
  width: 18%;
  min-width: 148px;
  vertical-align: top;
  white-space: normal;
}

.template-library-table td {
  overflow-wrap: break-word;
}

.template-library-table td:first-child {
  overflow-wrap: anywhere;
}

.template-context-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  line-height: 1.25;
}

.template-context-badges .template-meta-pill {
  margin-left: 0;
}

.template-context-badges .status-pill {
  white-space: nowrap;
}

.template-library-table .project-actions {
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  gap: 6px;
}

.template-library-table .text-button {
  justify-content: center;
  min-width: 74px;
  padding: 0 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  color: #425665;
  font-size: 12px;
  font-weight: 800;
  background: var(--panel-soft);
  border-radius: 999px;
}

.domain-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.domain-list span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  color: var(--teal-dark);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  background: var(--panel-soft);
  border-radius: 999px;
}

.workspace-link {
  color: var(--teal-dark);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.workspace-link:hover {
  text-decoration: underline;
}

.clients-panel {
  margin-top: 24px;
}

.clients-table th:first-child,
.clients-table td:first-child {
  width: 24%;
  min-width: 220px;
}

.project-table .project-actions {
  justify-content: flex-start;
  gap: 8px;
}

.project-table .text-button {
  min-height: 28px;
  padding: 0 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.project-table .text-button:hover {
  border-color: var(--teal);
}

.empty-state {
  padding: 22px;
  color: var(--muted);
  font-size: 14px;
}

.danger-button {
  color: #9b3a45;
}

@media (max-width: 1120px) {
  .topbar {
    flex-wrap: wrap;
  }

  .projects-layout {
    grid-template-columns: 1fr;
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .main-nav {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
  }
}

@media (max-width: 820px) {
  .topbar,
  .page-frame {
    padding: 22px;
  }

  .page-heading {
    display: grid;
  }

  .metric {
    justify-items: start;
    text-align: left;
  }

  .template-table {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .header-row {
    display: none;
  }

  .template-row {
    align-items: start;
  }

  .pill-button {
    justify-self: start;
  }

  .form-grid,
  .gap-upload-grid,
  .project-card,
  .project-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
  }

  .brand,
  .profile {
    min-width: 0;
  }

  .profile {
    margin-left: auto;
  }

  .profile-meta {
    align-items: flex-end;
    max-width: min(180px, 52vw);
  }

  .profile-primary {
    font-size: 10px;
  }

  .profile-secondary {
    font-size: 9px;
  }

  .profile .text-button {
    font-size: 10px;
  }

  .hero-card {
    padding: 22px 16px 28px;
    border-radius: 14px;
  }

  .eyebrow {
    letter-spacing: 0.22em;
  }
}
