:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #18212b;
  --muted: #657383;
  --line: #d8e0e8;
  --accent: #1677ff;
  --accent-dark: #0d5fd7;
  --ok: #188038;
  --danger: #b3261e;
}

* {
  box-sizing: border-box;
}

[v-cloak] {
  display: none;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.app-shell {
  width: min(1080px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 96px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.25;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 16px;
}

.app-header p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.service-pill {
  min-width: 92px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.service-pill.ok {
  color: var(--ok);
  border-color: #b9dfc3;
}

.service-pill.bad {
  color: var(--danger);
  border-color: #f1b8b4;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.search-panel,
.login-panel,
.admin-panel,
.tool-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.search-panel {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 10px;
  padding: 14px;
}

.login-panel {
  display: grid;
  gap: 12px;
  max-width: 420px;
  margin: 28px auto 0;
  padding: 18px;
}

.admin-panel {
  padding: 16px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.tool-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.user-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.product-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.product-panel .section-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.product-import {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 10px;
}

.product-import-grid {
  display: grid;
  gap: 10px;
  margin: 12px 0 8px;
}

.product-import label {
  display: grid;
  gap: 6px;
}

.product-import label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

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

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
  color: var(--ink);
  background: white;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 2px solid #d6e9ff;
}

button,
.file-action {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  color: white;
  background: var(--accent);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

button:hover,
.file-action:hover {
  background: var(--accent-dark);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secondary {
  color: var(--ink);
  background: #eef2f6;
}

.secondary:hover {
  background: #e0e7ef;
}

.danger {
  background: var(--danger);
}

.danger:hover {
  background: #8f1f19;
}

.result-meta {
  margin: 14px 2px 10px;
  color: var(--muted);
  font-size: 14px;
}

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

.file-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.file-name {
  font-weight: 650;
  overflow-wrap: anywhere;
}

.file-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.file-action {
  display: inline-grid;
  place-items: center;
  min-width: 84px;
  text-decoration: none;
}

.catalog-product {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) 140px minmax(360px, 1.8fr);
  gap: 16px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.catalog-image {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  overflow: hidden;
}

.catalog-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.catalog-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.catalog-title {
  font-size: 17px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.catalog-detail {
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.catalog-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(96px, 1fr));
  gap: 10px;
}

.catalog-fields > div {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

.catalog-fields span {
  color: var(--muted);
  font-size: 12px;
}

.catalog-fields strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.catalog-link {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.catalog-link span {
  grid-column: 1 / -1;
}

.compact-button,
.compact-action {
  min-height: 32px;
  min-width: 70px;
  padding: 0 10px;
  font-size: 13px;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 190px;
  padding: 20px;
  border: 1px dashed #aeb9c5;
  border-radius: 8px;
  background: #fbfcfd;
  text-align: center;
  cursor: pointer;
}

.dropzone.dragging {
  border-color: var(--accent);
  background: #f0f7ff;
}

.dropzone input {
  display: none;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 26px;
}

.dropzone small {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.selected-files {
  display: grid;
  gap: 8px;
}

.selected-files div,
.user-row,
.empty-line {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.user-list {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.user-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.product-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.product-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
}

.product-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1060px;
  font-size: 13px;
}

.product-table th,
.product-table td {
  max-width: 220px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.product-table th {
  position: sticky;
  top: 0;
  background: #f7f9fb;
  z-index: 1;
}

.product-table .select-cell {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  text-align: center;
  vertical-align: middle;
}

.product-name {
  font-weight: 650;
}

.product-edit {
  width: 100%;
  min-width: 140px;
  min-height: 74px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
}

.product-name-edit {
  min-width: 180px;
  font-weight: 650;
}

.product-edit:focus {
  border-color: var(--accent);
  outline: 2px solid #d6e9ff;
}

.product-thumb {
  display: block;
  width: 72px;
  height: 72px;
  margin-bottom: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.mini-upload {
  display: inline-grid;
  place-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  background: #eef6ff;
  color: var(--accent);
  font-weight: 650;
  cursor: pointer;
}

.mini-upload input {
  display: none;
}

.material-list {
  display: grid;
  gap: 5px;
  margin-bottom: 8px;
}

.material-list a {
  color: var(--accent);
  text-decoration: none;
}

.muted {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
}

.message {
  min-height: 20px;
  color: var(--muted);
  font-size: 14px;
}

.message.ok {
  color: var(--ok);
}

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

.hidden {
  display: none !important;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
  z-index: 20;
}

.nav-button {
  display: grid;
  place-items: center;
  min-height: 58px;
  border-radius: 0;
  color: var(--muted);
  background: #ffffff;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.nav-button:hover {
  background: #f8fafc;
}

.nav-button.is-active {
  color: var(--accent);
  background: #eef6ff;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 680px);
    padding-top: 16px;
  }

  .app-header,
  .admin-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .search-panel,
  .product-import,
  .file-row {
    grid-template-columns: 1fr;
  }

  .catalog-product,
  .catalog-fields {
    grid-template-columns: 1fr;
  }

  .catalog-image {
    max-width: 180px;
  }

  .file-action {
    width: 100%;
  }
}
