@font-face {
  font-family: Manrope;
  src: url("/fonts/manrope.ttf") format("truetype");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color: #172c24;
  background: #f6f7f3;
  font: 400 16px/1.55 Manrope, "Segoe UI", sans-serif;
  --ink: #172c24;
  --muted: #576a61;
  --green: #173d31;
  --lime: #d9eea8;
  --line: #dce4da;
  --paper: #fff;
  --focus: #407451;
  --radius: 13px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden], .symbol-library { display: none !important; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .64; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.frame { width: min(100% - 64px, 1240px); margin-inline: auto; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.site-header { position: relative; z-index: 1; background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: inline-flex; gap: 11px; align-items: center; text-decoration: none; font-weight: 800; font-size: 1.04rem; letter-spacing: -.035em; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 11px; background: var(--green); color: var(--lime); }
.brand-mark .icon { width: 23px; height: 23px; }
.header-actions { display: flex; align-items: center; gap: 15px; }
.role { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .875rem; font-weight: 700; }
.role .icon { width: 17px; height: 17px; }

.button {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 750;
  line-height: 1.3;
  transition: background-color .16s ease, border-color .16s ease;
}
.button-primary { color: #fff; background: var(--green); border-color: var(--green); }
.button-primary:hover { background: #245440; border-color: #245440; }
.button-outline { background: var(--paper); border-color: var(--line); }
.button-outline:hover, .button-text:hover { background: #eaf1e7; border-color: #cad8cc; }
.button-text { color: var(--green); }
.button-danger { color: #922d2d; }
.button-danger:hover { background: #faeeee; }
.button .icon { width: 17px; height: 17px; }
.logout { min-height: 37px; padding-inline: 11px; }

.catalog-page { padding-top: 23px; }
.catalog-cover {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 274px;
  overflow: hidden;
  border-radius: 18px;
  color: #f6faee;
  background: #102f29;
}
.catalog-cover::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, #102f29 0%, #102f29 29%, #102f29f2 39%, #102f2920 65%, transparent 100%);
  pointer-events: none;
}
.cover-image { position: absolute; z-index: -2; right: 0; top: 0; width: 67%; height: 100%; object-fit: cover; object-position: 50% 58%; }
.cover-copy { padding: 32px 44px; max-width: 65%; }
.cover-copy h1 { font-size: clamp(2rem, 4vw, 3.65rem); font-weight: 800; line-height: 1.045; letter-spacing: -.065em; }
.cover-copy p { color: #d3e1d6; max-width: 365px; margin-top: 15px; font-size: 1rem; }

.inventory { margin-top: 31px; }
.inventory-heading { display: flex; gap: 14px; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.inventory h2 { font-size: clamp(1.55rem, 2.7vw, 2.15rem); line-height: 1.15; letter-spacing: -.05em; font-weight: 800; }
.inventory-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.sections { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.section-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 7px 13px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: .875rem;
  font-weight: 750;
  line-height: 1.25;
}
.section-button .icon { width: 17px; height: 17px; }
.section-button:hover { border-color: #97b5a1; }
.section-button[aria-current="true"] { background: var(--lime); border-color: #afca7c; }
.section-count { color: var(--muted); font-weight: 650; }
.section-button[aria-current="true"] .section-count { color: #405643; }

.filter-line { display: flex; align-items: center; gap: 13px; margin-block: 17px 16px; }
.search-control, .sort-control { position: relative; }
.search-control { display: block; width: min(370px, 100%); }
.search-control .icon { position: absolute; top: 12px; left: 12px; color: #547065; pointer-events: none; }
.search-control input { width: 100%; min-height: 44px; padding-inline-start: 40px; }
.results-count { color: var(--muted); flex: 1; text-align: right; font-size: .875rem; white-space: nowrap; }
.sort-control select { min-height: 44px; padding-inline: 12px 34px; appearance: none; font-size: .875rem; }
.sort-control .icon { position: absolute; top: 13px; right: 10px; width: 17px; height: 17px; pointer-events: none; }
input, textarea, select {
  background: var(--paper);
  border: 1px solid #cdd9cf;
  border-radius: 8px;
  padding: 9px 11px;
  min-width: 0;
  font-size: 1rem;
}
input::placeholder, textarea::placeholder { color: #687870; opacity: 1; }

.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.product, .detail-photo { --photo-color: #e6f2f0; }
[data-section="physics"] { --photo-color: #e5eef8; }
[data-section="mathematics"] { --photo-color: #f6eee7; }
.product {
  position: relative;
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.product:hover { border-color: #91af9a; box-shadow: 0 4px 16px #173d310e; }
.product-open {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100%;
  padding: 0;
  text-align: start;
  border: 0;
  border-radius: inherit;
  color: inherit;
  background: transparent;
}
.product-photo {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 100%;
  height: clamp(152px, 14vw, 201px);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--photo-color);
}
.product-photo img, .detail-photo img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.image-empty { display: grid; place-items: center; gap: 7px; color: var(--muted); font-size: .875rem; }
.image-empty .icon { width: 32px; height: 32px; }
.product-copy { display: flex; flex: 1; flex-direction: column; padding: 13px 15px 15px; width: 100%; }
.product-meta { display: flex; justify-content: space-between; gap: 10px; align-items: center; min-height: 1.25rem; color: var(--muted); font-size: .8125rem; line-height: 1.35; font-weight: 650; }
.product-sku { letter-spacing: .025em; overflow-wrap: anywhere; }
.product-name { margin-top: 6px; font-size: 1rem; line-height: 1.35; font-weight: 800; letter-spacing: -.018em; overflow-wrap: anywhere; }
.product-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; margin-top: 5px; color: var(--muted); font-size: .875rem; line-height: 1.38; overflow-wrap: anywhere; }
.product-price { display: inline-block; margin-top: auto; padding-top: 11px; color: var(--green); font-size: 1.14rem; font-weight: 800; letter-spacing: -.04em; white-space: nowrap; }
.icon-button { display: grid; width: 38px; height: 38px; place-content: center; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; }
.icon-button:hover { background: #eaf1e7; border-color: #adc3b4; }
.product-edit { position: absolute; top: 8px; right: 8px; }
.product-edit .icon { width: 17px; height: 17px; }
.empty-state { padding: 34px 19px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }
.catalog-footer { margin-top: 27px; padding-block: 19px 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }

.startup { margin-top: 35px; color: var(--muted); }
.auth-page { max-width: 970px; padding-block: clamp(28px, 8vh, 86px); }
.auth-card { display: grid; grid-template-columns: 1.03fr 1fr; min-height: 480px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 20px 60px #183a2510; }
.auth-form-side { display: grid; place-items: center; padding: 42px; }
.auth-form-inner { width: min(100%, 360px); }
.auth-form-inner h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; line-height: 1.12; letter-spacing: -.065em; }
.auth-form-inner > p { margin-top: 10px; color: var(--muted); }
.auth-visual { background: #102f29 url("/media/classroom.jpg") 68% center / cover no-repeat; }
#login-form { display: grid; gap: 15px; margin-top: 25px; }
#login-form .button { margin-top: 3px; height: 48px; font-size: 1rem; }
#login-form label, #editor-form label { display: grid; gap: 5px; font-size: .875rem; font-weight: 750; }
#login-form input { height: 46px; }

.dialog { padding: 0; width: min(100% - 30px, 850px); max-height: min(88dvh, 940px); border: 1px solid var(--line); border-radius: 17px; background: var(--paper); color: var(--ink); box-shadow: 0 22px 80px #12271f55; }
.dialog::backdrop { background: #182a24a8; }
.dialog-close { position: absolute; top: 12px; right: 12px; z-index: 1; }
.detail-layout { display: grid; grid-template-columns: .92fr 1fr; }
.detail-photo { position: relative; display: grid; min-height: 285px; place-items: center; background: var(--photo-color); }
.detail-copy { padding: 39px 29px 29px; min-width: 0; }
.detail-copy h2 { margin-top: 8px; font-size: clamp(1.5rem, 3vw, 2.15rem); line-height: 1.16; letter-spacing: -.045em; overflow-wrap: anywhere; }
#detail-description { color: var(--muted); margin-top: 10px; white-space: pre-line; overflow-wrap: anywhere; }
.specs { margin-block: 19px 0; font-size: .875rem; }
.specs > div { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-block: 8px; border-top: 1px solid var(--line); }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; font-weight: 650; }
.specs dt, .specs dd { overflow-wrap: anywhere; }
.detail-bottom { display: flex; align-items: end; gap: 14px; justify-content: space-between; margin-top: 20px; }
.detail-bottom .product-price { font-size: 1.57rem; }

.editor-dialog { width: min(100% - 30px, 653px); }
.editor-inner { padding: 28px; }
.editor-inner h2 { padding-right: 36px; font-size: 1.52rem; font-weight: 800; letter-spacing: -.04em; }
#editor-form { display: grid; gap: 13px; margin-top: 14px; }
#editor-form textarea { resize: vertical; }
.form-columns { display: grid; grid-template-columns: 1.25fr 1fr .8fr; gap: 10px; }
.photo-field { display: flex; align-items: center; gap: 12px; }
.photo-field > div { min-width: 0; flex: 1; }
#editor-thumbnail { object-fit: cover; border-radius: 7px; }
.remove-photo { margin-top: 4px; min-height: 34px; }
.editor-actions { display: flex; gap: 9px; align-items: center; }
.editor-actions .button-primary { margin-left: auto; }
.error { color: #922d2d; font-size: .875rem; }
.notification { position: fixed; z-index: 5; bottom: 20px; right: 20px; max-width: min(420px, 100% - 40px); padding: 11px 15px; border-radius: 9px; background: var(--green); color: #fff; box-shadow: 0 5px 20px #12271f38; font-size: .875rem; }

@media (max-width: 1020px) {
  .frame { width: min(100% - 40px, 1240px); }
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .frame { width: calc(100% - 32px); }
  .header-inner { min-height: 60px; }
  .catalog-page { padding-top: 15px; }
  .catalog-cover { min-height: 224px; }
  .cover-copy { max-width: 74%; padding: 24px; }
  .cover-image { width: 80%; object-position: 59% 56%; }
  .catalog-cover::after { background: linear-gradient(90deg, #102f29 0%, #102f29ef 24%, #102f29bc 52%, #102f2920 88%); }
  .inventory { margin-top: 25px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .auth-card { grid-template-columns: 1fr; min-height: 0; }
  .auth-visual { min-height: 200px; background-position: 65% 57%; }
  .auth-form-side { padding: 26px; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-photo { min-height: 0; height: 220px; }
  .detail-copy { padding: 20px; }
}
@media (max-width: 480px) {
  .frame { width: calc(100% - 26px); }
  .brand { font-size: .95rem; gap: 7px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-mark .icon { width: 20px; height: 20px; }
  .role { display: none; }
  .cover-copy { padding: 19px; max-width: 96%; }
  .cover-copy h1 { font-size: clamp(1.7rem, 8vw, 2.2rem); }
  .cover-copy p { max-width: 225px; font-size: .9rem; }
  .sections { gap: 6px; margin-top: 16px; }
  .section-button { min-height: 40px; padding-inline: 9px; gap: 5px; }
  .section-count { display: none; }
  .filter-line { flex-wrap: wrap; gap: 8px; margin-block: 13px; }
  .search-control { width: 100%; }
  .results-count { text-align: left; }
  .sort-control select { max-width: 185px; font-size: .8125rem; }
  .product-copy { padding: 11px; }
  .product-photo { height: 130px; }
  .product-meta { font-size: .75rem; }
  .product-name { font-size: .9375rem; }
  .product-description { font-size: .8125rem; }
  .auth-page { padding-block: 20px; }
  .auth-visual { min-height: 140px; }
  .editor-inner { padding: 18px; }
  .form-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-columns label:first-child { grid-column: 1 / -1; }
}
@media (max-width: 320px) {
  .product-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
