:root {
  color-scheme: light;
  font-family: Inter, "Microsoft YaHei", Arial, sans-serif;
  background: #f6f7f5;
  color: #18201b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

[v-cloak] {
  display: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

#app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}

.sidebar {
  background: #132018;
  color: #f4f7ef;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.sidebar h1 {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: 0;
}

.sidebar p {
  margin: 0;
  color: #bcc8b7;
  font-size: 13px;
  line-height: 1.6;
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.sidebar button {
  text-align: left;
  color: #dfe7da;
  background: transparent;
  padding: 11px 12px;
  border-radius: 6px;
}

.sidebar button.active,
.sidebar button:hover {
  background: #284231;
  color: #fff;
}

.workspace {
  min-width: 0;
}

.topbar {
  height: 68px;
  border-bottom: 1px solid #dfe4dc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: #fbfcfa;
}

.topbar div {
  display: grid;
  gap: 4px;
}

.topbar span {
  color: #667064;
  font-size: 13px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 96px 70px;
  gap: 8px;
  margin-bottom: 16px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd7cc;
  border-radius: 6px;
  background: #fff;
  color: #18201b;
  padding: 9px 10px;
  outline: none;
}

textarea {
  min-height: 78px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #36745a;
  box-shadow: 0 0 0 3px rgba(54, 116, 90, 0.12);
}

.ok {
  color: #20734e;
  font-style: normal;
}

.muted {
  color: #879083;
  font-style: normal;
}

.editor,
.panel {
  padding: 24px 28px 40px;
}

.market-page {
  width: 100%;
  overflow-x: auto;
}

.form-page .editor {
  max-width: 920px;
  padding: 0;
}

.form-head,
.section-head,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.form-tools {
  display: flex;
  align-items: center;
  gap: 14px;
}

h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h2 {
  font-size: 21px;
}

h3 {
  font-size: 16px;
}

.grid {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

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

label {
  display: grid;
  gap: 7px;
  color: #455044;
  font-size: 13px;
}

.full {
  grid-column: 1 / -1;
}

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

.switch input {
  width: auto;
}

.primary,
.filters button,
.section-head button {
  background: #2f6f55;
  color: #fff;
  border-radius: 6px;
  padding: 9px 13px;
}

.ghost {
  background: #edf1eb;
  color: #425041;
  border-radius: 6px;
  padding: 9px 12px;
}

.danger {
  background: #9d2f2f;
  color: #fff;
  border-radius: 6px;
  padding: 9px 13px;
}

.map-tools {
  position: relative;
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
  z-index: 5;
}

.suggestions {
  position: absolute;
  z-index: 10000;
  top: 67px;
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #cfd7cc;
  border-radius: 7px;
  box-shadow: 0 12px 28px rgba(22, 31, 25, 0.14);
  pointer-events: auto;
}

.suggestions button {
  width: 100%;
  background: #fff;
  text-align: left;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid #edf0eb;
}

.suggestions small {
  color: #667064;
}

.map-box {
  position: relative;
  z-index: 1;
  height: 280px;
  border: 1px solid #cfd7cc;
  border-radius: 7px;
  background: #e8ece5;
}

.rules {
  border-top: 1px solid #dfe4dc;
  border-bottom: 1px solid #dfe4dc;
  padding: 18px 0;
  margin-bottom: 18px;
}

.rule-row {
  display: grid;
  grid-template-columns: 132px 120px 120px auto;
  gap: 8px;
  margin-bottom: 8px;
}

.multi-select {
  position: relative;
}

.multi-select-trigger {
  width: 100%;
  min-height: 39px;
  text-align: left;
  border: 1px solid #cfd7cc;
  border-radius: 6px;
  background: #fff;
  color: #18201b;
  padding: 9px 10px;
}

.multi-select-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #cfd7cc;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(22, 31, 25, 0.14);
  padding: 6px;
}

.multi-select-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 5px;
  color: #18201b;
}

.multi-select-menu label:hover {
  background: #eef5ef;
}

.multi-select-menu input {
  width: auto;
}

table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid #e5e9e2;
  vertical-align: top;
}

th {
  color: #667064;
  font-weight: 600;
}

.empty {
  color: #667064;
  text-align: center;
  padding: 24px;
}

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

  .sidebar {
    padding: 16px;
  }

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

  .grid.two,
  .rule-row,
  .filters {
    grid-template-columns: 1fr;
  }

  .correction-drawer {
    width: 100vw;
  }
}

.correction-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 900;
  width: min(920px, calc(100vw - 232px));
  height: 100vh;
  overflow-y: auto;
  background: #fff;
  box-shadow: -12px 0 36px rgba(0, 0, 0, 0.18);
  border-left: 1px solid #dfe4dc;
}

.correction-drawer .editor {
  max-width: none;
  padding: 0;
}

.correction-context {
  border: 1px solid #dfe4dc;
  border-left: 4px solid #2f6f55;
  border-radius: 8px;
  background: #f7faf5;
  padding: 12px 14px;
  margin-bottom: 16px;
  color: #425041;
}

.correction-context p {
  margin: 6px 0 0;
  line-height: 1.5;
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(20, 30, 20, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}

.modal {
  width: min(720px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.25);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.modal-head h3 {
  margin: 0;
}

.modal-hint {
  color: #5d6b58;
  font-size: 13px;
  margin: 4px 0;
}

.modal .map-box {
  height: 320px;
  margin: 12px 0;
}

.modal .actions {
  margin-top: 16px;
}
