:root {
  --ink: #17201a;
  --muted: #66736a;
  --line: #dce4dc;
  --panel: #ffffff;
  --page: #f6f8f3;
  --forest: #0d3b2e;
  --leaf: #2e7d47;
  --mint: #e7f4ea;
  --gold: #d7a928;
  --gold-soft: #fff4cf;
  --clay: #b45432;
  --blue: #2c6f9f;
  --red: #b33242;
  --shadow: 0 18px 44px rgba(22, 32, 26, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(215, 169, 40, 0.08), transparent 360px),
    var(--page);
}

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

button {
  color: inherit;
}

.inline-link {
  color: var(--leaf);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 0.22rem;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 272px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background:
    linear-gradient(150deg, rgba(215, 169, 40, 0.16), transparent 34%),
    var(--forest);
  color: #fff;
  z-index: 20;
}

.brand,
.top-actions,
.section-head,
.table-tools,
.search-box,
.sync-pill,
.drawer-header,
.tabbar,
.action-meta,
.quick-actions,
.stage-controls,
.event-feed-head {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand > div:last-child {
  min-width: 0;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gold) 0 50%, var(--leaf) 50% 100%);
  color: #07120c;
  font-weight: 900;
}

.brand span,
.operator-note span,
.eyebrow {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 800;
}

.brand span,
.operator-note span {
  color: #f7d86d;
}

.brand strong {
  display: block;
  margin-top: 2px;
  font-size: 0.98rem;
  line-height: 1.2;
}

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

nav a {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.76);
  font-weight: 700;
}

nav a:hover,
nav a.active {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--gold);
}

i,
svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.operator-note {
  margin-top: auto;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.operator-note p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.74);
  line-height: 1.45;
}

main {
  margin-left: 272px;
  padding: 24px;
  display: grid;
  gap: 18px;
}

.topbar,
.panel,
.command-strip article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topbar {
  min-height: 118px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background:
    linear-gradient(90deg, rgba(46, 125, 71, 0.12), transparent 52%),
    #fff;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--leaf);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.95rem;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 0.98rem;
  letter-spacing: 0;
}

.top-actions,
.section-head,
.table-tools,
.tabbar {
  gap: 10px;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 16px;
}

.primary-btn,
.secondary-btn,
.icon-btn,
.tab,
select {
  min-height: 40px;
  border-radius: 8px;
}

.primary-btn,
.secondary-btn,
.icon-btn,
.tab {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  cursor: pointer;
}

.primary-btn {
  padding: 0 16px;
  background: var(--forest);
  color: #fff;
}

.secondary-btn {
  padding: 0 14px;
  background: var(--gold-soft);
  color: #4b3910;
  border: 1px solid #eedb91;
}

.icon-btn {
  width: 40px;
  background: #f1f5f0;
  color: var(--forest);
  border: 1px solid var(--line);
}

select,
input,
textarea {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

select {
  padding: 0 34px 0 12px;
}

.command-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.command-strip article {
  padding: 16px;
}

.command-strip span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.command-strip strong {
  display: block;
  margin: 7px 0 2px;
  font-size: 1.65rem;
}

.command-strip small {
  color: var(--muted);
}

.workbench,
.system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 18px;
  min-width: 0;
  overflow: hidden;
}

.action-list {
  display: grid;
  gap: 10px;
}

.action-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  padding: 12px;
  background: #fffdfa;
}

.action-item.urgent {
  border-left-color: var(--red);
}

.action-item.done {
  opacity: 0.62;
}

.action-item strong {
  display: block;
  margin-bottom: 4px;
}

.action-item p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.45;
}

.action-meta {
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.quick-actions {
  gap: 8px;
  margin-top: 10px;
}

.mini-btn {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--forest);
  font-weight: 800;
  cursor: pointer;
}

.search-box {
  min-height: 40px;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.search-box input {
  width: 180px;
  border: 0;
  outline: 0;
}

.client-table-wrap {
  overflow-x: auto;
}

.client-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.client-table th,
.client-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 0.88rem;
}

.client-table th {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.client-table tbody tr {
  cursor: pointer;
}

.client-table tbody tr:hover {
  background: #f9fbf6;
}

.client-name strong,
.client-name span {
  display: block;
}

.client-name span {
  color: var(--muted);
  margin-top: 2px;
}

.client-category-pill {
  display: inline-flex;
  width: max-content;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #604500;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

.status-pill,
.sync-pill,
.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.sync-pill {
  color: var(--forest);
  background: var(--mint);
}

.status-pill {
  color: var(--forest);
  background: #eef5ee;
}

.status-pill.warn {
  color: #604500;
  background: var(--gold-soft);
}

.status-pill.red {
  color: #7b1c28;
  background: #ffe8eb;
}

.status-pill.blue {
  color: #124968;
  background: #e7f3fa;
}

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(145px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.stage-card {
  min-height: 116px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.stage-card strong,
.stage-card span {
  display: block;
}

.stage-card strong {
  font-size: 0.86rem;
  line-height: 1.25;
}

.stage-card span {
  margin-top: 8px;
  font-size: 1.45rem;
  font-weight: 900;
}

.stage-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.proposal-layout,
.voice-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  min-width: 0;
}

.proposal-form {
  display: grid;
  gap: 10px;
}

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

textarea,
input {
  width: 100%;
  border-radius: 8px;
  padding: 10px;
}

textarea {
  min-height: 86px;
  resize: vertical;
  line-height: 1.45;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: 1.5;
}

.proposal-output,
.call-script {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.proposal-output div,
.call-script,
.health-item,
.fulfillment-card,
.voice-item,
.drawer-summary,
.detail-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.proposal-output div {
  padding: 13px;
}

.proposal-output strong,
.proposal-output span {
  display: block;
}

.proposal-output span,
.call-script p,
.detail-block p {
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.fulfillment-grid,
.voice-list,
.health-list,
.event-feed {
  display: grid;
  gap: 10px;
}

.fulfillment-card,
.voice-item,
.health-item,
.event-item {
  padding: 13px;
  min-width: 0;
}

.fulfillment-card header,
.voice-item header,
.health-item,
.event-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.event-feed-head {
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.event-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.event-item p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.event-item time {
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.metric-row div {
  padding: 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.metric-row span,
.metric-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.metric-row span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.voice-item p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(760px, calc(100vw - 24px));
  transform: translateX(105%);
  transition: transform 180ms ease;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 64px rgba(22, 32, 26, 0.18);
  z-index: 40;
  padding: 20px;
  overflow-y: auto;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  justify-content: space-between;
  gap: 12px;
}

.drawer-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  padding: 12px;
  margin: 16px 0;
}

.drawer-summary div {
  min-width: 0;
}

.drawer-summary span,
.drawer-summary strong {
  display: block;
}

.drawer-summary span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.tabbar {
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.tab {
  padding: 0 12px;
  background: #f3f6f2;
  color: var(--forest);
}

.tab.active {
  background: var(--forest);
  color: #fff;
}

.drawer-body {
  padding-top: 16px;
  display: grid;
  gap: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.detail-block {
  padding: 14px;
}

.detail-block.full {
  grid-column: 1 / -1;
}

.detail-block h3 {
  margin-bottom: 8px;
}

.stage-controls {
  flex-wrap: wrap;
  gap: 8px;
}

.portal-invite-system {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 10px;
}

.portal-invite-system > div,
.portal-invite-system li {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.portal-invite-system span,
.portal-invite-system small,
.portal-invite-system strong {
  display: block;
  overflow-wrap: anywhere;
}

.portal-invite-system span,
.portal-invite-system small,
.portal-invite-system p {
  color: var(--muted);
}

.portal-invite-system span {
  font-size: 0.72rem;
  font-weight: 800;
}

.portal-invite-system button,
.portal-invite-system p,
.portal-invite-system ol {
  grid-column: 1 / -1;
}

.portal-invite-system p {
  margin: 0;
}

.portal-invite-system ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.category-form,
.admin-upload-form,
.commerce-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  align-items: end;
  gap: 10px;
}

.category-form label,
.admin-upload-form label,
.commerce-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.category-form input,
.admin-upload-form input,
.category-form select,
.admin-upload-form select,
.commerce-form input,
.commerce-form select,
.commerce-form textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.commerce-form textarea {
  min-height: 88px;
  padding: 10px;
  resize: vertical;
}

.commerce-form .full {
  grid-column: 1 / -1;
}

.commerce-summary,
.payment-schedule {
  display: grid;
  gap: 10px;
}

.commerce-summary {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.commerce-summary div,
.payment-schedule div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.commerce-summary span,
.payment-schedule span,
.payment-schedule small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.commerce-summary strong,
.payment-schedule strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.payment-schedule {
  margin-top: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.invoice-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.invoice-share-actions .mini-btn {
  align-items: center;
  display: inline-flex;
  padding: 0 12px;
  text-decoration: none;
}

.admin-upload-form input[type="file"] {
  padding: 8px 10px;
}

.form-status {
  align-self: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.intake-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.intake-field-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.intake-field-grid span,
.intake-field-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.intake-field-grid span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.intake-field-grid strong {
  font-size: 0.88rem;
  line-height: 1.35;
}

.file-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.file-card-mini {
  display: grid;
  gap: 5px;
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--leaf);
  border-radius: 8px;
  color: inherit;
  background: #fff;
  text-decoration: none;
}

.file-card-mini strong,
.file-card-mini span {
  display: block;
  overflow-wrap: anywhere;
}

.file-card-mini span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(13, 59, 46, 0.28);
  opacity: 0;
  pointer-events: none;
  z-index: 35;
}

.scrim.open {
  opacity: 1;
  pointer-events: auto;
}

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

@media (max-width: 1180px) {
  .command-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .workbench,
  .system-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .sidebar {
    position: static;
    width: auto;
  }

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

  main {
    margin-left: 0;
    padding: 14px;
  }

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

  .command-strip,
  .proposal-layout,
  .voice-panel,
  .drawer-summary,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .table-tools {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .search-box input {
    width: 100%;
  }
}

/* Meal Plan UI */

.meal-plan-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.meal-plan-card {
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .15s;
}

.meal-plan-card.active-plan {
  border-color: var(--leaf);
  background: var(--mint);
}

.meal-plan-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.meal-plan-card-head strong {
  font-size: .92rem;
  color: var(--ink);
}

.meal-plan-focus {
  font-size: .8rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

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

.meal-plan-meta span {
  background: var(--line);
  border-radius: 4px;
  padding: 1px 6px;
}

.meal-plan-assigned {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meal-plan-badge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.meal-plan-badge strong {
  font-size: 1rem;
  color: var(--ink);
}

.recipe-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.recipe-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.recipe-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.recipe-card-head strong {
  line-height: 1.25;
}

.recipe-card p,
.recipe-card small {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.grocery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 8px;
}

.grocery-grid div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.grocery-grid span,
.grocery-grid strong {
  display: block;
}

.grocery-grid span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

.pairing-list article {
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: #fff;
}

.pairing-list strong,
.pairing-list span {
  display: block;
}

.pairing-list span {
  margin-top: 3px;
  color: var(--leaf);
  font-weight: 800;
}

.pairing-list p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.4;
}
