﻿:root {
  --bg: #ffffff;
  --panel: #f7f6ff;
  --secondary: #6A5ACD;
  --accent: #4B0082;
  --discount: #483D8B;
  --text: #1c1730;
  --muted: #665f7d;
  --line: #ded9f3;
  --danger: #a61717;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.is-hidden { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #ffffff 0%, #f2efff 100%);
}
.login-panel {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(43, 28, 92, 0.12);
}
.brand-row { display: flex; gap: 16px; align-items: center; }
.brand-row h1, .brand-row p { margin: 0; }
.brand-row p { color: var(--muted); margin-top: 4px; }
.brand-logo { width: 76px; height: 76px; object-fit: contain; flex: 0 0 auto; }
.brand-logo.small { width: 52px; height: 52px; }
.login-form { display: grid; gap: 14px; margin-top: 24px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(75, 0, 130, 0.2); border-color: var(--accent); }
.login-error { min-height: 20px; margin: 0; color: var(--danger); }
.primary-button, .secondary-button, .nav-button, .card-button {
  border: 0;
  border-radius: 6px;
  min-height: 40px;
  padding: 10px 16px;
  font-weight: 700;
}
.primary-button { background: var(--accent); color: #fff; }
.secondary-button { background: #ece8ff; color: var(--accent); }
.login-panel > .secondary-button { width: 100%; margin-top: 12px; }

.app { min-height: 100vh; }
.app-header {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 16px 24px;
  background: var(--secondary);
  color: #fff;
}
.app-header p { color: #efeaff; }
.main-nav { display: flex; gap: 8px; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.user-badge { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 6px; padding: 8px 10px; background: rgba(255,255,255,0.16); color: #fff; font-weight: 700; }
.nav-button { color: #fff; background: rgba(255,255,255,0.16); }
.nav-button.is-active { background: #fff; color: var(--accent); }
.page-view { padding: 24px; }
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}
.section-head h2 { margin: 0; font-size: 28px; }
.section-head p { margin: 6px 0 0; color: var(--muted); }
.tools-panel {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.4fr;
  gap: 14px;
  padding: 16px;
  margin-bottom: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.product-card {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.product-card.high-discount { background: var(--discount); color: #fff; border-color: var(--discount); }
.product-card.out-of-stock { background: #e5e5e5; color: #555; border-color: #cfcfcf; }
.product-card.out-of-stock .meta, .product-card.out-of-stock .muted { color: #666; }

.product-card.high-discount .muted, .product-card.high-discount .meta { color: #eee8ff; }
.product-card.high-discount.out-of-stock .meta, .product-card.high-discount.out-of-stock .muted { color: #666; }
.product-image-frame {
  display: grid;
  place-items: center;
  position: relative;
  aspect-ratio: 4 / 3;
  background: #f4f3f8;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.product-image-frame::before {
  content: "";
  position: absolute;
  inset: -14px;
  background-image: var(--photo-bg);
  background-size: cover;
  background-position: center;
  filter: blur(14px);
  opacity: 0.34;
  transform: scale(1.04);
}
.product-card img {
  position: relative;
  z-index: 1;
  width: auto;
  height: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  display: block;
  object-fit: contain;
}
.product-body { padding: 14px; display: grid; gap: 10px; }
.product-title { margin: 0; font-size: 17px; line-height: 1.25; }
.meta { color: var(--muted); font-size: 13px; }
.price-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.price-block { display: grid; gap: 2px; }
.old-price { color: #b00020; text-decoration: line-through; font-weight: 700; }
.price { display: inline-block; width: max-content; padding: 2px 6px; border-radius: 4px; background: #fff; color: #000; font-size: 20px; font-weight: 800; }
.discount-badge { border-radius: 999px; padding: 4px 8px; background: #ece8ff; color: var(--accent); font-weight: 700; }
.high-discount .discount-badge { background: #fff; }
.card-actions { display: flex; gap: 8px; }
.card-button { flex: 1; background: #ece8ff; color: var(--accent); }
.card-button.danger { color: #fff; background: var(--danger); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; background: #fff; min-width: 960px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--panel); color: var(--accent); }
tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: 8px; }
.modal {
  width: min(760px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(25, 15, 60, 0.25);
}
.modal.wide { width: min(940px, calc(100% - 28px)); }
.message-modal { width: min(520px, calc(100% - 28px)); }
.modal::backdrop { background: rgba(22, 16, 48, 0.42); }
.modal form { padding: 22px; display: grid; gap: 16px; }
.modal h2 { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.message-head { display: flex; gap: 14px; align-items: flex-start; }
.message-head p { margin: 6px 0 0; color: var(--muted); line-height: 1.45; }
.message-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; background: #ece8ff; color: var(--accent); font-weight: 800; text-transform: uppercase; }
.message-icon.success { background: #e5f6ea; color: #1f7a3a; }
.message-icon.warning { background: #fff4d6; color: #8a5a00; }
.message-icon.error { background: #ffe4e4; color: var(--danger); }
.empty-state { padding: 28px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); text-align: center; }

@media (max-width: 820px) {
  .app-header { grid-template-columns: 1fr; }
  .header-actions { justify-content: stretch; flex-wrap: wrap; }
  .user-badge { max-width: none; flex: 1 1 100%; }
  .main-nav { width: 100%; }
  .nav-button { flex: 1; }
  .section-head { align-items: stretch; flex-direction: column; }
  .tools-panel, .form-grid { grid-template-columns: 1fr; }
  .page-view { padding: 16px; }
}



