:root {
  font:
    15px "Segoe UI",
    sans-serif;
  color: #193345;
  background: #f2f5f8;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
.top {
  background: #203d5b;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  gap: 12px;
}
.top strong {
  font-size: 25px;
}
.top nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
main {
  max-width: 1260px;
  margin: 26px auto;
  padding: 0 20px;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  border: 1px solid #b9cbdd;
  border-radius: 7px;
  padding: 9px 13px;
  background: #edf5ff;
  color: #245a90;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover {
  filter: brightness(0.97);
}
button:disabled {
  opacity: 0.48;
  cursor: default;
}
button.primary {
  background: #2563ad;
  color: white;
}
button.ready {
  background: #b42335;
  color: white;
  border-color: #b42335;
}
.danger {
  color: #ad2638;
}
input,
textarea,
select {
  padding: 9px;
  border: 1px solid #b8cad7;
  border-radius: 6px;
  width: 100%;
  min-width: 0;
  background: white;
  color: #18374d;
}
input:disabled {
  background: #f0f3f5;
  color: #5d6d79;
}
label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
}
form {
  display: grid;
  gap: 14px;
}
.login {
  max-width: 460px;
  margin: 65px auto;
}
.card,
.panel {
  border: 1px solid #d6e0e8;
  background: white;
  border-radius: 15px;
  padding: 18px;
  margin-bottom: 16px;
}
.title {
  background: #fff2c8;
  color: #594812;
  font-size: 18px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  text-align: left;
}
.card-top,
.toolbar,
.actions,
.heading {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.heading h2 {
  flex: 1;
  text-align: center;
}
.crumb {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}
.crumb .current {
  background: #2463a9;
  color: white;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}
.metric {
  padding: 10px;
  border: 1px solid #c4d8d2;
  border-radius: 10px;
  background: #edf8f1;
  display: grid;
  gap: 7px;
  min-width: 0;
}
.metric strong {
  font-size: 19px;
  overflow-wrap: anywhere;
}
.metric small {
  color: #586d77;
}
.customer .metric {
  background: #edf5ff;
}
.stages,
.stock {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}
.stages span,
.stock button,
.stock span {
  border-radius: 7px;
  padding: 7px 5px;
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
  border: 1px solid #bbd3e9;
  background: #edf5ff;
  min-width: 0;
}
.stages span.on {
  background: #367ec4;
  color: white;
}
.stock button,
.stock span {
  background: #eaf7ee;
  border-color: #b8d8c0;
  color: #205d38;
}
.stock .half {
  background: linear-gradient(90deg, #a3dbb4 50%, #eaf7ee 50%);
}
.stock .full {
  background: #a3dbb4;
}
.stock .locked {
  opacity: 0.55;
}
.stock {
  margin: 10px 0;
}
.terms {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  flex-wrap: wrap;
}
.terms input {
  width: 65px;
}
.terms label {
  display: flex;
  align-items: center;
}
.item-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.prices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.prices.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.price {
  background: #eaf7ee;
  border: 1px solid #bfdbc7;
  border-radius: 10px;
  padding: 10px;
}
.price.customer-price {
  background: #eaf3ff;
  border-color: #bfd5eb;
}
.price small {
  display: block;
  margin: 8px 0 4px;
}
.price strong {
  font-size: 20px;
}
.item-foot {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}
.group {
  border: 1px solid #c9d9e6;
  border-radius: 10px;
  padding: 6px;
  display: flex;
  gap: 6px;
}
.group.stock {
  display: grid;
  margin: 0;
  padding: 6px;
}
.muted {
  color: #617888;
  font-size: 13px;
}
.files {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.file {
  max-width: 170px;
  border: 1px solid #d4dde7;
  border-radius: 8px;
  padding: 6px;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.file img {
  width: 130px;
  height: 75px;
  object-fit: contain;
}
.note {
  margin: 12px 0;
  white-space: pre-wrap;
}
.quote {
  border-color: #deaaaa;
  background: #fff0f0;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table td {
  padding: 9px;
  border-bottom: 1px solid #ddd;
}
dialog {
  border: 1px solid #c4d4e0;
  border-radius: 14px;
  padding: 22px;
  width: min(94vw, 650px);
  max-height: 90dvh;
  overflow: auto;
}
dialog::backdrop {
  background: #10243a88;
}
dialog h2 {
  margin-top: 0;
}
dialog.chat {
  height: min(80dvh, 650px);
  overflow: hidden;
}
dialog.chat[open] {
  display: flex;
  flex-direction: column;
}
.messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  list-style: none;
  padding: 0;
}
.messages li {
  padding: 10px;
  margin: 8px 0;
  background: #eaf3ff;
  border-radius: 8px;
  white-space: pre-wrap;
}
.messages .mine {
  background: #eaf7ee;
}
.messages small {
  display: block;
  color: #657885;
}
.chat form {
  flex-shrink: 0;
}
.closebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#notice:not(:empty) {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  border-radius: 8px;
  padding: 12px 18px;
  max-width: 90vw;
  z-index: 10;
}
input[type="checkbox"] {
  width: auto;
}
.roles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.roles button {
  padding: 70px 12px;
  font-size: 27px;
}
.roles .supplier {
  background: #e2f2e7;
}
.search {
  max-width: 440px;
  margin: 10px 0;
}
a {
  color: #215e9b;
}
.error {
  color: #a62939;
}
@media (max-width: 800px) {
  .split,
  .item-grid {
    grid-template-columns: 1fr;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .item-foot {
    grid-template-columns: 1fr;
  }
  .stages {
    width: 100%;
  }
  .top {
    padding: 12px;
  }
  .roles button {
    font-size: 20px;
    padding: 40px 10px;
  }
}
@media (max-width: 420px) {
  main {
    padding: 0 10px;
  }
  .card {
    padding: 12px;
  }
  .prices {
    gap: 4px;
  }
  .price {
    padding: 6px;
  }
  .stock button,
  .stock span {
    font-size: 9px;
  }
  .fields {
    gap: 7px;
  }
}
.pdf-preview {
  display: block;
  max-width: 100%;
  max-height: 160px;
  object-fit: contain;
  margin: auto;
}
.gallery-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
}
.gallery-stage {
  height: 50dvh;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.gallery-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.source-row {
  display: flex;
  align-items: end;
  gap: 8px;
}
.source-row label {
  flex: 1;
}
.excel-preview {
  overflow: auto;
  max-height: 45dvh;
}
.excel-preview table {
  border-collapse: collapse;
}
.excel-preview input,
.excel-preview select {
  min-width: 90px;
}
.excel-mapping {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
input[type="number"] {
  appearance: textfield;
}
input::-webkit-inner-spin-button,
input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.totals {
  margin: 14px 0 20px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.totals .metric {
  min-height: 85px;
}
.identity-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.roles .customer {
  background: #eaf3ff;
}
.roles button {
  white-space: normal;
  padding: 24px 12px;
  font-size: 18px;
}
.top nav {
  max-width: 760px;
}
dialog form + form {
  border-top: 1px solid #cad8e2;
  padding-top: 18px;
  margin-top: 18px;
}
@media (max-width: 500px) {
  .identity-fields {
    grid-template-columns: 1fr;
  }
  .roles {
    grid-template-columns: 1fr;
  }
}
.attachment-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.attachment-slot {
  position: relative;
  min-width: 0;
}
.attachment-tile {
  width: 100%;
  min-width: 0;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  border: 1px solid #c4d8e9;
  border-radius: 8px;
  padding: 6px;
}
.attachment-tile img {
  width: 100%;
  height: 70px;
  object-fit: contain;
}
.attachment-tile small {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 10px;
}
.document-icon {
  font-size: 34px;
}
.upload-slot {
  font-size: 11px;
  cursor: pointer;
}
.upload-slot input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.remove-attachment {
  position: absolute;
  right: 0;
  top: 0;
  padding: 2px 6px;
  color: #8e2636;
  background: white;
}
.supplier-files .attachment-tile {
  max-width: 140px;
}
.inline-editor {
  border-color: #94b8db;
}
.inline-editor h3 {
  margin: 0 0 12px;
}
.inline-editor .identity-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.item-right {
  min-width: 0;
}
@media (max-width: 650px) {
  .inline-editor .identity-fields {
    grid-template-columns: 1fr 1fr;
  }
}
.firm-counters {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 5px;
}
.firm-counters > span {
  min-width: 0;
  min-height: 58px;
  padding: 6px 3px;
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  border: 1px solid #bfd4e7;
}
.firm-counters .blue {
  background: #edf5ff;
}
.firm-counters .green {
  background: #eaf7ee;
  border-color: #b8d8c0;
}
.firm-counters small {
  font-size: 10px;
  overflow-wrap: anywhere;
}
.firm-counters strong {
  font-size: 16px;
}
@media (max-width: 650px) {
  .firm-counters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.supplier-quote{display:flex;align-items:flex-start;gap:8px;margin:8px 0 14px}.quote-standalone{display:block;max-width:150px}.supplier-quote .pdf-preview{height:100px;width:auto;max-width:150px;object-fit:contain}.customer .metric.quote .pdf-preview{max-height:88px}.customer .metrics{grid-template-columns:repeat(3,minmax(0,1fr))}
