:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #637083;
  --line: #dfe4ea;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #a16207;
  --bad: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 700;
}

h2 {
  font-size: 18px;
  margin-bottom: 14px;
}

#status {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

button,
input,
select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

button {
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  background: var(--accent-dark);
}

input,
select {
  width: 100%;
  padding: 0 10px;
  background: #fff;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 140px 180px 86px;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
}

.results-wrap {
  overflow: auto;
  max-height: calc(100vh - 180px);
  border: 1px solid var(--line);
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  position: sticky;
  top: 0;
  background: #f9fafb;
  z-index: 1;
  color: var(--muted);
  font-weight: 600;
}

td.name {
  min-width: 260px;
  font-weight: 600;
}

td.note {
  color: var(--muted);
  min-width: 160px;
}

.price {
  font-weight: 700;
}

.pending {
  color: var(--warn);
}

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

.quote-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.quote-items {
  display: grid;
  gap: 8px;
  min-height: 120px;
}

.quote-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.quote-item header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.quote-item strong {
  font-size: 13px;
  line-height: 1.35;
}

.quote-item small {
  color: var(--muted);
}

.quote-item button {
  height: 28px;
  padding: 0 8px;
  background: #fff;
  color: var(--bad);
  border-color: #f1b4ad;
}

.item-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.actions {
  display: flex;
  gap: 6px;
}

.actions button {
  padding: 0 8px;
}

button.secondary {
  background: #fff;
  color: var(--accent);
  border-color: var(--accent);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-badge {
  min-width: 72px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.public-hidden {
  display: none;
}

.notice {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(23 32 42 / 36%);
}

.modal[hidden] {
  display: none;
}

.modal-box {
  width: min(360px, 100%);
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 45px rgb(23 32 42 / 18%);
}

.modal-box header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-box h2 {
  margin-bottom: 0;
}

.icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.totals {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.totals div {
  display: flex;
  justify-content: space-between;
}

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

  .filters {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .filters {
    grid-template-columns: 1fr;
  }
}
