:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --ink: #18212f;
  --muted: #667085;
  --line: #d9e2ec;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #0b5e59;
  --teal-soft: #e1f7f3;
  --blue: #2563eb;
  --blue-soft: #e7efff;
  --amber: #d97706;
  --amber-soft: #fff4d6;
  --violet: #7c3aed;
  --violet-soft: #efe7ff;
  --green: #15803d;
  --green-soft: #e7f8ed;
  --rose: #be123c;
  --rose-soft: #ffe8ee;
  --shadow: 0 18px 45px rgba(24, 33, 47, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #edf7ff 0, #f8fbf5 260px, var(--bg) 100%);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(37, 99, 235, 0.1) 42%, rgba(217, 119, 6, 0.12));
  padding: 9px 12px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
}

.brand-logo {
  width: clamp(92px, 8vw, 128px);
  height: auto;
  display: block;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.eyebrow {
  display: none;
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.28rem, 1.8vw, 1.7rem);
  line-height: 1.05;
  white-space: nowrap;
}

.top-actions,
.form-actions,
.filters,
.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.top-actions .primary-btn,
.top-actions .ghost-btn,
.top-actions .login-select,
.top-actions .login-password,
.login-status {
  min-height: 34px;
  padding-top: 0;
  padding-bottom: 0;
}

.login-status {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-dark);
  padding: 8px 11px;
  font-size: 0.82rem;
  font-weight: 900;
}

.login-select {
  width: 180px;
  min-height: 40px;
  background: white;
}

.login-password {
  width: 140px;
  min-height: 40px;
  background: white;
}

.admin-panel {
  display: none;
  grid-template-columns: 110px 160px auto;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  padding: 8px;
}

.admin-panel.is-open {
  display: grid;
}

.admin-panel input,
.admin-panel select {
  min-height: 36px;
  background: white;
}

.primary-btn,
.ghost-btn,
.edit-btn,
.delete-btn,
.icon-btn {
  border: 1px solid transparent;
  border-radius: 7px;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-btn {
  background: var(--accent);
  color: white;
}

.primary-btn:hover {
  background: var(--accent-dark);
}

.ghost-btn {
  background: white;
  border-color: var(--line);
  color: var(--ink);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metrics article,
.panel,
.main-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.metrics article {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  padding: 18px;
}

.metrics article::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent);
}

.metrics article:nth-child(2)::before {
  background: var(--blue);
}

.metrics article:nth-child(3)::before {
  background: var(--amber);
}

.metrics article:nth-child(4)::before {
  background: var(--green);
}

.metrics span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.metrics strong {
  font-size: clamp(1.45rem, 2vw, 2rem);
}

.metrics article:nth-child(1) strong {
  color: var(--accent-dark);
}

.metrics article:nth-child(2) strong {
  color: var(--blue);
}

.metrics article:nth-child(3) strong {
  color: var(--amber);
}

.metrics article:nth-child(4) strong {
  color: var(--green);
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

body.viewer-mode .workspace {
  grid-template-columns: 1fr;
}

body.viewer-mode .panel,
body.viewer-mode #newLeadBtn,
body.viewer-mode #logoutBtn {
  display: none;
}

body.editor-mode #loginBtn,
body.editor-mode #loginUser {
  display: none;
}

body.admin-mode .login-status {
  background: var(--violet-soft);
  color: #6d28d9;
}

.panel,
.main-panel {
  border-radius: 8px;
}

.panel {
  position: sticky;
  top: 18px;
  border-top: 5px solid var(--accent);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 12px;
}

.panel-header p,
.toolbar p {
  color: var(--muted);
  margin-bottom: 0;
}

.panel-header h2 {
  margin-bottom: 4px;
  font-size: 1.05rem;
}

.panel-header p {
  display: none;
}

form {
  display: grid;
  gap: 8px;
}

label {
  display: grid;
  gap: 4px;
  color: #304139;
  font-size: 0.76rem;
  font-weight: 800;
}

.field-note {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.product-other-field.is-hidden {
  display: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdff;
  color: var(--ink);
  min-height: 34px;
  padding: 7px 9px;
  outline: none;
}

textarea {
  max-height: 78px;
  resize: vertical;
}

input[readonly] {
  background: #eef6ff;
  color: var(--accent-dark);
  font-weight: 900;
}

.product-checklist {
  display: grid;
  gap: 5px;
  max-height: 150px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdff;
  padding: 7px;
}

.product-check {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 6px;
}

.product-check:hover {
  background: var(--blue-soft);
}

.product-check input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
}

.checklist-empty {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.main-panel {
  min-width: 0;
  border-top: 5px solid var(--blue);
  padding: 18px;
}

.toolbar {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.toolbar > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) repeat(4, minmax(145px, 1fr));
  gap: 10px;
  width: 100%;
}

.product-filter-strip {
  display: grid;
  grid-template-columns: auto minmax(260px, 520px);
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(13, 148, 136, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.1), rgba(37, 99, 235, 0.08));
}

.product-filter-strip label {
  color: var(--teal-dark);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.opportunity-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  padding: 6px;
}

.opportunity-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  min-height: 42px;
  padding: 9px 12px;
  text-align: left;
}

.opportunity-tab span {
  font-size: 0.86rem;
  font-weight: 900;
}

.opportunity-tab strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  border-radius: 999px;
  background: #edf1f7;
  color: var(--ink);
  padding: 4px 8px;
  font-size: 0.82rem;
}

.opportunity-tab.is-active {
  border-color: rgba(15, 118, 110, 0.22);
  background: linear-gradient(135deg, var(--teal-soft), var(--blue-soft));
  color: var(--accent-dark);
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.1);
}

.opportunity-tab.is-active strong {
  background: white;
  color: var(--accent-dark);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 10px;
}

.section-heading h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.section-heading span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.stage-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.summary-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 12px;
}

.summary-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--accent);
}

.summary-card.stage-lead {
  background: var(--blue-soft);
  border-color: #bcd0ff;
}

.summary-card.stage-opportunity {
  background: var(--teal-soft);
  border-color: #a7e3da;
}

.summary-card.stage-negotiation {
  background: var(--amber-soft);
  border-color: #f2ce78;
}

.summary-card.stage-order {
  background: var(--violet-soft);
  border-color: #d5c3ff;
}

.summary-card.stage-won {
  background: var(--green-soft);
  border-color: #b5e7c3;
}

.summary-card.stage-lost {
  background: var(--rose-soft);
  border-color: #ffc1cf;
}

.summary-card.stage-lead::before {
  background: var(--blue);
}

.summary-card.stage-opportunity::before {
  background: var(--accent);
}

.summary-card.stage-negotiation::before {
  background: var(--amber);
}

.summary-card.stage-order::before {
  background: var(--violet);
}

.summary-card.stage-won::before {
  background: var(--green);
}

.summary-card.stage-lost::before {
  background: var(--rose);
}

.summary-card span {
  display: block;
  min-height: 34px;
  color: #304139;
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.25;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.05rem;
}

.summary-card.stage-lead strong {
  color: var(--blue);
}

.summary-card.stage-opportunity strong {
  color: var(--accent-dark);
}

.summary-card.stage-negotiation strong {
  color: var(--amber);
}

.summary-card.stage-order strong {
  color: var(--violet);
}

.summary-card.stage-won strong {
  color: var(--green);
}

.summary-card.stage-lost strong {
  color: var(--rose);
}

.summary-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 750;
}

.renewal-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}

.renewal-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(360px, 1.4fr);
  gap: 16px;
  padding: 16px;
}

.renewal-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.renewal-kpi {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
}

.renewal-kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.renewal-kpi strong {
  display: block;
  margin-top: 6px;
  font-size: 1.25rem;
}

.renewal-kpi.renewed strong {
  color: var(--green);
}

.renewal-kpi.pipeline strong {
  color: var(--blue);
}

.renewal-kpi.lost strong {
  color: var(--rose);
}

.total-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  padding: 0 16px 16px;
}

.total-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.total-chip span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.total-chip strong {
  display: block;
  margin-top: 5px;
  font-size: 1.15rem;
}

.total-chip.danger strong {
  color: var(--rose);
}

.total-chip.info strong {
  color: var(--blue);
}

.renewal-chart {
  display: grid;
  gap: 11px;
}

.chart-row {
  display: grid;
  grid-template-columns: 145px minmax(160px, 1fr) 92px;
  align-items: center;
  gap: 10px;
}

.chart-label {
  color: #304139;
  font-size: 0.84rem;
  font-weight: 850;
}

.chart-track {
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f7;
}

.chart-bar {
  height: 100%;
  min-width: 4px;
  border-radius: 999px;
}

.chart-bar.renewed {
  background: var(--green);
}

.chart-bar.pipeline {
  background: var(--blue);
}

.chart-bar.lost {
  background: var(--rose);
}

.chart-bar.missing {
  background: var(--amber);
}

.chart-value {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  text-align: right;
}

.risk-table-wrap {
  border-top: 1px solid var(--line);
  max-height: 260px;
  overflow: auto;
}

.risk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.risk-table th,
.risk-table td,
.risk-table tfoot th {
  border-bottom: 1px solid var(--line);
  padding: 9px 12px;
  text-align: left;
}

.data-table tfoot th,
.risk-table tfoot th {
  background: #f8fafc;
  border-top: 2px solid var(--line);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 900;
  position: sticky;
  bottom: 0;
  z-index: 1;
}

.data-table tfoot .number-cell,
.risk-table tfoot .number-cell {
  color: var(--accent-dark);
  font-size: 0.92rem;
}

.risk-table th {
  position: sticky;
  top: 0;
  background: #fff8e7;
  color: #304139;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.risk-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 900;
  white-space: nowrap;
}

.risk-status.lost {
  background: var(--rose-soft);
  color: var(--rose);
}

.risk-status.missing {
  background: var(--amber-soft);
  color: #9a5a00;
}

.table-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.table-total-strip {
  padding: 0;
  margin-bottom: 10px;
}

.data-table-wrap {
  max-height: 520px;
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef6ff;
  color: #304139;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.data-table td {
  color: #304139;
}

.data-table tbody tr {
  cursor: pointer;
}

body.viewer-mode .data-table tbody tr {
  cursor: default;
}

.data-table tbody tr:hover {
  background: #f6f8f1;
}

.data-table .number-cell {
  text-align: right;
  white-space: nowrap;
  font-weight: 850;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 132px;
}

.table-edit-btn,
.table-delete-btn {
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 7px;
  background: var(--teal-soft);
  color: var(--accent-dark);
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.table-edit-btn:hover {
  background: var(--accent);
  color: white;
}

.table-delete-btn {
  border-color: rgba(190, 18, 60, 0.22);
  background: var(--rose-soft);
  color: var(--rose);
}

.table-delete-btn:hover {
  background: var(--rose);
  color: white;
}

.view-only-label {
  display: inline-flex;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
}

.stage-badge {
  display: inline-flex;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--accent-dark);
  padding: 4px 8px;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.stage-badge.stage-lead {
  background: var(--blue-soft);
  color: #1d4ed8;
}

.stage-badge.stage-opportunity {
  background: var(--teal-soft);
  color: var(--accent-dark);
}

.stage-badge.stage-negotiation {
  background: var(--amber-soft);
  color: #9a5a00;
}

.stage-badge.stage-order {
  background: var(--violet-soft);
  color: #6d28d9;
}

.stage-badge.stage-won {
  background: var(--green-soft);
  color: var(--green);
}

.stage-badge.stage-lost {
  background: var(--rose-soft);
  color: var(--rose);
}

.type-badge {
  display: inline-flex;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  padding: 4px 8px;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.type-badge.type-new {
  background: var(--blue-soft);
  color: #1d4ed8;
}

.type-badge.type-renewal {
  background: var(--green-soft);
  color: var(--green);
}

.type-badge.type-new-renewal {
  background: var(--violet-soft);
  color: #6d28d9;
}

.type-badge.type-pro-rata {
  background: var(--amber-soft);
  color: #9a5a00;
}

.muted-cell {
  color: var(--muted);
  max-width: 280px;
}

.insights-heading {
  margin-top: 26px;
}

.insight-accordion-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 10px;
}

.insight-accordion {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 28px rgba(24, 33, 47, 0.08);
  overflow: hidden;
}

.insight-accordion summary {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(170px, auto) 28px;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.insight-accordion summary::-webkit-details-marker {
  display: none;
}

.insight-accordion summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--accent-dark);
  font-size: 1.1rem;
  font-weight: 950;
}

.insight-accordion[open] summary {
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(37, 99, 235, 0.08));
}

.insight-accordion[open] summary::after {
  content: "-";
  background: var(--accent);
  color: white;
}

.insight-accordion summary span {
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 950;
}

.insight-accordion summary small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: right;
}

.insight-content {
  display: grid;
  gap: 14px;
  padding: 16px;
}

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

.insight-kpis article {
  border: 1px solid rgba(217, 226, 236, 0.9);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.insight-kpis span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.insight-kpis strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 1.1rem;
}

.insight-bars {
  display: grid;
  gap: 10px;
}

.insight-bar-row {
  display: grid;
  grid-template-columns: 170px minmax(180px, 1fr) 250px;
  align-items: center;
  gap: 12px;
}

.insight-bar-label {
  color: #304139;
  font-size: 0.84rem;
  font-weight: 900;
}

.insight-bar-track {
  height: 17px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f7;
}

.insight-bar-fill {
  height: 100%;
  min-width: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--blue));
}

.insight-bar-fill.stage-lead {
  background: var(--blue);
}

.insight-bar-fill.stage-opportunity {
  background: var(--accent);
}

.insight-bar-fill.stage-negotiation {
  background: var(--amber);
}

.insight-bar-fill.stage-order {
  background: var(--violet);
}

.insight-bar-fill.stage-won {
  background: var(--green);
}

.insight-bar-fill.stage-lost {
  background: var(--rose);
}

.insight-bar-value {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  text-align: right;
}

.insight-table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.insight-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 0.86rem;
}

.insight-table th,
.insight-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.insight-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f7ff;
  color: #304139;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.insight-empty {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
}

@media (max-width: 1050px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .renewal-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .insight-bar-row {
    grid-template-columns: 140px minmax(180px, 1fr);
  }

  .insight-bar-value {
    grid-column: 2;
    text-align: left;
  }

  .panel {
    position: static;
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100% - 20px, 1480px);
    padding: 18px 0;
  }

  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-block {
    align-items: center;
    flex-direction: row;
    gap: 9px;
    min-width: 0;
  }

  .brand-logo {
    width: 92px;
  }

  h1 {
    font-size: 1.28rem;
    white-space: normal;
  }

  .top-actions,
  .filters,
  .opportunity-tabs,
  .form-actions {
    width: 100%;
  }

  .top-actions button,
  .filters input,
  .filters select,
  .form-actions button {
    flex: 1;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .stage-summary {
    grid-template-columns: 1fr;
  }

  .renewal-kpis,
  .chart-row {
    grid-template-columns: 1fr;
  }

  .chart-value {
    text-align: left;
  }

  .insight-accordion summary {
    grid-template-columns: 1fr 28px;
  }

  .insight-accordion summary small {
    grid-column: 1;
    grid-row: 2;
    text-align: left;
  }

  .insight-accordion summary::after {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .insight-kpis,
  .insight-bar-row {
    grid-template-columns: 1fr;
  }

  .insight-bar-value {
    grid-column: auto;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .opportunity-tabs {
    grid-template-columns: 1fr;
  }

  .split {
    grid-template-columns: 1fr;
  }
}

/* Keep the interface focused on the core dashboard. */
.insights-heading,
.insight-accordion-grid {
  display: none;
}

/* Visual refresh: executive dashboard finish */
:root {
  --bg: #eef3f8;
  --ink: #111827;
  --muted: #64748b;
  --line: #d8e2ee;
  --panel: #ffffff;
  --accent: #0f8f83;
  --accent-dark: #07625d;
  --teal-dark: #07625d;
  --teal-soft: #ddf7f2;
  --blue: #2563eb;
  --blue-soft: #e8f0ff;
  --amber: #d97706;
  --amber-soft: #fff1cc;
  --violet: #7c3aed;
  --violet-soft: #efe6ff;
  --green: #15803d;
  --green-soft: #e2f7ea;
  --rose: #be123c;
  --rose-soft: #ffe4eb;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 20px rgba(15, 23, 42, 0.06);
}

body {
  background:
    linear-gradient(180deg, rgba(232, 240, 255, 0.9) 0, rgba(221, 247, 242, 0.58) 260px, #f5f7fb 720px),
    linear-gradient(90deg, rgba(15, 143, 131, 0.1), rgba(217, 119, 6, 0.06), rgba(37, 99, 235, 0.08));
  color: var(--ink);
}

.app-shell {
  width: min(1560px, calc(100% - 28px));
  padding: 16px 0 28px;
}

.topbar {
  position: sticky;
  top: 10px;
  z-index: 20;
  min-height: 74px;
  margin-bottom: 16px;
  border: 1px solid rgba(15, 98, 93, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(232, 240, 255, 0.92)),
    linear-gradient(90deg, rgba(15, 143, 131, 0.16), rgba(37, 99, 235, 0.12), rgba(217, 119, 6, 0.12));
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(14px);
  padding: 12px 14px;
}

.brand-block {
  min-width: 310px;
}

.brand-logo {
  width: 116px;
  filter: saturate(1.12);
}

.eyebrow {
  display: block;
  color: var(--accent-dark);
  font-size: 0.69rem;
  letter-spacing: 0.1em;
}

h1 {
  font-size: 1.62rem;
  letter-spacing: 0;
}

.login-status {
  border: 1px solid rgba(15, 143, 131, 0.2);
  background: #ffffff;
  color: var(--accent-dark);
  box-shadow: var(--shadow-soft);
}

.top-actions .login-select,
.top-actions .login-password,
.admin-panel input,
.admin-panel select {
  border-color: rgba(100, 116, 139, 0.24);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.primary-btn,
.ghost-btn,
.table-edit-btn,
.table-delete-btn {
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #0b6fcb);
  box-shadow: 0 10px 18px rgba(15, 143, 131, 0.18);
}

.primary-btn:hover,
.ghost-btn:hover,
.table-edit-btn:hover,
.table-delete-btn:hover,
.opportunity-tab:hover {
  transform: translateY(-1px);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(100, 116, 139, 0.22);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.05);
}

.metrics {
  gap: 14px;
}

.metrics article {
  min-height: 126px;
  border-color: rgba(216, 226, 238, 0.9);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94)),
    linear-gradient(135deg, rgba(15, 143, 131, 0.14), transparent 46%);
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
}

.metrics article::before {
  width: 100%;
  height: 4px;
  inset: 0 0 auto;
}

.metrics span,
.renewal-kpi span,
.total-chip span,
.insight-kpis span {
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.metrics strong {
  font-size: 1.8rem;
  letter-spacing: 0;
}

.workspace {
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
}

.panel,
.main-panel,
.renewal-panel,
.table-panel,
.insight-accordion {
  border-color: rgba(216, 226, 238, 0.95);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.panel {
  border-top: 0;
  padding: 14px;
}

.panel::before,
.main-panel::before {
  content: "";
  display: block;
  height: 4px;
  border-radius: 8px 8px 0 0;
  margin: -14px -14px 14px;
  background: linear-gradient(90deg, var(--accent), var(--blue), var(--amber));
}

.main-panel {
  border-top: 0;
  padding: 18px;
}

.main-panel::before {
  margin: -18px -18px 18px;
}

.panel-header h2,
.toolbar h2,
.section-heading h3 {
  color: #0f172a;
  font-weight: 900;
  letter-spacing: 0;
}

.panel-header h2 {
  font-size: 1.16rem;
}

.toolbar > div:first-child {
  align-items: center;
  padding: 4px 2px 0;
}

.toolbar h2 {
  font-size: 1.55rem;
}

.toolbar p {
  display: inline-flex;
  margin-left: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

label {
  color: #334155;
}

input,
select,
textarea {
  border-color: #cbd8e6;
  background: #ffffff;
  min-height: 38px;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03);
}

input::placeholder,
textarea::placeholder {
  color: #8a98aa;
}

.product-checklist {
  border-color: #cbd8e6;
  background: #ffffff;
}

.filters {
  grid-template-columns: minmax(260px, 1.5fr) repeat(4, minmax(142px, 1fr));
  gap: 12px;
}

.filters input,
.filters select,
.product-filter-strip select {
  min-height: 44px;
  border-color: rgba(148, 163, 184, 0.48);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  color: #1f2937;
  font-weight: 760;
}

.product-filter-strip {
  grid-template-columns: auto minmax(280px, 560px) minmax(0, 1fr);
  border-color: rgba(15, 143, 131, 0.28);
  background:
    linear-gradient(135deg, rgba(221, 247, 242, 0.9), rgba(232, 240, 255, 0.9)),
    linear-gradient(90deg, rgba(15, 143, 131, 0.08), rgba(217, 119, 6, 0.08));
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.05);
}

.product-filter-strip::after {
  content: "FY Apr-Mar carry-forward active";
  justify-self: end;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.opportunity-tabs {
  border-color: rgba(148, 163, 184, 0.26);
  background: #f8fafc;
}

.opportunity-tab {
  min-height: 50px;
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: 0 7px 14px rgba(15, 23, 42, 0.04);
}

.opportunity-tab.is-active {
  background: linear-gradient(135deg, #ddf7f2, #e8f0ff);
  border-color: rgba(15, 143, 131, 0.32);
  box-shadow: 0 12px 24px rgba(15, 143, 131, 0.12);
}

.stage-summary {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
}

.summary-card {
  min-height: 132px;
  border-color: rgba(148, 163, 184, 0.26);
  box-shadow: var(--shadow-soft);
  padding: 15px;
}

.summary-card span {
  min-height: 44px;
  color: #1f2937;
  font-size: 0.84rem;
}

.summary-card strong {
  font-size: 1.18rem;
}

.renewal-grid {
  grid-template-columns: minmax(300px, 0.85fr) minmax(400px, 1.45fr);
}

.renewal-kpi,
.total-chip,
.insight-kpis article {
  border-color: rgba(148, 163, 184, 0.24);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  box-shadow: var(--shadow-soft);
}

.chart-track,
.insight-bar-track {
  background: #e6edf5;
}

.risk-table th {
  background: #fff5da;
  color: #475569;
}

.data-table th,
.insight-table th {
  background: #e9f3ff;
  color: #475569;
}

.risk-table tbody tr:nth-child(even),
.data-table tbody tr:nth-child(even),
.insight-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

.risk-table tbody tr:hover,
.data-table tbody tr:hover,
.insight-table tbody tr:hover {
  background: #f0f9ff;
}

.data-table td,
.risk-table td,
.insight-table td {
  color: #273548;
}

.stage-badge,
.type-badge,
.risk-status,
.view-only-label {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.table-edit-btn {
  background: #ddf7f2;
}

.table-delete-btn {
  background: #ffe4eb;
}

.insight-accordion summary {
  min-height: 64px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.insight-accordion[open] summary {
  background: linear-gradient(135deg, rgba(221, 247, 242, 0.88), rgba(232, 240, 255, 0.92));
}

.insight-accordion summary::after {
  background: #ffffff;
  border: 1px solid rgba(15, 143, 131, 0.22);
  color: var(--accent-dark);
}

.insight-content {
  background: #ffffff;
}

@media (max-width: 1280px) {
  .stage-summary {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .workspace {
    grid-template-columns: 280px minmax(0, 1fr);
  }
}

@media (max-width: 1050px) {
  .topbar {
    position: static;
  }

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

  .panel {
    position: static;
    max-height: none;
  }

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

  .filters input {
    grid-column: 1 / -1;
  }

  .product-filter-strip {
    grid-template-columns: 1fr;
  }

  .product-filter-strip::after {
    justify-self: start;
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100% - 18px, 1560px);
  }

  .topbar {
    padding: 12px;
  }

  .brand-logo {
    width: 98px;
  }

  h1 {
    font-size: 1.34rem;
  }

  .metrics,
  .filters,
  .stage-summary,
  .renewal-kpis,
  .opportunity-tabs {
    grid-template-columns: 1fr;
  }

  .toolbar > div:first-child,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar p {
    display: block;
    margin-left: 0;
  }
}

/* Simple interface layer */
:root {
  --bg: #f4f6f8;
  --ink: #182230;
  --muted: #667085;
  --line: #d7dee8;
  --panel: #ffffff;
  --accent: #087f77;
  --accent-dark: #05635d;
  --teal-dark: #05635d;
  --teal-soft: #e2f5f2;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --amber: #c77700;
  --amber-soft: #fff2d2;
  --violet: #6d41c7;
  --violet-soft: #eee8ff;
  --green: #16803c;
  --green-soft: #e5f6eb;
  --rose: #b4233c;
  --rose-soft: #ffe7ed;
  --shadow: 0 8px 18px rgba(16, 24, 40, 0.06);
  --shadow-soft: 0 4px 10px rgba(16, 24, 40, 0.04);
}

body {
  background: var(--bg);
  color: var(--ink);
}

.app-shell {
  width: min(1500px, calc(100% - 28px));
  padding: 14px 0 24px;
}

.topbar {
  position: static;
  min-height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
  padding: 12px 14px;
}

.brand-block {
  min-width: 250px;
}

.brand-logo {
  width: 106px;
  mix-blend-mode: normal;
  filter: none;
}

.eyebrow {
  display: none;
}

h1 {
  font-size: 1.45rem;
  font-weight: 900;
}

.login-status {
  border: 1px solid #c7eee7;
  background: #f0fbf8;
  box-shadow: none;
}

.primary-btn {
  background: var(--accent);
  box-shadow: none;
}

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

.ghost-btn {
  background: #ffffff;
  box-shadow: none;
}

.primary-btn:hover,
.ghost-btn:hover,
.table-edit-btn:hover,
.table-delete-btn:hover,
.opportunity-tab:hover {
  transform: none;
}

.metrics {
  gap: 10px;
  margin-bottom: 14px;
}

.metrics article {
  min-height: 98px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
  padding: 14px 16px;
}

.metrics article::before {
  width: 4px;
  height: 100%;
  inset: 0 auto 0 0;
}

.metrics span {
  margin-bottom: 6px;
}

.metrics strong {
  font-size: 1.42rem;
}

.workspace {
  grid-template-columns: 282px minmax(0, 1fr);
  gap: 14px;
}

.panel,
.main-panel,
.renewal-panel,
.table-panel,
.insight-accordion {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.panel,
.main-panel {
  padding: 14px;
}

.panel::before,
.main-panel::before {
  display: none;
}

.panel {
  top: 12px;
  border-top: 4px solid var(--accent);
}

.main-panel {
  border-top: 4px solid var(--blue);
}

.panel-header h2,
.toolbar h2,
.section-heading h3 {
  color: var(--ink);
  font-weight: 900;
}

.toolbar {
  gap: 12px;
  margin-bottom: 14px;
}

.toolbar h2 {
  font-size: 1.38rem;
}

.toolbar p {
  display: inline-flex;
  margin-left: 10px;
  font-size: 0.88rem;
}

input,
select,
textarea,
.filters input,
.filters select,
.product-filter-strip select {
  min-height: 40px;
  border: 1px solid #ccd6e3;
  border-radius: 7px;
  background: #ffffff;
  box-shadow: none;
  color: var(--ink);
}

.filters {
  grid-template-columns: minmax(250px, 1.45fr) repeat(4, minmax(136px, 1fr));
  gap: 9px;
}

.product-filter-strip {
  grid-template-columns: auto minmax(240px, 480px) minmax(0, 1fr);
  border: 1px solid #cfe4e1;
  background: #f5fbfa;
  box-shadow: none;
  padding: 10px 12px;
}

.product-filter-strip::after {
  content: "Financial year: Apr-Mar";
  font-size: 0.76rem;
}

.opportunity-tabs {
  gap: 6px;
  border: 1px solid var(--line);
  background: #f8fafc;
  padding: 5px;
}

.opportunity-tab {
  min-height: 44px;
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
}

.opportunity-tab.is-active {
  border-color: #b7ded9;
  background: #e8f6f3;
  box-shadow: none;
}

.stage-summary {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 9px;
}

.summary-card {
  min-height: 104px;
  border-radius: 8px;
  box-shadow: none;
  padding: 12px;
}

.summary-card span {
  min-height: 30px;
}

.summary-card strong {
  font-size: 1.04rem;
}

.section-heading {
  margin: 16px 0 9px;
}

.same-month-panel {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
  padding: 14px;
}

.same-month-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.same-month-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  align-items: end;
  gap: 12px;
}

.same-month-column {
  display: grid;
  align-items: end;
  gap: 8px;
  min-height: 258px;
  border: 1px solid #e3ebf4;
  border-radius: 8px;
  background: #f9fbff;
  padding: 10px 8px;
}

.same-month-label {
  color: #334155;
  font-size: 0.84rem;
  font-weight: 900;
  text-align: center;
}

.same-month-bars {
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 10px;
  min-height: 190px;
}

.same-month-bar-group {
  display: grid;
  grid-template-rows: 138px auto auto auto;
  justify-items: center;
  align-items: end;
  gap: 4px;
  min-width: 44px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
}

.same-month-track {
  display: flex;
  align-items: end;
  width: 22px;
  height: 138px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef5;
}

.same-month-bar {
  width: 100%;
  border-radius: 999px;
}

.same-month-bar.previous {
  background: var(--amber);
}

.same-month-bar.current {
  background: var(--blue);
}

.same-month-bar-group strong {
  color: var(--ink);
  font-size: 0.72rem;
  line-height: 1.15;
}

.same-month-bar-group small {
  color: #718096;
  font-size: 0.68rem;
  font-weight: 800;
}

.renewal-kpi.positive strong {
  color: var(--green);
}

.renewal-kpi.negative strong {
  color: var(--rose);
}

.renewal-grid {
  grid-template-columns: minmax(260px, 0.9fr) minmax(340px, 1.35fr);
  gap: 12px;
  padding: 14px;
}

.renewal-kpis,
.total-strip,
.insight-kpis {
  gap: 8px;
}

.renewal-kpi,
.total-chip,
.insight-kpis article {
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: none;
}

.chart-track,
.insight-bar-track {
  background: #e9eef5;
}

.risk-table th,
.data-table th,
.insight-table th {
  color: #465468;
}

.risk-table th {
  background: #fff7e6;
}

.data-table th,
.insight-table th {
  background: #f0f6ff;
}

.risk-table tbody tr:nth-child(even),
.data-table tbody tr:nth-child(even),
.insight-table tbody tr:nth-child(even) {
  background: #fbfcfe;
}

.risk-table tbody tr:hover,
.data-table tbody tr:hover,
.insight-table tbody tr:hover {
  background: #f4f9ff;
}

.table-panel,
.renewal-panel {
  overflow: hidden;
}

.table-edit-btn,
.table-delete-btn {
  min-height: 32px;
  box-shadow: none;
}

.insights-heading {
  margin-top: 22px;
}

.insight-accordion-grid {
  gap: 9px;
}

.insight-accordion {
  box-shadow: none;
}

.insight-accordion summary {
  min-height: 54px;
  background: #ffffff;
  padding: 12px 14px;
}

.insight-accordion[open] summary {
  background: #f5fbfa;
}

.insight-accordion summary::after {
  border: 1px solid #bfd9d5;
  background: #ffffff;
}

.insight-content {
  padding: 14px;
}

.insight-bar-row {
  grid-template-columns: 165px minmax(180px, 1fr) 230px;
}

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

  .panel {
    position: static;
    max-height: none;
  }

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

  .filters input {
    grid-column: 1 / -1;
  }

  .product-filter-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100% - 18px, 1500px);
  }

  .topbar,
  .toolbar > div:first-child,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-logo {
    width: 92px;
  }

  .metrics,
  .filters,
  .renewal-kpis,
  .same-month-kpis,
  .opportunity-tabs,
  .insight-kpis,
  .insight-bar-row {
    grid-template-columns: 1fr;
  }

  .same-month-chart {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .same-month-column {
    min-height: 230px;
  }

  .same-month-bars {
    min-height: 168px;
  }

  .same-month-bar-group {
    grid-template-rows: 116px auto auto auto;
  }

  .same-month-track {
    height: 116px;
  }

  .toolbar p {
    display: block;
    margin-left: 0;
  }
}
