:root {
  color-scheme: dark;
  --bg-dark: #090909;
  --bg-card: #1e1e1e;
  --bg-filter: #1a1a1a;
  --bg-input: #101010;
  --bg-disabled: #303030;
  --text-light: #ffffff;
  --text-muted: #aaaaaa;
  --line: #333333;
  --line-highlight: #555555;
  --accent-yellow: #e5b83b;
  --accent-red: #d9383a;
  --accent-red-hover: #c02b2d;
  --accent-blue: #1e3a8a;
  --text-on-red: #ffffff;
  --ink-glyph: #ffffff;
  --orbit-red: #772333;
  --orbit-gold: #8b713e;
  --overlay: #000a;
  --success: #226440;
  --content-width: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 20px; }
body {
  margin: 0;
  background: var(--bg-dark);
  color: var(--text-light);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent-yellow); outline-offset: 3px; }
h1, h2, h3, h4, p { margin: 0; }

.site-shell { position: relative; }
.japanese-backdrop {
  --glyph-size: clamp(200px, 30vmin, 410px);
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  color: var(--ink-glyph);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", Meiryo, "Noto Serif CJK JP", serif;
}
.japanese-backdrop span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%) rotate(var(--tilt));
  font-size: calc(var(--glyph-size) * var(--size));
  font-weight: 700;
  line-height: 1;
  opacity: var(--depth);
}
.background-orbits { position: absolute; inset: 0; }
.orbit {
  position: absolute;
  display: block;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: .34;
}
.orbit-red { color: var(--orbit-red); }
.orbit-gold { color: var(--orbit-gold); }
.orbit-sweep { left: -28%; top: 16%; width: 157%; height: 64%; transform: rotate(-23deg); }
.orbit-crossing { left: -32%; top: 28%; width: 159%; height: 51%; transform: rotate(19deg); opacity: .26; }
.orbit-edge { left: 58%; top: -54%; width: 79%; height: 119%; transform: rotate(36deg); opacity: .24; }
.topbar { background: transparent; }
.topbar-inner {
  max-width: var(--content-width);
  min-height: 92px;
  margin-inline: auto;
  padding: 12px var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
}
.brand {
  width: max-content;
  display: grid;
  gap: 2px;
  justify-items: start;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
}
.brand img { display: block; width: auto; height: 72px; object-fit: contain; }
.brand span { padding-left: 4px; }
.brand .brand-yokohama { color: var(--accent-red); font-size: 18px; font-weight: 800; }
.public-nav { display: flex; align-items: center; justify-content: center; gap: clamp(6px, 2vw, 26px); }
.nav-link {
  display: block;
  position: relative;
  padding: 10px 4px;
  border: 0;
  background: none;
  color: var(--text-muted);
  text-decoration: none;
  text-transform: uppercase;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: .065em;
}
.nav-link:hover, .nav-link.active { color: var(--accent-yellow); }
.employee-entry {
  justify-self: end;
  border: 0;
  padding: 10px 13px;
  color: var(--accent-yellow);
  background: transparent;
  text-transform: uppercase;
  font-weight: 750;
  font-size: 11px;
  letter-spacing: .045em;
}
.employee-entry:hover { color: var(--text-light); }
.employee-entry span { margin-right: 4px; font-size: 15px; }

#catalog { max-width: var(--content-width); margin-inline: auto; padding-inline: var(--gutter); }
.catalog-section { padding-block: 36px 42px; }
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  padding-bottom: 13px;
  border-bottom: 2px solid var(--accent-red);
}
h1 { font-size: clamp(36px, 5vw, 48px); font-weight: 800; line-height: 1.1; }
.result-count { color: var(--text-muted); font-size: clamp(15px, 1.7vw, 19px); font-weight: 650; white-space: nowrap; }
.filter-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 24px;
  padding: clamp(14px, 2.5vw, 22px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-filter);
}
.filter-topline { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.filter-topline h2 { color: var(--accent-yellow); font-size: clamp(14px, 2vw, 18px); line-height: 1.25; text-transform: uppercase; }
.reset-button { border: 0; background: none; color: var(--text-muted); padding: 3px 0; font-size: 13px; }
.reset-button:hover { color: var(--text-light); }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.primary-filters.wheels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filter-control, .field { display: grid; gap: 6px; min-width: 0; }
.filter-control label, .range-label, .field label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.filter-control select, .filter-control input, .field select, .field input, .field textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--line-highlight);
  border-radius: 4px;
  color: var(--text-light);
}
.price-range, .et-range { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.advanced-filters { grid-column: 1 / -1; padding-top: 12px; border-top: 1px solid var(--line); }
.advanced-filters summary { width: fit-content; color: var(--text-muted); font-size: 13px; cursor: pointer; }
.advanced-filters .secondary-filters { margin-top: 12px; }
.show-button, .order-button, .primary-action {
  border: 0;
  border-radius: 4px;
  padding: 10px 15px;
  background: var(--accent-red);
  color: var(--text-on-red);
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
}
.show-button { min-height: 42px; min-width: 108px; }
.show-button:hover:not(:disabled), .order-button:hover, .primary-action:hover { background: var(--accent-red-hover); }
.show-button:disabled { background: var(--bg-disabled); color: var(--text-muted); }

.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.product-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 9px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent-red);
  border-radius: 4px;
  background: var(--bg-card);
}
.product-visual {
  height: clamp(155px, 19vw, 224px);
  display: grid;
  place-items: center;
  overflow: hidden;
  margin: -14px -14px 3px;
  background: var(--bg-filter);
  border-bottom: 1px solid var(--line);
}
.product-photo-button {
  position: relative;
  display: grid;
  place-items: center;
  container-type: size;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.product-photo-button:focus-visible { outline-offset: -3px; }
.product-photo-frame {
  position: relative;
  display: block;
  width: min(100cqw, calc(100cqh * var(--photo-ratio, 1.4303)));
  height: min(100cqh, calc(100cqw / var(--photo-ratio, 1.4303)));
}
.product-image { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.cover-supplier-mark::after {
  content: '';
  position: absolute;
  inset: auto 0 0 auto;
  width: 48%;
  height: 28%;
  background: #000 url('assets/logo.png') center / 78% auto no-repeat;
  pointer-events: none;
}
.photo-zoom-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--text-light);
  background: var(--overlay);
}
.product-visual.has-image .no-image { display: none; }
.no-image { color: var(--text-muted); font-size: 12px; }
.photo-dialog {
  width: min(548px, calc(100vw - 28px));
  max-width: none;
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 1px solid var(--line-highlight);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-light);
}
.photo-dialog::backdrop { background: var(--overlay); }
.photo-frame { position: relative; margin: 0; padding: 12px; }
.photo-close {
  position: absolute;
  z-index: 1;
  inset: 8px 8px auto auto;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-highlight);
  border-radius: 50%;
  background: var(--bg-input);
  color: var(--text-light);
  font-size: 24px;
  line-height: 1;
}
.photo-stage {
  position: relative;
  width: min(var(--view-width, 500px), 100%, calc(72dvh * var(--photo-ratio, 1.4303)));
  margin-inline: auto;
}
.photo-full { display: block; width: 100%; height: auto; }
.photo-frame figcaption { padding: 8px 4px 0; text-align: center; overflow-wrap: anywhere; }
.card-line { display: flex; align-items: start; justify-content: space-between; gap: 9px; }
.card-line h3 { min-width: 0; overflow-wrap: anywhere; font-size: 22px; line-height: 1.18; }
.wheel-card h3 { font-size: 17px; }
.diameter, .season {
  border: 1px solid var(--line-highlight);
  border-radius: 3px;
  padding: 2px 6px;
  color: var(--accent-yellow);
  font-size: 11px;
  white-space: nowrap;
}
.product-name { color: var(--text-muted); font-size: 14px; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 13px; margin-bottom: 5px; color: var(--text-muted); font-size: 12px; }
.card-meta b { color: var(--text-light); }
.card-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.card-bottom strong { color: var(--accent-yellow); font-size: 24px; font-weight: 800; }
.card-bottom > span { color: var(--text-muted); font-size: 11px; }
.order-button { margin-left: auto; }
.empty-state { grid-column: 1 / -1; border: 1px solid var(--line); padding: 26px 16px; text-align: center; color: var(--text-muted); }
.catalog-pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 14px; margin: 22px 0 0; font-size: 13px; }
.catalog-pagination button, .ghost-action {
  padding: 8px 12px;
  border: 1px solid var(--line-highlight);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-light);
}
.catalog-pagination button:disabled { opacity: .5; }
.contacts { border-top: 1px solid var(--line); padding: 24px 0 36px; }
.contacts h2 { font-size: 24px; }
.contacts p { margin-top: 8px; color: var(--text-muted); font-size: 14px; }
.preview-label { margin: 14px 0 0; color: var(--accent-yellow); font-size: 13px; }

.employee-drawer { position: relative; min-height: 100vh; }
.workspace-brand { background: none; border: 0; padding: 0; }
.workspace-main { max-width: var(--content-width); margin-inline: auto; padding-inline: var(--gutter); }
.workspace-topbar .nav-link { white-space: nowrap; }
.employee-tabs:empty { display: none; }
.role-switch { display: flex; align-items: center; gap: 8px; }
.drawer-content { padding-block: 24px 40px; }
.workspace-heading { align-items: center; }
.workspace-header h3 { font-size: clamp(30px, 5vw, 48px); }
.workspace-table { background: var(--bg-filter); border: 1px solid var(--line); border-radius: 4px; overflow-x: auto; }
.workspace-table td, .workspace-table th { padding: 12px 14px; }
.workspace-table tr:last-child td { border-bottom: 0; }
.modal h2 { font-size: 20px; margin-bottom: 14px; }
.field { color: var(--text-muted); font-size: 13px; }
.field input, .field select, .field textarea { font-size: 15px; }
.client-fields { min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--line-highlight); border-radius: 4px; }
.client-fields legend { color: var(--accent-yellow); padding-inline: 5px; }
.form-error { margin-top: 10px; color: var(--accent-yellow); }
.primary-action:disabled { background: var(--bg-disabled); color: var(--text-muted); }
.eyebrow { color: var(--accent-yellow); font-weight: 700; font-size: 12px; text-transform: uppercase; }
.icon-button, .logout-button, .employee-tab { background: none; border: 0; color: var(--text-muted); padding: 9px 10px; }
.icon-button { font-size: 24px; line-height: 1; }
.icon-button:hover, .logout-button:hover, .employee-tab:hover, .employee-tab.active { color: var(--accent-yellow); }
.login-hint { flex: 1; padding-block: 8px; color: var(--text-muted); font-size: 13px; }
.employee-tab { white-space: nowrap; }
.employee-tab.active { box-shadow: inset 0 -2px var(--accent-yellow); }
.workspace-header, .form-actions, .calc-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.workspace-header p, .notice { color: var(--text-muted); font-size: 13px; margin-top: 5px; }
.modal, .upload-zone, .mailing-card { margin-bottom: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-card); }
.modal h4, .upload-zone strong { display: block; margin-bottom: 12px; font-size: 16px; }
.form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-fields .full { grid-column: 1 / -1; }
.field textarea { min-height: 70px; resize: vertical; }
.form-actions { justify-content: end; margin: 14px 0 0; }
.calc-line { color: var(--accent-yellow); margin: 6px 0 0; }
.upload-zone input { margin-top: 10px; max-width: 100%; }
.data-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.data-table th, .data-table td { padding: 9px 7px; text-align: left; border-bottom: 1px solid var(--line); }
.data-table th, .status { color: var(--accent-yellow); }
.import-errors { color: var(--text-muted); }
.app-message { display: none; position: fixed; z-index: 12; right: 16px; bottom: 16px; max-width: min(440px, calc(100vw - 32px)); border-radius: 4px; }
.app-message.error, .app-message.success { display: block; padding: 12px 16px; background: var(--accent-red-hover); }
.app-message.success { background: var(--success); }

@media (max-width: 1050px) {
  .workspace-topbar { grid-template-columns: 1fr auto; row-gap: 8px; }
  .workspace-topbar .employee-tabs { grid-row: 2; grid-column: 1 / -1; justify-content: start; flex-wrap: wrap; }
}
@media (max-width: 899px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .topbar-inner { grid-template-columns: 1fr auto; gap: 8px 14px; }
  .public-nav { grid-row: 2; grid-column: 1 / -1; justify-content: start; }
  .employee-tabs { min-width: 0; flex-wrap: wrap; }
  .brand img { height: 56px; }
  .catalog-section { padding-top: 24px; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .topbar-inner { min-height: 0; }
  .brand img { height: 46px; }
  .brand .brand-yokohama { font-size: 15px; }
  .employee-entry { max-width: 147px; font-size: 10px; padding: 8px; }
  .public-nav { gap: 15px; }
  .filter-panel, .product-grid, .form-fields { grid-template-columns: minmax(0, 1fr); }
  .product-visual { height: 195px; }
}
