:root {
  color-scheme: light;
  --ink: #071d2f;
  --ink-2: #213c4c;
  --muted: #647783;
  --paper: #f2f6f7;
  --surface: #ffffff;
  --surface-2: #eaf0f2;
  --line: #d5e0e4;
  --teal: #078d7e;
  --teal-strong: #006e63;
  --teal-soft: #d9f4ef;
  --amber: #f2aa3d;
  --amber-soft: #fff1d9;
  --danger: #c84242;
  --danger-soft: #fde8e8;
  --navy: #071d2f;
  --navy-2: #0d2b3f;
  --shadow-sm: 0 5px 18px rgba(7, 29, 47, 0.07);
  --shadow-lg: 0 24px 70px rgba(7, 29, 47, 0.16);
  --radius: 14px;
  --editor-banner-height: 62px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf6f7;
  --ink-2: #d3e0e5;
  --muted: #91a6b2;
  --paper: #06131e;
  --surface: #0b2232;
  --surface-2: #102d40;
  --line: #254354;
  --teal: #35cfba;
  --teal-strong: #71e0d1;
  --teal-soft: #103c3b;
  --amber: #ffc166;
  --amber-soft: #3c2d18;
  --danger: #ff7d7d;
  --danger-soft: #432326;
  --navy: #020c13;
  --navy-2: #071d2f;
  --shadow-sm: 0 6px 20px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
.catalog-directory-link { color: var(--teal-strong); text-decoration: underline; text-underline-offset: 4px; font-size: .9rem; }
.item-card h3 a:hover, .table-item strong a:hover { color: var(--teal-strong); text-decoration: underline; }
.public-catalog-site { min-height: 100vh; display: flex; flex-direction: column; }
.public-page-nav { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: .85rem; }
.public-page-nav a:hover, .public-breadcrumbs a:hover { text-decoration: underline; }
.public-catalog-page { width: min(1120px, 100%); margin: 0 auto; padding: 32px 24px 56px; flex: 1; overflow-wrap: anywhere; }
.public-catalog-page h1 { font-size: clamp(1.5rem, 3vw, 2.25rem); line-height: 1.5; margin: 20px 0 12px; }
.public-lead, .public-breadcrumbs { color: var(--muted); }
.public-breadcrumbs { font-size: .85rem; }
.public-directory-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0; margin: 28px 0; list-style: none; gap: 18px; }
.public-directory-list li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.public-directory-list h2 { font-size: 1.05rem; margin: 10px 0; }
.public-directory-list h2 a { color: var(--teal-strong); text-decoration: underline; text-underline-offset: 4px; }
.public-directory-list p { font-size: .87rem; }
.public-category, .public-item-code { color: var(--muted); font-size: .8rem; }
.public-item-code { display: inline-block; }
.public-english { text-align: start; color: var(--muted); overflow-wrap: anywhere; }
.public-pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 22px; }
.public-pagination a { color: var(--teal-strong); text-decoration: underline; }
.public-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px 32px; }
.public-item-heading, .public-item-actions { grid-column: 1 / -1; }
.public-item-heading h1 { margin-top: 8px; }
.public-item-image { margin: 0; background: #fff; border-radius: var(--radius); padding: 24px; align-self: start; }
.public-item-image img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; object-position: center; }
.public-item-image figcaption { text-align: center; color: #526474; font-size: .85rem; margin-top: 12px; }
.public-no-image { min-height: 240px; display: grid; place-items: center; color: #526474; }
.public-item-information h2 { font-size: 1.2rem; margin-top: 0; }
.public-item-information dl { margin: 0 0 28px; }
.public-item-information dl div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.public-item-information dt { color: var(--muted); }
.public-item-information dd { margin: 0; }
.public-usage { white-space: pre-wrap; }
.public-item-actions { display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 800px) { .public-directory-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } .public-catalog-site .topbar { flex-wrap: wrap; gap: 12px; } }
@media (max-width: 560px) { .public-directory-list, .public-item { grid-template-columns: minmax(0, 1fr); } .public-catalog-page { padding: 24px 18px 40px; } .public-item-image { max-width: 480px; width: 100%; } .public-catalog-site footer { flex-wrap: wrap; } }
body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Sans Arabic", "Noto Kufi Arabic", Tahoma, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}
button, input, select, textarea { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.topbar {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 12px clamp(18px, 4vw, 64px);
  color: #fff;
  background: var(--navy);
  border-bottom: 3px solid #1eb6a2;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .14);
}
.is-editor { padding-top: var(--editor-banner-height); }
.is-editor .topbar { top: var(--editor-banner-height); }
.editor-banner {
  position: fixed;
  z-index: 70;
  top: 0;
  right: 0;
  left: 0;
  min-height: var(--editor-banner-height);
  padding: 9px clamp(18px, 4vw, 64px);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #30200a;
  background: #f3b44f;
  border-bottom: 1px solid #cb8821;
  box-shadow: 0 5px 18px rgba(72, 43, 0, .18);
}
.editor-banner:not([hidden]) { display: flex; }
.editor-banner > div:first-child { display: flex; align-items: baseline; gap: 14px; }
.editor-banner span { font-size: .8rem; }
.editor-banner-actions { display: flex; gap: 8px; }
.editor-banner .button { min-height: 38px; border-color: rgba(48,32,10,.28); background: rgba(255,255,255,.4); }
.editor-banner .button-dark { color: #fff; background: #30200a; }
.brand { display: flex; align-items: center; min-width: 0; gap: 12px; }
.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #37d6c0;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 10px;
  font-size: 24px;
}
.brand-copy { display: grid; min-width: 0; }
.brand-copy small { color: #9fb8c5; font-size: .74rem; }
.brand-copy strong { overflow: hidden; font-size: clamp(.95rem, 1.7vw, 1.2rem); white-space: nowrap; text-overflow: ellipsis; }
.top-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }

.button, .icon-button, .close-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; font-weight: 700; }
.button:hover, .icon-button:hover, .close-button:hover { border-color: var(--teal); }
.button:active, .icon-button:active, .close-button:active { transform: translateY(1px); }
.button-accent { color: #08201f; border-color: var(--amber); background: var(--amber); }
.button-quiet, .topbar .icon-button { color: #fff; border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.07); }
.button-primary { color: #fff; border-color: var(--teal-strong); background: var(--teal-strong); }
.button-danger { color: #fff; border-color: var(--danger); background: var(--danger); }
.icon-button, .close-button { display: grid; place-items: center; width: 42px; padding: 0; }
.close-button { font-size: 1.55rem; }
.text-button { border: 0; background: transparent; color: var(--teal); font-size: .85rem; font-weight: 750; }

.menu-wrap { position: relative; }
.menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  left: 0;
  min-width: 170px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.menu button { display: block; width: 100%; padding: 11px 14px; border: 0; background: transparent; color: var(--ink); text-align: right; }
.menu button:hover { background: var(--surface-2); }

.app-shell {
  display: grid;
  grid-template-columns: minmax(235px, 275px) minmax(0, 1fr);
  gap: clamp(22px, 3vw, 46px);
  max-width: 1740px;
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  padding: clamp(26px, 4vw, 54px) clamp(18px, 4vw, 64px) 70px;
}
.filter-panel { position: sticky; top: 102px; align-self: start; max-height: calc(100vh - 126px); overflow: auto; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); scrollbar-width: thin; }
.filter-panel-head, .sheet-head, .modal-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.overline, .eyebrow { color: var(--teal); font-size: .75rem; font-weight: 800; letter-spacing: .02em; }
.filter-panel h2, .sheet h2, .modal h2, .confirm-dialog h2 { margin: 2px 0 0; font-size: 1.2rem; }
.filter-group { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.filter-group-title { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 0 0 10px; border: 0; background: transparent; font-weight: 800; }
.filter-group.is-collapsed .check-list { display: none; }
.filter-group.is-collapsed .filter-group-title span:last-child { transform: rotate(180deg); }
.check-list { display: grid; gap: 6px; }
.check-list-scroll { max-height: 250px; overflow: auto; padding-left: 4px; scrollbar-width: thin; }
.check-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 34px; font-size: .88rem; }
.check-row input { width: 17px; height: 17px; accent-color: var(--teal); }
.check-row span { color: var(--ink-2); }
.check-row small { color: var(--muted); font-variant-numeric: tabular-nums; }
.source-note { display: flex; gap: 10px; margin-top: 22px; padding: 13px; border-radius: 10px; color: var(--muted); background: var(--surface-2); font-size: .76rem; }
.source-note > span { color: var(--amber); font-size: 1.15rem; }
.source-note p { display: grid; margin: 0; }
.source-note strong { color: var(--ink); }

.catalog-panel { min-width: 0; }
.catalog-intro { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.catalog-intro h1 { max-width: 780px; margin: 3px 0 8px; font-size: clamp(2rem, 4.2vw, 4.3rem); line-height: 1.04; letter-spacing: -.035em; }
.intro-copy { max-width: 750px; margin: 0; color: var(--muted); }
.catalog-stats { display: flex; flex: 0 0 auto; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.catalog-stats div { display: grid; min-width: 125px; padding: 14px 16px; background: var(--surface); }
.catalog-stats strong { color: var(--amber); font-size: 1.8rem; line-height: 1.1; }
.catalog-stats span { color: var(--muted); font-size: .75rem; }

.search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 10px; }
.search-box { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: center; min-height: 58px; padding: 5px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
.search-box > span { color: var(--teal); font-size: 1.8rem; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
kbd { padding: 2px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--paper); font-family: inherit; font-size: .7rem; }
.mobile-filter-button { display: none; }
.cart-button { border-color: var(--navy); background: var(--navy); color: #fff; }
.cart-count, .filter-badge { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; background: var(--amber); color: #15221f; font-size: .75rem; }

.quick-pills { display: flex; gap: 8px; overflow-x: auto; padding: 18px 0 7px; scrollbar-width: thin; }
.quick-pills button { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); white-space: nowrap; }
.quick-pills button small { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 999px; background: var(--surface-2); font-size: .7rem; }
.quick-pills button.is-active { border-color: var(--teal); background: var(--teal); color: #fff; }
.quick-pills button.is-active small { background: rgba(255,255,255,.2); }

.subdomain-search-panel { display: grid; gap: 11px; margin-top: 10px; padding: 14px 16px; border: 1px dashed var(--line); border-radius: 12px; background: color-mix(in srgb, var(--surface) 88%, var(--teal-soft)); }
.subdomain-search-panel.has-options { border-style: solid; border-color: color-mix(in srgb, var(--teal) 45%, var(--line)); }
.subdomain-search-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.subdomain-search-head strong { color: var(--ink); font-size: .9rem; }
.subdomain-search-head span { color: var(--muted); font-size: .78rem; }
.quick-subdomain-pills { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: thin; }
.quick-subdomain-pills:empty { display: none; }
.quick-subdomain-pills button { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink-2); white-space: nowrap; }
.quick-subdomain-pills button small { color: var(--muted); font-size: .7rem; }
.quick-subdomain-pills button:hover { border-color: var(--teal); color: var(--teal-strong); }
.quick-subdomain-pills button.is-active { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-strong); font-weight: 800; }

.results-bar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 22px 0 12px; }
.results-bar p { margin: 0; }
.results-bar > div:first-child > span { color: var(--muted); font-size: .82rem; }
.results-controls { display: flex; align-items: center; gap: 10px; }
.sort-control { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .8rem; }
.sort-control select { min-height: 40px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; outline: 0; background: var(--surface); }
.view-switch { display: flex; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.view-switch button { width: 42px; min-height: 40px; border: 0; background: var(--surface); }
.view-switch button + button { border-right: 1px solid var(--line); }
.view-switch button.is-active { background: var(--ink); color: var(--surface); }
.active-filters { display: flex; flex-wrap: wrap; gap: 7px; min-height: 0; margin-bottom: 12px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 3px 10px; border: 1px solid var(--teal); border-radius: 999px; background: var(--teal-soft); color: var(--teal-strong); font-size: .75rem; }
.filter-chip button { border: 0; background: transparent; color: inherit; font-size: 1rem; line-height: 1; }

.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 15px; }
.item-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.category-stripe { position: absolute; z-index: 3; top: 0; right: 0; left: 0; height: 6px; background: #7c8790; }
.category-physics .category-stripe { background: #2473c9; }
.category-chemistry .category-stripe { background: #ad4b3e; }
.category-biology .category-stripe { background: #2d8c57; }
.category-earth .category-stripe { background: #8a603a; }
.category-astronomy .category-stripe { background: #6557b8; }
.category-general .category-stripe { background: #75808a; }
.item-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--teal) 55%, var(--line)); box-shadow: var(--shadow-lg); }
.item-image-button { position: relative; display: block; width: 100%; padding: 0; border: 0; background: #fff; }
.item-image-button img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.image-fallback { display: grid; width: 100%; aspect-ratio: 4 / 3; place-items: center; color: #56616a; background: #edf0f2; font-size: clamp(3rem, 8vw, 6rem); font-weight: 850; }
.category-physics .image-fallback { color: #2473c9; background: #e8f2fd; }
.category-chemistry .image-fallback { color: #ad4b3e; background: #faece9; }
.category-biology .image-fallback { color: #2d8c57; background: #e8f5ed; }
.category-earth .image-fallback { color: #8a603a; background: #f3ece4; }
.category-astronomy .image-fallback { color: #6557b8; background: #efedfb; }
[data-theme="dark"] .image-fallback { background: var(--surface-2); }
.zoom-hint { position: absolute; bottom: 10px; left: 10px; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.7); border-radius: 50%; background: rgba(7,29,47,.78); color: #fff; opacity: 0; transition: opacity .18s ease; }
.item-card:hover .zoom-hint, .item-image-button:focus-visible .zoom-hint { opacity: 1; }
.item-card-body { display: grid; gap: 10px; padding: 15px; }
.card-meta { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.badge { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 9px; border: 1px solid color-mix(in srgb, var(--teal) 35%, transparent); border-radius: 999px; color: var(--teal-strong); background: var(--teal-soft); font-size: .7rem; font-weight: 800; }
.item-code { color: var(--muted); font-size: .68rem; direction: ltr; }
.item-card h3 { margin: 0; font-size: 1.06rem; line-height: 1.45; }
.english { margin: -6px 0 0; color: var(--muted); direction: ltr; text-align: right; font-size: .72rem; line-height: 1.35; }
.usage { min-height: 2.9em; margin: 0; overflow: hidden; color: var(--muted); font-size: .84rem; line-height: 1.55; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-tag { padding: 2px 7px; border-radius: 5px; background: var(--surface-2); color: var(--muted); font-size: .68rem; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; padding-top: 11px; border-top: 1px solid var(--line); }
.card-actions button:first-child { flex: 1 1 100px; }
.card-actions button { min-height: 36px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: transparent; font-size: .76rem; }
.card-actions button:hover { border-color: var(--teal); color: var(--teal-strong); background: var(--teal-soft); }
.card-actions .is-in-cart { border-color: var(--amber); background: var(--amber-soft); color: #6e4610; }
.card-actions .danger-link { color: var(--danger); }
.card-more { position: relative; }
.card-more summary { display: grid; place-items: center; width: 36px; min-height: 36px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; list-style: none; }
.card-more summary::-webkit-details-marker { display: none; }
.card-menu { position: absolute; z-index: 20; bottom: calc(100% + 6px); left: 0; min-width: 150px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-lg); }
.card-menu button { width: 100%; border: 0; border-radius: 0; text-align: right; }
.card-menu button[data-action="delete"] { color: var(--danger); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
.items-table { width: 100%; min-width: 920px; border-collapse: collapse; }
.items-table th { position: sticky; z-index: 1; top: 0; padding: 12px; color: #d8e9ed; background: var(--navy-2); text-align: right; font-size: .76rem; }
.items-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: .82rem; }
.items-table tr:hover td { background: var(--surface-2); }
.table-item { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 10px; align-items: center; min-width: 220px; }
.table-item img { width: 52px; height: 52px; object-fit: contain; border: 0; border-radius: 0; background: transparent; }
.table-item .image-fallback, .cart-thumb .image-fallback, .deleted-thumb .image-fallback { width: 52px; height: 52px; aspect-ratio: 1; border-radius: 7px; font-size: 1.4rem; }
.table-item strong, .table-item small { display: block; }
.table-item small { color: var(--muted); direction: ltr; text-align: right; }
.table-actions { display: flex; gap: 5px; }
.table-actions button { min-width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 6px; background: transparent; }

.empty-state { grid-column: 1 / -1; display: grid; place-items: center; min-height: 310px; padding: 44px 20px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); font-size: 1.15rem; }
.empty-state span { max-width: 420px; }
.load-more { display: block; min-width: 180px; margin: 24px auto 0; padding: 10px 18px; border: 1px solid var(--teal); border-radius: 9px; background: transparent; color: var(--teal-strong); font-weight: 800; }

footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px clamp(18px, 4vw, 64px); color: #9fb8c5; background: var(--navy); font-size: .77rem; }
footer div { display: grid; }
footer strong { color: #fff; }

dialog { padding: 0; border: 0; color: var(--ink); background: var(--surface); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(1, 12, 19, .7); backdrop-filter: blur(4px); }
.modal { width: min(760px, calc(100% - 24px)); max-height: calc(100vh - 32px); overflow: auto; border-radius: 16px; }
.modal form { padding: 22px; }
#installDialog { width: min(480px, calc(100% - 24px)); padding: 24px; }
#installDialog p { line-height: 1.9; }
#managerLoginDialog { width: min(480px, calc(100% - 24px)); }
.pin-modal { width: min(410px, calc(100% - 24px)); padding: 24px; overflow: hidden; }
.pin-help { margin: 4px 0 18px; color: var(--muted); text-align: center; }
.pin-dots { display: flex; direction: ltr; justify-content: center; gap: 12px; min-height: 28px; margin-bottom: 8px; }
.pin-dots i { width: 17px; height: 17px; border: 2px solid var(--line); border-radius: 50%; background: transparent; transition: transform .15s ease, background-color .15s ease; }
.pin-dots i.is-filled { border-color: var(--teal); background: var(--teal); transform: scale(1.08); }
.pin-dots.is-shaking { animation: pin-shake .32s ease; }
.pin-message { min-height: 26px; margin: 0 0 8px; color: var(--danger); text-align: center; font-size: .82rem; }
.pin-keypad { display: grid; direction: ltr; grid-template-columns: repeat(3, 1fr); gap: 9px; max-width: 280px; margin: 0 auto; }
.pin-keypad button { min-height: 54px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); color: var(--ink); font-size: 1.15rem; font-weight: 800; }
.pin-keypad button:hover { border-color: var(--teal); background: var(--teal-soft); }
.pin-keypad .pin-clear { color: var(--danger); }
.change-pin-fields { display: grid; gap: 14px; }
.change-pin-fields label { display: grid; gap: 6px; font-size: .82rem; font-weight: 750; }
.change-pin-fields input { min-height: 46px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); text-align: center; letter-spacing: .35em; direction: ltr; }
.form-error { min-height: 24px; margin: 0; color: var(--danger); font-size: .82rem; font-weight: 700; }
.modal-head { margin-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label, .experiment-name { display: grid; gap: 6px; color: var(--ink-2); font-size: .8rem; font-weight: 700; }
.form-grid input, .form-grid select, .form-grid textarea, .experiment-name input { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; outline: 0; background: var(--paper); color: var(--ink); }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .experiment-name input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent); }
.form-grid textarea { resize: vertical; }
.full-field { grid-column: 1 / -1; }
.upload-field { padding: 12px; border: 1px dashed var(--line); border-radius: 9px; }
.upload-field small { color: var(--muted); font-weight: 400; }
.image-preview { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: center; }
.image-preview img { max-height: 230px; object-fit: contain; }
.modal-actions, .sheet-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }

.sheet { width: min(490px, 100%); height: 100%; max-height: 100%; margin: 0 0 0 auto; overflow: auto; border-radius: 0; }
.sheet[open] { animation: sheet-in .2s ease-out; }
.sheet-head { position: sticky; z-index: 3; top: 0; padding: 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.sheet > :not(.sheet-head):not(.sheet-actions) { margin-right: 20px; margin-left: 20px; }
.sheet-actions { position: sticky; bottom: 0; margin: 0; padding: 14px 20px; background: var(--surface); }
.filter-sheet #mobileFiltersContent { padding-bottom: 16px; }
.filter-sheet .filter-group { margin: 0; padding: 17px 0; }
.details-sheet { width: min(570px, 100%); }
.details-hero { position: relative; margin: 0 !important; background: #fff; }
.details-hero .item-image-button { height: min(38vh, 350px); height: min(38dvh, 350px); padding: 12px; }
.details-hero .item-image-button img { display: block; width: 100%; height: 100%; aspect-ratio: auto; object-fit: contain; object-position: center; }
.details-hero .image-fallback { height: 100%; aspect-ratio: auto; }
.details-body { padding: 20px 0 30px; }
.details-body h2 { margin: 10px 0 2px; font-size: 1.55rem; }
.details-en { margin: 0; color: var(--muted); direction: ltr; text-align: right; }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.details-field { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); }
.details-field.full { grid-column: 1 / -1; }
.details-field span { display: block; color: var(--muted); font-size: .72rem; }
.details-field p { margin: 4px 0 0; }
.details-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.experiment-name { margin: 18px 20px 4px; }
.cart-list { display: grid; gap: 9px; padding: 12px 0 90px; }
.cart-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 9px; }
.cart-row img { width: 52px; height: 52px; object-fit: contain; border-radius: 6px; background: #fff; }
.cart-row strong, .cart-row span { display: block; }
.cart-row span { color: var(--muted); font-size: .72rem; }
.cart-row button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--danger); }
.cart-empty { display: grid; place-items: center; min-height: 230px; color: var(--muted); text-align: center; }
.cart-actions { display: grid; grid-template-columns: 1fr 1fr; }

.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; color: #fff; background: #03090e; }
.lightbox-toolbar { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 62px; padding: 10px 18px; background: #071d2f; }
.lightbox-toolbar > div { display: flex; gap: 6px; }
.lightbox-toolbar button { min-width: 40px; min-height: 38px; border: 1px solid rgba(255,255,255,.18); border-radius: 7px; background: rgba(255,255,255,.08); color: #fff; }
.lightbox-stage { display: grid; place-items: center; width: 100%; height: calc(100vh - 62px); overflow: auto; }
.lightbox-stage img { max-width: 90vw; max-height: 82vh; object-fit: contain; transform: scale(1); transform-origin: center; transition: transform .15s ease; }

.confirm-dialog { width: min(410px, calc(100% - 24px)); padding: 26px; border-radius: 15px; text-align: center; }
.confirm-icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 50%; color: var(--danger); background: var(--danger-soft); font-size: 1.6rem; font-weight: 900; }
.confirm-dialog p { color: var(--muted); }
.confirm-dialog .modal-actions { justify-content: center; }

.toast { position: fixed; z-index: 100; right: 50%; bottom: 24px; max-width: min(430px, calc(100% - 32px)); padding: 11px 16px; border-radius: 9px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow-lg); opacity: 0; transform: translate(50%, 16px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translate(50%, 0); }

.admin-tabs { display: flex; gap: 8px; margin-top: 18px; padding-bottom: 8px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.admin-tabs button { min-height: 40px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); white-space: nowrap; }
.admin-tabs button.is-active { border-color: #c78118; color: #30200a; background: var(--amber); font-weight: 800; }
.admin-tabs span { display: inline-grid; min-width: 22px; height: 22px; margin-right: 4px; place-items: center; border-radius: 999px; background: var(--surface-2); font-size: .72rem; }
.deleted-list, .audit-list { display: grid; gap: 10px; }
.deleted-row { position: relative; display: grid; grid-template-columns: 64px minmax(0,1fr) auto; gap: 13px; align-items: center; overflow: hidden; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.deleted-thumb { display: grid; place-items: center; width: 56px; height: 56px; overflow: hidden; border-radius: 8px; background: #fff; }
.deleted-thumb img { width: 100%; height: 100%; object-fit: contain; }
.deleted-row div:nth-of-type(2) { display: grid; }
.deleted-row span, .deleted-row small { color: var(--muted); font-size: .75rem; }
.audit-row { display: grid; grid-template-columns: 120px minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.audit-action { color: var(--teal-strong); font-weight: 800; }
.audit-row div { display: grid; }
.audit-row small, .audit-row time { color: var(--muted); font-size: .75rem; }

@keyframes pin-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-5px); } }

@keyframes sheet-in { from { transform: translateX(-30px); opacity: .4; } to { transform: translateX(0); opacity: 1; } }

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; }
  .filter-panel { display: none; }
  .mobile-filter-button { display: inline-flex; }
  .catalog-intro h1 { font-size: clamp(2rem, 7vw, 3.7rem); }
}

@media (max-width: 760px) {
  :root { --editor-banner-height: 104px; }
  body { font-size: 15px; }
  .editor-banner:not([hidden]) { display: grid; align-content: center; padding: 9px 14px; }
  .editor-banner > div:first-child { display: grid; gap: 0; }
  .editor-banner-actions { justify-content: stretch; }
  .editor-banner-actions .button { flex: 1; }
  .topbar { min-height: 68px; padding: 10px 14px; }
  .brand-mark { width: 42px; height: 42px; }
  .brand-copy small { display: none; }
  .brand-copy strong { max-width: 48vw; font-size: .88rem; white-space: normal; line-height: 1.25; }
  .top-actions { gap: 5px; }
  .top-actions .button { min-width: 42px; padding: 7px 9px; }
  .top-actions .button-accent span:last-child, .hide-mobile { display: none; }
  .editor-access span:last-child { display: none; }
  .app-shell { padding: 24px 14px 54px; }
  .catalog-intro { display: grid; align-items: start; }
  .catalog-intro h1 { font-size: 2.2rem; }
  .catalog-stats { width: 100%; }
  .catalog-stats div { flex: 1 1 0; min-width: 0; }
  .search-row { grid-template-columns: 1fr 1fr; }
  .search-box { grid-column: 1 / -1; }
  .search-row .admin-only { grid-column: 1 / -1; }
  kbd { display: none; }
  .results-bar { align-items: end; }
  .sort-control > span { display: none; }
  .sort-control select { max-width: 160px; }
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .full-field { grid-column: auto; }
  .audit-row { grid-template-columns: 90px minmax(0,1fr); }
  .audit-row time { grid-column: 2; }
  footer { display: grid; }
  footer > span { display: none; }
}

@media (max-width: 500px) {
  .catalog-intro h1 { font-size: 1.85rem; }
  .intro-copy { font-size: .9rem; }
  .catalog-stats strong { font-size: 1.45rem; }
  .cart-button, .mobile-filter-button { padding: 7px 10px; }
  .subdomain-search-panel { padding: 12px; }
  .subdomain-search-head { display: grid; gap: 2px; }
  .results-controls { display: grid; justify-items: end; }
  .results-bar { align-items: start; }
  .item-grid { grid-template-columns: 1fr; }
  .item-card { display: grid; grid-template-columns: 42% 58%; }
  .item-card .item-image-button img { height: 100%; aspect-ratio: auto; }
  .item-card .item-image-button .image-fallback { height: 100%; aspect-ratio: auto; }
  .item-card-body { padding: 12px; }
  .usage { display: none; }
  .card-actions { gap: 4px; }
  .card-actions button { padding: 5px 7px; }
  .card-more { display: none; }
  .details-grid { grid-template-columns: 1fr; }
  .details-field.full { grid-column: auto; }
  .deleted-row { grid-template-columns: 52px minmax(0,1fr); }
  .deleted-row > .button { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media print {
  .topbar, .filter-panel, .search-row, .quick-pills, .results-controls, .card-actions, footer { display: none !important; }
  .app-shell { display: block; padding: 0; }
  .item-grid { grid-template-columns: repeat(3, 1fr); }
  .item-card { break-inside: avoid; box-shadow: none; }
}
