:root {
  --bg: #000;
  --panel: #111114;
  --panel-2: #1a1a1f;
  --text: #fff;
  --muted: #a8a8a8;
  --line: #2a2a30;
  --field: #4a4a52;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --danger: #ff5c6c;
  --ok: #43d17a;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

a { color: inherit; }

.status { padding: 48px 16px; text-align: center; color: var(--muted); }

.login { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; }
.login form { width: 100%; max-width: 380px; padding: 28px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.login h1 { margin: 0 0 18px; font-size: 24px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.94);
}
.topbar h1 { margin: 0; font-size: 18px; }
.save-state { flex: 1; min-width: 150px; color: var(--muted); font-size: 14px; }
.save-state.dirty { color: #ffc857; }
.save-state.ok { color: var(--ok); }
.save-state.error { color: var(--danger); }

.page { max-width: 880px; margin: 0 auto; padding: 24px 16px 96px; }

.section { margin-bottom: 24px; padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.section > h2 { margin: 0 0 14px; font-size: 18px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 5px; font-size: 14px; font-weight: 600; }
.field small { display: block; margin-top: 4px; color: var(--muted); }

input[type="text"], input[type="password"], input[type="number"], input[type="url"], select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--field);
  border-radius: 6px;
  background: #000;
  color: var(--text);
  font: inherit;
}
textarea { min-height: 120px; resize: vertical; }

.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 14px; }

.btn {
  appearance: none;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--field);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--text); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.wide { width: 100%; }

.error { margin: 0 0 12px; color: var(--danger); }

.upload { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.upload img { width: 128px; aspect-ratio: 16 / 9; border-radius: 6px; object-fit: cover; background: var(--panel-2); }
.upload img.round { width: 72px; aspect-ratio: 1; border-radius: 50%; }
.upload input[type="file"] { max-width: 100%; }
.upload-empty { display: flex; align-items: center; justify-content: center; width: 128px; aspect-ratio: 16 / 9; border: 1px dashed var(--field); border-radius: 6px; color: var(--muted); font-size: 13px; }

.row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.row input { flex: 1; min-width: 0; }

.product-item { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.product-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px; }
.product-head img, .product-head .no-image { width: 88px; aspect-ratio: 16 / 9; border-radius: 4px; object-fit: cover; background: #000; }
.product-summary { flex: 1; min-width: 150px; }
.product-summary strong { display: block; overflow-wrap: anywhere; }
.product-summary span { color: var(--muted); font-size: 14px; }
.product-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.product-editor { padding: 14px; border-top: 1px solid var(--line); }

@media (max-width: 560px) {
  .topbar { padding: 10px 16px; }
  .two { grid-template-columns: minmax(0, 1fr); }
  .section { padding: 14px; }
}
