:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #24313f;
  --muted: #687684;
  --line: #dfe5eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --ok: #16a34a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px;
}

.hidden { display: none !important; }

.login-view {
  min-height: 80vh;
  display: grid;
  place-items: center;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.login-panel {
  width: min(420px, 100%);
}

h1, h2 {
  margin: 0 0 14px;
}

h1 { font-size: 24px; }
h2 { font-size: 18px; }

.topbar,
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

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

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

input, textarea, select, button {
  width: 100%;
  font: inherit;
}

input, textarea, select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: white;
}

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

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  background: var(--primary);
  color: white;
  font-weight: 600;
}

button:hover { background: var(--primary-dark); }
button:disabled { opacity: .65; cursor: wait; }

button.secondary {
  width: auto;
  background: #e8edf3;
  color: var(--text);
}

button.secondary:hover { background: #d8e0ea; }
button.danger { background: var(--danger); }
button.danger:hover { background: var(--danger-dark); }

.results {
  max-height: 240px;
  overflow-y: auto;
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.result-item {
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.result-item:hover { background: #f8fafc; }

.selected-panel,
.files-panel {
  margin-top: 16px;
}

.selected-item,
.file-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 8px;
}

.selected-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.selected-item button[data-remove] {
  width: auto;
  min-width: 56px;
  padding: 8px 12px;
  align-self: center;
}

.file-meta,
.empty {
  color: var(--muted);
  font-size: 14px;
}

.file-actions {
  display: flex;
  gap: 8px;
}

.file-actions a,
.file-actions button {
  width: auto;
  text-decoration: none;
  white-space: nowrap;
}

.file-actions a {
  display: inline-block;
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--primary);
  color: white;
  font-weight: 600;
}

.link-button {
  display: inline-block;
  width: auto;
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--primary);
  color: white;
  font-weight: 600;
  text-decoration: none;
}

.print-options {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.print-options label {
  display: block;
  margin-bottom: 12px;
  font-weight: 600;
}

.print-options label input,
.print-options label select {
  margin-top: 6px;
  font-weight: 400;
}

.notice {
  padding: 12px;
  border-radius: 6px;
  margin: 12px 0;
}

.notice.ok {
  background: #dcfce7;
  color: #14532d;
}

.notice.warn {
  background: #fef9c3;
  color: #713f12;
}

.audit-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.audit-list {
  max-height: 180px;
  overflow: auto;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  line-height: 1.8;
  font-family: Arial, sans-serif;
}

.audit-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.audit-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.audit-summary strong,
.audit-summary span {
  display: block;
}

.audit-summary span {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 700;
}

.audit-section {
  margin-top: 22px;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.audit-table th,
.audit-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.audit-table th {
  background: #eef2f7;
}

.sku-cell {
  width: 90px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
  font-weight: 400;
}

@media (max-width: 860px) {
  .search-grid { grid-template-columns: 1fr; }
  .topbar, .section-header { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; }
  button.secondary { width: 100%; }
  .icon-button { width: 38px; flex: 0 0 38px; }
  .selected-item { grid-template-columns: minmax(0, 1fr) auto; }
  .file-item { grid-template-columns: 1fr; }
  .file-actions { flex-direction: column; }
  .audit-summary { grid-template-columns: 1fr; }
  .audit-table { font-size: 14px; }
}
