:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --brand: #2563eb;
  --brand-soft: #dbeafe;
  --brand-2: #0ea5e9;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
  --shadow-soft: 0 2px 10px rgba(15, 23, 42, 0.05);
  --radius: 18px;
  --tab-bg: rgba(255, 255, 255, 0.94);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #111c2e;
  --surface-2: #16233a;
  --surface-3: #1b2b45;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: #243247;
  --brand: #60a5fa;
  --brand-soft: #172e52;
  --brand-2: #38bdf8;
  --green: #4ade80;
  --green-soft: #123424;
  --red: #f87171;
  --red-soft: #3a1717;
  --amber: #fbbf24;
  --amber-soft: #3a2a10;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.25);
  --tab-bg: rgba(17, 28, 46, 0.95);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(37, 99, 235, 0.1), transparent 60%),
    radial-gradient(900px 460px at -10% 30%, rgba(14, 165, 233, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body.sheet-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: 100%;
  max-width: 760px;
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
}

/* ------------------------------------------------------------ 登录 */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(155deg, #0b1220 0%, #142c5b 52%, #0e7490 100%);
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(4px);
  opacity: 0.55;
  pointer-events: none;
}

.login-orb--one {
  width: 260px;
  height: 260px;
  top: -80px;
  right: -70px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.55), transparent 70%);
}

.login-orb--two {
  width: 320px;
  height: 320px;
  bottom: -120px;
  left: -110px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.5), transparent 70%);
}

.login-panel {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  padding: 28px 24px 24px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 8px 18px rgba(37, 99, 235, 0.35));
}

.login-panel h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.02em;
}

.login-sub {
  margin: 4px 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.field input,
.search-box input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field input:focus,
.search-box input:focus {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 64px;
}

.ghost-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  padding: 8px;
  min-height: 36px;
}

.form-error {
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
  line-height: 1.4;
}

.login-foot {
  margin: 18px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* ------------------------------------------------------------ 通用按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease,
    opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

html[data-theme="dark"] .btn-primary {
  color: #08111f;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  background: var(--red-soft);
  border-color: transparent;
  color: var(--red);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  min-height: 50px;
  border-radius: 14px;
  font-size: 15px;
}

.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

/* ------------------------------------------------------------ 顶栏 */
.main-view {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 14px 16px 12px;
  color: #f8fafc;
  background:
    radial-gradient(600px 200px at 90% -40%, rgba(56, 189, 248, 0.35), transparent 65%),
    linear-gradient(135deg, #0b1220, #1e3a8a);
  border-radius: 0 0 22px 22px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.26);
}

.topbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-title h1 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.topbar-title p {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(248, 250, 252, 0.68);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.17);
  flex: 0 0 auto;
}

.status-dot.is-offline {
  background: #f87171;
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.17);
}

.status-dot.is-busy {
  background: #fbbf24;
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.17);
}

.topbar-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.16);
}

.icon-btn.is-spinning svg {
  animation: spin 0.9s linear infinite;
}

.topbar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  font-size: 11px;
  color: rgba(248, 250, 252, 0.58);
}

.server-host {
  max-width: 52%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------ 页面 */
.page {
  padding: 18px 16px calc(96px + var(--safe-bottom));
  animation: fadeUp 0.22s ease both;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 14px 14px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  text-align: left;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -20px -30px auto;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.07);
}

.stat-card--green::after {
  background: rgba(22, 163, 74, 0.09);
}

.stat-card--blue::after {
  background: rgba(14, 165, 233, 0.1);
}

.stat-card--red::after {
  background: rgba(220, 38, 38, 0.09);
}

.stat-card--action {
  cursor: pointer;
}

.stat-card--action:active {
  transform: scale(0.99);
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.stat-card strong {
  font-size: 27px;
  line-height: 1.15;
  letter-spacing: -0.03em;
  z-index: 1;
}

.stat-note {
  color: var(--muted);
  font-size: 11px;
  z-index: 1;
}

.stat-card--red strong {
  color: var(--red);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 2px 10px;
}

.section-head--compact {
  margin-top: 16px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.chip.is-active {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}

/* ------------------------------------------------------------ 店铺卡片 */
.store-list {
  display: grid;
  gap: 11px;
}

.store-card {
  position: relative;
  padding: 15px 15px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  animation: fadeUp 0.22s ease both;
}

.store-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--border);
}

.store-card.is-running::before {
  background: var(--green);
}

.store-card.is-attention::before {
  background: var(--amber);
}

.store-card__top {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.store-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.2);
}

.store-avatar[data-kind="pdd"] {
  background: linear-gradient(135deg, #e11d48, #f97316);
}

.store-avatar[data-kind="douyin"] {
  background: linear-gradient(135deg, #111827, #4b5563);
}

.store-avatar[data-kind="weixin"] {
  background: linear-gradient(135deg, #16a34a, #22c55e);
}

.store-avatar[data-kind="taobao"] {
  background: linear-gradient(135deg, #ea580c, #f59e0b);
}

.store-avatar[data-kind="jd"] {
  background: linear-gradient(135deg, #dc2626, #ef4444);
}

.store-avatar[data-kind="ali1688"] {
  background: linear-gradient(135deg, #d97706, #f59e0b);
}

.store-main {
  min-width: 0;
  flex: 1 1 auto;
}

.store-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.store-title-row h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.store-side {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
}

.store-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 60px;
  min-height: 44px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s ease;
}

.store-menu-btn:active {
  transform: scale(0.97);
  background: var(--surface-3);
}

.store-menu-btn:disabled {
  color: var(--muted);
  opacity: 0.65;
}

.store-menu-btn svg {
  width: 14px;
  height: 14px;
}

.store-menu-busy {
  font-size: 10px;
  white-space: nowrap;
}

.store-sub {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.store-sub b {
  color: var(--text);
  font-weight: 700;
}

.status-pill {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--muted);
}

.status-pill.is-running {
  background: var(--green-soft);
  color: var(--green);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.tag.is-green {
  background: var(--green-soft);
  color: var(--green);
}

.tag.is-red {
  background: var(--red-soft);
  color: var(--red);
}

.tag.is-amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.tag.is-blue {
  background: var(--brand-soft);
  color: var(--brand);
}

.store-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.meta-item::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.6;
}

.meta-item.is-green {
  background: var(--green-soft);
  color: var(--green);
}

.meta-item.is-green::before {
  background: var(--green);
  opacity: 1;
}

.meta-item.is-amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.meta-item.is-amber::before {
  background: var(--amber);
  opacity: 1;
}

.meta-item.is-red {
  background: var(--red-soft);
  color: var(--red);
}

.meta-item.is-red::before {
  background: var(--red);
  opacity: 1;
}

.store-warning {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 11px;
  line-height: 1.45;
}

/* ------------------------------------------------------------ 售后 */
.handoff-summary {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.handoff-summary__main {
  display: grid;
  align-content: center;
  min-width: 110px;
  padding-right: 14px;
  border-right: 1px solid var(--border);
}

.handoff-summary__main strong {
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.handoff-summary__split {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.handoff-summary__split > div {
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 11px;
  background: var(--surface-2);
}

.handoff-summary__split span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.handoff-summary__split strong {
  font-size: 21px;
  line-height: 1.1;
}

.handoff-summary__split > div:first-child strong {
  color: var(--red);
}

.duty-line {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  line-height: 1.45;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: var(--surface-3);
  margin-bottom: 10px;
}

.segment {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.segment.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 5px 5px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
}

.search-box svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex: 0 0 auto;
}

.search-box input {
  border: 0;
  background: transparent;
  padding: 0;
  min-height: 38px;
  box-shadow: none;
}

.search-box input:focus {
  box-shadow: none;
  background: transparent;
}

.search-box .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.handoff-list {
  display: grid;
  gap: 9px;
}

.handoff-item {
  display: block;
  width: 100%;
  padding: 13px 14px;
  border-radius: 15px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  text-align: left;
  color: var(--text);
  animation: fadeUp 0.2s ease both;
}

.handoff-item:active {
  transform: scale(0.995);
}

.handoff-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ho-store {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ho-issue {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 7px 0 8px;
  font-size: 14px;
  line-height: 1.45;
}

.ho-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  color: var(--muted);
  font-size: 11px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.pager .btn {
  min-width: 72px;
}

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
}

.empty h3 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 15px;
}

.empty p {
  margin: 0;
  font-size: 12px;
}

/* ------------------------------------------------------------ 底部导航 */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  padding: 6px 10px calc(6px + var(--safe-bottom));
  background: var(--tab-bg);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.tab {
  position: relative;
  flex: 1;
  min-height: 54px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
}

.tab svg {
  width: 22px;
  height: 22px;
}

.tab.is-active {
  color: var(--brand);
  background: var(--brand-soft);
}

.tab-badge {
  position: absolute;
  top: 5px;
  right: calc(50% - 26px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
}

/* ------------------------------------------------------------ 弹层 */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(2, 6, 23, 0.45);
  backdrop-filter: blur(2px);
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  width: 100%;
  max-width: 760px;
  max-height: 92vh;
  margin: 0 auto;
  padding: 8px 18px calc(20px + var(--safe-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  box-shadow: 0 -20px 60px rgba(2, 6, 23, 0.3);
  overflow-y: auto;
  transform: translateY(102%);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet.is-open {
  transform: translateY(0);
}

.sheet-handle {
  width: 42px;
  height: 5px;
  margin: 2px auto 14px;
  border-radius: 999px;
  background: var(--border);
}

.sheet-body {
  display: grid;
  gap: 14px;
}

.sheet-title {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.sheet-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.sheet-actions {
  display: flex;
  gap: 9px;
  padding-top: 4px;
}

.sheet-actions .btn {
  flex: 1;
}

.action-menu {
  display: grid;
  gap: 8px;
}

.action-menu .btn {
  width: 100%;
  min-height: 48px;
  justify-content: flex-start;
  padding: 0 15px;
  border-radius: 12px;
  text-align: left;
}

.action-menu .btn::after {
  content: "›";
  margin-left: auto;
  font-size: 19px;
  line-height: 1;
  opacity: 0.45;
}

.action-menu .btn:disabled::after {
  content: "";
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-head h2 {
  margin: 5px 0 2px;
  font-size: 19px;
}

.detail-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.close-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.detail-section {
  padding: 12px 13px;
  border-radius: 13px;
  background: var(--surface-2);
}

.detail-section h3 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.detail-section p {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 2px 0;
}

.chat-thread.is-empty {
  padding: 13px 0 5px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.chat-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
}

.chat-row.agent {
  align-items: flex-end;
}

.chat-meta {
  margin: 0 14px 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.chat-bubble {
  max-width: 86%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 4px 14px 14px 14px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}

.chat-row.agent .chat-bubble {
  border-color: transparent;
  border-radius: 14px 4px 14px 14px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
  color: #fff;
}

.chat-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-line + .chat-line {
  margin-top: 4px;
}

.chat-line.is-card {
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--surface-2);
}

.chat-row.agent .chat-line.is-card {
  background: rgba(255, 255, 255, 0.14);
}

.chat-event {
  align-self: center;
  max-width: 92%;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  text-align: center;
  word-break: break-word;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.detail-grid .detail-section {
  min-width: 0;
}

.readonly-note {
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12px;
  line-height: 1.5;
}

/* ------------------------------------------------------------ 提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(82px + var(--safe-bottom));
  z-index: 80;
  transform: translateX(-50%);
  max-width: min(88vw, 420px);
  padding: 11px 15px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.3);
  animation: toastIn 0.2s ease both;
}

.toast.is-error {
  background: rgba(185, 28, 28, 0.96);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 6px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@media (min-width: 640px) {
  .summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .page {
    padding-left: 22px;
    padding-right: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
