:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #202124;
  background: #f7f8fa;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: #f7f8fa;
  font-size: 14px;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }

.market-toolbar {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid #e1e4e8;
  background: #fff;
}

.market-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }

.brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #b90022;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.market-kicker { color: #7a5b60; font-size: 10px; font-weight: 800; text-transform: uppercase; }
h1 { margin: 2px 0 0; font-size: 20px; line-height: 1.1; }

.node-state {
  flex: 0 0 auto;
  border: 1px solid #b8dfcd;
  border-radius: 999px;
  padding: 5px 8px;
  background: #edf8f2;
  color: #17623f;
  font-size: 11px;
  font-weight: 800;
}

.market-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 16px 18px 22px; }
.publish-panel { min-width: 0; padding: 12px 0 16px; border-bottom: 1px solid #dfe3e8; }
.publish-panel[hidden] { display: none; }
.publish-heading { display: flex; align-items: baseline; gap: 12px; }
.publish-heading h2 { margin: 0 0 12px; font-size: 16px; }
.publish-heading span { color: #686d73; font-size: 12px; }
#publishForm { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
#publishForm label { display: grid; min-width: 0; gap: 5px; color: #454a52; font-size: 12px; font-weight: 700; }
#publishForm input[type=file] { width: 100%; max-width: 100%; min-width: 0; }
#publishForm input:not([type=file]), #publishForm select, #publishForm textarea {
  min-width: 0; width: 100%; border: 1px solid #d9dde3; border-radius: 6px; padding: 8px; background: #fff; color: #202124;
}
#publishForm .publish-description, #publishForm .publish-file { grid-column: span 2; }
#publishForm button { justify-self: start; }
#publishFeedback { margin: 8px 0 0; min-height: 18px; color: #5b6066; overflow-wrap: anywhere; }
.market-controls { display: grid; gap: 10px; }

.market-search input {
  width: 100%;
  height: 40px;
  border: 1px solid #d9dde3;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: #202124;
  outline: none;
}

.market-search input:focus { border-color: #b90022; box-shadow: 0 0 0 3px rgba(185, 0, 34, .08); }

.market-tabs {
  width: max-content;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 3px;
  padding: 3px;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  background: #eef0f3;
  overflow: auto;
}

.market-tab {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: #62676f;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.market-tab.active { background: #fff; color: #202124; box-shadow: 0 1px 3px rgba(32, 33, 36, .1); }
.market-meta { min-height: 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #6b7078; font-size: 12px; }
.market-meta strong { color: #3c4043; }
#marketFeedback { text-align: right; }

.plugin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.plugin-card {
  min-width: 0;
  min-height: 205px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  padding: 14px;
  border: 1px solid #dde1e6;
  border-radius: 8px;
  background: #fff;
}

.plugin-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.plugin-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }

.plugin-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #fcecef;
  color: #a4001e;
  font-weight: 900;
}

.plugin-mark.feishu { background: #eaf2ff; color: #1559a6; }
.plugin-mark.kicad { background: #ecebff; color: #5146a8; }
.plugin-mark.easyeda { background: #e9f7f2; color: #137356; }
.plugin-card h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.plugin-author { margin-top: 3px; color: #777c84; font-size: 11px; }

.plugin-kind {
  flex: 0 0 auto;
  border: 1px solid #dde1e6;
  border-radius: 999px;
  padding: 3px 6px;
  color: #676c73;
  font-size: 10px;
  font-weight: 800;
}

.plugin-summary { margin: 0; color: #575c64; font-size: 12px; line-height: 1.55; }
.plugin-tags { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 5px; }
.plugin-tag { border-radius: 5px; padding: 4px 6px; background: #f1f3f5; color: #555a62; font-size: 10px; font-weight: 700; }
.plugin-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid #eceef1; }
.plugin-version { color: #7a7f86; font-size: 11px; }

.plugin-action {
  min-height: 32px;
  border: 1px solid #b90022;
  border-radius: 7px;
  padding: 0 11px;
  background: #b90022;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.plugin-action:hover:not(:disabled) { background: #94001b; border-color: #94001b; }
.plugin-action:disabled { cursor: default; border-color: #d8dce1; background: #f1f3f5; color: #73777e; }
.market-empty { grid-column: 1 / -1; min-height: 180px; display: grid; place-items: center; border: 1px dashed #d7dbe0; border-radius: 8px; color: #777c84; background: #fff; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
  .market-toolbar { padding: 12px; }
  .market-main { padding: 12px; }
  .plugin-grid { grid-template-columns: 1fr; }
  .plugin-card { min-height: 190px; }
  #publishForm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #publishForm .publish-description, #publishForm .publish-file { grid-column: 1 / -1; }
}
