* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: #f5f5f7;
  color: #1d1d1f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; color: inherit; }

.shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 12px 24px;
}

.side-name {
  padding: 4px 12px 22px;
  font-size: 32px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.side-label {
  margin: 18px 0 4px;
  padding: 0 12px;
  font-size: 13px;
  color: #6e6e73;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  margin: 1px 0;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover { background: rgba(0, 0, 0, .04); }

.nav-item[aria-current="page"] {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .08);
}

.nav-meta {
  font-size: 13px;
  color: #6e6e73;
}

.nav-toggle {
  display: none;
}

.canvas { min-width: 0; }

main[hidden] { display: none !important; }

main {
  width: auto;
  max-width: none;
  margin: 0;
  padding: 28px 28px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.group.fill {
  flex: 1;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

#swarm-view .group.fill {
  flex: 0 1 auto;
  min-height: 0;
}

.period-row { justify-content: flex-start; }
.period-row .tools { margin-left: auto; }

.date-set {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 32px;
  font-size: 13px;
  color: #6e6e73;
}

.date-set input[type="date"] {
  height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: #1d1d1f;
}

.shop-platform {
  min-height: 36px;
  display: flex;
  align-items: center;
  border-top: 1px solid rgba(0, 0, 0, .08);
  font-size: 14px;
  font-weight: 650;
}

.shop-line {
  min-height: 52px;
  display: grid;
  grid-template-columns: 28px 88px minmax(0, 1fr) 120px;
  align-items: center;
  column-gap: 12px;
  border-top: 1px solid rgba(0, 0, 0, .08);
  font-size: 14px;
}

.shop-line input {
  width: 16px;
  height: 16px;
  margin: 0;
}

#shop-rows {
  max-height: 36vh;
  overflow: auto;
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0 12px;
  min-height: 96px;
  max-height: 28vh;
  flex: 0 1 auto;
  overflow: auto;
}

.bubble {
  font-size: 14px;
  line-height: 1.45;
}

.bubble .from {
  display: block;
  font-size: 13px;
  color: #6e6e73;
  margin-bottom: 2px;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding-bottom: 8px;
}

.route-jump {
  align-self: flex-start;
}

.chat-form input {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, .06);
  font-size: 14px;
}

.page-head h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: #1d1d1f;
}

.page-head p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: #6e6e73;
}

.group {
  margin-top: 24px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 12px;
  padding: 0 16px 8px;
}

.title-row {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.title-row h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.tools, .segment {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.segment {
  width: max-content;
  max-width: 100%;
  min-height: 32px;
  margin: 0 0 4px;
  padding: 2px;
  border-radius: 9px;
  background: rgba(0, 0, 0, .06);
  overflow-x: auto;
}

.segment button {
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

.segment button[aria-pressed="true"] {
  background: #fff;
}

.segment button:hover { background: rgba(255, 255, 255, .55); }
.segment button[aria-pressed="true"]:hover { background: #fff; }

input[type="search"] {
  width: 220px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(0, 0, 0, .16);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

input[type="search"]::placeholder { color: #6e6e73; }

.lan-banner {
  margin: 16px 28px 0;
  padding: 10px 14px;
  border: 1px solid rgba(180, 120, 0, .28);
  border-radius: 10px;
  background: #fff8e8;
  color: #6e4e00;
  font-size: 13px;
  line-height: 1.45;
}

.todo {
  margin: 4px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.todo-title {
  margin: 8px 0 2px;
  font-size: 13px;
  color: #6e6e73;
}

.todo-line {
  min-height: 40px;
  display: grid;
  grid-template-columns: 72px 72px minmax(0, 1fr) 108px 76px;
  align-items: center;
  column-gap: 12px;
  font-size: 14px;
}

input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

.period-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #6e6e73;
}

select {
  height: 32px;
  max-width: 240px;
  padding: 0 8px;
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

button.primary {
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: #0071e3;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

button.primary:hover { background: #0077ed; }
button.primary:active { background: #006edb; }
button.primary:disabled { opacity: .45; cursor: default; }

button.link {
  height: 28px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: #0071e3;
  font-size: 13px;
  cursor: pointer;
}

button.link:hover { text-decoration: underline; }
button.link:disabled { opacity: .45; cursor: default; text-decoration: none; }

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid #0071e3;
  outline-offset: 2px;
}

.plat,
.account,
.file-row {
  min-height: 44px;
  display: grid;
  align-items: center;
  column-gap: 12px;
  border-top: 1px solid rgba(0, 0, 0, .08);
  font-size: 14px;
}

.plat {
  width: 100%;
  padding: 0;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  grid-template-columns: minmax(0, 1fr) auto 16px;
}

.plat:hover,
.account:hover,
.file-row:hover { background: rgba(0, 0, 0, .03); }

.plat:active { background: rgba(0, 0, 0, .05); }

.plat-name { font-weight: 600; }

.summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 12px;
  font-size: 13px;
  color: #6e6e73;
}

.summary span,
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.chev {
  width: 12px;
  height: 12px;
  color: #6e6e73;
  transition: transform 180ms ease;
}

.plat[aria-expanded="true"] .chev { transform: rotate(90deg); }

.drawer {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 180ms ease;
}

.drawer.open { grid-template-rows: 1fr; }

.drawer-inner { overflow: hidden; }

.account {
  grid-template-columns: 88px minmax(0, 1fr) 108px 76px;
  margin-left: 16px;
  min-height: 52px;
}

.who {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}

.shop {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-note {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: #6e6e73;
}

.file-row { grid-template-columns: 72px minmax(0, 1fr) auto 72px 132px; }

a.link {
  color: #0071e3;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

a.link:hover { text-decoration: underline; }

.file {
  display: flex;
  align-items: center;
  min-width: 0;
}

.name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sample {
  margin-left: 8px;
  flex: none;
  font-size: 13px;
  color: #6e6e73;
}

.size,
.when {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #6e6e73;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 8px;
}

.dot.in { background: #34c759; }
.dot.stale { background: #ff9f0a; }
.dot.out { background: #8e8e93; }
.dot.scan { background: #007aff; }

.empty {
  min-height: 44px;
  display: flex;
  align-items: center;
  border-top: 1px solid rgba(0, 0, 0, .08);
  color: #6e6e73;
  font-size: 14px;
}

.note {
  margin: 8px 0 4px;
  font-size: 13px;
  color: #6e6e73;
}

.note:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  .chev, .drawer { transition: none; }
}

@media (max-width: 760px) {
  .shell { display: flex; flex-direction: column; }
  .side { display: none; position: static; height: auto; padding: 0 16px 8px; }
  .shell.nav-open .side { display: block; }
  .nav-toggle {
    display: flex;
    align-items: center;
    width: calc(100% - 32px);
    min-height: 44px;
    margin: 12px 16px 0;
    padding: 0 14px;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 12px;
    background: #fff;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
  }
  .nav-item { min-height: 44px; }
  main { padding: 28px 16px 48px; }
  .title-row { align-items: flex-start; flex-direction: column; padding: 12px 0; }
  .period-row .tools { margin-left: 0; }
  .date-set input[type="date"] { flex: 1; min-width: 140px; }
  .tools { width: 100%; }
  input[type="search"], select { width: 100%; max-width: none; }
  .segment { width: 100%; }
  .account { grid-template-columns: 72px minmax(0, 1fr) 92px 68px; column-gap: 8px; margin-left: 8px; }
  .file-row { grid-template-columns: 56px minmax(0, 1fr) auto 56px; }
  .when { display: none; }
}
