:root {
  --bg: #f3f6f4;
  --panel: #ffffff;
  --ink: #1c2522;
  --muted: #65716c;
  --line: #dce3df;
  --teal: #157a6e;
  --teal-dark: #0f5d55;
  --mint: #dff4eb;
  --blue: #355c8a;
  --amber: #a76512;
  --red: #b42318;
  --green: #217345;
  --violet: #6f4aa2;
  --shadow: 0 18px 60px rgba(27, 38, 33, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

button:disabled,
select:disabled,
input:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(21, 122, 110, 0.14), transparent 34%),
    linear-gradient(315deg, rgba(53, 92, 138, 0.12), transparent 38%),
    var(--bg);
}

.login-panel {
  width: min(430px, 100%);
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.login-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: linear-gradient(90deg, var(--teal), var(--blue), var(--green));
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-weight: 800;
}

.login-panel h1,
.topbar h1,
.panel h2,
.detail-panel h2 {
  margin: 0;
  line-height: 1.1;
}

.login-panel p {
  color: var(--muted);
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.login-link {
  width: 100%;
  margin-top: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 94px;
  resize: vertical;
}

.login-form button,
.primary-button,
.danger-button,
.safe-button,
.ghost-button,
.text-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
}

.login-form button,
.primary-button {
  background: var(--teal);
  color: white;
}

.danger-button {
  background: var(--red);
  color: white;
}

.safe-button {
  background: var(--green);
  color: white;
}

.ghost-button {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.form-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.text-button {
  background: transparent;
  color: var(--teal-dark);
  padding-inline: 8px;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 380px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(21, 122, 110, 0.2), transparent 220px),
    #16231f;
  color: #eef6f2;
}

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

.sidebar-brand span {
  display: block;
  color: #a9bab2;
  font-size: 0.875rem;
  margin-top: 3px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 12px;
  background: transparent;
  color: #d7e6e0;
  text-align: left;
  font-weight: 800;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  box-shadow: inset 3px 0 0 var(--mint);
}

.outbound-card {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.outbound-card p {
  margin: 0;
  color: #cfe0da;
  line-height: 1.45;
  font-size: 0.875rem;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

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

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-pill,
.readiness-pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 5px 10px;
  background: #e8efeb;
  color: var(--ink);
  font-weight: 800;
  font-size: 0.8125rem;
}

.user-pill {
  background: var(--mint);
  color: var(--teal-dark);
}

.readiness-pill {
  background: #17231f;
  color: #f7fbf9;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 900;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.command-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 18px;
  align-items: stretch;
  padding: 20px;
  margin-bottom: 16px;
  border-radius: 8px;
  color: #f8fffc;
  background:
    linear-gradient(135deg, rgba(21, 122, 110, 0.96), rgba(30, 54, 78, 0.98)),
    #173b3a;
  box-shadow: 0 18px 48px rgba(21, 56, 51, 0.2);
}

.command-band .eyebrow {
  color: #bfe7dc;
}

.command-band h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2.4vw, 2rem);
  line-height: 1.15;
  max-width: 780px;
}

.command-status {
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.command-status span {
  color: #cde9e0;
  font-size: 0.8125rem;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-card,
.panel,
.detail-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(28, 37, 34, 0.05);
}

.summary-card {
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--teal), var(--blue));
}

.summary-card strong {
  display: block;
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: 8px;
}

.summary-card span {
  color: var(--muted);
  font-weight: 700;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.panel {
  padding: 16px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.readiness-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.readiness-list,
.checklist-grid {
  display: grid;
  gap: 10px;
}

.readiness-item,
.check-card {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.readiness-item span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.integration-item {
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.7fr);
  align-items: center;
}

code {
  display: block;
  padding: 9px 10px;
  border-radius: 8px;
  background: #edf3f0;
  color: #27443c;
  overflow-wrap: anywhere;
  font-size: 0.8125rem;
}

.handoff-panel {
  margin-bottom: 20px;
}

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

.check-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.stack-list,
.review-list,
.inquiry-grid,
.discovery-grid {
  display: grid;
  gap: 10px;
}

.lead-row,
.review-card,
.inquiry-card,
.discovery-card,
.timeline-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfb;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.lead-row:hover,
.review-card:hover,
.inquiry-card:hover,
.discovery-card:hover {
  border-color: #b8cac3;
  box-shadow: 0 10px 28px rgba(22, 35, 31, 0.08);
  transform: translateY(-1px);
}

.lead-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.lead-row button {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.lead-row strong,
.review-card strong,
.inquiry-card strong,
.discovery-card strong {
  display: block;
  margin-bottom: 4px;
}

.muted {
  color: var(--muted);
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.priority-CALL_NOW {
  background: #e5f4ec;
  color: var(--green);
}

.priority-CALL_NEXT {
  background: #e8eef8;
  color: var(--blue);
}

.priority-RESEARCH_FIRST {
  background: #fff4df;
  color: var(--amber);
}

.priority-DO_NOT_CALL {
  background: #fbe8e6;
  color: var(--red);
}

.priority-Hot {
  background: #fbe8e6;
  color: var(--red);
}

.priority-Warm {
  background: #fff4df;
  color: var(--amber);
}

.priority-Research {
  background: #e8eef8;
  color: var(--blue);
}

.discovery-card {
  display: grid;
  gap: 10px;
}

.discovery-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.discovery-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.score-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 900;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 190px 190px;
  gap: 12px;
  margin-bottom: 14px;
  align-items: end;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

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

th {
  position: sticky;
  top: 0;
  background: #eef3f0;
  font-size: 0.8125rem;
  color: var(--muted);
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f8faf8;
}

.practice-button {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
  padding: 0;
  text-align: left;
}

.detail-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-top: 0;
  border-bottom: 0;
  border-right: 0;
  border-radius: 0;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(21, 122, 110, 0.08), transparent 180px),
    var(--panel);
}

.empty-detail {
  display: grid;
  align-content: center;
  min-height: 70vh;
  color: var(--muted);
}

.detail-section {
  display: grid;
  gap: 12px;
  padding-block: 16px;
  border-bottom: 1px solid var(--line);
}

.detail-section:last-child {
  border-bottom: 0;
}

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

.field {
  min-width: 0;
}

.field span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.field strong,
.field a {
  overflow-wrap: anywhere;
}

.field a {
  color: var(--teal-dark);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.account-tools {
  display: grid;
  gap: 14px;
}

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

.tool-form strong {
  display: block;
  margin-bottom: 4px;
}

.tool-form .muted {
  margin: 0;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
}

.link-box {
  display: block;
  margin-top: 8px;
  padding: 10px;
  border-radius: 8px;
  background: #eef3f0;
  color: var(--ink);
  overflow-wrap: anywhere;
  white-space: normal;
}

.detail-actions,
.review-actions,
.inquiry-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.review-card textarea {
  margin-block: 10px;
}

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

.timeline-item {
  display: grid;
  gap: 4px;
}

.status-note {
  padding: 10px 12px;
  border-radius: 8px;
  background: #eef3f0;
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .detail-panel {
    position: fixed;
    inset: auto 16px 16px 16px;
    height: min(72vh, 680px);
    z-index: 10;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    transform: translateY(calc(100% + 24px));
    transition: transform 160ms ease;
  }

  .detail-panel.is-open {
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .summary-grid,
  .split-grid,
  .command-band,
  .readiness-grid,
  .checklist-grid,
  .inline-form,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
