@import url("tokens.css?v=9");

:root {
  --content: 1160px;
  --control: 40px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; }
body {
  font-family: var(--font);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
main a:not(.btn):not(.pill):not(.brand):not(.icon-btn):not(.user-chip):not(.shot):not(.count-pill):not(.card):not(.thread-link):not(.back) {
  color: #1d4ed8;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
}
main a:not(.btn):not(.pill):not(.brand):not(.icon-btn):not(.user-chip):not(.shot):not(.count-pill):not(.card):not(.thread-link):not(.back):hover {
  color: #1e3a8a;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.page {
  width: min(var(--content), calc(100% - 32px));
  margin: 16px auto 40px;
  padding: 0 0 8px;
}
.banner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: var(--info-bg);
  color: var(--info);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
}

.top, .panel-nav, .card, .table-wrap, .toast, .chat, .note, .auth-card {
  background: var(--surface);
  border: 1px solid rgb(15 23 42 / 5%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "brand nav tools";
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 12px;
}
.brand { grid-area: brand; display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.brand strong { display: block; letter-spacing: -0.03em; line-height: 1.1; }
.brand small { display: block; color: var(--faint); font-size: 0.68rem; letter-spacing: 0.08em; }
.pills {
  grid-area: nav;
  display: flex;
  gap: 2px;
  align-items: center;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.pills::-webkit-scrollbar { display: none; }
.pill {
  display: inline-flex;
  align-items: center;
  flex: none;
  border: 0;
  background: transparent;
  color: var(--muted-fg);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.92rem;
  font-weight: 650;
  white-space: nowrap;
}
.pill.active, .pill:hover { color: var(--fg); }
.pill.active { background: var(--primary); color: white; }
.tools { grid-area: tools; display: flex; align-items: center; gap: 4px; min-width: 0; }
.tools form { margin: 0; }
.icon-btn {
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  color: var(--fg);
  position: relative;
  display: grid;
  place-items: center;
}
.icon-btn:hover { background: #f3f6fa; }
.count {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  font-size: 0.68rem;
  display: grid;
  place-items: center;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 168px;
  background: #f4f7fb;
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  font-weight: 700;
  font-size: 0.78rem;
}
.user-chip span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #dbe7ff;
  color: #1e3a8a;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
}
.panel-nav {
  display: flex;
  gap: 2px;
  padding: 5px;
  margin-bottom: 16px;
  width: 100%;
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: thin;
}
.panel-nav .pill { padding: 6px 8px; font-size: 0.82rem; }
.subnav { width: max-content; max-width: 100%; }
.login-link { margin-left: 4px; }

.page-title { margin: 0 0 2px; font-size: 1.45rem; letter-spacing: -0.03em; line-height: 1.2; }
.lede, .sub { color: var(--muted-fg); margin: 0 0 14px; font-size: 0.92rem; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; }
.count-pill {
  border-radius: 999px;
  background: white;
  border: 1px solid var(--border);
  padding: 6px 10px;
  color: var(--muted-fg);
  font-size: 0.85rem;
}
.grid { display: grid; gap: 12px; align-items: start; }
.grid-4, .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats { align-items: stretch; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.72fr); }
.grid-2 > :nth-child(2) { position: sticky; top: 12px; }
.products {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  align-items: stretch;
}
.product-card {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px;
}
.product-card .shot { display: block; }
.product-card .frame, .gallery .frame {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 12px;
  background: var(--photo);
}
.frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.product-card .frame, .gallery .frame, .photo-edit .frame { position: relative; }
.frame { display: grid; place-items: center; color: var(--faint); font-weight: 700; }
.detail { overflow: hidden; }
.gallery { min-width: 0; }
.product-card.sold-out { opacity: 0.48; }
.product-card.sold-out .btn:disabled { cursor: not-allowed; }
.product-card h3 {
  margin: 2px 0 0;
  font-size: 0.95rem;
  line-height: 1.25;
}
.product-card .price-row { margin-top: auto; padding-top: 10px; }
.card { padding: 14px; margin-bottom: 12px; }
.grid > .card, .products > .card, .stats > .card { margin-bottom: 0; }
.stats .card { min-height: 86px; display: flex; flex-direction: column; justify-content: center; }
.stats .muted { margin: 6px 0 0; font-size: 0.78rem; line-height: 1.35; }
a.card {
  position: relative;
  display: block;
  cursor: pointer;
  border-color: #d5e3f7;
}
a.card:not(.notice) { padding-right: 42px; }
a.card:not(.notice)::after {
  content: "→";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #e8efff;
  color: #1d4ed8;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 750;
}
a.notice::after { content: "→"; color: #1d4ed8; font-weight: 750; align-self: center; }
a.card:hover { border-color: #93c5fd; }
.thread-link { position: relative; padding-right: 28px; }
.thread-link::after {
  content: "→";
  position: absolute;
  right: 12px;
  top: 14px;
  color: #94a3b8;
  font-weight: 750;
}
.thread-link:hover::after, .thread-link.active::after { color: #1d4ed8; }
.icon-btn.lined { border: 1px solid var(--border); background: white; width: 34px; height: 34px; }
.actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.status-form { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 0; }
.status-form label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 0.84rem; font-weight: 650; white-space: nowrap; }
.status-form input { width: auto; height: auto; }
.card h2, .card h3 { margin: 0 0 8px; font-size: 1rem; letter-spacing: -0.02em; }
.stat { font-size: 1.35rem; font-weight: 750; letter-spacing: -0.03em; line-height: 1.15; }
.stat-label { color: var(--faint); font-size: 0.75rem; letter-spacing: 0.06em; font-weight: 750; }
.muted { color: var(--muted-fg); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 10px; }
.back { color: var(--muted-fg); font-size: 0.9rem; }

.btn, button.btn, a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--control);
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 0 14px;
  background: var(--primary);
  color: var(--primary-fg);
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
.btn.secondary { background: var(--surface); color: var(--fg); border-color: var(--border); }
.btn.ghost { background: transparent; color: var(--muted-fg); }
.btn.danger { background: var(--danger); color: white; }
.btn.small { height: 34px; padding: 0 12px; font-size: 0.84rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 750;
  background: #f1f5f9;
  color: var(--muted-fg);
  border: 0;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }

.announce { display: flex; gap: 12px; align-items: flex-start; }
.announce-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #f3f6fb;
  display: grid;
  place-items: center;
  color: var(--muted-fg);
  flex: none;
}
.kicker { margin: 0; font-size: 0.72rem; letter-spacing: 0.08em; color: var(--faint); font-weight: 750; }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search {
  flex: 1 1 220px;
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--faint);
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 12px;
  height: var(--control);
  min-width: min(100%, 220px);
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field[hidden] { display: none; }
.field span, .field label, label { font-size: 0.92rem; font-weight: 650; }
.input, .select, .textarea, .file {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 8px 12px;
}
.input, .select, .file { height: var(--control); }
.input:focus, .select:focus, .textarea:focus, .file:focus {
  outline: 2px solid #dbe7ff;
  border-color: #bfd0ea;
}
.search .input { border: 0; height: 100%; padding: 0; background: transparent; outline: 0; }
.filters .select, .filters .input { width: auto; min-width: 132px; flex: 0 1 160px; }
.textarea { height: 88px; min-height: 88px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .span-2, .form-grid .alert { grid-column: 1 / -1; }
.auth-card .form-grid, .compose .form-grid { grid-template-columns: 1fr; }
.lines {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(100px, 0.55fr) minmax(120px, 0.7fr);
  align-items: center;
}
.lines .select, .lines .input { width: 100%; min-width: 0; flex: none; }
.check { width: auto; height: auto; }
.field:has(input.check) { flex-direction: row; align-items: center; gap: 8px; align-self: end; margin-bottom: 14px; }
.help, .errorlist { color: var(--danger); margin: 4px 0 0; padding-left: 18px; font-size: 0.88rem; }

.alert, .toast {
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 10px;
  border: 0;
  background: #f8fafc;
}
.alert.success, .toast.success { background: #e9f8ef; color: #166534; }
.alert.error, .toast.error { background: var(--danger-bg); color: #b91c1c; }
.alert.warning, .toast.warning { background: var(--warn-bg); color: var(--warn); }

.table-wrap { overflow-x: auto; margin-bottom: 14px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; vertical-align: middle; }
td, .kv strong { overflow-wrap: anywhere; }
th { color: var(--faint); font-size: 0.75rem; font-weight: 750; letter-spacing: 0.06em; }
td { border-top: 1px solid var(--border); }
.photo, .thumb {
  background: var(--photo);
  border-radius: 12px;
  object-fit: cover;
  width: 100%;
}
.photo:not(img) {
  display: grid;
  place-items: center;
  color: var(--faint);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.thumb { width: 44px; height: 44px; flex: none; }
.product-card .meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--faint);
  font-size: 0.75rem;
}
.price-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; }
.price { font-weight: 750; letter-spacing: -0.03em; }
.detail { display: grid; grid-template-columns: minmax(240px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.gallery { display: flex; flex-direction: column; gap: 8px; }
.gallery .hero { aspect-ratio: 1; width: 100%; max-height: 380px; object-fit: cover; margin: 0; }
.thumbs { display: flex; gap: 8px; }
.thumbs .photo { width: 72px; height: 72px; flex: none; aspect-ratio: auto; max-height: none; margin: 0; }
.big { font-size: 1.6rem; font-weight: 750; letter-spacing: -0.04em; margin: 12px 0; }
.buy { display: flex; gap: 10px; align-items: center; }
.step {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: white;
}
.step button { width: 34px; height: 38px; border: 0; background: transparent; }
.step input { width: 72px; height: 38px; border: 0; text-align: center; padding: 0; background: transparent; }
.crop-dialog {
  width: min(440px, calc(100vw - 24px));
  border: 0;
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.crop-dialog::backdrop { background: rgb(15 23 42 / 45%); }
.crop-stage {
  width: min(320px, 100%);
  aspect-ratio: 1;
  margin: 0 auto 12px;
  overflow: hidden;
  border-radius: 12px;
  background: #0f172a;
  position: relative;
  touch-action: none;
  cursor: grab;
}
.crop-stage img { position: absolute; max-width: none; user-select: none; }
.photo-edit { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.photo-edit .frame {
  width: 160px;
  flex: none;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 12px;
  background: var(--photo);
}
img.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--photo); display: block; }
.product-cell { display: flex; align-items: center; gap: 10px; }
.product-cell small { display: block; }
.line {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
}
.line strong { white-space: nowrap; }
.kv { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0; color: var(--muted-fg); }
.kv strong { color: var(--fg); }
.total { font-size: 1.35rem; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack .card { margin: 0; }
.empty { padding: 18px; text-align: center; color: var(--faint); }
.pager { display: flex; gap: 8px; margin-top: 16px; align-items: center; }
.chart { display: flex; align-items: stretch; gap: 8px; min-height: 168px; }
.chart-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.chart-bar { height: 140px; width: 100%; display: flex; align-items: flex-end; }
.chart-col span { margin-top: 6px; font-size: 0.72rem; color: var(--muted-fg); text-align: center; }
.bar { background: var(--primary); border-radius: 8px 8px 0 0; min-height: 4px; width: 100%; }
.auth-card { width: min(400px, 100%); margin: 28px auto; padding: 18px; }
.compose { max-width: 640px; }
.profile-page { max-width: none; }
.profile-page .grid-2 { grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.9fr); }
.single .form-grid { grid-template-columns: 1fr; }
.profile-page .input, .profile-page .select, .profile-page .textarea { padding: 8px 12px; }
.profile-page .card { padding: 14px; }
.profile-page .field { margin-bottom: 8px; }
.note-modal {
  width: min(440px, calc(100vw - 24px));
  max-width: 440px;
  box-sizing: border-box;
  border: 0;
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.note-modal::backdrop { background: rgb(15 23 42 / 40%); }
.note-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); }
.note-row > div { flex: 1; min-width: 0; }
.note-row form { flex: none; }
.note-row p { margin: 4px 0 0; }
.notice { display: flex; justify-content: space-between; gap: 12px; }
.dot { width: 8px; height: 8px; border-radius: 999px; background: #60a5fa; display: inline-block; margin-right: 6px; }
.threads { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 12px; align-items: stretch; min-height: 560px; }
.thread-list { padding: 8px; margin: 0; display: flex; flex-direction: column; min-height: 560px; max-height: calc(100vh - 150px); }
.thread-scroll { overflow: auto; min-height: 0; flex: 1; }
.start-chat { padding: 8px 8px 12px; margin: 0 0 8px; border-bottom: 1px solid var(--border); }
.start-chat .field { margin-bottom: 8px; }
.side-note { margin: 0 8px 10px; font-size: 0.82rem; }
.chat {
  min-height: 560px;
  max-height: calc(100vh - 150px);
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
}
.chat-head {
  flex: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.chat-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
}
.chat-idle { justify-content: center; }
.chat-empty { margin: auto; text-align: center; max-width: 320px; padding: 24px; }
.chat-empty p { margin: 6px 0 0; }
.bubble {
  flex: none;
  width: fit-content;
  max-width: min(440px, 88%);
  background: #f4f7fb;
  border-radius: 16px 16px 16px 6px;
  padding: 8px 12px;
}
.bubble p { margin: 0; white-space: pre-wrap; }
.bubble.mine { align-self: flex-end; margin-left: 0; background: var(--primary); color: white; border-radius: 16px 16px 6px 16px; }
.bubble-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.bubble small { color: var(--faint); font-size: 0.72rem; }
.bubble.mine small { color: #cbd5e1; }
.bubble-delete {
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.8;
  font-size: 0.72rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.composer {
  flex: none;
  margin: 0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.composer .textarea { min-height: 44px; height: 44px; }
.order-pick { flex: none; width: 160px; height: 44px; }
.announce-board { align-items: start; }
.announce-item h2 { margin: 2px 0 8px; }
.announce-item p { margin: 0 0 8px; white-space: pre-wrap; }
.note-body { white-space: pre-wrap; margin: 0; }
.sheet { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(240px, 0.7fr); gap: 14px; align-items: start; }
.sheet > aside { position: sticky; top: 12px; }
.line-row, .cost-row { display: grid; gap: 8px; align-items: center; margin-bottom: 8px; }
.line-row { grid-template-columns: minmax(0, 1.4fr) 110px 120px auto; }
.cost-row { grid-template-columns: minmax(0, 1fr) 120px minmax(0, 1fr) auto; }
.line-row .select, .line-row .input, .cost-row .select, .cost-row .input { width: 100%; min-width: 0; flex: none; }
.summary-card .total { font-size: 1.15rem; }
.effect-list { margin: 0 0 16px; padding-left: 18px; }
.effect-list li { margin: 6px 0; }
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 0.86rem;
  font-weight: 650;
  cursor: pointer;
}
.status-form .switch { margin: 0; }
.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.switch-track {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #e2e8f0;
  position: relative;
  flex: none;
  transition: background .15s;
}
.switch-track::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: white;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform .15s;
  box-shadow: 0 1px 2px rgb(15 23 42 / 20%);
}
.switch input:checked + .switch-track { background: #111827; }
.switch.trust input:checked + .switch-track { background: #1d4ed8; }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:disabled + .switch-track { opacity: 0.45; }
.switch input:focus-visible + .switch-track { outline: 2px solid #dbe7ff; }
.thread-link { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 28px 12px 12px; }
.thread-link.active, .thread-link:hover { background: #f4f7fb; }
.icon-btn.active { background: #e8efff; }
.send {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  flex: none;
}

@media (max-width: 980px) {
  .page { width: calc(100% - 20px); margin: 10px auto 28px; }
  .stats, .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3, .grid-2, .detail, .threads, .profile-page .grid-2, .sheet { grid-template-columns: 1fr; }
  .top {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand tools" "nav nav";
  }
  .pills { flex-wrap: wrap; overflow: visible; }
  .grid-2 > :nth-child(2) { position: static; }
  .line { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .user-chip span:last-child { display: none; }
  .user-chip { max-width: none; padding-right: 4px; }
}
@media (max-width: 640px) {
  .stats, .grid-4, .form-grid, .products { grid-template-columns: 1fr; }
  .product-card { max-width: none; }
  .lines, .line-row, .cost-row { grid-template-columns: 1fr; }
  .detail { grid-template-columns: 1fr; }
}
