:root {
  --bg: #f6f8fb;
  --panel: #fff;
  --line: #e4e9f2;
  --text: #172033;
  --muted: #657184;
  --blue: #1463ff;
  --blue-50: #eef4ff;
  --green: #12a36a;
  --orange: #e1840b;
  --red: #dc2626;
  --purple: #7c3aed;
  --shadow: 0 10px 28px rgba(18, 32, 59, .07);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Microsoft YaHei", Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

.scrim {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  color: #0f4bd6;
  font-weight: 800;
}

.logo {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0f6bff, #29c3ff);
  color: #fff;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #334155;
  font-size: 14px;
}

.nav a:hover,
.nav a.active {
  background: var(--blue-50);
  color: var(--blue);
  font-weight: 700;
}

.badge {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
}

.sidebar-footer {
  position: absolute;
  right: 14px;
  bottom: 18px;
  left: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: #64748b;
  font-size: 12px;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 66px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(12px);
}

.hamb {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.search {
  flex: 1;
  max-width: 680px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: #94a3b8;
}

.icons {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.dot {
  position: absolute;
  top: -8px;
  right: -8px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 4px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #cbd5e1, #64748b);
}

.content {
  padding: 24px 26px 40px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-title h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.page-title p {
  margin: 0;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font-weight: 700;
  cursor: pointer;
}

.btn.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.btn.danger {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.grid {
  display: grid;
  gap: 16px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.kpis {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 16px;
}

.kpi {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 18px;
}

.kpi .ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-weight: 800;
}

.kpi b {
  font-size: 24px;
}

.trend {
  color: var(--muted);
}

.trend.good {
  color: var(--green);
}

.trend.bad {
  color: var(--red);
}

.ico.blue,
.pill.blue {
  background: #eaf2ff;
  color: var(--blue);
}

.ico.green,
.pill.green {
  background: #e8f8f1;
  color: var(--green);
}

.ico.orange,
.pill.orange {
  background: #fff6df;
  color: var(--orange);
}

.ico.red,
.pill.red {
  background: #feecec;
  color: var(--red);
}

.ico.purple,
.pill.purple {
  background: #f3edff;
  color: var(--purple);
}

.filters {
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto auto;
  align-items: end;
  padding: 15px;
  margin-bottom: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #64748b;
  font-size: 12px;
}

.field input,
.field select,
.field textarea,
.input {
  width: 100%;
  min-height: 39px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #334155;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.table-card {
  overflow: hidden;
}

.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.table-head h3,
.side h3,
.chart-box h3 {
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #fbfcff;
  color: #64748b;
  font-size: 12px;
}

.board {
  display: grid;
  grid-template-columns: repeat(7, minmax(180px, 1fr)) 290px;
  gap: 12px;
  align-items: start;
}

.column {
  min-height: 540px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
}

.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.col-head h3 {
  margin: 0;
  font-size: 15px;
}

.deal-card {
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.deal-card h4 {
  margin: 0 0 5px;
  font-size: 14px;
}

.deal-card p {
  margin: 2px 0;
  color: #64748b;
  font-size: 12px;
}

.deal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  font-size: 12px;
}

.side {
  padding: 16px;
}

.activity {
  margin: 12px 0 20px 8px;
  padding-left: 14px;
  border-left: 2px solid #dbe4f0;
}

.activity li {
  position: relative;
  margin: 0 0 14px;
  list-style: none;
  font-size: 13px;
}

.activity li::before {
  content: "";
  position: absolute;
  top: 5px;
  left: -19px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
}

.mini-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mini-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.chart-box {
  min-height: 260px;
  padding: 18px;
}

.line-chart {
  position: relative;
  overflow: hidden;
  height: 190px;
  border-radius: 10px;
  background:
    linear-gradient(to top, transparent 24%, #eef2f7 25%, transparent 26%, transparent 49%, #eef2f7 50%, transparent 51%, transparent 74%, #eef2f7 75%, transparent 76%),
    linear-gradient(135deg, transparent 10%, rgba(20, 99, 255, .1));
}

.line-chart svg {
  width: 100%;
  height: 100%;
}

.funnel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.funnel div {
  display: grid;
  place-items: center;
  height: 32px;
  border-radius: 6px;
  color: #fff;
  font-weight: 700;
}

.two-col {
  grid-template-columns: 1.2fr 1fr;
}

.dashboard-main {
  grid-template-columns: 1.25fr .75fr;
  margin-bottom: 16px;
}

.dashboard-bottom {
  grid-template-columns: 1fr 1fr 360px;
}

.charts {
  grid-template-columns: 1.1fr .9fr .9fr;
  margin-bottom: 16px;
}

.product-layout,
.customer-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.form-layout {
  grid-template-columns: 370px minmax(0, 1fr) 330px;
}

.profile-grid {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 230px;
  gap: 18px;
}

.profile-logo,
.business-card-preview {
  display: grid;
  place-items: center;
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  text-align: center;
}

.business-card-preview img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
}

.business-card-preview img.card-zoomable {
  cursor: zoom-in;
  transition: opacity .15s ease;
}

.business-card-preview img.card-zoomable:hover {
  opacity: .85;
}

.selected-row {
  background: #eef6ff;
}

.upload-zone {
  padding: 36px;
  border: 2px dashed #bcd0ff;
  border-radius: var(--radius);
  color: #64748b;
  text-align: center;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 18px;
}

.timeline {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 16px;
}

.tstep {
  flex: 1;
  text-align: center;
}

.circle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

.tstep:nth-child(4) .circle {
  background: var(--blue);
}

.tstep:nth-child(n+5) .circle {
  background: #cbd5e1;
}

.org {
  grid-template-columns: 1fr 1fr;
}

.org-chart {
  padding: 18px;
  text-align: center;
}

.node {
  display: inline-block;
  margin: 6px;
  padding: 10px 16px;
  border: 1px solid #bcd0ff;
  border-radius: 10px;
  background: #f4f8ff;
}

.dept-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 15px;
}

.product-thumb {
  flex: 0 0 auto;
  width: 58px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0f172a, #64748b);
}

.notice {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  background: #fff7ed;
  color: #9a3412;
}

.notice.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.notice.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.business-card-ocr-layout {
  grid-template-columns: 360px minmax(0, 1fr);
  align-items: start;
}

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

.ocr-upload-zone {
  display: grid;
  gap: 8px;
  padding: 28px 18px;
  cursor: pointer;
}

.ocr-upload-zone span {
  color: var(--text);
  font-weight: 800;
}

.ocr-upload-zone small {
  color: var(--muted);
  line-height: 1.5;
}

.ocr-upload-zone input {
  width: 100%;
  margin-top: 8px;
}

.ocr-preview {
  overflow: hidden;
  min-height: 210px;
}

.ocr-preview img {
  display: block;
  width: 100%;
  max-height: 300px;
  object-fit: contain;
}

.business-card-list {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.business-card-search {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(130px, .7fr) minmax(130px, .7fr) minmax(140px, .7fr) minmax(140px, .7fr);
  gap: 12px;
  align-items: end;
  padding: 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.business-card-search-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  grid-column: 1 / -1;
}

.business-card-search-actions .btn {
  min-width: 120px;
}

.business-card-list-head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.business-card-row {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 6px 18px rgba(18, 32, 59, .04);
}

.business-card-row + .business-card-row {
  margin-top: 2px;
}

.business-card-row:last-child {
  border-bottom: 1px solid var(--line);
}

.business-card-thumb {
  display: grid;
  place-items: center;
  align-self: start;
  width: 100%;
  min-height: 140px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--muted);
}

.business-card-thumb img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
}

.business-card-result {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.business-card-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.business-card-title {
  min-width: 0;
}

.business-card-title h4 {
  margin: 3px 0 4px;
  font-size: 18px;
  line-height: 1.35;
  word-break: break-word;
}

.business-card-title p {
  margin: 0;
  color: #334155;
  font-weight: 700;
}

.business-card-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.business-card-contact-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.business-card-contact-grid div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.business-card-contact-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.business-card-contact-grid b {
  display: block;
  overflow-wrap: anywhere;
  color: #1f2937;
  font-size: 13px;
}

.business-card-compact-fields {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 5px 10px;
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--line);
  background: #fbfdff;
}

.business-card-compact-fields dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.business-card-compact-fields dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.business-card-linked {
  padding: 9px 11px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: var(--blue-50);
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.business-card-note {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  background: #f8fbff;
}

.business-card-note span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.business-card-note p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  white-space: normal;
  word-break: break-word;
}

.business-card-raw summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

.business-card-raw textarea {
  margin-top: 8px;
}

.business-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* 解析中（全屏遮罩 + 转圈 + 不确定进度条） */
.ocr-processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(2px);
}

.ocr-processing-overlay.show {
  display: flex;
}

.ocr-processing-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: min(86vw, 340px);
  padding: 28px 24px;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.ocr-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: ocr-spin 0.9s linear infinite;
}

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

.ocr-processing-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.ocr-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.ocr-progress span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 999px;
  background: var(--blue);
  animation: ocr-bar 1.4s ease-in-out infinite;
}

@keyframes ocr-bar {
  0%   { margin-left: -40%; }
  100% { margin-left: 100%; }
}

/* メール送信ページ */
.mailer-form {
  display: grid;
  gap: 16px;
  max-width: 640px;
}

.mailer-section {
  display: grid;
  gap: 10px;
}

.mailer-section h3 {
  margin: 0;
}

.mailer-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.photo-slot {
  position: relative;
  width: 96px;
  height: 96px;
}

/* 空きスロット：点線の四角 + 中央の＋ */
.photo-add {
  width: 100%;
  height: 100%;
  border: 2px dashed #bcd0ff;
  border-radius: 12px;
  background: var(--blue-50);
  color: var(--blue);
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-slot.filled .photo-add {
  display: none;
}

/* サムネイル（選択後）*/
.photo-thumb {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  cursor: zoom-in;
}

.photo-slot.filled .photo-thumb {
  display: block;
}

/* 右上の削除（✕）*/
.photo-remove {
  display: none;
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--red);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}

.photo-slot.filled .photo-remove {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ライトボックス（拡大表示）*/
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .85);
  padding: 24px;
}

.photo-lightbox.show {
  display: flex;
}

.photo-lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

.photo-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .9);
  color: #111;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mailer-select-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn.small {
  padding: 6px 12px;
  font-size: 13px;
}

.mailer-type-filter {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.mailer-type-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mailer-type-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.mailer-type-option input {
  width: 16px;
  height: 16px;
}

.mailer-type-option.blue {
  border-color: #bfdbfe;
}

.mailer-type-option.green {
  border-color: #bbf7d0;
}

.mailer-type-option.orange {
  border-color: #fed7aa;
}

.mailer-type-option.red {
  border-color: #fecaca;
}

.mailer-type-option.purple {
  border-color: #ddd6fe;
}

.mailer-sensitive-warning {
  display: none;
  margin: 0;
}

.mailer-recipients {
  display: grid;
  gap: 8px;
  max-height: 46vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
}

.mailer-recipient {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
}

.mailer-recipient:hover {
  background: var(--blue-50);
}

.mailer-recipient input[type=checkbox] {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.mailer-recipient-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mailer-recipient-info b,
.mailer-recipient-info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 第1步：拍照 / 相册 两个按钮 */
.ocr-capture-buttons {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.ocr-capture-form {
  margin: 0;
}

.ocr-size-field {
  margin-bottom: 10px;
}

.ocr-capture-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px;
  font-size: 16px;
  cursor: pointer;
  box-sizing: border-box;
}

.ocr-camera-card {
  max-width: 760px;
  margin: 0 auto;
}

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

.ocr-camera-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 6 / 7;
  width: 100%;
  max-height: 58vh;
  border-radius: 8px;
  background: #020617;
}

.ocr-camera-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ocr-camera-mask {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.ocr-camera-frame {
  position: relative;
  width: min(88%, 560px);
  aspect-ratio: 91 / 55;
  box-shadow: 0 0 0 9999px rgba(2, 6, 23, 0.58);
}

.ocr-camera-frame[data-size="standard_cn"] {
  aspect-ratio: 90 / 54;
}

.ocr-camera-frame[data-size="standard_us"] {
  aspect-ratio: 89 / 51;
}

.ocr-camera-frame[data-size="vertical"] {
  width: min(58%, 360px);
  aspect-ratio: 55 / 91;
}

.ocr-camera-frame .corner {
  position: absolute;
  width: 38px;
  height: 38px;
  border-color: #22c55e;
  border-style: solid;
  filter: drop-shadow(0 1px 3px rgba(2, 6, 23, 0.7));
}

.ocr-camera-frame .tl {
  top: 0;
  left: 0;
  border-width: 4px 0 0 4px;
}

.ocr-camera-frame .tr {
  top: 0;
  right: 0;
  border-width: 4px 4px 0 0;
}

.ocr-camera-frame .bl {
  bottom: 0;
  left: 0;
  border-width: 0 0 4px 4px;
}

.ocr-camera-frame .br {
  right: 0;
  bottom: 0;
  border-width: 0 4px 4px 0;
}

.ocr-camera-message {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.ocr-camera-message:empty {
  display: none;
}

.ocr-camera-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 0 4px;
  background: linear-gradient(to top, var(--panel) 72%, transparent);
}

.ocr-camera-actions .btn {
  min-height: 46px;
}

.ocr-crop-card {
  max-width: 760px;
  margin: 0 auto;
}

.ocr-album-editor {
  grid-column: 1 / -1;
}

.ocr-album-editor[hidden] {
  display: none;
}

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

.ocr-crop-stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  touch-action: none;
  user-select: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
}

.ocr-crop-stage img {
  display: block;
  width: 100%;
  height: auto;
}

.ocr-crop-selection {
  position: absolute;
  box-sizing: border-box;
  border: 3px solid #22c55e;
  background: rgba(34, 197, 94, 0.12);
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.42);
  cursor: move;
  touch-action: none;
}

.ocr-crop-handle {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.28);
}

.ocr-crop-handle.nw {
  top: -13px;
  left: -13px;
  cursor: nwse-resize;
}

.ocr-crop-handle.ne {
  top: -13px;
  right: -13px;
  cursor: nesw-resize;
}

.ocr-crop-handle.sw {
  bottom: -13px;
  left: -13px;
  cursor: nesw-resize;
}

.ocr-crop-handle.se {
  right: -13px;
  bottom: -13px;
  cursor: nwse-resize;
}

.ocr-crop-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 12px 0 4px;
  background: linear-gradient(to top, var(--panel) 72%, transparent);
}

.ocr-crop-actions .btn {
  flex: 1;
  min-height: 46px;
}

/* === 第3步：确认 / 修改 表单（移动端优先） === */
.ocr-edit {
  max-width: 560px;
  margin: 0 auto;
}

.ocr-edit-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

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

.ocr-field {
  display: grid;
  gap: 6px;
}

.ocr-field-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.req-mark {
  color: var(--red);
  margin-left: 4px;
}

.ocr-field input,
.ocr-field textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px; /* 16px 可避免 iOS 聚焦时自动放大 */
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-sizing: border-box;
}

.ocr-field input:focus,
.ocr-field textarea:focus {
  outline: none;
  border-color: var(--blue);
}

.ocr-field.required input {
  background: #fffdf5;
}

.ocr-field.note-field textarea {
  min-height: 112px;
  line-height: 1.6;
  resize: vertical;
}

.ocr-edit-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 12px 0 4px;
  background: linear-gradient(to top, var(--panel) 70%, transparent);
}

.ocr-edit-actions .btn {
  flex: 1;
  padding: 13px;
  text-align: center;
  font-size: 15px;
}

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

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.login-body {
  min-height: 100vh;
  background: var(--bg);
}

.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: min(440px, 100%);
  padding: 24px;
}

.login-card h1 {
  margin: 0 0 8px;
}

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

@media (max-width: 1180px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 30;
    display: block;
    height: 100vh;
    width: 246px;
    overflow: auto;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .scrim.show {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: block;
    background: rgba(15, 23, 42, .45);
  }

  .hamb {
    display: grid;
    place-items: center;
  }

  .kpis,
  .dashboard-main,
  .dashboard-bottom,
  .charts,
  .product-layout,
  .customer-layout,
  .business-card-ocr-layout,
  .form-layout,
  .org,
  .two-col,
  .three {
    grid-template-columns: 1fr;
  }

  .board {
    grid-template-columns: 1fr;
  }

  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 0 14px;
  }

  .content {
    padding: 18px 14px 32px;
  }

  .page-head,
  .table-head,
  .timeline {
    flex-direction: column;
    align-items: stretch;
  }

  .filters,
  .form-grid,
  .business-card-search {
    grid-template-columns: 1fr;
  }

  .business-card-search-actions {
    justify-content: stretch;
  }

  .business-card-search-actions .btn {
    flex: 1;
  }

  .business-card-list-head-actions {
    justify-content: stretch;
  }

  .business-card-list-head-actions .btn {
    flex: 1;
  }

  .business-card-row {
    grid-template-columns: 1fr;
  }

  .business-card-summary {
    grid-template-columns: 1fr;
  }

  .business-card-status {
    justify-content: flex-start;
  }

  .business-card-contact-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ocr-upload-form .btn,
  .ocr-upload-zone input {
    min-height: 44px;
  }

  .ocr-crop-card {
    margin: 0;
  }

  .ocr-camera-card {
    margin: 0;
  }

  .ocr-camera-stage {
    aspect-ratio: 6 / 7;
    max-height: 58vh;
  }

  .ocr-crop-actions {
    flex-direction: column;
  }

  .search {
    display: none;
  }
}
