:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --border: #d9e0e8;
  --text: #17202a;
  --muted: #66717f;
  --accent: #1957c2;
  --accent-dark: #123f8d;
  --good: #15803d;
  --good-bg: #eaf7ee;
  --warn: #a16207;
  --warn-bg: #fff6df;
  --bad: #b42318;
  --bad-bg: #ffefed;
  --shadow: 0 10px 30px rgba(22, 35, 52, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

html {
  scroll-behavior: smooth;
}

button,
input,
select {
  font: inherit;
}

.is-hidden {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: #ffffff;
  padding: 24px 18px;
}

.brand-block {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.brand-block h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
}

.brand-block p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.nav-list,
.sidebar-status,
.sidebar-actions {
  display: grid;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: 38px;
  border-radius: 6px;
  padding: 0 10px;
  color: #263446;
  font-weight: 800;
  text-decoration: none;
}

.nav-link:hover {
  background: #edf3fb;
  color: var(--accent);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn);
  font-weight: 700;
  font-size: 13px;
}

.status-pill.is-ok {
  background: var(--good-bg);
  color: var(--good);
}

.status-muted {
  color: var(--muted);
  font-size: 13px;
}

.main-pane {
  display: grid;
  align-content: start;
  gap: 20px;
  min-width: 0;
  padding: 22px clamp(18px, 3vw, 40px) 32px;
}

.control-panel,
.results-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.control-panel {
  align-self: start;
  padding: 18px;
}

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

.panel-heading,
.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

.results-toolbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.filter-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  align-items: end;
  gap: 13px;
}

label {
  display: grid;
  gap: 6px;
  color: #2f3a47;
  font-weight: 700;
  font-size: 13px;
}

input,
select {
  width: 100%;
  height: 40px;
  border: 1px solid #c8d1dc;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 10px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(25, 87, 194, 0.2);
  outline-offset: 2px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.filter-form > .two-col {
  grid-column: span 2;
}

.filter-form > .primary-button {
  align-self: end;
}

.primary-button,
.secondary-button,
.text-button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  height: 42px;
  background: var(--accent);
  color: #ffffff;
}

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

.primary-button[disabled],
.secondary-button[disabled] {
  cursor: wait;
  opacity: 0.6;
}

.secondary-button {
  height: 36px;
  padding: 0 12px;
  border: 1px solid #b8c4d2;
  background: #ffffff;
  color: #233041;
}

.text-button {
  height: 32px;
  padding: 0 4px;
  background: transparent;
  color: var(--accent);
}

.policy-list {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.policy-list h3 {
  color: #2f3a47;
  font-size: 13px;
  text-transform: none;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  border: 1px solid #c7d3e1;
  border-radius: 999px;
  background: #ffffff;
  color: #243244;
  min-height: 32px;
  padding: 0 10px;
  cursor: pointer;
  font-size: 13px;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summary-grid div {
  min-height: 66px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.summary-grid strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.summary-grid span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.message {
  min-height: 22px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
}

.message.is-error {
  color: var(--bad);
}

.decision-lists {
  display: grid;
  gap: 16px;
}

.decision-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.decision-section.recommend-section {
  border-left: 4px solid var(--good);
}

.decision-section.review-section {
  border-left: 4px solid #d99010;
}

.decision-section.reject-section {
  border-left: 4px solid var(--bad);
}

.decision-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.decision-heading span {
  min-width: 32px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 4px 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}

.empty-list {
  border: 1px dashed #c8d1dc;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 18px;
  text-align: center;
  font-size: 14px;
}

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

.product-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) minmax(128px, 170px);
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.product-image {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e3e8ef;
  background: var(--surface-soft);
}

.product-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.product-title a {
  color: #17202a;
  text-decoration: none;
}

.product-title a:hover {
  color: var(--accent);
}

.product-meta,
.reason-list {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.tag.good {
  background: var(--good-bg);
  color: var(--good);
}

.tag.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.tag.deny {
  background: var(--bad-bg);
  color: var(--bad);
}

.score-box {
  display: grid;
  align-content: start;
  justify-items: end;
  gap: 8px;
  text-align: right;
}

.score {
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
}

.decision {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 900;
}

.decision.recommend {
  color: var(--good);
  background: var(--good-bg);
}

.decision.review {
  color: var(--warn);
  background: var(--warn-bg);
}

.decision.reject {
  color: var(--bad);
  background: var(--bad-bg);
}

.footer {
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.footer a {
  color: var(--accent);
}

.overlay,
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.48);
}

.login-box,
.modal-panel {
  width: min(460px, 100%);
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.24);
  padding: 22px;
}

.login-box h2,
.login-box p {
  margin: 0;
}

.login-box p {
  margin-top: 8px;
  color: var(--muted);
}

.login-form,
.user-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.modal-panel {
  width: min(860px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
}

.modal-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.user-form {
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) 140px 120px;
  align-items: end;
}

.users-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 120px 120px 190px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
}

.user-row strong {
  overflow-wrap: anywhere;
}

.user-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.danger-button {
  height: 32px;
  border: 1px solid #f4b7b2;
  border-radius: 6px;
  background: #ffffff;
  color: var(--bad);
  cursor: pointer;
  font-weight: 800;
}

.mini-button {
  height: 32px;
  border: 1px solid #b8c4d2;
  border-radius: 6px;
  background: #ffffff;
  color: #233041;
  cursor: pointer;
  font-weight: 800;
}

@media (max-width: 920px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

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

  .nav-link {
    justify-content: center;
    text-align: center;
  }

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

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

  .product-row {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .product-image {
    width: 76px;
    height: 76px;
  }

  .score-box {
    grid-column: 1 / -1;
    justify-items: start;
    text-align: left;
  }

  .user-form,
  .user-row {
    grid-template-columns: 1fr;
  }

  .user-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .summary-grid,
  .filter-form,
  .two-col {
    grid-template-columns: 1fr;
  }

  .filter-form > .two-col {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }

  .main-pane {
    padding: 16px 12px 24px;
  }

  .nav-list {
    grid-template-columns: 1fr 1fr;
  }

  .results-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
