/* PCのブラウザ版（画面イメージ meishi_w1.png）。左に一覧、右に選んだ名刺。
   D-067 案 C：白地・細い線・左の列をそろえた項目の表・等幅の数字。札・影・色の地は使わない */
html, body.app-body { height: 100%; }
body.app-body { display: flex; flex-direction: column; line-height: 1.6; }

.app-bar {
  flex: none; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; border-bottom: 1px solid var(--line); min-height: 52px;
}
.app-bar .brand { font-size: 17px; }
.app-bar .brand img { width: 28px; height: 28px; border-radius: 6px; }
.env-badge { font-size: 13px; font-weight: 600; color: var(--warn); }
.account { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--text-2); }
.account #apple-sign-out-button { min-height: 32px; display: flex; align-items: center; }

.app-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* サインイン・読み込み・読めないとき */
.state { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow: auto; }
#state-loading { align-items: center; color: var(--text-2); }
.state-box { max-width: 560px; width: 100%; }
.state-box h1 { font-size: 26px; margin: 0 0 12px; }
.state-box ol:not(.numbered) { padding-left: 1.4em; }
.state-box ol:not(.numbered) li { margin: 6px 0; }
.signin-button { min-height: 44px; margin: 20px 0; }
.state-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
/* Pro でないときの画面の注記（灰色の短い文の並び） */
.pro-notes { padding-left: 1.2em; color: var(--text-2); font-size: 15px; }
.pro-notes li { margin: 6px 0; }

/* 一覧と詳細 */
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 360px minmax(0, 1fr); }
.workspace[hidden] { display: none; }
.sidebar { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.sidebar-head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 18px 8px; }
.sidebar-head h1 { font-size: 22px; margin: 0; }
.count { font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.search { padding: 0 18px 10px; }
.search input {
  width: 100%; height: 38px; border-radius: 8px; border: 1px solid transparent; background: var(--fill);
  color: var(--text); font: inherit; font-size: 15px; padding: 0 12px;
}
.search input:focus { outline: none; border-color: var(--link); background: var(--bg); }
.card-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.card-list li { margin: 0; }
.card-row {
  width: 100%; display: flex; gap: 12px; align-items: center; text-align: left;
  padding: 10px 18px; border: 0; border-top: 1px solid var(--line-soft); background: transparent;
  color: var(--text); font: inherit; cursor: pointer;
}
.card-row:hover { background: var(--bg-grouped); }
.card-row[aria-selected="true"] { background: var(--selected); }
.card-row .texts { min-width: 0; }
.card-row .n { display: block; font-size: 16px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-row .c { display: block; font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb {
  flex: none; width: 60px; height: 36px; border-radius: 2px; background: var(--paper);
  border: 1px solid var(--card-line); overflow: hidden; display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #6e6e73;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.list-empty { padding: 12px 18px; color: var(--text-2); font-size: 15px; }
.card-row .t { display: block; font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail { overflow-y: auto; padding: 22px 30px 40px; min-width: 0; }
.detail-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.detail-title { min-width: 0; flex: 1 1 320px; }
.detail-title h2 { font-size: 26px; font-weight: 600; margin: 0; }
.detail-sub { margin: 2px 0 0; color: var(--text-2); font-size: 15px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-actions .button { min-height: 38px; font-size: 15px; padding: 0 14px; }
.back-button { display: none; }

.images { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 18px; }
.image-item { margin: 0; width: min(340px, 100%); }
.image-item button {
  display: block; width: 100%; padding: 0; border: 0; background: var(--paper); cursor: zoom-in;
  aspect-ratio: 91 / 55; border-radius: 4px; border: 1px solid var(--card-line); overflow: hidden;
}
.image-item img { width: 100%; height: 100%; object-fit: contain; display: block; }
.image-item figcaption { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.no-image {
  width: min(340px, 100%); aspect-ratio: 91 / 55; border-radius: 4px; border: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: 15px;
}
.image-failed { display: flex; align-items: center; justify-content: center; height: 100%; color: #6e6e73; font-size: 14px; }

.fields { margin-top: 22px; border-collapse: collapse; width: 100%; max-width: 720px; border-top: 1px solid var(--line); }
.fields th, .fields td { text-align: left; vertical-align: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.fields th { width: 120px; font-weight: 400; font-size: 14px; color: var(--text-2); padding-right: 16px; }
.fields td { white-space: pre-wrap; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.detail-note { margin-top: 20px; }
.history { margin-top: 26px; max-width: 720px; }
.history h3 { font-size: 14px; font-weight: 600; color: var(--text-2); margin: 0 0 6px; }
.history .fields { margin-top: 4px; }
.history-entry { margin-top: 12px; }
.history-heading { margin: 0; font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.image-dialog { border: 0; border-radius: 12px; padding: 12px; max-width: min(1100px, 94vw); background: var(--bg); color: var(--text); }
.image-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.image-dialog form { text-align: right; margin-bottom: 8px; }
.image-dialog img { display: block; max-width: 100%; max-height: 80vh; margin: 0 auto; }

.noscript { padding: 16px; }

/* スマホの幅：一覧と詳細を切り替える */
@media (max-width: 760px) {
  .workspace { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; }
  .detail { display: none; padding: 16px 16px 32px; }
  .workspace.show-detail .sidebar { display: none; }
  .workspace.show-detail .detail { display: block; }
  .back-button { display: inline-flex; flex: 0 0 auto; }
  .detail-top { flex-direction: column; gap: 12px; }
  .detail-title { flex: none; }
  .detail-title h2 { font-size: 24px; }
  .fields th { width: 96px; }
  .account .signed-in { display: none; }
}
