/* ==========================================================================
   FITO ARCHIVE — Architectural Drafting Grid & Brand Design System
   Colors: #a9a9aa (Drafting Hairline & Serif Text) | #364b95 (FITO Cobalt Ink)
   Fonts: Adobe 宋体 (Serif) & 寒蝉云墨黑 / ChillYunmoGothic (Display Ink)
   ========================================================================== */

@font-face {
  font-family: 'ChillYunmoLocal';
  src: local('ChillYunmoGothic'),
       local('寒蝉云墨黑'),
       local('ChillYunMoHei'),
       local('ChillYunmoGothic-Regular'),
       url('/fonts/ChillYunmoGothic.woff2') format('woff2'),
       url('/fonts/ChillYunmoGothic.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'AdobeSongLocal';
  src: local('Adobe Song Std'),
       local('AdobeSongStd-Light'),
       local('Source Han Serif SC'),
       local('Songti SC'),
       local('STSong');
  font-display: swap;
}

:root {
  --fito-grey: #a9a9aa;
  --fito-grey-light: rgba(169, 169, 170, 0.28);
  --fito-grey-subtle: rgba(169, 169, 170, 0.10);
  --fito-blue: #364b95;
  --fito-blue-soft: rgba(54, 75, 149, 0.08);
  --fito-bg: #ffffff;
  --fito-line: 1px solid #a9a9aa;

  /* Brand Font Stacks */
  --font-songti: 'AdobeSongLocal', 'Adobe Song Std', 'AdobeSongStd-Light', 'Cormorant Garamond', 'Source Han Serif SC', 'Noto Serif SC', 'Songti SC', 'STSong', serif;
  --font-yunmo: 'ChillYunmoLocal', 'ChillYunmoGothic', '寒蝉云墨黑', 'ChillYunMoHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;

  /* Architectural Grid Proportions (Matches Reference Image 2 on Desktop, Image 1 on Mobile) */
  --grid-cols-desktop: 18% 19% 26% 19% 18%;
  --grid-cols-mobile: 32% 36% 32%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background-color: var(--fito-bg);
  color: var(--fito-grey);
  font-family: var(--font-songti);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background-color: var(--fito-bg);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}

button {
  cursor: pointer;
}

/* ==========================================================================
   1. FITO BRAND HEADER HERO — MINIMALIST DOUBLE-RULE ARCHIVE STAGE
   Proportions (x = 35px modular baseline unit):
     - Top blank: 2x (70px)
     - Two grey horizontal rules spaced x (35px) apart:
         Even archive columns (4 cols -> 2/4 = 50%; 2 cols -> 2/2 = 100%)
         Odd  archive columns (3 cols -> 1/3 = 33.3333%; 1 col -> 1/1 = 100%)
     - Bottom blank: 2x (70px)
     - Total height: 5x = 175px
   Blend Mode: mix-blend-mode: multiply (Archive ink pressed across the two lines)
   ========================================================================== */

:root {
  --header-band-width: 50%; /* 4 columns (even) => 2 columns wide */
}

.fito-brand-header {
  width: 100%;
  border-bottom: none;
  background: var(--fito-bg);
  position: relative;
}

.fito-brand-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 175px;
  padding-top: 70px;
  padding-bottom: 70px;
  background: var(--fito-bg);
  box-sizing: border-box;
  position: relative;
}

.brand-archive-band {
  width: var(--header-band-width, 50%);
  height: 35px;
  border-top: var(--fito-line);
  border-bottom: var(--fito-line);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  box-sizing: border-box;
}

/* Archive Glyph with Positive Film (Multiply) Blend Mode over the two rules */
.brand-glyph-img {
  height: 38px;
  width: auto;
  display: block;
  object-fit: contain;
  pointer-events: none;
  mix-blend-mode: multiply;
  transition: transform 0.2s ease;
}

.brand-archive-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  line-height: 0;
  outline: none;
  position: relative;
  z-index: 2;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.brand-archive-btn:hover {
  opacity: 0.8;
  transform: scale(1.02);
}

.brand-glyph-archive {
  height: 38px;
  width: auto;
  max-width: 90%;
  mix-blend-mode: multiply;
}

/* ==========================================================================
   3. TWO-TIER ARCHITECTURAL NAVIGATION SYSTEM
   Tier 1: 全部 / 笔记本 / 扇子 / 扩香器 / 更新 / 管理 / 搜索
   Tier 2: status: all, available, sold / colors: all, bk, bg... ...
   ========================================================================== */

.archive-nav-system {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  border-top: var(--fito-line);
  border-bottom: var(--fito-line);
}

/* Tier 1: Collections & Main Actions */
.nav-tier-primary {
  height: 35px;
  min-height: 35px;
  max-height: 35px;
  line-height: 35px;
  border-bottom: var(--fito-line);
  box-sizing: border-box;
}

.tier1-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  min-height: 35px;
  max-height: 35px;
  line-height: 35px;
  padding: 0 16px;
  gap: 16px;
  box-sizing: border-box;
}

.tier1-collections-cell {
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0;
  gap: 6px;
  height: 100%;
}

.tier1-collections-cell::-webkit-scrollbar {
  display: none;
}

.collection-tab-btn {
  font-family: var(--font-yunmo);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--fito-grey);
  padding: 0 10px;
  height: 100%;
  line-height: 35px;
  border: none;
  background: transparent;
  white-space: nowrap;
  transition: color 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
}

.collection-tab-btn:hover {
  color: var(--fito-blue);
  border: none;
  background: transparent;
}

.collection-tab-btn.is-active {
  color: var(--fito-blue);
  font-weight: 700;
  border: none;
  background: transparent;
}

.tier1-actions-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
  flex-shrink: 0;
}

.tier1-status-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 35px;
}

.tier1-action-btn {
  font-family: var(--font-yunmo);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--fito-grey);
  padding: 0 8px;
  height: 100%;
  line-height: 35px;
  border: none;
  background: transparent;
  transition: color 0.18s ease, opacity 0.18s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
}

.tier1-action-btn:hover {
  color: var(--fito-blue);
  border: none;
  background: transparent;
}

.tier1-action-btn[aria-pressed="true"],
.tier1-action-btn.is-active {
  color: var(--fito-blue);
  font-weight: 700;
  border: none;
  background: transparent;
}

.tier1-action-btn.is-spinning {
  opacity: 0.5;
  cursor: wait;
}

.tier1-divider {
  display: none;
}

.tier1-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}

.tier1-search-input {
  width: 110px;
  height: 24px;
  line-height: 20px;
  padding: 2px 6px;
  border: none;
  border-radius: 0;
  font-family: var(--font-yunmo);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--fito-blue);
  background: transparent;
  outline: none;
  transition: width 0.2s ease;
  box-sizing: border-box;
}

.tier1-search-input::placeholder {
  color: var(--fito-grey);
}

.tier1-search-input:focus {
  width: 150px;
}

/* Tier 2: status: all, available, sold / colors: all, bk, bg... */
.nav-tier-secondary {
  min-height: 35px;
  box-sizing: border-box;
}

.tier2-track {
  display: flex;
  align-items: center;
  height: 35px;
  min-height: 35px;
  max-height: 35px;
  line-height: 35px;
  padding: 0 16px;
  gap: 28px;
  overflow-x: auto;
  scrollbar-width: none;
  box-sizing: border-box;
}

.tier2-track::-webkit-scrollbar {
  display: none;
}

.tier2-status-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  flex-shrink: 0;
  height: 35px;
  line-height: 35px;
}

.tier2-filter-label {
  font-family: var(--font-yunmo);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--fito-grey);
  user-select: none;
  line-height: 35px;
}

.tier2-status-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 35px;
}

.filter-btn {
  font-family: var(--font-yunmo);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--fito-grey);
  padding: 0 8px;
  height: 35px;
  line-height: 35px;
  border: none;
  background: transparent;
  transition: color 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
}

.filter-btn:hover {
  color: var(--fito-blue);
  border: none;
  background: transparent;
}

.filter-btn.is-active {
  color: var(--fito-blue);
  font-weight: 700;
  border: none;
  background: transparent;
}

.color-mode-btn {
  padding: 0 6px;
  letter-spacing: 0.08em;
}

.count-pill {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  opacity: 0.85;
}

.track-divider {
  display: none;
}

.tier2-colors-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  height: 35px;
  line-height: 35px;
}

.tier2-colors-cell::-webkit-scrollbar {
  display: none;
}

.tier2-colors-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  height: 35px;
  line-height: 35px;
}

.tier2-colors-scroll::-webkit-scrollbar {
  display: none;
}

.color-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  height: 35px;
  line-height: 35px;
  border: none;
  background: transparent;
  font-family: var(--font-yunmo);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--fito-grey);
  white-space: nowrap;
  transition: color 0.15s ease, opacity 0.15s ease;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
}

.color-chip:hover {
  color: var(--fito-blue);
  border: none;
  background: transparent;
}

.color-chip.is-active {
  color: var(--fito-blue);
  font-weight: 700;
  border: none;
  background: transparent;
}

.color-chip.is-zero-stock {
  opacity: 0.45;
}

.color-chip.is-zero-stock:hover,
.color-chip.is-zero-stock.is-active {
  opacity: 1;
}

.color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

/* Management Mode Sub-Track */
.toolbar-manage-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 16px;
  border-top: var(--fito-line);
  background: var(--fito-blue-soft);
  height: 35px;
  min-height: 35px;
  max-height: 35px;
  line-height: 35px;
  box-sizing: border-box;
}

.toolbar-manage-track[hidden] {
  display: none;
}

.manage-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  height: 100%;
}

.manage-badge {
  font-family: var(--font-yunmo);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--fito-blue);
  font-weight: 600;
  line-height: 35px;
  white-space: nowrap;
}

.nas-path-label {
  font-family: var(--font-songti);
  font-size: 12px;
  color: var(--fito-grey);
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 35px;
}

.manage-btn {
  font-family: var(--font-yunmo);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--fito-blue);
  padding: 0 9px;
  height: 22px;
  line-height: 20px;
  border: 1px solid var(--fito-grey);
  background: #ffffff;
  transition: all 0.15s ease;
  box-sizing: border-box;
  white-space: nowrap;
}

.manage-btn:hover:not(:disabled) {
  border-color: var(--fito-blue);
  background: var(--fito-blue);
  color: #ffffff;
}

.manage-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Active Filter Strip */
.active-filter-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 18px;
  height: 35px;
  min-height: 35px;
  max-height: 35px;
  line-height: 35px;
  box-sizing: border-box;
  border-bottom: var(--fito-line);
  font-family: var(--font-yunmo);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--fito-blue);
  background: var(--fito-bg);
}

.active-filter-strip[hidden] {
  display: none;
}

.active-filter-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 35px;
}

.clear-filter-btn {
  color: var(--fito-grey);
  font-size: 11px;
  padding: 0 6px;
  height: 20px;
  line-height: 18px;
  border: 1px solid var(--fito-grey);
  box-sizing: border-box;
  white-space: nowrap;
}

.clear-filter-btn:hover {
  color: var(--fito-blue);
  border-color: var(--fito-blue);
}

/* ==========================================================================
   4. PRODUCT ARCHIVE GRID (Architectural Hairline Grid + Double-Line Bands)
   ========================================================================== */

.archive-main {
  width: 100%;
  min-height: 48vh;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  gap: 0;
  border-top: none;
  border-left: var(--fito-line);
  background: var(--fito-bg);
}

/* Each Product Card Cell */
.archive-card {
  display: flex;
  flex-direction: column;
  background: var(--fito-bg);
  position: relative;
  min-width: 0;
  border-right: var(--fito-line);
  border-bottom: var(--fito-line);
  box-sizing: border-box;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

/* Empty Placeholder Card (Completes trailing gaps in the last row) */
.archive-card.is-placeholder {
  pointer-events: none;
  user-select: none;
  background: var(--fito-bg);
}

.archive-card.is-placeholder .placeholder-stage {
  background: #faf9f7;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
}

.archive-card.is-placeholder .placeholder-stage::after {
  content: '';
  width: 12px;
  height: 12px;
  background:
    linear-gradient(to right, transparent 5px, var(--fito-grey) 5px, var(--fito-grey) 6px, transparent 6px),
    linear-gradient(to bottom, transparent 5px, var(--fito-grey) 5px, var(--fito-grey) 6px, transparent 6px);
  opacity: 0.28;
}

.archive-card.is-placeholder .placeholder-track {
  background: var(--fito-bg);
}

.archive-card.is-placeholder .placeholder-text {
  visibility: hidden;
}

/* Card Image Stage (At the very top of each card) */
.card-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #faf9f7;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-bottom: var(--fito-line);
  box-sizing: border-box;
}

.card-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
}

.card-stage:hover .card-photo {
  transform: scale(1.025);
}

/* Card Stock Badge on Image Stage: Pure Minimalist Number (No background block, clean contrast) */
.card-stock-badge {
  position: absolute;
  top: 9px;
  right: 11px;
  z-index: 3;
  background: transparent;
  border: none;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-yunmo);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--fito-blue);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.8), 0 0 8px rgba(255, 255, 255, 0.6);
}

.archive-card.is-sold .card-stock-badge {
  color: var(--fito-grey);
  background: transparent;
  border: none;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
}

/* Card Info Track (Directly underneath the photo: Product Code + Multi-Color Swatches) */
.card-track-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  height: 35px;
  min-height: 35px;
  max-height: 35px;
  line-height: 35px;
  border-bottom: var(--fito-line);
  background: var(--fito-bg);
  box-sizing: border-box;
}

.card-code {
  font-family: var(--font-yunmo);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--fito-blue);
  transform: skewX(-6deg);
  white-space: nowrap;
  line-height: 1;
}

.card-color-meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.color-dots-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.color-dots-group .color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
  box-sizing: border-box;
}

/* When Product is SOLD: Keep image pure & unobstructed, subtly lower resting opacity */
.archive-card.is-sold .card-photo {
  opacity: 0.56;
}

.archive-card.is-sold .card-stage:hover .card-photo {
  opacity: 0.92;
}

.archive-card.is-sold .card-code {
  color: var(--fito-grey);
}

/* Selection Checkbox in Management Mode */
.card-select-box {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  width: 22px;
  height: 22px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--fito-grey);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.card-select-box input {
  width: 14px;
  height: 14px;
  accent-color: var(--fito-blue);
  cursor: pointer;
}

/* Card Bottom Track: 3-column layout (Status Left, Series Center, Collection Right) */
.card-track-bottom {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 14px;
  height: 35px;
  min-height: 35px;
  max-height: 35px;
  line-height: 35px;
  background: var(--fito-bg);
  box-sizing: border-box;
  position: relative;
}

.card-status-col {
  justify-self: start;
  display: flex;
  align-items: center;
  min-width: 0;
}

.card-status-label {
  display: inline-block;
  font-family: var(--font-yunmo);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--fito-blue);
  white-space: nowrap;
  line-height: 1;
}

.archive-card.is-sold .card-status-label {
  color: var(--fito-grey);
}

.card-series-name {
  justify-self: center;
  text-align: center;
  font-family: var(--font-songti);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--fito-grey);
  user-select: none;
  white-space: nowrap;
  line-height: 1;
}

.archive-card.is-sold .card-series-name {
  color: var(--fito-grey);
}

.card-name-col {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.card-dimension-label {
  display: inline-block;
  font-family: var(--font-yunmo);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--fito-blue);
  white-space: nowrap;
  line-height: 1;
}

.archive-card.is-sold .card-dimension-label {
  color: var(--fito-grey);
}

/* Interactive Status Toggle in Management Mode */
.card-status-toggle {
  font-family: var(--font-yunmo);
  font-size: 12px;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border: 1px solid var(--fito-blue);
  color: var(--fito-blue);
  background: var(--fito-blue-soft);
  transition: all 0.15s ease;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}

.archive-card.is-sold .card-status-toggle {
  border-color: var(--fito-grey);
  color: var(--fito-grey);
  background: transparent;
}

.card-status-toggle:hover {
  background: var(--fito-blue);
  color: #ffffff;
  border-color: var(--fito-blue);
}

.card-color-select {
  font-family: var(--font-yunmo);
  font-size: 11px;
  color: var(--fito-blue);
  border: 1px solid var(--fito-grey);
  padding: 2px 6px;
  background: #ffffff;
  cursor: pointer;
}

/* Empty State */
.empty-state {
  padding: 70px 24px;
  text-align: center;
  border-bottom: var(--fito-line);
}

.empty-state[hidden] {
  display: none;
}

.empty-title {
  font-family: var(--font-yunmo);
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--fito-blue);
  margin-bottom: 8px;
}

.empty-subtitle {
  font-family: var(--font-songti);
  font-size: 14px;
  color: var(--fito-grey);
  margin-bottom: 18px;
}

/* ==========================================================================
   5. FOOTER MANIFESTO SECTION (Frameless clean editorial typography)
   ========================================================================== */

.archive-footer {
  margin-top: 35px;
  border-top: none;
  border-bottom: none;
  margin-bottom: 0;
  background: var(--fito-bg);
}

.footer-manifesto-container {
  padding: 24px 24px 35px;
  text-align: center;
}

.manifesto-text {
  font-family: var(--font-songti);
  font-size: 13px;
  line-height: 1.25;
  letter-spacing: 0.04em;
  color: var(--fito-grey);
}

.footer-utility-track {
  border-top: none;
  height: 35px;
  min-height: 35px;
  max-height: 35px;
  line-height: 35px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.footer-utility-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 100%;
}

.footer-search-wrap .tier1-search-input {
  width: 150px;
}

.footer-search-wrap .tier1-search-input:focus {
  width: 210px;
}

/* ==========================================================================
   5.5 EXPORT OFFLINE PDF DIALOG
   ========================================================================== */
.pdf-device-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.pdf-device-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  padding: 10px 12px;
  border: var(--fito-line);
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, background-color 0.16s ease;
  box-sizing: border-box;
}

.pdf-device-card:hover {
  border-color: var(--fito-blue);
  background: #f6f9fc;
}

.pdf-device-card.is-active {
  border-color: var(--fito-blue);
  background: var(--fito-blue-soft);
  box-shadow: inset 0 0 0 1px var(--fito-blue);
}

.pdf-device-name {
  font-family: var(--font-yunmo);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--fito-blue);
}

.pdf-device-spec {
  font-family: var(--font-songti);
  font-size: 11px;
  color: var(--fito-grey);
}

.pdf-preview-summary {
  margin-top: 8px;
  color: var(--fito-blue);
}

.pdf-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
}

.pdf-progress-bar {
  width: 100%;
  height: 4px;
  background: #e6ecf1;
  overflow: hidden;
}

.pdf-progress-fill {
  height: 100%;
  background: var(--fito-blue);
  transition: width 0.2s ease;
}

.pdf-progress-text {
  font-family: var(--font-songti);
  font-size: 11px;
  color: var(--fito-grey);
}

/* ==========================================================================
   6. NATIVE <dialog closedby="any"> MODALS (Following modern-web-guidance)
   ========================================================================== */

.fito-dialog {
  margin: auto;
  padding: 0;
  border: var(--fito-line);
  background: var(--fito-bg);
  color: var(--fito-grey);
  width: min(920px, 94vw);
  max-height: 90vh;
  overflow: auto;
}

.fito-dialog-narrow {
  width: min(540px, 94vw);
}

.fito-dialog::backdrop {
  background-color: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(3px);
}

.dialog-shell {
  display: flex;
  flex-direction: column;
}

.dialog-track-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: var(--fito-line);
  min-height: 42px;
}

.dialog-header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.dialog-code {
  font-family: var(--font-yunmo);
  font-size: 18px;
  letter-spacing: 0.06em;
  color: var(--fito-blue);
  transform: skewX(-6deg);
}

.dialog-collection-tag {
  font-family: var(--font-songti);
  font-size: 13px;
  color: var(--fito-grey);
}

.dialog-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dialog-status-tag {
  font-family: var(--font-yunmo);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--fito-blue);
  font-weight: 700;
}

.dialog-close-btn {
  font-family: var(--font-yunmo);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--fito-grey);
  padding: 4px 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: color 0.15s ease;
  outline: none;
}

.dialog-close-btn:hover {
  color: var(--fito-blue);
}

.dialog-body-grid {
  display: grid;
  grid-template-columns: 1.08fr 1fr;
}

.dialog-image-pane {
  border-right: var(--fito-line);
  background: #faf9f7;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  min-height: 380px;
  position: relative;
}

.photo-carousel-stage {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  touch-action: pan-y pinch-zoom;
}

.carousel-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(4px);
  border: 1px solid var(--fito-line);
  color: var(--fito-blue);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
}

.carousel-prev {
  left: 12px;
}

.carousel-next {
  right: 12px;
}

.carousel-nav-btn:hover {
  background: var(--fito-blue);
  color: #ffffff;
  border-color: var(--fito-blue);
}

.carousel-nav-btn[hidden] {
  display: none !important;
}

.carousel-counter-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 4;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(4px);
  border: 1px solid var(--fito-line);
  padding: 2px 8px;
  font-family: var(--font-yunmo);
  font-size: 11px;
  font-weight: 600;
  color: var(--fito-blue);
  pointer-events: none;
}

.carousel-counter-badge[hidden] {
  display: none !important;
}

.dialog-thumbnails-strip {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  overflow-x: auto;
  border-top: var(--fito-line);
  background: var(--fito-bg);
  box-sizing: border-box;
}

.dialog-thumbnails-strip[hidden] {
  display: none !important;
}

.dialog-thumb-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid var(--fito-line);
  background: #faf9f7;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.dialog-thumb-btn:hover {
  border-color: var(--fito-blue);
}

.dialog-thumb-btn.is-active {
  border: 2px solid var(--fito-blue);
}

.dialog-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dialog-photo {
  width: 100%;
  height: 100%;
  max-height: 68vh;
  object-fit: contain;
  display: block;
}

.dialog-meta-pane {
  display: flex;
  flex-direction: column;
}

.meta-block {
  padding: 16px 20px;
  border-bottom: var(--fito-line);
}

.meta-block:last-child {
  border-bottom: none;
}

/* Stock Management Section */
.stock-block {
  background: #ffffff;
}

.stock-block.is-readonly .stock-btn,
.stock-block.is-readonly .stock-add-btn {
  display: none !important;
}

.stock-block.is-readonly .stock-input {
  border: 1px solid transparent;
  background: transparent;
  pointer-events: none;
  font-weight: 700;
  color: var(--fito-blue);
  padding: 0;
  width: auto;
  text-align: left;
}

.stock-control-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stock-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--fito-grey);
  background: #ffffff;
  color: var(--fito-blue);
  font-family: var(--font-yunmo);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
}

.stock-btn:hover {
  background: var(--fito-blue);
  color: #ffffff;
  border-color: var(--fito-blue);
}

.stock-input {
  width: 58px;
  height: 32px;
  border: 1px solid var(--fito-grey);
  text-align: center;
  font-family: var(--font-yunmo);
  font-size: 14px;
  font-weight: 700;
  color: var(--fito-blue);
  background: #ffffff;
  outline: none;
  -moz-appearance: textfield;
}

.stock-input::-webkit-outer-spin-button,
.stock-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stock-input:focus {
  border-color: var(--fito-blue);
}

.stock-add-btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--fito-blue);
  background: var(--fito-blue-soft);
  color: var(--fito-blue);
  font-family: var(--font-yunmo);
  font-size: 12px;
  letter-spacing: 0.05em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  outline: none;
}

.stock-add-btn:hover {
  background: var(--fito-blue);
  color: #ffffff;
}

.stock-subtext {
  font-family: var(--font-songti);
  font-size: 12px;
  color: var(--fito-grey);
  margin-top: 6px;
}

.meta-label {
  display: block;
  font-family: var(--font-songti);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--fito-grey);
  margin-bottom: 10px;
}

.status-switch-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-option-btn {
  padding: 4px 6px;
  border: none;
  background: transparent;
  font-family: var(--font-yunmo);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--fito-grey);
  cursor: pointer;
  transition: color 0.15s ease;
  outline: none;
}

.status-option-btn:hover {
  color: var(--fito-blue);
}

.status-option-btn.is-active {
  color: var(--fito-blue);
  font-weight: 700;
}

/* Pure Circular Color Swatches (6 columns x 4 rows matching official palette image) */
.palette-swatches-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px 10px;
  justify-items: center;
  align-items: center;
  padding: 8px 0;
}

.palette-swatch-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.14);
  cursor: pointer;
  padding: 0;
  background-clip: padding-box;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  outline: none;
}

.palette-swatch-circle:hover {
  transform: scale(1.18);
}

.palette-swatch-circle.is-active {
  transform: scale(1.1);
  box-shadow: 0 0 0 2px var(--fito-bg), 0 0 0 4px var(--fito-blue);
}

.color-stage-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(120, 120, 120, 0.25);
  min-height: 30px;
}

.color-stage-preview {
  font-family: var(--font-yunmo);
  font-size: 12px;
  color: var(--fito-grey);
  letter-spacing: 0.04em;
}

.color-stage-preview.is-dirty {
  color: var(--fito-blue);
  font-weight: 600;
}

.color-stage-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-reset-btn {
  font-family: var(--font-yunmo);
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--fito-grey);
  background: transparent;
  color: var(--fito-grey);
  cursor: pointer;
  transition: all 0.15s ease;
}

.color-reset-btn:hover {
  border-color: var(--fito-blue);
  color: var(--fito-blue);
}

.color-apply-btn {
  font-family: var(--font-yunmo);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border: 1px solid var(--fito-blue);
  background: var(--fito-blue);
  color: #ffffff;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.color-apply-btn:hover {
  opacity: 0.88;
}

.color-apply-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dialog-track-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 18px;
  border-top: var(--fito-line);
  min-height: 42px;
}

.dialog-nav-btns {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dialog-nav-btn {
  font-family: var(--font-yunmo);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--fito-grey);
  border: none;
  background: transparent;
  padding: 4px 6px;
  cursor: pointer;
  transition: color 0.15s ease;
  outline: none;
}

.dialog-nav-btn:hover {
  color: var(--fito-blue);
}

.custom-id-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.fito-input,
.fito-textarea {
  width: 100%;
  padding: 7px 10px;
  border: var(--fito-line);
  font-family: var(--font-yunmo);
  font-size: 13px;
  color: var(--fito-blue);
  background: #ffffff;
  outline: none;
}

.fito-textarea {
  font-family: var(--font-songti);
  resize: vertical;
}

.fito-input:focus,
.fito-textarea:focus {
  border-color: var(--fito-blue);
}

.fito-btn-outline {
  padding: 7px 12px;
  border: 1px solid var(--fito-blue);
  font-family: var(--font-yunmo);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--fito-blue);
  white-space: nowrap;
}

.fito-btn-outline:hover {
  background: var(--fito-blue);
  color: #ffffff;
}

.fito-btn-primary {
  padding: 8px 16px;
  background: var(--fito-blue);
  color: #ffffff;
  font-family: var(--font-yunmo);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.fito-btn-primary:hover {
  opacity: 0.9;
}

.dialog-track-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-top: var(--fito-line);
  min-height: 40px;
}

.dialog-footer-hint {
  font-family: var(--font-songti);
  font-size: 12px;
  color: var(--fito-grey);
}

.dialog-nav-btns {
  display: flex;
  gap: 8px;
}

/* Upload Preview Box */
.upload-preview-box {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: var(--fito-line);
  align-items: center;
}

.upload-preview-box[hidden] {
  display: none;
}

.upload-preview-img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border: var(--fito-line);
}

.upload-detected-code {
  font-family: var(--font-yunmo);
  font-size: 20px;
  color: var(--fito-blue);
  margin-bottom: 10px;
  transform: skewX(-6deg);
  display: inline-block;
}

/* Toast Notification */
.fito-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
  padding: 10px 18px;
  background: #ffffff;
  border: 1px solid var(--fito-blue);
  color: var(--fito-blue);
  font-family: var(--font-yunmo);
  font-size: 13px;
  letter-spacing: 0.05em;
  box-shadow: 0 6px 20px rgba(54, 75, 149, 0.10);
}

/* ==========================================================================
   7. RESPONSIVE BREAKPOINTS (Fluid Real-Time Architectural Reflow)
   ========================================================================== */

@media (max-width: 1200px) {
  :root {
    --header-band-width: 33.3333%; /* 3 columns (odd) => 1 column wide */
  }

  .archive-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --header-band-width: 100%; /* 2 columns (even) => 2 columns wide */
  }
  .desktop-only {
    display: none !important;
  }

  .grid-row {
    grid-template-columns: var(--grid-cols-mobile);
  }

  .tier1-track {
    min-height: 35px;
    height: 35px;
    line-height: 35px;
    padding: 0 12px;
    gap: 10px;
  }

  .tier1-collections-cell {
    padding: 0;
    gap: 4px;
    border-bottom: none;
    height: 100%;
  }

  .collection-tab-btn {
    font-size: 12px;
    padding: 0 6px;
    height: 100%;
    line-height: 35px;
  }

  .tier1-actions-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    justify-content: flex-end;
    height: 100%;
  }

  .tier1-action-btn {
    font-size: 12px;
    padding: 0 6px;
    height: 100%;
    line-height: 35px;
  }

  .tier1-search-input {
    width: 80px;
    font-size: 12px;
    padding: 2px 4px;
    height: 22px;
  }

  .tier1-search-input:focus {
    width: 105px;
  }

  .tier2-track {
    min-height: 35px;
    height: 35px;
    line-height: 35px;
    padding: 0 12px;
    gap: 16px;
  }

  .tier2-status-cell {
    border-bottom: none;
    padding-bottom: 0;
    gap: 8px;
    height: 35px;
  }

  .filter-btn {
    font-size: 12px;
    padding: 0 6px;
    height: 35px;
    line-height: 35px;
  }

  .color-chip {
    font-size: 12px;
    padding: 0 5px;
    height: 35px;
    line-height: 35px;
  }

  .tier2-colors-cell {
    padding: 0;
    gap: 8px;
    height: 35px;
  }

  .toolbar-manage-track {
    height: 35px;
    min-height: 35px;
    max-height: 35px;
    line-height: 35px;
    padding: 0 12px;
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .manage-cell {
    border: none;
    flex-shrink: 0;
    height: 100%;
  }

  .active-filter-strip {
    height: 35px;
    min-height: 35px;
    max-height: 35px;
    line-height: 35px;
    padding: 0 12px;
    font-size: 11px;
    gap: 8px;
  }

  .archive-footer {
    margin-top: 35px;
    margin-bottom: 0;
  }

  .footer-manifesto-container {
    padding: 20px 16px 35px;
  }

  .archive-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dialog-body-grid {
    grid-template-columns: 1fr;
  }

  .dialog-image-pane {
    border-right: none;
    border-bottom: var(--fito-line);
    min-height: 260px;
  }
}

@media (max-width: 480px) {
  .tier1-track {
    padding: 0 8px;
    gap: 6px;
    min-height: 35px;
    height: 35px;
    line-height: 35px;
  }

  .collection-tab-btn {
    font-size: 11px;
    padding: 0 4px;
    height: 100%;
    line-height: 35px;
  }

  .tier1-actions-cell {
    gap: 4px;
    height: 100%;
  }

  .tier1-action-btn {
    font-size: 11px;
    padding: 0 4px;
    height: 100%;
    line-height: 35px;
  }

  .tier1-search-input {
    width: 65px;
    font-size: 11px;
    height: 20px;
  }

  .tier1-search-input:focus {
    width: 90px;
  }

  .tier2-track {
    padding: 0 8px;
    gap: 12px;
    min-height: 35px;
    height: 35px;
    line-height: 35px;
  }

  .filter-btn {
    font-size: 11px;
    padding: 0 4px;
    height: 35px;
    line-height: 35px;
  }

  .color-chip {
    font-size: 11px;
    padding: 0 4px;
    height: 35px;
    line-height: 35px;
  }

  .toolbar-manage-track {
    padding: 0 8px;
    gap: 8px;
  }

  .active-filter-strip {
    height: 35px;
    min-height: 35px;
    max-height: 35px;
    line-height: 35px;
    padding: 0 8px;
    font-size: 10px;
    gap: 6px;
  }

  .footer-manifesto-container {
    padding: 16px 12px 24px;
  }

  .footer-utility-track {
    padding: 0 8px;
    overflow-x: auto;
    scrollbar-width: none;
    justify-content: flex-start;
  }

  .footer-utility-actions {
    gap: 8px;
  }

  .footer-search-wrap .tier1-search-input {
    width: 100px;
  }

  .footer-search-wrap .tier1-search-input:focus {
    width: 130px;
  }

  .card-code,
  .card-status-label,
  .card-series-name,
  .card-dimension-label,
  .card-status-toggle {
    font-size: 11px;
  }

  .archive-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   PIN Authentication Modal
   ========================================================================== */
.auth-dialog {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 380px;
  width: 90%;
  margin: auto;
}

.auth-dialog::backdrop {
  background: rgba(10, 10, 10, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.auth-shell {
  background: var(--fito-white);
  border: 1px solid var(--fito-border);
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.auth-brand {
  font-family: var(--font-brand);
  font-size: 18px;
  letter-spacing: 0.14em;
  color: var(--fito-black);
}

.auth-title {
  font-family: var(--font-tech);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--fito-grey);
}

.auth-subtext {
  font-size: 12px;
  color: var(--fito-grey);
  margin-bottom: 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-input-wrap {
  width: 100%;
}

.auth-pin-input {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-tech);
  font-size: 18px;
  text-align: center;
  letter-spacing: 0.3em;
  border: 1px solid var(--fito-border);
  background: var(--fito-bg-subtle);
  color: var(--fito-black);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.auth-pin-input:focus {
  border-color: var(--fito-blue);
  background: var(--fito-white);
}

.auth-msg {
  font-size: 12px;
  color: #d32f2f;
  min-height: 16px;
}

.auth-submit-btn {
  width: 100%;
  padding: 12px;
  font-size: 13px;
}
