:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #5d6872;
  --line: #d9e0e6;
  --paper: #ffffff;
  --canvas: #f4f7f8;
  --nav: #132e54;
  --nav-soft: #31444f;
  --accent: #0f7f79;
  --accent-dark: #075e59;
  --warn: #b45f06;
  --danger: #b42318;
  --ok: #198754;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.import-button {
  min-height: 30px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: none;
  margin: 0;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #132e54;
}

.auth-card {
  width: min(360px, 100%);
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.auth-card img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.auth-card h1,
.auth-card p {
  margin: 0;
}

.auth-card h1 {
  font-size: 1.25rem;
}

.auth-card p {
  color: var(--muted);
}

.auth-message {
  min-height: 18px;
  font-size: 0.85rem;
}

.auth-message.error {
  color: var(--danger);
}

.auth-card .primary-button {
  background: #ffce61;
  color: #132e54;
}

.auth-card .primary-button:hover {
  background: #f2bd45;
}

.sidebar {
  background: var(--nav);
  color: #f7fbfc;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  gap: 8px;
  align-items: center;
}

.brand-logo-upload {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background: #ffffff;
  color: #dbe5e9;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

.brand-logo-upload.has-logo {
  background: #ffffff;
}

.brand-logo-upload img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-logo-upload input {
  display: none;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.form-panel h3,
.form-panel p {
  margin: 0;
}

.brand h1 {
  font-size: 0.94rem;
}

.brand p {
  color: #c5d0d6;
  font-size: 0.78rem;
}

.nav-tabs {
  display: grid;
  gap: 6px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  color: #eef7f9;
  background: transparent;
  text-align: left;
}

.nav-tab.active,
.nav-tab:hover {
  background: var(--nav-soft);
}

.sidebar-user {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}

.sidebar-user span {
  overflow: hidden;
  color: #dbe5e9;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-signout {
  justify-self: start;
  width: auto;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: #f7fbfc;
  font-size: 0.74rem;
  font-weight: 600;
}

.sidebar-signout:hover {
  background: var(--nav-soft);
}

.sidebar-panel {
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.panel-label {
  margin: 0 0 8px;
  color: #f2c94c;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.workflow-list {
  margin: 0;
  padding-left: 18px;
  color: #dbe5e9;
  line-height: 1.55;
}

.sidebar-admin-actions {
  display: grid;
  gap: 8px;
  padding-top: 8px;
}

.sidebar-admin-actions .ghost-button,
.sidebar-admin-actions .import-button {
  width: 100%;
  min-height: 30px;
}

.admin-dropdown summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
}

.admin-dropdown summary::-webkit-details-marker {
  display: none;
}

.admin-dropdown summary::after {
  width: 7px;
  height: 7px;
  border-right: 2px solid #f2c94c;
  border-bottom: 2px solid #f2c94c;
  content: "";
  transform: rotate(45deg);
  transition: transform 0.16s ease;
}

.admin-dropdown[open] summary::after {
  transform: rotate(225deg);
}

.admin-dropdown .panel-label {
  margin: 0;
}

.main-content {
  min-width: 0;
  padding: 14px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

#intake-view,
#deals-view,
#clients-view {
  max-width: 980px;
}

#dashboard-view {
  max-width: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.topbar.compact {
  margin-bottom: 12px;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h2 {
  margin-top: 3px;
  font-size: clamp(1.18rem, 2vw, 1.45rem);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  padding: 6px 8px;
  font-weight: 400;
}

textarea {
  resize: vertical;
}

.calculated-field input {
  background: #f7fafb;
  color: var(--muted);
}

select.placeholder {
  color: var(--muted);
  font-style: italic;
  font-weight: 400;
}

select.placeholder option {
  color: var(--ink);
  font-style: normal;
  font-weight: 400;
}

.ship-method-field {
  min-width: 0;
  border: 0;
  padding: 0;
  margin: 0;
}

.ship-method-field legend {
  margin-bottom: 6px;
  font-size: 0.9rem;
  font-weight: 700;
}

.circle-choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
  align-items: center;
}

.circle-choice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  cursor: pointer;
  font-weight: 400;
}

.circle-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-circle {
  width: 14px;
  height: 14px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  background: var(--paper);
}

.circle-choice input:checked + .choice-circle {
  border-color: var(--accent-dark);
  box-shadow: inset 0 0 0 3px var(--paper);
  background: var(--accent-dark);
}

#search-input {
  width: min(280px, 34vw);
}

.primary-button {
  padding: 0 10px;
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.ghost-button,
.import-button {
  padding: 0 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

button:disabled,
.ghost-button.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.danger-button {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid #f1b8b3;
  background: #fff5f5;
  color: var(--danger);
}

.import-button {
  display: inline-grid;
  place-items: center;
}

.import-button input {
  display: none;
}

.sidebar-admin-actions .ghost-button,
.sidebar-admin-actions .import-button {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: #f7fbfc;
}

.sidebar-admin-actions .ghost-button:hover,
.sidebar-admin-actions .import-button:hover {
  background: var(--nav-soft);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.metric {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.metric span {
  display: block;
  font-size: 1.15rem;
  font-weight: 900;
}

.metric p {
  margin: 3px 0 0;
  color: var(--muted);
  font-weight: 400;
}

.board {
  overflow-x: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.board-column {
  min-width: 0;
}
#pipeline-board {
  overflow-x: visible;
}

#pipeline-board .po-list-table {
  min-width: 0;
  table-layout: fixed;
}

#pipeline-board .po-list-table th,
#pipeline-board .po-list-table td {
  padding: 5px 3px;
  white-space: nowrap;
  word-break: normal;
  hyphens: none;
}

#pipeline-board .po-list-table th {
  overflow: visible;
}

#pipeline-board .po-list-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

#pipeline-board .po-list-table td:last-child {
  overflow: visible;
  text-overflow: clip;
}

#pipeline-board .po-list-table th {
  font-size: 0.56rem;
}

#pipeline-board .po-list-table td {
  font-size: 0.74rem;
  line-height: 1.25;
  text-align: center !important;
}

#pipeline-board .po-list-table td > * {
  margin-left: auto;
  margin-right: auto;
}

#pipeline-board .po-list-actions {
  justify-content: center;
  flex-wrap: nowrap;
  gap: 3px;
}

#pipeline-board .po-list-actions button {
  min-height: 23px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 0.66rem;
}

#pipeline-board .attention-badge {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.po-list-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.po-list-table th,
.po-list-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.po-list-table th {
  position: relative;
  color: var(--muted);
  background: #f7fafb;
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.pipeline-heading-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-width: 100%;
}

.pipeline-heading-label {
  display: inline;
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-filter-trigger {
  display: inline-grid;
  width: 15px;
  height: 15px;
  min-height: 15px;
  flex: 0 0 15px;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.62rem;
  line-height: 1;
}

.pipeline-filter-trigger::before {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  content: "";
}

.pipeline-filter-trigger:hover {
  color: var(--accent-dark);
}

.pipeline-filter-menu {
  position: absolute;
  top: calc(100% - 2px);
  left: 50%;
  z-index: 20;
  display: none;
  min-width: 132px;
  max-width: 220px;
  max-height: 230px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 8px 22px rgba(22, 41, 54, 0.14);
  transform: translateX(-50%);
}

.pipeline-filter-menu.open {
  display: grid;
  gap: 2px;
}

.pipeline-filter-option {
  width: 100%;
  min-height: 24px;
  padding: 4px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 400;
  text-align: left;
  text-transform: none;
  white-space: nowrap;
}

.pipeline-filter-option:hover,
.pipeline-filter-option.active {
  background: #e9f1f1;
  color: var(--accent-dark);
}
.po-list-table td {
  color: var(--ink);
  font-weight: 400;
  text-align: center;
  white-space: nowrap;
  font-size: 0.88rem;
}

.po-list-table tbody tr:hover {
  background: #f7fafb;
}

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

.pipeline-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

.pipeline-pagination-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.pipeline-page-button {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 600;
}

.pipeline-page-button:hover,
.pipeline-page-button.active {
  background: var(--accent);
  color: #ffffff;
}

.pipeline-page-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.pipeline-pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 4px;
}

.attention-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.attention-badge.complete {
  background: #e8f5ee;
  color: var(--ok);
}

.attention-badge.needs-attention {
  background: #fff4df;
  color: var(--warn);
}

.po-list-actions {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.pending-deals-list {
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.pending-deals-table {
  min-width: 820px;
}

.dashboard-summary {
  margin-top: 12px;
}

.summary-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.summary-heading h3,
.summary-heading p {
  margin: 0;
}


.column-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
}

.column-count {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: #e9f1f1;
  color: var(--accent-dark);
}

.request-card,
.client-row,
.form-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.request-card {
  padding: 11px;
  margin-bottom: 9px;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.po-number {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.card-title {
  margin: 0;
  font-size: 0.94rem;
}

.stage-pill {
  flex: 0 0 auto;
  max-width: 112px;
  padding: 4px 7px;
  border-radius: 999px;
  background: #e9f1f1;
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
}

.stage-pill.approved,
.stage-pill.archived {
  background: #e8f5ee;
  color: var(--ok);
}

.stage-pill.questionnaire,
.stage-pill.submitted {
  background: #fff4df;
  color: var(--warn);
}

.card-description {
  color: var(--muted);
  line-height: 1.32;
  font-weight: 400;
}

.card-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 9px;
}

.card-details div {
  min-width: 0;
}

.card-details dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.card-details dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-weight: 400;
}

.checklist {
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: var(--radius);
  background: #f7fafb;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 400;
}

.check-dot {
  width: 17px;
  height: 17px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 900;
}

.check-item.done .check-dot {
  border-color: var(--ok);
  background: var(--ok);
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 12px;
}

.intake-layout {
  display: grid;
  gap: 12px;
}

.form-panel {
  padding: 14px;
}

.section-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.step-number {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e9f1f1;
  color: var(--accent-dark);
  font-weight: 900;
}

.form-panel h3 {
  font-size: 0.98rem;
}

.form-panel p {
  margin-top: 3px;
  color: var(--muted);
}

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

.po-form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.po-form-grid label {
  gap: 3px;
}

.po-form-grid input,
.po-form-grid select {
  min-height: 32px;
  padding: 5px 8px;
}

.po-form-grid textarea {
  min-height: 66px;
}

label {
  display: grid;
  gap: 4px;
  color: #34444d;
  font-weight: 800;
}

.wide {
  grid-column: 1 / -1;
}

.questionnaire-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.questionnaire-grid.single-item {
  grid-template-columns: repeat(2, minmax(180px, 260px));
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7fafb;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.client-list {
  display: grid;
  gap: 12px;
}

.client-row {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 14px;
}

.client-row strong {
  display: block;
}

.client-row span {
  color: var(--muted);
  font-weight: 400;
}

.client-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.client-actions button {
  min-height: 26px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 0.76rem;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-weight: 400;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .nav-tabs,
  .metrics-grid,
  .board,
  .questionnaire-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .po-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .main-content,
  .sidebar {
    padding: 14px;
  }

  .topbar,
  .topbar-actions,
  .pipeline-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .pipeline-pagination-controls {
    justify-content: flex-start;
  }

  #search-input {
    width: 100%;
  }

  .metrics-grid,
  .board,
  .form-grid,
  .questionnaire-grid,
  .client-row {
    grid-template-columns: 1fr;
  }
}
