:root {
  color-scheme: light;
  --blue: #0b57d0;
  --bar: #153a5f;
  --ink: #222;
  --muted: #5c6570;
  --line: #e2e6ea;
  --bg: #f3f5f7;
  --card: #fff;
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; max-width: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  color: var(--ink);
  background: var(--bg);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

#app, .shell { height: 100%; }
.shell { display: flex; flex-direction: column; min-height: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  min-height: calc(64px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px));
  background: var(--bar);
  color: #fff;
}
.brand {
  border: 0;
  background: transparent;
  color: #fff;
  padding: 0;
  border-radius: 0;
  min-width: 0;
  font-size: clamp(15px, 2vw, 20px);
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.spacer { flex: 1; }
.topbar button.linkish {
  border: 0;
  background: transparent;
  color: #fff;
}
.settings-btn {
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: transparent;
  color: #fff;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.banner {
  background: #fff6e0;
  color: #6b4a00;
  font-size: 13px;
  padding: 6px 16px;
}

.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.stage.home {
  align-items: center;
  overflow: auto;
  background: linear-gradient(180deg, #f8f9fb 0%, #eef1f4 100%);
}
.stage.settings { overflow: auto; }
.stage.module { overflow: hidden; }
.stage.module .workspace { flex: 1; }
.footbar {
  flex: none;
  height: calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--bar);
}

.home-wrap {
  width: min(720px, 100%);
  max-width: 100%;
  margin: auto;
  flex: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 22px);
  padding: clamp(12px, 2.5vh, 28px) clamp(14px, 3vw, 28px);
}
.module-card {
  position: relative;
  min-width: 0;
  min-height: clamp(128px, 22vh, 172px);
  border: 1px solid transparent;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(21, 58, 95, 0.04), 0 8px 18px rgba(21, 58, 95, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 0.7vh, 8px);
  padding: clamp(16px, 2.2vh, 24px) clamp(12px, 1.6vw, 20px);
  text-align: center;
  color: #3d4a59;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .module-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(21, 58, 95, 0.05), 0 12px 24px rgba(21, 58, 95, 0.08);
  }
}
.module-card:active { transform: scale(0.985); }
.module-card strong {
  font-size: clamp(16px, 1.7vw, 18px);
  font-weight: 600;
  line-height: 1.25;
  color: var(--bar);
}
.module-blurb {
  max-width: 16em;
  font-size: 13px;
  line-height: 1.4;
  color: #6d7884;
}
.module-count { font-style: normal; font-size: 13px; line-height: 1.3; color: #9aa3ad; }
.module-count.has { color: #5c6b7a; }
.module-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e25555;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  box-shadow: 0 1px 2px rgba(168, 42, 42, 0.22);
}
.module-icon { width: clamp(32px, 4vw, 40px); height: clamp(32px, 4vw, 40px); }
.module-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mod-inquiry { background: linear-gradient(165deg, #f8fbfe 0%, #e4f0fb 100%); border-color: #d4e4f4; color: #2a6294; }
.mod-query { background: linear-gradient(165deg, #f8fafb 0%, #e6eef2 100%); border-color: #d5e0e6; color: #3d5a6e; }
.mod-payment { background: linear-gradient(165deg, #f7fcf8 0%, #e3f5e8 100%); border-color: #d3ead9; color: #2d7a46; }
.mod-internal { background: linear-gradient(165deg, #fffaf6 0%, #fdecd9 100%); border-color: #f3ddc6; color: #c16f28; }
.mod-other { background: linear-gradient(165deg, #faf8fd 0%, #efe8f8 100%); border-color: #e3d8f0; color: #6d4f96; }
.tone-0 { background: linear-gradient(165deg, #f8fbfe 0%, #e4f0fb 100%); border-color: #d4e4f4; color: #2a6294; }
.tone-1 { background: linear-gradient(165deg, #f7fcf8 0%, #e3f5e8 100%); border-color: #d3ead9; color: #2d7a46; }
.tone-2 { background: linear-gradient(165deg, #fffaf6 0%, #fdecd9 100%); border-color: #f3ddc6; color: #c16f28; }
.tone-3 { background: linear-gradient(165deg, #faf8fd 0%, #efe8f8 100%); border-color: #e3d8f0; color: #6d4f96; }
.unready { max-width: 520px; }
.unready p { font-size: 18px; color: var(--bar); }
.mod-row, .mod-create { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.mod-row input, .mod-create input { width: 160px; }

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}
.list, .detail { min-height: 0; overflow: auto; }
.list { background: #fff; border-right: 1px solid var(--line); }
.list h1, .detail h1, .settings h1 { font-size: 18px; margin: 0; }
.pad { padding: 14px 16px 24px; }
.item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  text-align: left;
  padding: 12px 14px;
}
.item.selected { background: #e8f0fe; }
.item strong, .done-item strong { display: block; }
.muted, .item span, .done-item span { color: var(--muted); font-size: 13px; }
.back { margin-bottom: 8px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-top: 12px;
}
.card h2 { margin: 0 0 8px; font-size: 15px; }
.card p { margin: 0; line-height: 1.5; }
.fields { display: grid; gap: 8px; margin-top: 8px; }
.fields div { display: grid; gap: 2px; }
.fields b { font-size: 12px; color: var(--muted); font-weight: 600; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); margin-top: 8px; }
input, textarea, select {
  width: 100%;
  border: 1px solid #cfd6df;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions button, .primary, .ghost {
  border-radius: 10px;
  padding: 10px 14px;
  min-height: 40px;
}
.primary { border: 0; background: var(--blue); color: #fff; }
.ghost, .actions .ghost { border: 1px solid #cfd6df; background: #fff; color: var(--ink); }
.mail {
  white-space: pre-wrap;
  background: #f7f9fc;
  border-radius: 10px;
  padding: 10px;
  margin-top: 8px;
}
.done-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  padding: 10px 0;
}
.flash { margin: 8px 0; font-size: 14px; }
.flash.error { color: #b42318; }
.flash .ghost { margin-left: 8px; vertical-align: baseline; }
.stage.settings { max-width: none; }
.future { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.future li { margin: 6px 0; }

.gate {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 30px rgba(20, 40, 80, 0.08);
}
.gate-card h1 { margin: 8px 0; }
.gate-card ul { color: var(--muted); padding-left: 18px; }

.empty { color: var(--muted); padding: 16px; }

@media (max-width: 800px) {
  .workspace { grid-template-columns: 1fr; }
  .workspace.show-detail .list { display: none; }
  .workspace.show-list .detail { display: none; }
  .topbar {
    gap: 8px;
    min-height: calc(52px + env(safe-area-inset-top, 0px));
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }
  .brand { font-size: clamp(14px, 4.1vw, 16px); letter-spacing: 0.01em; }
  .settings-btn { padding: 5px 9px; }
  .home-wrap { gap: 10px; padding: 12px; }
  .module-card {
    min-height: clamp(112px, 18vh, 136px);
    gap: 5px;
    padding: 14px 8px 12px;
    border-radius: 14px;
  }
  .module-blurb { display: none; }
  .module-card strong { font-size: clamp(14px, 3.8vw, 16px); }
  .module-count { font-size: 12px; }
  .module-icon { width: 30px; height: 30px; }
  .module-badge { top: 8px; right: 8px; min-width: 20px; height: 20px; font-size: 11px; line-height: 20px; }
  input, textarea, select { font-size: 16px; }
  .actions button, .primary, .ghost { min-height: 44px; }
}

@media (max-width: 360px) {
  .topbar { gap: 6px; }
  .brand { letter-spacing: 0; }
  .settings-btn { padding: 4px 8px; font-size: 12px; }
  .home-wrap { gap: 8px; padding: 10px; }
  .module-card { min-height: 108px; padding: 12px 6px 10px; border-radius: 12px; }
  .module-icon { width: 26px; height: 26px; }
}

@media (max-height: 640px) {
  .home-wrap { padding-top: 8px; padding-bottom: 8px; }
  .module-card { min-height: 100px; padding-top: 10px; padding-bottom: 10px; }
  .module-blurb { display: none; }
}

.inquiry-shell {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(240px, 30%) minmax(0, 70%);
  background: #f7f8fa;
}
.inquiry-list, .inquiry-detail { min-width: 0; min-height: 0; }
.inquiry-list { background: #fff; border-right: 1px solid var(--line); overflow: auto; }
.inquiry-tools {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.filter {
  border: 1px solid #d5dde6;
  background: #fff;
  color: var(--bar);
  border-radius: 999px;
  min-height: 36px;
  padding: 0 12px;
}
.filter.on { background: var(--bar); color: #fff; border-color: var(--bar); }
.pc-mail-tabs .filter { flex: 1; }
.inquiry-row {
  width: 100%;
  display: grid;
  gap: 3px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 12px 14px;
  min-width: 0;
  overflow: hidden;
}
.inquiry-row:active { background: #e4eef8; }
.inquiry-row.selected { background: #eef4fb; }
.inquiry-row strong { color: var(--bar); font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inquiry-row span, .inquiry-row em { color: var(--muted); font-style: normal; font-size: 13px; line-height: 1.4; min-width: 0; }
.inquiry-row .mail-subject {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inquiry-row .mail-meta,
.inquiry-row .mail-state {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.inquiry-row .mail-state { margin-top: 1px; }
.list-title { font-size: 14px; font-weight: 600; color: var(--bar); padding: 4px 2px; }
.customer-no { flex: 0 0 auto; color: #5c6b7a; font-size: 13px; white-space: nowrap; }
.assign-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px 10px;
  width: 100%;
  min-width: 0;
}
.assign-bar .field-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 0;
  margin: 0;
  color: #5c6b7a;
  font-size: 13px;
  white-space: nowrap;
}
.assign-bar .field-inline > span { flex: 0 0 auto; }
.assign-bar .field-customer input {
  width: 4.8rem;
  min-width: 4.8rem;
  max-width: 4.8rem;
  min-height: 30px;
  border: 1px solid #d5dde6;
  border-radius: 8px;
  padding: 0 8px;
  background: #fff;
  text-align: center;
}
.assign-bar .field-customer input[readonly] {
  background: #f5f7fa;
  color: #334155;
}
.assign-bar .field-sales select {
  width: 7.2rem;
  min-width: 6.5rem;
  max-width: 8.5rem;
  min-height: 30px;
  border: 1px solid #d5dde6;
  border-radius: 8px;
  padding: 0 8px;
  background: #fff;
}
.assign-bar .field-sales select:disabled {
  background: #f5f7fa;
  color: #334155;
}
.assign-error {
  margin: 6px 0 0;
  color: #9d3b3b;
  font-size: 13px;
}
.resend-zone { display: flex; align-items: center; }
.resend-bar { width: 100%; display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; }
.resend-btn, .resend-bar .ignore-btn { min-height: 36px; min-width: 7.5rem; padding: 0 16px; }
.mark-pending { background: #e8eef5; color: var(--bar); }
.mark-assigned { background: #e7f6ee; color: #067647; }
.mark-wait { background: #fff6df; color: #8a5a00; }
.mark-assigned { background: #e5f6ea; color: #146c36; }
.assign-status { align-self: center; color: var(--bar); font-weight: 600; }
.assign-status.is-waiting { color: #b42318; }
.mail-inbox-row { min-height: 96px; }
.mail-row {
  height: 86px;
  min-height: 86px;
  max-height: 86px;
  overflow: hidden;
}
.mail-row > strong,
.mail-row > span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: unset;
}
.mail-row > strong { line-height: 20px; }
.mail-row > span { line-height: 18px; }
.mail-row > em {
  flex-wrap: nowrap;
  height: 18px;
  line-height: 18px;
  min-width: 0;
  overflow: hidden;
}
.mail-row > em span { display: inline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: unset; }
.module-detail { flex: 1; min-width: 0; min-height: 0; overflow: auto; }
.inquiry-detail { background: #fff; display: flex; min-height: 0; overflow: hidden; }
.detail-stack { flex: 1; min-width: 0; max-width: 100%; min-height: 0; display: flex; flex-direction: column; }
.survey-zone { flex: none; min-width: 0; max-width: 100%; overflow: hidden; padding: 4px 12px 2px; border-bottom: 1px solid var(--line); }
.survey-wrap { min-width: 0; max-width: 100%; }
.mail-zone { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; padding: 4px 12px; background: #fbfcfd; }
.ai-zone { flex: none; min-width: 0; max-width: 100%; overflow: hidden; padding: 4px 12px calc(4px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: #fff; }
.survey-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.survey-cell { display: grid; grid-template-columns: 9.2em minmax(0, 1fr); gap: 0 8px; align-items: center; padding: 1px 0; border-bottom: 1px solid #e6ebf0; font-size: 13px; line-height: 1.35; }
.survey-cell b { color: #5c6b7a; font-weight: 600; white-space: nowrap; }
.survey-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.survey-cell.single-line,
.survey-cell.single-line b,
.survey-cell.single-line .survey-value { white-space: nowrap; }
.mail-bar { flex: none; display: flex; align-items: center; gap: 8px; min-width: 0; margin-bottom: 4px; }
.mail-bar strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.mail-bar span { flex: none; color: var(--muted); font-size: 12px; max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-bar select { flex: none; width: auto; min-height: 28px; margin-left: auto; }
.mail-bar .lang-toggle { flex: none; min-height: 28px; padding: 0 8px; font-size: 12px; }
.mail-scroll { flex: 1; min-height: 0; overflow: auto; }
.mail-text { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: 0; }
.mail-frame { width: 100%; height: 100%; min-height: 100%; border: 0; background: #fff; display: block; }
.mail-note, .rule-hint, .ai-hint { color: #8a5a00; font-size: 12px; margin: 0 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.experience-note { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; }
.experience-note button { min-height: 28px; font-size: 12px; white-space: normal; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: grid; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ai-zone textarea { width: 100%; max-width: 100%; height: 100%; min-width: 0; min-height: 0; max-height: none; resize: none; border: 1px solid #d5dde6; border-radius: 8px; padding: 6px 8px; }
.ai-form { display: grid; grid-template-columns: minmax(0, 1fr) 8.2rem; gap: 6px; align-items: stretch; width: 100%; max-width: 100%; min-width: 0; height: 56px; }
.ai-actions { display: grid; grid-template-rows: 1fr 1fr; gap: 4px; width: 8.2rem; min-width: 0; max-width: 100%; height: 100%; margin: 0; }
.ai-actions button { width: 100%; max-width: 100%; height: 100%; min-width: 0; min-height: 0; padding: 0 6px; font-size: 12px; line-height: 1.15; white-space: normal; }
.ai-actions button.is-saved:disabled { background: #e6e8eb; color: #6d7580; border-color: #d5d8de; opacity: 1; cursor: not-allowed; white-space: normal; }
.learned-rules { margin-top: 18px; }
.learned-rules ul { list-style: none; padding: 0; }
.learned-rules li { border-top: 1px solid var(--line); padding: 8px 0; }
.inquiry-scroll { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
.inquiry-hint { min-height: 100%; display: grid; place-items: center; padding: 24px; color: var(--muted); }
.inquiry-head { display: flex; align-items: center; gap: 8px; min-width: 0; margin-bottom: 2px; flex-wrap: nowrap; }
.inquiry-head .reanalyze { flex: 0 0 auto; margin-left: auto; min-height: 28px; white-space: nowrap; }
.inquiry-head strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--bar); font-size: 16px; white-space: nowrap; }
.inquiry-head span { min-width: 0; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inquiry-head .to-recipient { flex: 1 1 8rem; max-width: 42%; }
.survey { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
.survey th, .survey td { border-bottom: 1px solid #e6ebf0; padding: 4px 8px; text-align: left; vertical-align: top; }
.survey th { width: 9em; color: #5c6b7a; font-weight: 600; white-space: nowrap; }
.survey td { color: #1c2833; overflow-wrap: anywhere; }
.src-mark {
  margin-left: 6px;
  border: 0;
  background: #eef3f8;
  color: #5c6b7a;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 12px;
  line-height: 18px;
}
.src-note { display: block; grid-column: 1 / -1; margin-top: 2px; color: #6d7884; font-size: 12px; line-height: 1.4; white-space: normal; }
.assign { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: 100%; max-width: 100%; min-width: 0; margin: 2px 0 0; }
.assign-main { display: flex; align-items: center; flex-wrap: nowrap; gap: 8px; min-width: 0; }
.assign label { display: flex; align-items: center; gap: 8px; margin: 0; min-width: 0; flex: 1 1 auto; overflow: hidden; color: #5c6b7a; font-size: 13px; white-space: nowrap; }
.assign select { flex: 1 1 0; width: 0; min-width: 0; max-width: 100%; min-height: 30px; }
.assign-note { margin: 0; color: #5c6b7a; font-size: 13px; }
.grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e8eef5;
  color: var(--bar);
  font-size: 12px;
  font-weight: 700;
}
.grade-A { background: #e5f4ea; color: #246b3b; }
.grade-B { background: #e7f0fb; color: #24598a; }
.grade-C { background: #fdecd9; color: #9a5b16; }
.grade-D { background: #f8e6e6; color: #9d3b3b; }
.mark {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e8eef5;
  color: var(--bar);
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  white-space: nowrap;
}
.mark.mark-sales { background: #fde8e8; color: #b42318; }
.mark-ignored { background: #f8e6e6; color: #9d3b3b; }
.mark-star { background: #fff6df; color: #8a5a00; }
.forward-btn { flex: 0 0 auto; width: auto; min-height: 30px; padding: 0 12px; white-space: nowrap; }
.assign-actions { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; flex-wrap: wrap; }
.action-btn { flex: 0 0 auto; min-height: 30px; min-width: 72px; padding: 0 12px; border: 0; border-radius: 10px; font-size: 13px; line-height: 30px; white-space: nowrap; }
.ignore-btn { background: #c62828; color: #fff; }
.ignore-btn:disabled { opacity: 0.65; }
.leave-btn { background: #eceff3; color: #334155; }
.leave-btn:disabled { opacity: 0.65; }
.ai-form { grid-template-columns: minmax(0, 1fr) 9.4rem; }
.ai-actions { width: 9.4rem; }
.ai-actions.single { grid-template-rows: 1fr; }
.ai-actions.single button { grid-row: auto; height: 100%; padding: 8px 12px; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }

@media (max-width: 800px) {
  .inquiry-shell { grid-template-columns: minmax(0, 1fr); }
  .inquiry-shell.show-detail .inquiry-list { display: none; }
  .inquiry-shell.show-list .inquiry-detail { display: none; }
  .inquiry-detail { display: block; overflow: auto; }
  .detail-stack { display: block; }
  .survey-zone, .mail-zone, .ai-zone { max-height: none; overflow: visible; }
  .survey-wrap { display: block; }
  .mail-zone { display: block; min-height: 0; }
  .mail-bar { flex-wrap: wrap; }
  .mail-bar strong, .mail-bar span { white-space: normal; max-width: none; }
  .mail-scroll { overflow: visible; max-height: none; }
  .mail-frame { height: auto; min-height: 50vh; }
  .ai-zone { position: static; overflow: visible; }
  .ai-form { height: 72px; grid-template-columns: minmax(0, 1fr) 8.2rem; }
  .ai-actions { display: grid; grid-template-rows: 1fr 1fr; width: 8.2rem; }
  .ai-actions button { min-height: 0; width: 100%; max-width: 100%; height: 100%; font-size: 12px; }
  .survey-grid { grid-template-columns: 1fr; }
  .survey-cell { grid-template-columns: 9.2em minmax(0, 1fr); }
  .survey-value { white-space: normal; overflow: visible; text-overflow: clip; }
  .survey-cell.single-line .survey-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .survey-zone .rule-hint { white-space: normal; overflow: visible; text-overflow: clip; }
  .inquiry-list { border-right: 0; }
  .filter { min-height: 44px; }
  .inquiry-row { min-height: 76px; }
  .mail-inbox-row { min-height: 104px; }
  .inquiry-row .mail-meta { gap: 6px; }
  .assign-main { flex-direction: column; align-items: stretch; flex-wrap: wrap; width: 100%; }
  .customer-no { width: 100%; }
  .mail-row { height: 86px; min-height: 86px; max-height: 86px; }
  .module-detail .actions button { max-width: 100%; }
  .inquiry-scroll { padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .inquiry-head { flex-wrap: wrap; }
  .inquiry-head strong, .inquiry-head span { white-space: normal; }
  .survey { font-size: 14px; }
  .survey th { width: 38%; white-space: normal; }
  .assign { display: flex; flex-direction: column; align-items: stretch; gap: 10px; width: 100%; max-width: 100%; }
  .assign-bar { flex-wrap: wrap; }
  .assign-bar .field-customer input { width: 5.2rem; min-width: 5.2rem; max-width: 5.2rem; min-height: 36px; }
  .assign-bar .field-sales select { width: 8rem; min-width: 7rem; max-width: 100%; min-height: 36px; }
  .assign select { min-height: 36px; width: 100%; max-width: 100%; }
  .assign-actions { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .action-btn, .forward-btn, .ignore-btn, .leave-btn { width: 100%; min-height: 40px; min-width: 0; padding: 0 8px; }
  .resend-bar { justify-content: center; }
  .resend-btn, .resend-bar .ignore-btn { width: min(100%, 12rem); min-height: 44px; }
}
.stage.settings { overflow: hidden; background: #fff; }
.settings-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  background: #fff;
}
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 12px 10px;
  border-right: 1px solid var(--line);
  background: #fff;
}
.settings-nav button {
  border: 0;
  background: transparent;
  color: var(--bar);
  text-align: left;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}
.settings-nav button.on { background: #e7f0fb; font-weight: 600; }
.settings-pane { min-width: 0; overflow: auto; }
.gmail-box { margin: 0 0 12px; padding: 12px; border: 1px solid #d5deea; border-radius: 10px; background: #f7fafc; }
.gmail-box h2 { margin: 0 0 6px; font-size: 15px; }
.gmail-box p { margin: 4px 0; overflow-wrap: anywhere; }
.gmail-box .primary, .gmail-box .ghost { margin-top: 8px; margin-right: 8px; }
.gmail-box ul { margin: 6px 0 0; padding-left: 18px; }
.gmail-box li { margin: 2px 0; }
.settings-scroll { padding: 12px 16px 20px; }
.settings-scroll h1 { margin: 8px 0; color: var(--bar); font-size: 18px; }
.settings-empty { margin: 24px 16px; color: var(--muted); }
.rule-label { display: grid; gap: 6px; margin-top: 14px; color: #5c6b7a; font-size: 14px; }
.rule-label textarea { width: 100%; min-height: 72px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.rule-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.rule-actions .primary, .rule-actions .ghost { min-height: 36px; }
.rule-preview { margin-top: 8px; font-size: 14px; }
.rule-preview p { margin: 4px 0; }
.rule-history { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
.rule-history li { margin: 2px 0; }
.rule-page { flex: 1; min-height: 0; overflow: auto; padding: 12px 16px 24px; }
.rule-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.rule-head h1 { margin: 0; flex: 1; color: var(--bar); font-size: 18px; }
.rule-table { display: grid; border-top: 1px solid var(--line); overflow-x: auto; }
.rule-row { display: grid; grid-template-columns: 120px 96px 148px minmax(220px, 1fr) 124px; gap: 8px; align-items: center; width: 100%; min-width: 740px; min-height: 40px; height: 40px; padding: 0 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; font: inherit; color: inherit; }
.rule-head-row { color: var(--muted); font-size: 12px; font-weight: 600; }
.rule-cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-action { min-width: 220px; }
.rule-ops { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.rule-ops .ghost { height: 28px; min-height: 28px; min-width: 52px; padding: 0 8px; border-radius: 6px; font-size: 13px; line-height: 26px; }
.rule-row.is-off .rule-cell { color: var(--muted); }
.rule-form { display: grid; gap: 8px; min-height: 0; }
.rule-compact { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: 8px; }
.rule-form label { display: grid; gap: 4px; min-width: 0; color: #5c6b7a; font-size: 13px; }
.rule-form input, .rule-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; background: #fff; }
.rule-form input { height: 34px; min-height: 34px; }
.rule-form textarea { min-height: 72px; max-height: 9.5em; overflow: auto; resize: vertical; white-space: pre-wrap; }
.rule-page .rule-actions { position: sticky; bottom: 0; background: var(--bg); padding-top: 8px; }
.dispatch-mask { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(15, 23, 32, 0.35); padding: 16px; }
.dispatch-card { width: min(420px, 100%); max-height: min(78vh, 720px); overflow: auto; background: #fff; border-radius: 12px; padding: 16px 18px; box-shadow: 0 12px 40px rgba(15, 23, 32, 0.18); }
.dispatch-card.rule-card { width: min(640px, 100%); max-height: min(86vh, 820px); display: flex; flex-direction: column; overflow: hidden; }
.dispatch-card.rule-card .rule-form { overflow: auto; flex: 1 1 auto; }
.rule-alarm, .rule-check-error, .rule-review { margin: 10px 0 0; padding: 10px 12px; border-radius: 8px; max-height: 180px; overflow: auto; }
.rule-alarm { border: 1px solid #e11d48; background: #fff1f2; color: #9f1239; }
.rule-alarm h3, .rule-check-error h3, .rule-review h3 { margin: 0 0 6px; font-size: 14px; }
.rule-alarm h3 { color: #be123c; }
.rule-alarm ul, .rule-review ul { margin: 0; padding-left: 18px; }
.rule-alarm li, .rule-review li { margin: 8px 0; }
.rule-alarm p, .rule-check-error p, .rule-review p, .rule-save-error { margin: 4px 0; overflow-wrap: anywhere; }
.rule-check-error { border: 1px solid #d97706; background: #fffbeb; color: #92400e; }
.rule-review { border: 1px solid #d5deea; background: #f8fafc; color: #334155; }
.rule-save-error { color: #9f1239; }
.conflict-list { margin: 8px 0 0; padding-left: 18px; }
.conflict-list li { margin: 6px 0; }
.dispatch-card h2 { margin: 0 0 8px; color: var(--bar); font-size: 18px; }
.dispatch-card p { margin: 6px 0; }
.iphone-login-code {
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
  background: #f3f6f9;
  color: var(--bar);
  font: 700 18px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
  text-align: center;
  overflow-wrap: anywhere;
  user-select: all;
}
.resend-desk, .resend-phone { display: grid; align-content: start; gap: 12px; padding: 18px; }
.resend-phone p { margin: 0; font-size: 16px; }
.dispatch-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
@media (max-width: 800px) {
  .dispatch-mask { padding: 10px; }
  .dispatch-card.rule-card { width: 100%; max-height: 92vh; }
  .rule-compact { grid-template-columns: minmax(0, 1fr); }
  .dispatch-actions { flex-wrap: nowrap; }
  .dispatch-actions button { flex: 1 1 0; min-height: 44px; white-space: normal; line-height: 1.25; }
  .rule-page { padding: 10px 12px 20px; }
  .rule-ops .ghost { min-height: 28px; }
}
.adjust-lines { margin: 8px 0 0; padding-left: 18px; }
.adjust-lines li { margin: 4px 0; }
button:active:not(:disabled) { filter: brightness(0.95); }
button:disabled { opacity: 0.45; }
button.is-pending:disabled { opacity: 0.72; }
button.action-btn.is-locked:disabled {
  background: #e6e8eb;
  color: #8b919a;
  opacity: 1;
  cursor: not-allowed;
}
.ledger-page { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.query-tabs { display: flex; gap: 6px; flex: 0 0 auto; }
.query-tabs button { min-height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--bar); font-size: 13px; }
.query-tabs button.on { background: var(--bar); color: #fff; border-color: var(--bar); }
.query-page .ledger-bar { flex-wrap: nowrap; gap: 6px; padding: 8px 12px; }
.query-page .ledger-bar input { min-height: 30px; }
.query-page .ledger-bar input[type="date"] { flex: 0 0 132px; }
.query-table, .query-rules { width: 100%; table-layout: fixed; }
.query-table col:nth-child(1) { width: 7%; }
.query-table col:nth-child(2) { width: 6.5%; }
.query-table col:nth-child(3) { width: 5.5%; }
.query-table col:nth-child(4) { width: 9%; }
.query-table col:nth-child(5) { width: 7%; }
.query-table col:nth-child(6) { width: 13%; }
.query-table col:nth-child(7) { width: 10%; }
.query-table col:nth-child(8) { width: 6%; }
.query-table col:nth-child(9) { width: 4%; }
.query-table col:nth-child(10) { width: 11%; }
.query-table col:nth-child(11) { width: 3.5%; }
.query-table col:nth-child(12) { width: 10%; }
.query-table col:nth-child(13) { width: 7.5%; }
.query-table th, .query-table td, .query-rules th, .query-rules td { overflow: hidden; text-overflow: ellipsis; padding: 3px 4px; font-size: 12px; line-height: 1.3; }
.query-table td.query-date,
.query-table td.query-star { white-space: nowrap; }
.query-ellipsis,
.query-note-btn {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.query-note-btn.is-empty { color: #7a8a99; }
.query-op-btn {
  min-height: 28px;
  min-width: 3.5rem;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.query-op-btn.delete { background: #c62828; color: #fff; }
.query-op-btn.restore { background: #546e7a; color: #fff; }
.query-op-btn:disabled { opacity: 0.65; }
.query-table tbody tr.is-disabled td { background: #f3f4f6; color: #6b7280; }
.query-disabled-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 4px;
  background: #e5e7eb;
  color: #6b7280;
  font-size: 11px;
  vertical-align: middle;
}
.query-note-box {
  width: 100%;
  min-height: 120px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  font: inherit;
}
.query-rules col, .query-rules { font-size: 12px; }
.query-rules th:nth-child(1), .query-rules td:nth-child(1) { width: 14%; }
.query-rules th:nth-child(2), .query-rules td:nth-child(2) { width: 13%; }
.query-rules th:nth-child(7), .query-rules td:nth-child(7) { width: 7%; }
.cell-pop { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; background: transparent; padding: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.query-table tbody tr { cursor: pointer; }
.query-empty { margin: 12px 16px; color: #5c6b7a; }
.query-body { white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto; margin: 8px 0 0; font: inherit; }
.ledger-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; }
.ledger-bar h1 { margin: 0; color: var(--bar); font-size: 16px; }
.ledger-bar input { flex: 1 1 180px; min-width: 0; min-height: 34px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; }
.ledger-scroll { flex: 1; min-height: 0; overflow: auto; }
.ledger { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.ledger th, .ledger td { border-bottom: 1px solid #e6ebf0; border-right: 1px solid #e6ebf0; padding: 4px 8px; white-space: nowrap; background: #fff; text-align: left; font-weight: 400; }
.ledger thead th { position: sticky; top: 0; z-index: 2; background: #f7f9fb; color: #5c6b7a; }
.ledger td.hit { background: #e7f0fb; font-weight: 600; }
@media (min-width: 801px) {
  .ledger tbody th, .ledger thead th:first-child { position: sticky; left: 0; }
  .ledger tbody th { z-index: 1; }
  .ledger thead th:first-child { z-index: 3; }
}
@media (max-width: 800px) {
  .ledger-bar { padding: 8px 12px; }
  .ledger-bar h1 { flex: 1 1 100%; }
  .ledger-bar .primary, .ledger-bar .ghost { min-height: 44px; }
}
@media (max-width: 800px) {
  .settings-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .settings-nav { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; }
  .settings-nav button { flex: 1 1 calc(50% - 6px); text-align: center; min-height: 40px; }
  .rule-actions .primary, .rule-actions .ghost { flex: 1 1 140px; min-height: 44px; }
}

body.iphone-ui {
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}
body.iphone-ui #app,
body.iphone-ui .shell,
body.iphone-ui .stage {
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}
body.iphone-ui .shell { height: 100%; }
body.iphone-ui .stage {
  display: flex;
  flex-direction: column;
}
body.iphone-ui .topbar {
  min-height: calc(52px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px));
  gap: 12px;
}
body.iphone-ui .iphone-back,
body.iphone-ui .topbar .settings-btn {
  min-height: 48px;
  min-width: 48px;
  padding: 0 14px;
  font-size: 17px;
  font-weight: 600;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.25);
}
body.iphone-ui .iphone-back {
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  text-align: center;
}
body.iphone-ui .iphone-back:active,
body.iphone-ui .topbar .settings-btn:active {
  opacity: 0.75;
}
body.iphone-ui .iphone-title {
  margin: 0;
  flex: 1;
  min-width: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  line-height: 48px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
body.iphone-ui .flash {
  flex: none;
  margin: 0;
  padding: 8px 12px;
  overflow-wrap: anywhere;
  background: #fff6e0;
  color: #6b4a00;
}
body.iphone-ui .flash.error {
  background: #fdecec;
  color: #9d3b3b;
}
body.iphone-ui .iphone-list,
body.iphone-ui .iphone-detail {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
}
body.iphone-ui .iphone-list {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #f3f5f7;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px));
  border: 0;
}
body.iphone-ui .iphone-pull {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 0;
  overflow: hidden;
  color: #5c6b7a;
  font-size: 13px;
  transition: height 0.15s ease;
}
body.iphone-ui .iphone-list.is-refreshing .iphone-pull {
  height: 44px;
  align-items: center;
}
body.iphone-ui .iphone-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0 -12px 8px;
  padding: 0 12px;
  background: #f3f5f7;
  border-bottom: 1px solid var(--line);
}
body.iphone-ui .iphone-tabs button {
  min-height: 48px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #5c6b7a;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  touch-action: manipulation;
}
body.iphone-ui .iphone-tabs button.on {
  color: var(--bar);
  border-bottom-color: var(--bar);
}
body.iphone-ui .iphone-back-spacer {
  display: inline-block;
  min-width: 48px;
  min-height: 48px;
}
body.iphone-ui .iphone-card {
  display: grid;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  min-height: 76px;
  margin: 0 0 8px;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  text-align: left;
  box-shadow: 0 1px 2px rgba(21, 58, 95, 0.06);
  touch-action: manipulation;
}
body.iphone-ui .iphone-card:active { background: #e4eef8; }
body.iphone-ui .iphone-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
body.iphone-ui .iphone-card-top strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--bar);
  font-size: 16px;
}
body.iphone-ui .iphone-card .grade { flex: none; }
body.iphone-ui .iphone-home {
  min-height: 0;
  overflow: auto;
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 12px;
}
body.iphone-ui .iphone-module {
  width: 100%;
  min-height: 72px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(20, 40, 70, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  text-align: left;
  font: inherit;
}
body.iphone-ui .iphone-module strong { font-size: 18px; }
body.iphone-ui .iphone-module span { color: #5c6b7a; white-space: nowrap; }
body.iphone-ui .iphone-card-subject,
body.iphone-ui .iphone-card-meta,
body.iphone-ui .iphone-card-time {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 14px;
}
body.iphone-ui .iphone-empty {
  margin: 24px 8px;
  color: var(--muted);
  text-align: center;
}
body.iphone-ui .iphone-detail {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}
body.iphone-ui .iphone-detail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
}
body.iphone-ui .iphone-detail-head {
  flex: none;
  display: grid;
  gap: 4px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--line);
}
body.iphone-ui .iphone-detail-head strong {
  font-size: 17px;
  color: var(--bar);
  overflow-wrap: anywhere;
}
body.iphone-ui .iphone-detail-head span {
  color: #5c6b7a;
  font-size: 14px;
  overflow-wrap: anywhere;
}
body.iphone-ui .iphone-survey {
  flex: none;
  min-width: 0;
  padding: 4px 12px 6px;
  border-bottom: 1px solid var(--line);
}
body.iphone-ui .iphone-survey-row {
  display: grid;
  grid-template-columns: 3.8em minmax(0, 1fr);
  gap: 2px 10px;
  padding: 4px 0;
  border-bottom: 1px solid #eef2f6;
  font-size: 14px;
  line-height: 1.4;
}
body.iphone-ui .iphone-survey-row b {
  color: #5c6b7a;
  font-weight: 600;
  white-space: nowrap;
}
body.iphone-ui .iphone-survey-row span,
body.iphone-ui .iphone-reason,
body.iphone-ui .mail-note,
body.iphone-ui .mail-text {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
body.iphone-ui .iphone-reason,
body.iphone-ui .mail-note {
  margin: 4px 0 0;
  color: #5c6b7a;
  font-size: 13px;
  line-height: 1.35;
}
body.iphone-ui .iphone-mail {
  flex: none;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 12px 12px;
  background: #fbfcfd;
}
body.iphone-ui .iphone-mail-bar {
  flex: none;
  display: grid;
  gap: 2px;
  min-width: 0;
  margin-bottom: 4px;
}
body.iphone-ui .iphone-mail-bar strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}
body.iphone-ui .iphone-mail-bar span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
body.iphone-ui .iphone-mail-bar .lang-toggle {
  justify-self: start;
  min-height: 48px;
  min-width: 48px;
  margin-top: 4px;
  padding: 0 14px;
  font-size: 15px;
  touch-action: manipulation;
}
body.iphone-ui .iphone-mail .mail-scroll {
  flex: none;
  max-height: none;
  overflow: visible;
}
body.iphone-ui .iphone-mail .mail-text {
  margin: 0;
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
}
body.iphone-ui .iphone-mail-source {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #d7dee7;
}
body.iphone-ui .iphone-mail-source summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  color: #5c6b7a;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
body.iphone-ui .iphone-assign {
  flex: none;
  display: grid;
  gap: 10px;
  min-width: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 10px 12px calc(14px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 16px rgba(15, 23, 32, 0.06);
}
body.iphone-ui .iphone-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-width: 0;
  color: #334155;
  font-size: 15px;
}
body.iphone-ui .iphone-field > span { flex: 0 0 4.6em; }
body.iphone-ui .iphone-field input,
body.iphone-ui .iphone-field select {
  flex: 1 1 auto;
  width: 1px;
  min-width: 0;
  max-width: 100%;
  min-height: 48px;
  font-size: 16px;
}
body.iphone-ui .iphone-assigned-line {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
}
body.iphone-ui .iphone-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}
body.iphone-ui .iphone-actions .action-btn:only-child {
  grid-column: 1 / -1;
}
body.iphone-ui .iphone-actions .action-btn,
body.iphone-ui .iphone-actions .forward-btn,
body.iphone-ui .iphone-actions .ignore-btn,
body.iphone-ui .iphone-actions .leave-btn,
body.iphone-ui .iphone-actions .resend-btn {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0 8px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(21, 58, 95, 0.12);
}
body.iphone-ui .iphone-actions .action-btn:active {
  transform: scale(0.98);
  opacity: 0.9;
}
body.iphone-ui .iphone-return {
  display: block;
  width: calc(100% - 24px);
  margin: 0 12px;
  min-height: 44px;
}
@media (max-height: 500px) {
  body.iphone-ui .iphone-detail-head { padding-top: 6px; padding-bottom: 6px; }
}
