:root {
  --olive: #c9a227;
  --orange: #f97316;
  --blue: #3b82f6;
  --slate: #64748b;
  --bg: #f4f1ea;
  --surface: rgba(255, 255, 255, 0.78);
  --ink: #1c1915;
  --muted: #6f675e;
  --line: rgba(28, 25, 21, 0.1);
  --sea: var(--blue);
  --sea-deep: #1b2430;
  --tint: var(--orange);
  --buoy: var(--orange);
  --danger: #e11d2e;
  --shadow: 0 1px 2px rgba(28, 25, 21, 0.05), 0 12px 28px rgba(28, 25, 21, 0.06);
  --radius: 999px;
  --tab: 68px;
  --input: rgba(255, 255, 255, 0.72);
  --placeholder: #8a8176;
  --glass: rgba(255, 255, 255, 0.66);
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --olive: #d4b43a;
    --bg: #121416;
    --surface: rgba(36, 40, 43, 0.78);
    --ink: #f6f3ec;
    --muted: #c4bbb0;
    --line: rgba(255, 255, 255, 0.1);
    --input: rgba(255, 255, 255, 0.06);
    --placeholder: #9c9488;
    --glass: rgba(18, 20, 22, 0.72);
    --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  background:
    radial-gradient(820px 380px at 100% -8%, color-mix(in srgb, var(--orange) 22%, transparent), transparent 55%),
    radial-gradient(680px 320px at -8% 0%, color-mix(in srgb, var(--blue) 18%, transparent), transparent 50%),
    var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; touch-action: manipulation; }
img { max-width: 100%; }
::placeholder { color: var(--placeholder); }

#app { min-height: 100vh; }
.workspace { min-width: 0; }
main {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 22px 18px 48px;
}

#nav {
  display: none;
  width: 270px;
  background: var(--sea-deep);
  color: #f6f3ec;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding-bottom: 18px;
}
@media (min-width: 960px) {
  #app { display: flex; flex-direction: row; }
  #nav { display: flex; flex-direction: column; }
  #tabbar { display: none; }
  main { padding: 28px 28px 56px; }
}

.brand { display: flex; gap: 12px; align-items: center; padding: 20px 16px 10px; }
.logo {
  width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center;
  background: var(--orange); color: white; font-weight: 800;
}
.brand strong { display: block; font-size: 16px; }
.brand small, .side-foot { color: #d6ebe7; }
.side-foot { margin: auto 16px 8px; font-size: 13px; }
.nav-links, .menu-links { display: flex; flex-direction: column; gap: 4px; padding: 8px; }
.side-link, .menu-link {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px;
  border-radius: 12px; text-decoration: none; font-weight: 650; color: inherit;
}
.side-link > span:nth-child(2), .menu-link > span:nth-child(2) { flex: 1; line-height: 1.25; }
.side-link.on { background: rgba(255, 255, 255, 0.14); }
.menu-link { color: var(--ink); }
.menu-link.on { background: var(--bg); }
.pill-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--c, var(--slate)); flex: none; }
.nav-meta { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.nav-dots { display: inline-flex; align-items: center; gap: 4px; }
.nav-dot { width: 10px; height: 10px; border-radius: 99px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45); }
.nav-count {
  background: var(--buoy); color: white; border-radius: 999px;
  min-width: 22px; text-align: center; font-size: 12px; padding: 2px 7px;
}

#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex;
  overflow-x: auto;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(18px);
  border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabbar a, #tabbar button {
  flex: 1 1 0; min-width: 0; min-height: 58px; margin: 0; border: 0; border-radius: 0; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; text-decoration: none; font-size: 11px; font-weight: 600; letter-spacing: -0.01em; position: relative;
}
#tabbar a span, #tabbar button span { font-size: 16px; line-height: 1.1; }
#tabbar .on { color: var(--c, var(--orange)); background: transparent; }
#tabbar .nav-count { position: absolute; top: 4px; right: calc(50% - 28px); margin: 0; }
#tabbar .nav-dots { position: absolute; bottom: 5px; gap: 3px; }
#tabbar .nav-dot { width: 7px; height: 7px; box-shadow: none; }
@media (min-width: 960px) { #tabbar { display: none; } }
@media (max-width: 959px) {
  main { padding: 12px 14px calc(var(--tab) + 28px + env(safe-area-inset-bottom)); }
}

#offline { margin: 0; padding: 10px 14px; background: var(--danger); color: white; text-align: center; }

.page-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; margin-bottom: 12px; }
.page-head h1, .section-title, .app-title { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; }
.app-title { margin: 2px 2px 12px; }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-weight: 600; font-size: 13px; }
.hint, .muted, .more-hint { color: var(--muted); }
.back { color: var(--blue); font-weight: 700; text-decoration: none; display: inline-flex; min-height: 44px; align-items: center; }

.search { position: relative; display: block; }
.search > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); }
.search input, .list-search {
  width: 100%; height: 48px; border-radius: 16px; border: 0;
  background: var(--input); padding: 0 14px 0 44px; font-size: 16px; font-weight: 500;
}
.list-search { padding-left: 14px; margin: 8px 0 12px; border: 1px solid var(--line); background: var(--surface); }
.search input:focus, .list-search:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 35%, transparent); }
.search-sticky {
  position: sticky; top: 0; z-index: 5; padding: 8px 0 10px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
}

.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
@media (min-width: 720px) { .quick { grid-template-columns: repeat(3, 1fr); } }
.quick a {
  background: var(--surface); border: 0; border-radius: 16px; min-height: 84px;
  text-decoration: none; color: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: var(--shadow); padding: 8px;
}
.quick b { font-size: 24px; line-height: 1; font-weight: 700; letter-spacing: -0.04em; }
.quick span { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 2px; text-align: center; line-height: 1.25; }

.card, .result, .person, .panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.card { margin-bottom: 12px; overflow: hidden; }
.card-main { display: block; padding: 14px 14px 6px; color: inherit; text-decoration: none; }
.card-top, .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.card-top { color: var(--muted); font-size: 13px; font-weight: 600; }
.row input { flex: 1; min-height: 48px; border-radius: 12px; border: 0; background: var(--input); padding: 0 12px; }
.card h3 { margin: 4px 0 2px; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.card p { margin: 2px 0; overflow-wrap: anywhere; }
.product, .work { font-weight: 600; }
.warn { color: var(--danger); font-weight: 700; }
.badges { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.badge, .shelf-badge {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 4px 8px;
  font-size: 13px; font-weight: 800;
}
.shelf-line { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 18px; }
.shelf-pick {
  flex: 1 1 140px; min-height: 46px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--bg); color: var(--ink); font-weight: 800; padding: 6px 10px;
}
.shelf-pick.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.shelf-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .shelf-grid { grid-template-columns: repeat(4, 1fr); } }
.shelf-tile { display: flex; flex-direction: column; gap: 4px; min-height: 108px; padding: 14px; text-decoration: none; color: inherit; margin: 0; }
.shelf-tile b { font-size: 28px; letter-spacing: 0.04em; }
.shelf-tile span { font-weight: 800; }
.shelf-tile small { color: var(--muted); }
.status-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px; }
@media (min-width: 720px) { .status-row { grid-template-columns: repeat(4, 1fr); } }
.st-btn {
  min-height: 52px; border-radius: 14px; border: 0;
  background: var(--c, var(--slate)); color: white; font-weight: 700; font-size: 13.5px;
  letter-spacing: -0.02em; line-height: 1.15; padding: 8px 6px; white-space: normal; text-wrap: balance;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}
.st-btn.on { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9); }

.result { margin-bottom: 12px; overflow: hidden; }
.result-head, .result-jobs a, .person {
  display: flex; gap: 8px; align-items: center; text-decoration: none; color: inherit; min-height: 52px;
}
.result-head { flex-wrap: wrap; padding: 12px 14px; }
.result-head strong { font-size: 18px; }
.result-jobs a { padding: 10px 14px; border-top: 1px solid var(--line); }
.person { margin-bottom: 8px; padding: 12px 14px; flex-wrap: wrap; }
.person em, .result-head em { margin-left: auto; color: var(--muted); font-style: normal; font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 99px; flex: none; }
.line-text { flex: 1; overflow-wrap: anywhere; }
.text-btn { margin-left: auto; color: var(--buoy); font-weight: 800; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }

.chips { display: flex; gap: 8px; overflow: auto; padding-bottom: 4px; }
.chip {
  flex: none; min-height: 40px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; font-weight: 650;
  transition: background .18s ease, color .18s ease;
}
.chip:hover { background: color-mix(in srgb, var(--c, var(--orange)) 16%, transparent); }
.chip.on { background: var(--c, var(--orange)); color: white; border-color: transparent; }
.chip .pill-dot { background: var(--c, var(--slate)); }
.chip.on .pill-dot { background: white; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  padding: 10px 14px; border-radius: 14px; border: 0; background: var(--input);
  color: inherit; text-decoration: none; font-weight: 650; font-size: 16px; letter-spacing: -0.015em; position: relative;
}
.btn-primary { background: var(--orange); color: white; width: 100%; min-height: 52px; font-size: 17px; font-weight: 700; }
.btn-ghost { background: var(--input); }
.btn-danger { color: var(--danger); background: transparent; width: 100%; }
.btn:active, .st-btn:active, .chip:active, .quick a:active { opacity: 0.72; }
.actions { display: flex; gap: 8px; margin: 12px 0; }
.actions .btn { flex: 1; width: auto; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field textarea, .field select {
  width: 100%; border: 0; background: var(--input); border-radius: 12px;
  padding: 12px 14px; min-height: 48px; font-size: 16px;
}
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 3px solid color-mix(in srgb, var(--blue) 40%, transparent); }
.grid-2 { display: grid; gap: 0 12px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } .customer-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; } .identity { position: sticky; top: 12px; } }

.suggest { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.suggest button, .lock {
  text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 10px 12px; min-height: 48px;
}
.lock p { margin: 2px 0; }
.owner { font-size: 18px; }
.owner a { color: inherit; }

.dock {
  position: sticky; bottom: calc(var(--tab) + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 28px rgba(26, 24, 20, 0.08); padding: 8px 10px 10px; z-index: 8; margin: 18px -14px 0;
}
@media (min-width: 960px) { .dock { bottom: 12px; border-radius: 20px; margin: 18px 0 0; } }
#status-caption { margin: 0 4px 6px; font-weight: 800; }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shot { margin: 0; position: relative; }
.shot-open { display: block; width: 100%; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--bg); min-height: 92px; }
.shot img { width: 100%; height: 110px; object-fit: cover; display: block; }
.shot-del { position: absolute; right: 6px; bottom: 6px; border: 0; border-radius: 999px; background: rgba(0,0,0,.7); color: white; min-height: 32px; }
.file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { display: flex; flex-direction: column; justify-content: center; min-height: 96px; padding: 12px; text-decoration: none; color: inherit; }
.stat b { font-size: 28px; line-height: 1; }
.panel { padding: 14px; margin-bottom: 12px; }
.status-edit { display: grid; gap: 8px; margin-bottom: 10px; }
.status-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.url { display: block; font-weight: 800; word-break: break-all; margin: 6px 0; }

.empty { padding: 28px 8px; text-align: center; }
.empty h2 { margin-bottom: 8px; }
.section-title { margin: 18px 0 10px; font-size: 20px; }

#sheet { position: fixed; inset: 0; z-index: 30; }
.sheet-back, .light-back { position: absolute; inset: 0; border: 0; background: rgba(20, 16, 12, 0.5); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 8px 8px calc(12px + env(safe-area-inset-bottom)); max-height: 86vh; overflow: auto;
}
.sheet-panel::before, .assistant-panel::before {
  content: ""; display: block; width: 36px; height: 5px; border-radius: 99px;
  background: var(--line); margin: 4px auto 2px;
}
.sheet-panel h2 { margin: 8px 12px 10px; font-size: 20px; font-weight: 700; letter-spacing: -0.03em; }

#lightbox { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; }
#lightbox img { position: relative; z-index: 1; max-width: min(96vw, 1000px); max-height: 82vh; object-fit: contain; }
.light-nav, .light-close {
  position: absolute; z-index: 2; border: 0; background: rgba(255,255,255,.16); color: white; border-radius: 999px; min-width: 48px; min-height: 48px;
}
.light-nav.prev { left: 10px; } .light-nav.next { right: 10px; font-size: 32px; }
.light-nav.prev { font-size: 32px; }
.light-close { bottom: calc(16px + env(safe-area-inset-bottom)); }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--tab) + 14px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 70; background: #1c1917; color: #fffdf8; border-radius: 14px; padding: 12px 14px;
  display: flex; gap: 12px; align-items: center; max-width: min(92vw, 460px); box-shadow: var(--shadow);
}
#toast button { border: 0; background: transparent; color: #ffd7c2; font-weight: 800; min-height: 40px; }
@media (min-width: 960px) { #toast { bottom: 20px; } }

@media (prefers-reduced-motion: reduce) {
  .btn:active, .st-btn:active, .chip:active, .quick a:active { opacity: 1; }
}

button.menu-link, button.side-link { width: 100%; border: 0; background: transparent; text-align: left; }
.side-assistant {
  margin: 8px 16px 0; border: 0; background: var(--orange); color: white;
  border-radius: 12px; min-height: 44px; font-weight: 800; padding: 0 16px;
}
#assistant-fab {
  position: fixed; right: 16px; z-index: 25; border: 0; background: var(--blue); color: white;
  border-radius: 999px; min-height: 52px; padding: 0 18px; font-weight: 800; box-shadow: var(--shadow);
  bottom: calc(var(--tab) + 16px + env(safe-area-inset-bottom));
}
@media (min-width: 960px) { #assistant-fab { bottom: 20px; } }
#assistant:not([hidden]) ~ #assistant-fab { display: none !important; }
#assistant {
  position: fixed; inset: 0; z-index: 45; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(20, 16, 12, 0.45);
}
@media (min-width: 960px) { #assistant { align-items: center; } }
.assistant-back { position: absolute; inset: 0; border: 0; background: transparent; }
.assistant-panel {
  position: relative; z-index: 1; width: min(560px, 100%); max-height: min(78vh, 720px);
  background: #fffdf8; color: #1c1915; border-radius: 20px 20px 0 0; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
@media (prefers-color-scheme: dark) {
  .assistant-panel { background: #1b2024; color: #f6f3ec; }
}
@media (min-width: 960px) {
  .assistant-panel { border-radius: 20px; }
  .assistant-panel::before { display: none; }
}
.assistant-head {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.assistant-head button { border: 0; background: transparent; min-width: 44px; min-height: 44px; font-size: 28px; }
.assistant-log { overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 140px; flex: 1; }
.assistant-msg { margin: 0; padding: 10px 12px; border-radius: 14px; white-space: pre-wrap; max-width: 92%; }
.assistant-msg.bot { background: #e7eef8; color: #1c1915; }
.assistant-msg.me { background: var(--orange); color: white; align-self: flex-end; }
.assistant-msg a { display: inline-block; margin-top: 6px; font-weight: 800; color: inherit; }
@media (prefers-color-scheme: dark) { .assistant-msg.bot { background: #24312d; color: #f6f3ec; } }
.assistant-form {
  display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line);
  background: inherit;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
@media (max-width: 959px) {
  #assistant { padding-bottom: calc(var(--tab) + env(safe-area-inset-bottom)); }
  .assistant-form { padding-bottom: 10px; }
}
.assistant-form input {
  flex: 1; min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line);
  background: #fff; color: #1c1915; padding: 0 12px;
}
@media (prefers-color-scheme: dark) {
  .assistant-form input { background: #121416; color: #f6f3ec; }
}
.assistant-form button { min-height: 48px; border: 0; border-radius: 999px; background: var(--orange); color: white; font-weight: 700; padding: 0 16px; }

body.share-mode #nav,
body.share-mode #tabbar { display: none !important; }
.share-page { max-width: 720px; margin: 0 auto; }
.share-page h1 { margin: 4px 0 8px; }
.share-status {
  display: inline-flex; align-items: center; min-height: 36px; margin: 8px 0;
  border-radius: 999px; padding: 6px 12px; font-weight: 800;
}
.share-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 10px; }
.share-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: var(--line); }

@media (prefers-reduced-motion: reduce) {
  .st-btn, .btn, .side-link, .menu-link, #tabbar a, #tabbar button { transition: none; }
  .st-btn:hover, .btn:hover { transform: none; filter: none; }
}
