/* PS SERVICE admin panel. Mobile first: one column on a phone, the list grows into rows on a
   wider screen. No inline styles anywhere (Content-Security-Policy style-src 'self'). */

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c1e21;
  --muted: #65676b;
  --line: #dadde1;
  --accent: #0b5cd5;
  --accent-text: #ffffff;
  --ok-bg: #e7f6ec;
  --ok-text: #1e6b34;
  --bad-bg: #fdecea;
  --bad-text: #a61b1b;
  --warn-bg: #fff4e0;
  --warn-text: #8a5300;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

main { padding: 12px; max-width: 1100px; margin: 0 auto; }

h1 { font-size: 1.35rem; margin: 0 0 8px; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1;
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.topnav { display: flex; align-items: center; gap: 6px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 0 0 12px;
}
.card.narrow { max-width: 460px; margin: 24px auto; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.inline { display: inline; }
.note { white-space: pre-line; }

.flash { padding: 10px 12px; border-radius: var(--radius); margin: 0 0 12px; }
.flash.ok { background: var(--ok-bg); color: var(--ok-text); }
.flash.bad { background: var(--bad-bg); color: var(--bad-text); }
.flash.warn { background: var(--warn-bg); color: var(--warn-text); }
.field-error { color: var(--bad-text); margin: -6px 0 10px; font-size: 0.9rem; }

/* Buttons are large enough for a thumb (44 px). */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.button.danger { color: var(--bad-text); border-color: var(--bad-text); }
.button.link { border-color: transparent; background: transparent; color: var(--accent); }
.button:disabled { opacity: 0.4; cursor: default; }

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font: inherit;
  color: inherit;
}
input[type="checkbox"] { width: auto; min-height: auto; }

/* Filters: stacked on a phone, one line on a wide screen. */
.filters { display: grid; gap: 8px; margin: 0 0 8px; }
.filters .check { display: flex; align-items: center; gap: 6px; }
.filter-actions { display: flex; gap: 6px; }

/* Product list: a card per item. */
.products { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.product {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
}
.product.hidden-item { opacity: 0.65; }
.product.sold-out .qty { color: var(--bad-text); }
.thumb {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-decoration: none;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.no-photo { font-size: 0.7rem; color: var(--muted); text-align: center; }
.title { font-weight: 600; color: var(--text); text-decoration: none; }
.price { font-weight: 600; margin-top: 4px; }
.price.big { font-size: 1.15rem; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.badge { font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }
.badge.bad { background: var(--bad-bg); color: var(--bad-text); }

.stock {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.qty { font-size: 1.4rem; font-weight: 700; min-width: 2.5ch; text-align: center; }
.qty-buttons { display: flex; gap: 6px; flex: 1; }
.qty-buttons .button { flex: 1; }

/* Product form. */
.product-form label { display: block; margin: 0 0 12px; font-weight: 600; }
.product-form label > input, .product-form label > select, .product-form label > textarea {
  margin-top: 4px;
  font-weight: 400;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: flex; gap: 8px; margin: 4px 0 12px; }

.photo { display: block; max-width: 100%; max-height: 360px; border-radius: var(--radius); margin: 0 0 10px; }
.photo-form { display: grid; gap: 8px; }
.widget { margin: 16px 0; min-height: 48px; }

.table-wrap { overflow-x: auto; }
.movements { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.movements th, .movements td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }

@media (min-width: 760px) {
  main { padding: 20px; }
  .filters { grid-template-columns: 2fr repeat(4, 1fr); align-items: center; }
  .filters .check, .filter-actions { grid-column: span 1; }
  .product { grid-template-columns: 72px 1fr auto; align-items: center; }
  .stock { grid-column: auto; }
  .qty-buttons { flex: none; }
  .qty-buttons .button { flex: none; }
  .photo-form { grid-template-columns: 1fr auto; }
}
