:root {
  --bg: #fff;
  --text: #111214;
  --muted: #6f7684;
  --line: #e9edf2;
  --soft: #f5f7fa;
  --soft-2: #fafbfc;
  --accent: #aef3ff;
  --accent-strong: #74e8fb;
  --yellow: #ffe16a;
  --green: #1f7a40;
  --green-soft: #a6f48a;
  --red: #ff6a6a;
  --shadow: 0 20px 50px rgba(17, 18, 20, 0.06);
  --radius: 26px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { font-family: Inter, system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
input, textarea, select { outline: none; }
.material-symbols-rounded { font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
.hidden { display: none !important; }
.brand-title, h1, h2, h3, h4, .hero-title, .stat-value, .sheet-title, .item-name-overlay { font-family: Unbounded, Inter, sans-serif; }
.app { min-height: 100vh; padding-bottom: 70px; }
.topbar {
  position: sticky; top: 0; z-index: 45; background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
  display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line);
}
.brand-kicker, .section-kicker { color: var(--muted); text-transform: lowercase; letter-spacing: .09em; font-size: 12px; }
.brand-title { font-size: 18px; }
.page-shell { max-width: 1280px; margin: 0 auto; padding: 18px 20px 40px; }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 28px; padding: 8px 0 28px; border-bottom: 1px solid var(--line); }
.hero.compact-hero { align-items: end; }
.hero-title { font-size: clamp(32px, 5vw, 56px); line-height: 1.04; margin: 8px 0 14px; }
.hero-text { color: var(--muted); max-width: 760px; line-height: 1.65; }
.hero-side-tight { padding-top: 16px; }
.quick-lines { display: grid; gap: 12px; }
.quick-line { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.quick-line:last-child { border-bottom: 0; }
.quick-line span:last-child { color: var(--muted); }
.gate-view { display: none; }
.gate-view.active { display: block; }
.view { display: block; }
.section { padding: 16px 0 26px; border-bottom: 1px solid var(--line); }
.section:last-child { border-bottom: 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 14px; }
.section-head h2 { margin: 6px 0 0; font-size: clamp(24px, 4vw, 38px); }
.slim-head { margin-bottom: 16px; }
.btn {
  height: 44px; border-radius: 999px; border: 1px solid transparent; padding: 0 16px; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700;
}
.btn.wide { width: 100%; }
.btn.btn-accent { background: var(--accent); color: #0f1a1f; }
.btn.btn-accent:hover { background: var(--accent-strong); }
.btn.btn-soft { background: var(--soft); border-color: var(--line); color: var(--text); }
.btn.btn-danger { background: rgba(255,106,106,.12); border-color: rgba(255,106,106,.18); color: #a81b1b; }
.btn.btn-muted { background: var(--soft-2); border-color: var(--line); color: var(--muted); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 999px; border: 1px solid var(--line); background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.field { display: grid; gap: 8px; }
.field > span { color: var(--muted); font-size: 13px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 18px; padding: 13px 14px; color: var(--text);
}
.field textarea { min-height: 120px; resize: vertical; }
.inline-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.toolbar-line { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 18px 0 10px; }
.search-wrap, .select-wrap {
  height: 48px; border: 1px solid var(--line); border-radius: 999px; background: #fff; display: flex; align-items: center; gap: 10px; padding: 0 14px;
}
.search-wrap { flex: 1; min-width: 240px; }
.search-wrap input { border: 0; flex: 1; background: transparent; }
.select-wrap select { border: 0; background: transparent; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-chip {
  height: 44px; border-radius: 999px; padding: 0 16px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-weight: 700;
}
.tab-chip.active { background: var(--soft); color: var(--text); }
.archive-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.card {
  position: relative; border: 1px solid var(--line); border-radius: 30px; overflow: hidden; background: #fff; box-shadow: var(--shadow);
}
.card-media {
  position: relative; aspect-ratio: 1 / 1; background: linear-gradient(180deg, #f7f8fa, #eef2f5); overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.no-photo { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); padding: 20px; text-align: center; }
.photo-overlay { position: absolute; inset: auto 0 0 0; padding: 22px 18px 16px; background: linear-gradient(180deg, transparent, rgba(0,0,0,.68)); color: #fff; }
.item-name-overlay { font-size: 18px; line-height: 1.25; max-width: 90%; text-shadow: 0 4px 20px rgba(0,0,0,.35); }
.section-badge {
  position: absolute; top: 12px; right: 12px; z-index: 2; background: rgba(174,243,255,.96); color: #0d3f49; border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 800;
}
.card-body { display: grid; gap: 10px; padding: 16px 16px 18px; }
.info-row { display: flex; align-items: start; gap: 10px; color: var(--muted); font-size: 14px; }
.info-row strong { color: var(--text); font-weight: 600; }
.info-row .material-symbols-rounded { font-size: 18px; margin-top: 1px; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 9px 12px; font-weight: 700; width: fit-content;
}
.inventory-badge { border: 1px solid var(--line); background: var(--soft); cursor: pointer; }
.card-actions { display: flex; gap: 10px; }
.card-actions .icon-btn { width: 46px; height: 46px; }
.sheet {
  border: 1px solid var(--line); border-radius: 32px; background: #fff; box-shadow: var(--shadow); padding: 18px;
}
.sheet-title { font-size: 22px; margin: 6px 0 0; }
.sheet-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; margin-bottom: 16px; }
.sheet-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 26px; }
.gallery-main { aspect-ratio: 1.1 / 1; border-radius: 28px; overflow: hidden; background: var(--soft); }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.gallery-thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.thumb-btn { width: 88px; height: 88px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: var(--soft); padding: 0; }
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; }
.detail-list { display: grid; gap: 0; }
.detail-line { display: flex; justify-content: space-between; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-line:last-child { border-bottom: 0; }
.detail-line span:last-child { color: var(--muted); text-align: right; }
.panel-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px; }
.stack { display: grid; gap: 24px; }
.panel-list { display: grid; gap: 0; }
.panel-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.panel-item:last-child { border-bottom: 0; }
.profile-chip { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.avatar, .avatar-lg { border-radius: 50%; background: linear-gradient(180deg, #eff3f7, #e5ebf1); overflow: hidden; display: grid; place-items: center; color: var(--muted); flex: none; }
.avatar { width: 44px; height: 44px; }
.avatar-lg { width: 64px; height: 64px; }
.avatar img, .avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.profile-list { display: grid; gap: 0; }
.profile-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.profile-row:last-child { border-bottom: 0; }
.auto-login-badge { position: relative; }
.auto-login-badge .hint { position: absolute; left: 0; top: calc(100% + 8px); width: 260px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow); color: var(--muted); font-size: 13px; display: none; z-index: 10; }
.auto-login-badge:hover .hint { display: block; }
.maintenance-shell { max-width: 740px; padding: 14vh 0 0; }
.maintenance-title { color: #c62929; font-size: clamp(34px, 6vw, 60px); margin: 12px 0 12px; }
.maintenance-text { color: var(--text); max-width: 620px; line-height: 1.7; }
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(17,18,20,.24); backdrop-filter: blur(10px); }
.modal-card {
  position: relative; z-index: 1; width: min(760px, calc(100vw - 22px)); max-height: min(88vh, 980px); overflow: auto;
  border-radius: 34px; border: 1px solid var(--line); background: #fff; box-shadow: 0 30px 80px rgba(17,18,20,.14); padding: 18px;
}
.modal-card.slim { width: min(520px, calc(100vw - 22px)); }
.modal-card::-webkit-scrollbar { width: 8px; }
.modal-card::-webkit-scrollbar-thumb { background: #d8dde3; border-radius: 999px; }
.modal-grid { display: grid; gap: 14px; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.photo-picker-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.photo-tile { position: relative; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; aspect-ratio: 1/1; background: var(--soft); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-remove { position: absolute; top: 8px; right: 8px; }
.toast-root { position: fixed; right: 16px; bottom: 16px; z-index: 120; display: grid; gap: 10px; }
.toast { background: rgba(17,18,20,.94); color: #fff; border-radius: 20px; padding: 12px 14px; min-width: 240px; box-shadow: var(--shadow); }
.empty-state { padding: 26px 0; color: var(--muted); }
.logger-list { display: grid; gap: 0; }
.logger-item { display: grid; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.logger-item:last-child { border-bottom: 0; }
.logger-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.detail-changes { display: grid; gap: 8px; }
.change-pill { padding: 10px 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--soft-2); }
.fullscreen-viewer { position: fixed; inset: 0; background: rgba(17,18,20,.92); z-index: 120; display: grid; place-items: center; padding: 20px; }
.fullscreen-viewer img { max-width: min(96vw, 1280px); max-height: 88vh; border-radius: 24px; }
.qr-box { display: grid; place-items: center; gap: 12px; text-align: center; }
.qr-box img { width: min(72vw, 340px); border-radius: 24px; background: #fff; padding: 14px; }
.helper { color: var(--muted); font-size: 13px; line-height: 1.5; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
@media (max-width: 1080px) {
  .archive-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet-grid, .panel-grid, .hero { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topbar { padding: 14px; }
  .page-shell { padding: 14px 14px 26px; }
  .archive-grid, .photo-picker-grid, .inline-grid { grid-template-columns: 1fr; }
  .toolbar-line { align-items: stretch; }
  .search-wrap, .select-wrap, .tabs, .toolbar-line .btn { width: 100%; }
  .tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tab-chip { width: 100%; }
  .card-body { padding: 14px; }
  .modal-card { border-radius: 28px; width: calc(100vw - 12px); padding: 14px; }
  .gallery-thumbs { flex-wrap: nowrap; overflow: auto; }
  .detail-line { display: grid; gap: 8px; }
  .detail-line span:last-child { text-align: left; }
  .panel-item, .profile-row { align-items: start; flex-direction: column; }
  .toast-root { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: unset; }
}

/* KP_CHOOSER_START */
.kp-chooser-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  background: #000;
  color: #fff;
  overflow: hidden;
}

.kp-chooser-left {
  position: relative;
  z-index: 2;
  min-width: 0;
  padding: 20px 16px 24px;
  background: linear-gradient(90deg, rgba(0,0,0,0.98) 0%, rgba(0,0,0,0.94) 68%, rgba(0,0,0,0.34) 100%);
  display: flex;
  flex-direction: column;
}

.kp-chooser-brand {
  font-size: 18px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .03em;
  color: rgba(255,255,255,.98);
  margin-bottom: 24px;
}

.kp-chooser-title {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
  color: rgba(255,255,255,.62);
  margin-bottom: 14px;
}

.kp-chooser-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.kp-profile-card {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  width: 100%;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, opacity .18s ease;
}

.kp-profile-card:hover {
  transform: translateX(4px);
}

.kp-profile-card:active {
  transform: translateX(2px) scale(.995);
}

.kp-profile-avatar-wrap {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  padding: 4px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ff4fd8 48%, #705cff 100%);
  box-shadow: 0 0 0 1px rgba(255,255,255,.06);
  overflow: hidden;
  flex-shrink: 0;
}

.kp-profile-avatar-wrap.is-auto-login {
  background: linear-gradient(135deg, #67e8f9 0%, #22d3ee 48%, #06b6d4 100%);
}

.kp-profile-avatar-img,
.kp-profile-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  display: grid;
  place-items: center;
  object-fit: cover;
  background: #181818;
}

.kp-profile-avatar-fallback .material-symbols-rounded {
  font-size: 38px;
  color: rgba(255,255,255,.92);
}

.kp-profile-content {
  min-width: 0;
}

.kp-profile-name {
  font-size: 18px;
  line-height: 1.08;
  font-weight: 800;
  color: #fff;
  word-break: break-word;
}

.kp-profile-status {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.35;
  color: rgba(255,255,255,.66);
}

.kp-profile-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.kp-maintenance-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 96, 96, .14);
  color: #ffb4b4;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.kp-chooser-right {
  position: relative;
  min-width: 0;
  min-height: 100vh;
  background: #14091d;
}

.kp-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #14091d;
}

.kp-stage-slide,
.kp-stage-fallback {
  position: absolute;
  inset: 0;
}

.kp-stage-slide {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1s ease, transform 5s ease;
  filter: saturate(1.04) contrast(1.02);
}

.kp-stage-slide.is-active {
  opacity: 1;
  transform: scale(1);
}

.kp-stage-fallback {
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.18);
  font-size: 64px;
  font-weight: 800;
  letter-spacing: .04em;
}

.kp-stage-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg,
      #000 0%,
      #000 20%,
      rgba(0,0,0,0.995) 21.5%,
      rgba(0,0,0,0.96) 23%,
      rgba(0,0,0,0.78) 25%,
      rgba(0,0,0,0.42) 27%,
      rgba(0,0,0,0.12) 29%,
      rgba(0,0,0,0.02) 31%,
      rgba(0,0,0,0) 33%
    ),
    linear-gradient(180deg, rgba(0,0,0,.02) 0%, rgba(0,0,0,.10) 100%);
}

@media (max-width: 980px) {
  .kp-chooser-screen {
    grid-template-columns: 1fr;
    min-height: 100vh;
  }

  .kp-chooser-right {
    display: none;
  }

  .kp-chooser-left {
    min-height: 100vh;
    padding: 20px 16px 28px;
    background: #070707;
  }

  .kp-chooser-brand {
    margin-bottom: 28px;
  }

  .kp-profile-card {
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 14px;
  }

  .kp-profile-avatar-wrap {
    width: 78px;
    height: 78px;
  }

  .kp-profile-name {
    font-size: 20px;
  }

  .kp-profile-status {
    font-size: 13px;
  }

  .kp-profile-side {
    display: none;
  }
}
/* KP_CHOOSER_END */


.app-shell:has(.chooser-view.active) .topbar {
  display: none !important;
}

.app-shell:has(.chooser-view.active) .page-shell,
.app-shell:has(.chooser-view.active) .layout-shell,
.app-shell:has(.chooser-view.active) main,
.app-shell:has(.chooser-view.active) .content-shell {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

.app-shell:has(.chooser-view.active) {
  background: #000 !important;
}

@media (max-width: 980px) {
  .kp-chooser-screen {
    grid-template-columns: 1fr;
    min-height: 100vh;
  }

  .kp-chooser-left {
    min-height: 100vh;
    padding: 20px 16px 28px;
    background: #070707;
  }
}

/* CHOOSER_FULLSCREEN_FIX_START */
body.chooser-fullscreen-active .topbar {
  display: none !important;
}

body.chooser-fullscreen-active {
  overflow: hidden;
  background: #000 !important;
}

body.chooser-fullscreen-active .kp-chooser-screen {
  position: fixed;
  inset: 0;
  z-index: 70;
  min-height: 100vh;
}

body.chooser-fullscreen-active #chooserView,
body.chooser-fullscreen-active .chooser-view,
body.chooser-fullscreen-active .chooser-view.active {
  position: fixed;
  inset: 0;
  z-index: 70;
}

body.chooser-fullscreen-active .app-shell,
body.chooser-fullscreen-active main,
body.chooser-fullscreen-active .page-shell,
body.chooser-fullscreen-active .layout-shell,
body.chooser-fullscreen-active .content-shell {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

body.chooser-fullscreen-active .modal {
  z-index: 120 !important;
}

@media (max-width: 980px) {
  body.chooser-fullscreen-active .kp-chooser-screen {
    grid-template-columns: 1fr;
    min-height: 100vh;
  }

  body.chooser-fullscreen-active .kp-chooser-left {
    min-height: 100vh;
  }
}
/* CHOOSER_FULLSCREEN_FIX_END */
