:root {
  color-scheme: light;

  --ink: #172923;
  --muted: #687771;
  --line: #e1e8e3;
  --paper: #f5f7f4;
  --white: #ffffff;

  --green: #1c5947;
  --green-dark: #144535;
  --green-soft: #eaf3ee;

  --amber: #805b14;
  --amber-bg: #fff7e5;

  --red: #a53a31;

  font-family: Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}


/* General */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}


/* Header */

.topbar {
  height: 68px;
  padding: 0 max(24px, calc((100% - 1180px) / 2));

  display: flex;
  align-items: center;
  justify-content: space-between;

  background: #14231f;
  color: #fff;
}

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

  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;

  border-radius: 11px;

  display: grid;
  place-items: center;

  background: #d7e8d9;
  color: #18392c;

  font-weight: 800;
}

.brand strong,
.brand small,
.salesperson-chip strong,
.salesperson-chip small {
  display: block;
}

.brand strong {
  font-size: 14px;
  letter-spacing: .02em;
}

.brand small {
  margin-top: 2px;
  color: #b4c4bd;
  font-size: 11px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 9px;

  color: #d8e2dc;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;

  border-radius: 50%;

  background: #8ed1a4;
}


/* Main page */

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 38px auto 60px;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 7px;

  color: var(--green);

  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
}

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

h1 {
  margin-bottom: 7px;

  font-size: clamp(27px, 4vw, 35px);
  letter-spacing: -.04em;
}

.subheading {
  margin: 0;

  color: var(--muted);
  font-size: 14px;
}


/* Salesperson */

.salesperson-chip {
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 8px 13px 8px 8px;

  border: 1px solid var(--line);
  border-radius: 999px;

  background: var(--white);
}

.avatar {
  width: 34px;
  height: 34px;

  border-radius: 50%;

  display: grid;
  place-items: center;

  background: #e5efe7;
  color: var(--green);

  font-weight: 800;
}

.salesperson-chip strong {
  font-size: 12px;
}

.salesperson-chip small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}


/* Price warning */

.notice {
  margin-bottom: 20px;
  padding: 13px 16px;

  border: 1px solid #f0dfb5;
  border-radius: 12px;

  background: var(--amber-bg);
  color: #715115;

  font-size: 12px;
  line-height: 1.55;
}


/* Workspace panels */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 18px;

  align-items: start;
}

.panel {
  min-width: 0;

  padding: 23px;

  border: 1px solid var(--line);
  border-radius: 16px;

  background: var(--white);

  box-shadow: 0 5px 18px rgba(25, 49, 37, .035);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  margin-bottom: 21px;
}

h2 {
  margin: 0;

  font-size: 19px;
  letter-spacing: -.025em;
}

.muted-label,
.quote-count {
  color: var(--muted);
  font-size: 11px;
}

.quote-count,
.draft-tag {
  padding: 6px 9px;

  border-radius: 999px;

  background: var(--green-soft);
  color: var(--green);

  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}


/* Inputs and search */

.field-label {
  display: block;
  margin-bottom: 7px;

  color: #52625b;

  font-size: 11px;
  font-weight: 700;
}

.search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  top: 8px;
  left: 13px;

  color: #718078;

  font-size: 23px;
  line-height: 1;
}

input,
textarea {
  width: 100%;

  border: 1px solid #dce5df;
  border-radius: 9px;

  outline: none;

  background: #fff;
  color: var(--ink);
}

input {
  min-height: 41px;
  padding: 0 12px;

  font-size: 12px;
}

.search-wrap input {
  padding-left: 39px;
}

input:focus,
textarea:focus {
  border-color: #5c927c;

  box-shadow: 0 0 0 3px rgba(64, 125, 99, .11);
}


/* Product results */

.product-results {
  display: grid;
  gap: 9px;

  margin-top: 14px;
}

.product-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 12px;

  border: 1px solid #e7ece8;
  border-radius: 11px;
}

.product-info {
  min-width: 0;
}

.product-name {
  display: block;
  margin-bottom: 4px;

  color: #263830;

  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.product-meta {
  color: var(--muted);

  font-size: 10px;
  line-height: 1.5;
}

.product-price {
  display: block;
  margin-top: 5px;

  color: var(--green);

  font-size: 12px;
  font-weight: 800;
}

.product-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;

  flex-shrink: 0;
}

.stock-label {
  color: var(--muted);
  font-size: 9px;
}

.empty-message {
  margin: 8px 0;

  color: var(--muted);
  font-size: 12px;
}


/* Buttons */

.button {
  min-height: 36px;

  border: 0;
  border-radius: 8px;

  padding: 0 13px;

  cursor: pointer;

  font-size: 11px;
  font-weight: 750;
}

.button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.button-primary {
  background: var(--green);
  color: #fff;
}

.button-primary:hover:not(:disabled) {
  background: var(--green-dark);
}

.button-secondary {
  background: var(--green-soft);
  color: var(--green);
}

.button-small {
  min-height: 30px;
  padding: 0 10px;
}


/* Customer fields */

.customer-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;

  padding-bottom: 17px;

  border-bottom: 1px solid #edf0ed;
}


/* Quotation items */

.quote-lines {
  display: grid;
  gap: 10px;

  padding: 15px 0;
}

.empty-quote {
  min-height: 150px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;

  color: var(--muted);
  text-align: center;
}

.empty-icon {
  width: 35px;
  height: 35px;

  display: grid;
  place-items: center;

  border-radius: 50%;

  background: var(--green-soft);
  color: var(--green);

  font-size: 21px;
}

.empty-quote strong {
  color: #34463d;
  font-size: 12px;
}

.empty-quote span:last-child {
  font-size: 11px;
}

.quote-line {
  padding: 11px 0;

  border-bottom: 1px solid #edf0ed;
}

.quote-line-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.quote-line-name {
  font-size: 11px;
  font-weight: 750;
  line-height: 1.4;
}

.quote-line-meta {
  margin-top: 4px;

  color: var(--muted);
  font-size: 10px;
}

.remove-line {
  border: 0;

  background: transparent;
  color: #8a9690;

  cursor: pointer;

  font-size: 17px;
  line-height: 1;
}

.quote-line-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  margin-top: 10px;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;

  color: var(--muted);
  font-size: 10px;
}

.qty-control input {
  width: 65px;
  min-height: 32px;

  text-align: center;
}

.line-total {
  text-align: right;
}

.line-total strong {
  display: block;
  font-size: 11px;
}

.line-total small {
  color: var(--muted);
  font-size: 9px;
}


/* Financial summary */

.totals {
  padding-top: 13px;

  border-top: 1px solid #e9eeea;
}

.total-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;

  padding: 6px 0;

  color: #62716a;
  font-size: 11px;
}

.total-row strong {
  color: #263830;

  font-size: 11px;
  font-weight: 700;
}

.discount-row strong {
  color: var(--green);
}

.grand-total {
  margin-top: 8px;
  padding-top: 13px;

  border-top: 1px dashed #d9e2dc;

  color: var(--ink);

  font-size: 13px;
  font-weight: 800;
}

.grand-total strong {
  color: var(--green);
  font-size: 18px;
}


/* Approval and errors */

.approval-notice {
  margin-top: 13px;
  padding: 11px 12px;

  border: 1px solid #f0dfb5;
  border-radius: 9px;

  background: var(--amber-bg);
  color: var(--amber);

  font-size: 11px;
  line-height: 1.5;
}

.approval-notice[hidden],
.error-message[hidden] {
  display: none;
}

.error-message {
  margin-top: 12px;

  color: var(--red);
  font-size: 11px;
}


/* WhatsApp reply section */

.reply-panel {
  margin-top: 18px;
}

.reply-heading {
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-description {
  margin: 6px 0 0;

  color: var(--muted);
  font-size: 11px;
}

.draft-tag {
  background: #f1f3f1;
  color: #68756e;
}

textarea {
  min-height: 155px;

  padding: 13px;

  resize: vertical;

  font-size: 12px;
  line-height: 1.6;
}

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

  margin-top: 12px;
}

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

.page-footnote {
  margin: 17px 3px 0;

  color: #7b8982;
  font-size: 10px;
  line-height: 1.5;
}


/* Tablet layout */

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

  .page-shell {
    margin-top: 27px;
  }
}


/* Mobile layout */

@media (max-width: 540px) {
  .topbar {
    height: 60px;
    padding: 0 16px;
  }

  .page-shell {
    width: calc(100% - 24px);
    margin-top: 23px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .salesperson-chip {
    padding: 6px;
  }

  .salesperson-chip > span:last-child {
    display: none;
  }

  .panel {
    padding: 17px;
    border-radius: 13px;
  }

  .customer-fields {
    grid-template-columns: 1fr;
  }

  .reply-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .reply-buttons {
    width: 100%;
    flex-direction: column;
  }

  .reply-actions .button {
    width: 100%;
  }

  .product-card {
    align-items: flex-start;
  }
}

/* Stage 5: mobile and one thumb usability improvements */

button,
input,
textarea {
  touch-action: manipulation;
}

@media (max-width: 540px) {

  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* Larger, easier-to-read input fields. */
  input,
  textarea {
    font-size: 16px;
  }

  input {
    min-height: 50px;
  }

  .search-wrap input {
    min-height: 54px;
  }

  /* Larger touch targets for buttons. */
  .button {
    min-height: 48px;
    padding: 0 16px;
    font-size: 14px;
  }

  .button-small {
    min-height: 48px;
    min-width: 82px;
  }

  .product-actions .button {
    min-width: 88px;
  }

  /* Make product cards easier to interact with. */
  .product-card {
    min-height: 90px;
    padding: 14px 12px;
    gap: 12px;
  }

  .product-name {
    font-size: 14px;
  }

  .product-price {
    font-size: 13px;
  }

  /* Easier quantity selection. */
  .qty-control input {
    width: 78px;
    min-height: 48px;
    font-size: 16px;
  }

  /* Larger remove button. */
  .remove-line {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    font-size: 23px;
  }

  /* Larger message editing area. */
  textarea {
    min-height: 180px;
    padding: 14px;
  }

  /* Large, easy-to-press reply buttons. */
  .reply-buttons {
    width: 100%;
    flex-direction: column;
  }

  .reply-buttons .button {
    width: 100%;
    min-height: 52px;
    font-size: 14px;
  }

  /* Slightly more space between sections. */
  .panel {
    margin-bottom: 2px;
  }
}
