:root {
  --red: #ae1f2c;
  --charcoal: #202428;
  --muted: #62686d;
  --line: #d1d5d7;
  --soft: #f5f6f7;
  --surface: #fff;
  --green: #17633f;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--charcoal);
  background: var(--soft);
  font-size: 16px;
  letter-spacing: 0;
}
* {
  box-sizing: border-box;
}
#draft-entry {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid #858c90;
  border-radius: 4px;
  background: var(--surface);
  color: var(--charcoal);
  font-size: 14px;
  cursor: pointer;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid #146b62;
  outline-offset: 3px;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin-top: 6px;
  padding: 10px 11px;
  border: 1px solid #858c90;
  border-radius: 4px;
  background: #fff;
  color: var(--charcoal);
  font-size: 15px;
}
textarea {
  min-height: 88px;
  resize: vertical;
}
h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}
h1 {
  font-size: 28px;
}
h2 {
  font-size: 21px;
}
h3 {
  font-size: 16px;
}
p {
  line-height: 1.5;
}
[hidden] {
  display: none !important;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: 18px 32px;
  border-bottom: 3px solid var(--red);
  background: var(--surface);
}
.brand {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 18px;
  color: inherit;
  text-decoration: none;
}
.brand strong {
  font-size: 21px;
}
.brand span,
#identity {
  color: var(--muted);
  font-size: 14px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px;
}

.button-primary {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}
.button-secondary {
  background: #fff;
}
.login-panel {
  max-width: 380px;
  margin-top: 20px;
  padding: 30px 0;
  border-top: 1px solid var(--line);
}
.login-panel h1 {
  margin-bottom: 22px;
}
.login-panel #google-signin {
  min-height: 44px;
}
.login-panel #retry {
  margin-top: 16px;
}
.notice {
  margin: 20px 0;
  padding: 12px 14px;
  border-left: 4px solid;
  overflow-wrap: anywhere;
}
.notice-error {
  border-color: var(--red);
  background: #fff1f2;
  color: #861623;
}
.notice-success {
  border-color: #237a53;
  background: #e9f3ee;
  color: var(--green);
}

.workspace-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.workspace-heading p,
.state-message {
  color: var(--muted);
  font-size: 14px;
}
.workspace-heading p {
  margin: 7px 0 0;
}
.workspace-heading nav {
  display: flex;
  gap: 20px;
  padding-top: 8px;
}
.workspace-heading a,
.quote-actions a {
  color: #145e66;
  text-underline-offset: 3px;
}
#sales-notices .notice {
  margin: 14px 0;
}
.tabs {
  display: flex;
  gap: 4px;
  margin: 26px 0 24px;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  min-height: 44px;
  padding: 11px 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
}
.tabs button[aria-selected="true"] {
  border-color: var(--red);
  color: #8b1723;
  font-weight: 700;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.order-context,
.catalog-filters,
.form-grid,
.order-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.order-context {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.catalog-filters {
  grid-template-columns: minmax(0, 300px) minmax(180px, 240px);
  margin: 18px 0;
}
label {
  display: block;
  color: #42484d;
  font-size: 13px;
  font-weight: 700;
}
.company-results {
  border-bottom: 1px solid var(--line);
}
.company-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  gap: 12px;
  padding: 12px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  text-align: left;
}
.company-result.selected {
  background: #edf3f2;
}
.company-result strong,
.company-result span,
.product-meta strong,
.product-meta span,
.application-row strong,
.application-row span {
  display: block;
  overflow-wrap: anywhere;
}
.company-result span,
.product-meta span,
.application-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.35;
}
tbody tr:last-child td {
  border-bottom: 0;
}
th {
  color: #596166;
  font-size: 12px;
  text-transform: uppercase;
}
.catalog-table th:nth-child(1) {
  width: 43%;
}
.catalog-table th:nth-child(2) {
  width: 17%;
}
.catalog-table th:nth-child(3) {
  width: 15%;
}
.catalog-table th:nth-child(4) {
  width: 25%;
}
.product {
  display: flex;
  min-width: 0;
  gap: 12px;
}
.product-image {
  width: 54px;
  height: 54px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  object-fit: cover;
}
.product-meta {
  min-width: 0;
}
.unavailable {
  color: #8b1723 !important;
  font-weight: 700;
}
.available {
  color: var(--green);
  font-weight: 700;
}
.quantity {
  display: flex;
  align-items: center;
  gap: 5px;
}
.quantity button {
  width: 36px;
  min-height: 36px;
  height: 36px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}
.quantity input {
  width: 56px;
  min-height: 36px;
  margin: 0;
  padding: 5px;
  text-align: center;
}
.order-details {
  margin-top: 24px;
}
.full-width {
  grid-column: 1 / -1;
}
.order-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
}
.order-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.quote {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 2px solid #2d363a;
}
.quote-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.quote-address {
  margin: 8px 0 0;
  color: #4e565b;
  white-space: pre-line;
  font-size: 14px;
}
.quote table {
  margin: 18px 0;
}
.quote table th:nth-child(1) {
  width: 55%;
}
.quote table th:nth-child(n + 2) {
  width: 15%;
}
.quote-total {
  max-width: 360px;
  margin-left: auto;
}
.quote-total div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 7px 0;
  font-size: 14px;
}
.quote-total .grand-total {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--charcoal);
  font-size: 16px;
  font-weight: 700;
}
.shipping-options {
  margin: 20px 0;
  padding: 14px;
  border-left: 3px solid #146b62;
  background: #eef1f2;
}
.shipping-options p {
  margin: 0 0 8px;
  font-size: 14px;
}
.shipping-options label,
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 9px 0;
  color: var(--charcoal);
  font-size: 14px;
  font-weight: 400;
}
.shipping-options input,
.checkbox input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex: none;
  margin: 0;
}
.quote-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
}

.companies-table th:nth-child(1) {
  width: 24%;
}
.companies-table th:nth-child(2) {
  width: 16%;
}
.companies-table th:nth-child(3) {
  width: 32%;
}
.companies-table th:nth-child(4) {
  width: 15%;
}
.companies-table th:nth-child(5) {
  width: 13%;
}
.company-filter {
  max-width: 460px;
  margin-bottom: 20px;
}
fieldset {
  margin: 26px 0 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
legend {
  padding: 0 5px;
  font-size: 14px;
  font-weight: 700;
}
.form-actions {
  margin-top: 22px;
}
.applications-section {
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.applications-section h3 {
  margin-bottom: 12px;
}
.test-mode-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
  padding: 14px 16px;
  border-left: 4px solid #b61f2e;
  background: #fff1f2;
  color: #5f111a;
}
.test-mode-banner strong {
  flex: none;
  font-size: 13px;
}
.test-company-flow {
  margin-bottom: 28px;
  padding: 20px 0 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.test-company-flow dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.test-company-flow dl div {
  min-width: 0;
}
.test-company-flow dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
}
.test-company-flow dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.application-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.status {
  display: inline-block;
  padding: 5px 8px;
  background: #e3e7e8;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.status.pending-review {
  background: #eef0f1;
  color: #4f575b;
}

@media (max-width: 720px) {
  .site-header {
    align-items: flex-start;
    padding: 16px;
  }
  .brand {
    gap: 7px;
  }
  .header-actions {
    align-items: flex-end;
    flex-direction: column;
    gap: 6px;
  }
  main {
    padding: 24px 16px;
  }
  .workspace-heading {
    flex-direction: column;
    gap: 14px;
  }
  .workspace-heading nav {
    padding-top: 0;
  }
  .order-context,
  .catalog-filters,
  .form-grid,
  .order-details {
    grid-template-columns: 1fr;
  }
  .catalog-table {
    min-width: 680px;
  }
  .companies-table {
    min-width: 760px;
  }
  .order-footer {
    align-items: flex-start;
    flex-direction: column;
  }
  .quote-total {
    width: 100%;
    max-width: none;
    margin-left: 0;
  }
  .application-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .application-row time {
    grid-column: 1 / -1;
  }
  .tabs {
    overflow-x: auto;
  }
  .tabs button {
    white-space: nowrap;
  }
  .test-mode-banner {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
  .test-company-flow dl {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 480px) {
  h1 {
    font-size: 25px;
  }
  .company-result {
    grid-template-columns: 1fr;
  }
  .section-heading,
  .quote-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .quote table {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
  }
  .quote thead {
    display: none;
  }
  .quote tbody {
    display: block;
    width: 100%;
  }
  .quote tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .quote tbody td {
    display: block;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
  }
  .quote tbody td:first-child {
    grid-column: 1 / -1;
  }
  .quote tbody td::before {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }
  .quote tbody td:nth-child(2)::before {
    content: "QUANTITY";
  }
  .quote tbody td:nth-child(3)::before {
    content: "UNIT PRICE";
  }
  .quote tbody td:nth-child(4)::before {
    content: "LINE TOTAL";
  }
  .catalog-table,
  .companies-table {
    min-width: 0;
    table-layout: auto;
  }
  .catalog-table thead,
  .companies-table thead {
    display: none;
  }
  .catalog-table,
  .catalog-table tbody,
  .catalog-table tr,
  .catalog-table td,
  .companies-table,
  .companies-table tbody,
  .companies-table tr,
  .companies-table td {
    display: block;
    width: 100%;
  }
  .catalog-table tr,
  .companies-table tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .catalog-table td,
  .companies-table td {
    padding: 5px 0;
    border: 0;
  }
  .catalog-table td::before,
  .companies-table td::before {
    display: block;
    margin-bottom: 3px;
    color: #596166;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
  }
  .catalog-table td:nth-child(2)::before {
    content: "Category";
  }
  .catalog-table td:nth-child(3)::before {
    content: "Unit price";
  }
  .catalog-table td:nth-child(4)::before {
    content: "Quantity";
  }
  .companies-table td:nth-child(2)::before {
    content: "ABN";
  }
  .companies-table td:nth-child(3)::before {
    content: "Location";
  }
  .companies-table td:nth-child(4)::before {
    content: "Terms";
  }
  .companies-table td:nth-child(5)::before {
    content: "Ordering";
  }
}
