:root {
  /* ダークテーマ（背景 黒・文字 白） */
  --bg: #101216;          /* 画面の下地 */
  --panel: #1a1d23;       /* サイドバー・一覧・プレビューの面 */
  --panel-2: #22262e;     /* 見出し行・ホバーなど一段明るい面 */
  --border: #333945;      /* 枠線 */
  --line: #3b4351;        /* 列と行を仕切る線 */
  --text: #e9ecf1;        /* 本文の文字 */
  --muted: #98a1af;       /* 補助的な文字 */
  --primary: #5b9dff;
  --primary-hover: #7db2ff;
  --accent: #f0b429;
  --danger: #ff7b72;
  --ok: #56d364;
  --topbar: #0a0c0f;
  --topbar-h: 52px;
  --sel: #24406d;         /* 選択中の行 */
  --sel-border: #5b9dff;
  --row-unread: #23272f;  /* 未読の行（既読より明るくする） */
  --hover: #2a303a;
  --input: #0f1116;       /* 入力欄の中 */
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}
/* 入力欄は**どこでも黒地に白文字**。ここで1回決めておく
   （`.fields input` のような個別指定の外に置いた欄が、ブラウザ既定の白い箱になっていた） */
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="search"], input[type="url"], input[type="tel"],
select, textarea {
  background: var(--input); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 6px 8px; font: inherit; max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
input:disabled, select:disabled, textarea:disabled { color: var(--muted); background: #14161b; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--panel-2); color: var(--text); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
h1 { font-size: 20px; margin: 0; }
h3 { font-size: 14px; margin: 18px 0 8px; color: var(--muted); border-bottom: 1px solid var(--border); padding-bottom: 4px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  height: var(--topbar-h); padding: 0 16px;
  background: var(--topbar); color: #fff;
  border-bottom: 1px solid var(--border);
}
.topbar .brand { color: #fff; font-weight: 600; font-size: 16px; white-space: nowrap; }
.topbar .brand:hover { text-decoration: none; }
/* 上の「絞り込み」。アカウント／受信日時／差出人／件名／本文を1行に並べる */
.topbar .filter { flex: 1; display: flex; gap: 6px; align-items: center; min-width: 0; }
.topbar .filter input, .topbar .filter select {
  padding: 5px 8px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--input); color: var(--text); font: inherit; font-size: 13px; min-width: 0;
}
.topbar .filter select { flex: none; width: 130px; }
.topbar .filter input[type=date] { flex: none; width: 135px; color-scheme: dark; }
.topbar .filter input[type=search] { flex: 1; min-width: 70px; }
.topbar .filter input::placeholder { color: #6b7480; }
.topbar .filter .flt-label { flex: none; font-size: 12px; color: var(--muted); white-space: nowrap; }
.topbar .filter button {
  flex: none; padding: 5px 12px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--panel-2); color: var(--text); cursor: pointer; font: inherit; font-size: 13px; white-space: nowrap;
}
.topbar .filter button:hover { background: var(--hover); }
.topbar .filter .flt-clear { flex: none; font-size: 13px; white-space: nowrap; }
.topbar .userbox { margin-left: auto; display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.topbar .userbox a { color: #c3cad4; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: calc(100vh - var(--topbar-h)); }
/* レールとサイドバーは常に画面いっぱいの高さで貼り付けておく。
   こうしないと「下詰め」にした設定ボタンが、縦に長いページで画面の外に出てしまう。 */
.app-rail, .sidebar {
  position: sticky; top: 0; align-self: flex-start;
  height: calc(100vh - var(--topbar-h));
}
.sidebar {
  width: 232px; flex: none;
  background: var(--panel); border-right: 1px solid var(--border);
  padding: 12px 8px; display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto;
}
.sidebar-actions { display: flex; flex-direction: column; gap: 6px; padding: 0 2px; }
.sync-time { text-align: center; margin-top: 3px; }

/* サイドバーのツリー（Outlook 風: アカウント > フォルダ） */
.tree { display: flex; flex-direction: column; gap: 2px; }
.tree-group > summary {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em;
  list-style: none; user-select: none;
}
.tree-group > summary::-webkit-details-marker { display: none; }
.tree-group > summary::before {
  content: "▶"; font-size: 8px; color: var(--muted); flex: none; width: 9px; text-align: center;
  transition: transform .12s ease;
}
.tree-group[open] > summary::before { transform: rotate(90deg); }
.tree-group > summary:hover { background: var(--hover); }
.tree-group > summary .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-group[open] > summary .badge { display: none; }
.tree-group .nav { padding-left: 14px; }

.nav { list-style: none; margin: 0; padding: 0; }
/* 行は「リンク＋右端の⋮」の並び。⋮ を重ねずに置くので未読の数字と喧嘩しない */
.nav li { display: flex; align-items: center; }
.nav li a {
  display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0;
  padding: 6px 9px; border-radius: 6px; color: var(--text);
}

/* フォルダの右の「⋮」。開くと名前の変更とフォルダ作成が出る（`base.html` の folder_menu）。
   JS は使わず <details> の開閉だけ。ふだんは薄く、その行にマウスを乗せたときだけはっきり出す */
.row-menu { position: relative; flex: none; }
.row-menu > summary {
  list-style: none; cursor: pointer; width: 20px; line-height: 22px; text-align: center;
  border-radius: 5px; color: var(--muted); opacity: 0; font-size: 15px;
}
.row-menu > summary::-webkit-details-marker { display: none; }
.nav li:hover .row-menu > summary, .row-menu[open] > summary { opacity: 1; }
/* JS があるときは「⋮」を出さない（右クリックのメニューで足りる）。JS が無いときだけ予備の道として残る */
html.js .row-menu > summary { display: none; }
.row-menu > summary:hover, .row-menu[open] > summary { background: var(--panel-2); color: var(--text); }
.menu-panel {
  position: absolute; right: 0; top: 26px; z-index: 60; width: 218px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .45);
}
.menu-panel form { display: flex; flex-direction: column; gap: 4px; }
.menu-panel label { font-size: 11px; color: var(--muted); }
.menu-panel input { width: 100%; }
/* お気に入り（「今すぐ受信」の下）。下の線で本体のツリーと分ける */
.favorites { padding: 8px 2px 10px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.favorites h4 { margin: 0 0 4px; padding: 0 8px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.favorites .fav-empty { padding: 4px 8px; }

/* ドラッグ＆ドロップの目印（app.js が付ける）。フォルダのツリーとお気に入りで共通 */
.folder-nav li.dragging, .fav-nav li.dragging { opacity: .45; }
.folder-nav li.drop-before, .fav-nav li.drop-before { box-shadow: 0 -2px 0 0 var(--primary); }
.folder-nav li.drop-after, .fav-nav li.drop-after { box-shadow: 0 2px 0 0 var(--primary); }
.folder-nav li.drop-into > a { outline: 2px solid var(--primary); outline-offset: -2px; background: var(--hover); }
.folder-nav li[draggable="true"] > a, .fav-nav li[draggable="true"] > a { cursor: grab; }

/* 右クリックのメニュー（項目だけ）。押した場所に app.js が置く */
.ctx-menu {
  position: fixed; z-index: 90; min-width: 200px; padding: 4px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .45); display: flex; flex-direction: column;
}
.ctx-menu[hidden], .ctx-menu [hidden] { display: none; }   /* display:block が hidden 属性に勝つので明示 */
.ctx-menu button {
  display: block; width: 100%; text-align: left; padding: 7px 12px; border: 0; border-radius: 5px;
  background: transparent; color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
}
.ctx-menu button:hover, .ctx-menu button:focus { background: var(--hover); outline: none; text-decoration: none; }
.ctx-menu button.danger { color: var(--danger); }
/* できない項目はグレーにして残す（受信トレイの名前変更など） */
.ctx-menu button:disabled { opacity: .38; cursor: default; }
.ctx-menu button:disabled:hover { background: transparent; }

/* 専用ダイアログ（<dialog>）。名前の変更・作成・削除で共用し、中身は app.js が書き換える */
.dlg {
  width: min(420px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel); color: var(--text); box-shadow: 0 16px 40px rgba(0, 0, 0, .6);
}
.dlg::backdrop { background: rgba(0, 0, 0, .55); }
.dlg form { padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.dlg h3 { margin: 0; font-size: 16px; }
.dlg .dlg-note { margin: 0; font-size: 12px; color: var(--muted); }
.dlg label { display: block; font-size: 12px; color: var(--muted); }
.dlg label[hidden] { display: none; }
.dlg input[name=name] { display: block; width: 100%; margin-top: 4px; padding: 7px 9px; font-size: 14px; }
.dlg .form-actions { margin-top: 6px; justify-content: flex-end; }

/* 削除は開いてからもう一度押す。開くまでは控えめな1行 */
.menu-danger > summary { list-style: none; cursor: pointer; font-size: 11px; color: var(--muted); }
.menu-danger > summary::-webkit-details-marker { display: none; }
.menu-danger > summary:hover, .menu-danger[open] > summary { color: var(--danger); }
.menu-danger p { margin: 4px 0; font-size: 11px; color: var(--muted); }
.menu-danger .btn-danger { align-self: flex-start; }
.nav li a .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav li a .ico { flex: none; width: 16px; text-align: center; font-size: 12px; }
.nav li a:hover { background: var(--hover); text-decoration: none; }
.nav li.active a { background: var(--sel); color: #fff; font-weight: 600; }
.nav.bottom { margin-top: auto; border-top: 1px solid var(--border); padding-top: 8px; }
.nav-note { padding: 6px 10px; }
.badge { background: var(--primary); color: #0a0c0f; border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 700; flex: none; }

.content { flex: 1; padding: 20px 24px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 small { font-weight: normal; color: var(--muted); font-size: 14px; margin-left: 6px; }
.page-head .btn { margin-left: auto; }

/* ---------- いちばん左: アプリ切り替えレール ----------
   アプリ同士は線で区切らない。全体設定だけ下詰めにして、線で分ける。 */
.app-rail {
  flex: none; width: 84px;
  background: var(--topbar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.app-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  min-height: 72px; padding: 12px 4px;
  color: #9aa4b2; text-align: center;
}
/* 全体設定はいちばん下へ押し下げる。レールの区切り線は真っ黒な下地でも見えるよう --line を使う */
.app-item-bottom { margin-top: auto; border-top: 1px solid var(--line); }
.app-item:hover { background: #1b1f27; color: #fff; text-decoration: none; }
.app-item.active { background: var(--sel); color: #fff; }
/* 選択中は左端に縦棒（どこを開いているか一目で分かるように） */
.app-item.active::before {
  content: ""; position: absolute; left: 0; top: -1px; bottom: -1px;
  width: 3px; background: var(--sel-border);
}
.app-ico { display: block; line-height: 0; }
.app-ico .icon { width: 24px; height: 24px; display: block; }
.app-label { font-size: 12px; letter-spacing: .02em; white-space: nowrap; }

/* ---------- 設定の目次 ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; max-width: 980px; }
.card {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px; color: var(--text);
}
.card:hover { background: var(--panel-2); border-color: var(--primary); text-decoration: none; }
.card-ico { font-size: 22px; line-height: 1.2; flex: none; }
.card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.card-title { font-weight: 600; }
.card-desc { color: var(--muted); font-size: 13px; }

/* これから作るアプリの案内（画面が空っぽに見えないよう、カードにまとめる） */
.coming-card {
  display: flex; gap: 18px; align-items: center; max-width: 620px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 22px 24px;
}
.coming-icon { flex: none; color: var(--muted); line-height: 0; }
.coming-icon .icon { width: 40px; height: 40px; stroke-width: 1.3; }
.coming-title { font-weight: 600; margin-bottom: 4px; }
.coming-detail { font-size: 13px; line-height: 1.9; }

/* ---------- ペインの仕切り（ドラッグで幅を変える） ---------- */
.splitter { flex: none; width: 5px; cursor: col-resize; background: transparent; position: relative; }
.splitter::after { content: ""; position: absolute; inset: 0 2px; background: transparent; }
.splitter:hover::after, body.dragging .splitter::after { background: var(--primary); }
.splitter-sidebar { margin-left: -5px; }
body.dragging { cursor: col-resize; user-select: none; }
body.dragging iframe { pointer-events: none; }

/* ---------- buttons / forms ---------- */
.btn {
  display: inline-block; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--panel-2); color: var(--text); cursor: pointer;
  font: inherit; font-size: 13px; line-height: 1.4; white-space: nowrap;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #0a0c0f; font-weight: 600; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: #5a2f2c; }
.btn-danger:hover { background: #3a2220; }
.btn-block { display: block; width: 100%; text-align: center; }
/* サイドバーの受信: アカウントのプルダウン＋［今すぐ受信］を1行に */
.sync-row { display: flex; gap: 6px; align-items: stretch; }
.sync-row select { flex: 1 1 auto; min-width: 0; }
.sync-row .btn { flex: 0 0 auto; white-space: nowrap; }
.btn-close { margin-left: auto; }
.btn:disabled { opacity: .5; cursor: default; }
.inline { display: inline; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 20px 24px; max-width: 860px; }
form.stack label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
form.stack input[type=text], form.stack input[type=email], form.stack input[type=password],
form.stack input[type=number], form.stack input[type=search], form.stack select, form.stack textarea {
  display: block; width: 100%; margin-top: 4px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 6px;
  font: inherit; color: var(--text); background: var(--input);
}
form.stack textarea { line-height: 1.6; resize: vertical; }
form.stack input:focus, form.stack select:focus, form.stack textarea:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
form.stack label.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
form.stack label.check input { margin: 0; }
form.stack input[type=file] { color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
/* アカウント画面の受信方式（POP3 / IMAP）のラジオ。選んだ方式に合わない欄は app.js が hidden にする */
.radio-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.imap-only[hidden], .pop-only[hidden] { display: none; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }

/* ---------- flash ---------- */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; border: 1px solid transparent; }
.flash-info { background: #16283f; border-color: #274a72; color: #b9d4f5; }
.flash-success { background: #14301c; border-color: #2a5c38; color: #b7e8c4; }
.flash-error { background: #3a1d1b; border-color: #6b2f2a; color: #f7bdb8; }

/* ================================================================
   メール画面（3ペイン）
   ================================================================ */
.mail-page .layout { height: calc(100vh - var(--topbar-h)); min-height: 0; overflow: hidden; }
.mail-page .content { padding: 0; display: flex; flex-direction: column; min-height: 0; }
.mail-page .flashes { padding: 8px 10px 0; }
.panes { flex: 1; display: flex; min-height: 0; }

/* --- 中央: メール一覧 --- */
.list-pane {
  /* 列の幅。見出しの境目をドラッグすると JS がこの値を書き換える */
  --w-when: 88px;
  --w-who: 140px;
  width: 560px; flex: none; min-width: 320px;
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.list-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--border); flex: none; }
.list-title { font-size: 15px; font-weight: 600; }
.list-title small { font-weight: normal; color: var(--muted); font-size: 12px; margin-left: 6px; }
.list-scroll { flex: 1; overflow-y: auto; min-height: 0; }

.mail-list { list-style: none; margin: 0; padding: 0; }

/* 一覧は1行 = 受信日時 | 差出人 | 件名 の3カラム。列は縦線で仕切る */
.mail-head, .mail-link { display: flex; align-items: center; gap: 0; min-width: 0; }
.mail-head {
  position: sticky; top: 0; z-index: 2;
  padding: 6px 0; background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  font-size: 11px; color: var(--muted); letter-spacing: .04em;
  user-select: none;
}
.col-when, .col-who, .col-subj { padding: 0 9px; }
.col-when { flex: none; width: var(--w-when); font-variant-numeric: tabular-nums; }
.col-who  { flex: none; width: var(--w-who); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-subj { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-when, .col-who, .col-clip { border-right: 1px solid var(--line); }
/* 添付の列（差出人と件名の間）。クリップだけの細い列 */
.col-clip { flex: none; width: 30px; text-align: center; padding: 0 4px; font-size: 13px; }
.mail-head .col-clip { color: var(--muted); }

/* 見出しの境目 = 列幅のつまみ */
.mail-head .col-when, .mail-head .col-who { position: relative; }
.col-resize { position: absolute; top: 0; right: -4px; width: 9px; height: 100%; cursor: col-resize; z-index: 3; }
.col-resize::after {
  content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 3px; background: transparent;
}
.col-resize:hover::after, body.dragging .col-resize::after { background: var(--primary); }

.mail-item { position: relative; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.mail-item:hover { background: var(--hover); }
.mail-item.unread { background: var(--row-unread); }
.mail-item.unread::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); z-index: 1;
}
.mail-item.active, .mail-item.active:hover { background: var(--sel); }
.mail-item.active::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--sel-border); z-index: 1;
}
.mail-link { flex: 1; padding: 6px 0; color: var(--text); font-size: 13px; }
.mail-link:hover { text-decoration: none; }
.mail-item .col-when, .mail-item .col-who { color: var(--muted); }
.mail-item .col-when { font-size: 12px; }
.mail-item.unread .col-who, .mail-item.unread .col-subj { font-weight: 700; color: #fff; }
.mail-item.unread .col-when { color: var(--primary); font-weight: 600; }
.mail-item.active .col-when, .mail-item.active .col-who, .mail-item.active .col-subj { color: #fff; }
.clip { margin-left: 2px; }
.pagination { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 12px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); line-height: 2; }

/* --- 右: プレビュー --- */
.preview-pane {
  flex: 1; min-width: 0; background: var(--panel);
  display: flex; flex-direction: column; min-height: 0;
}
.preview-pane.loading { opacity: .5; }
.preview-bar {
  flex: none; display: flex; flex-wrap: wrap; gap: 5px; align-items: center;
  padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--panel-2);
}
.preview-head { flex: none; padding: 14px 18px 10px; border-bottom: 1px solid var(--border); }
.preview-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 18px 24px; }
.preview-body-html { overflow: hidden; padding: 0; display: flex; flex-direction: column; }
.preview-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: var(--muted); text-align: center; padding: 20px;
}
.preview-empty-icon { font-size: 44px; opacity: .3; line-height: 1; }
.remote-note {
  flex: none; padding: 7px 14px; background: #3a2f14; border-bottom: 1px solid #6b5320; color: #f3d489;
}
.remote-note a { color: #ffd479; }

.mail-subject { margin: 0 0 10px; font-size: 18px; word-break: break-word; color: #fff; }
.mail-headers { border-collapse: collapse; font-size: 13px; }
.mail-headers th { text-align: left; color: var(--muted); font-weight: normal; padding: 1px 14px 1px 0; white-space: nowrap; vertical-align: top; }
.mail-headers td { padding: 1px 0; word-break: break-all; }
.attachments {
  padding: 8px 12px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px;
  margin-top: 10px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center;
}
.text-body { white-space: pre-wrap; word-break: break-word; line-height: 1.75; font-size: 14px; }
/* HTML メールは送信者側が黒文字前提で書いているので、ここだけ白地のまま表示する */
.html-body { width: 100%; border: none; background: #fff; }
.mail-page .html-body { flex: 1; min-height: 0; }
.view-switch { margin-top: 10px; font-size: 13px; color: var(--muted); }
.view-switch a.on { font-weight: 600; color: var(--text); }

/* --- 詳細ページ単体 (/mail/{id}) で使うときの見た目 --- */
.detail-back { margin-bottom: 10px; }
.preview-standalone { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.preview-standalone .preview-body { padding: 18px 22px 24px; }
.preview-standalone .preview-body-html { padding: 0; display: block; }
.preview-standalone .html-body { height: 70vh; resize: vertical; }

/* ---------- 署名 ---------- */
textarea.mono, .signature-sample {
  font-family: "SFMono-Regular", Consolas, "Courier New", "Yu Gothic UI", monospace;
  font-size: 13px; line-height: 1.7;
}
.signature-sample {
  background: var(--input); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 18px; white-space: pre-wrap; word-break: break-word; margin: 0; color: var(--text);
}

/* ---------- フォルダ / 仕分けルール ---------- */
.nav li.sub a { padding-left: 26px; }
.nav li.sub a .ico { font-size: 11px; opacity: .8; }

.move-form { display: inline-flex; gap: 4px; align-items: center; }
.move-form select {
  padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--input); color: var(--text); font: inherit; font-size: 13px; max-width: 180px;
}

.inline-form { display: flex; gap: 6px; align-items: center; }
.name-input {
  padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--input); color: var(--text); font: inherit; font-size: 13px; min-width: 160px;
}
.sub-row { padding-left: 18px !important; }

.cond-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
/* form.stack の「幅100%」より強くするため、あえて form.stack を前に付ける */
form.stack .cond-row select {
  display: inline-block; flex: none; width: 210px; margin-top: 0;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--input); color: var(--text); font: inherit;
}
form.stack .cond-row input[type=text] {
  display: inline-block; flex: 1; min-width: 160px; width: auto; margin-top: 0;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--input); color: var(--text); font: inherit;
}
.cond-row .muted { flex: none; }
.cond-row select:focus, .cond-row input:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { background: var(--panel-2); font-size: 12px; color: var(--muted); white-space: nowrap; }
table.data td.actions { white-space: nowrap; }
table.data td.actions .btn, table.data td.actions form { margin-right: 4px; }
.tag { font-size: 11px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; }
.text-danger { color: var(--danger); font-weight: 600; }
.text-ok { color: var(--ok); font-weight: 600; }

/* ---------- misc ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.login-box {
  max-width: 380px; margin: 80px auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 28px;
}
.login-box h1 { font-size: 18px; margin-bottom: 4px; }

/* ---------- スマホ・狭い画面 ---------- */
@media (max-width: 900px) {
  :root { --topbar-h: 46px; }
  .layout { flex-direction: column; min-height: auto; }
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar .brand { font-size: 14px; }
  .topbar .filter { display: none; }
  .topbar .userbox { gap: 8px; font-size: 13px; }
  .app-rail, .sidebar { position: static; height: auto; align-self: auto; }
  .app-rail {
    width: auto; flex-direction: row; justify-content: center;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .app-item { flex: 1; flex-direction: row; gap: 6px; min-height: 0; padding: 8px 10px; }
  .app-item-bottom { margin-top: 0; border-top: none; border-left: 1px solid var(--border); }
  .app-item.active::before { top: auto; bottom: 0; left: 0; right: 0; width: auto; height: 3px; }
  .app-ico .icon { width: 18px; height: 18px; }
  .card-grid { grid-template-columns: 1fr; }
  .sidebar {
    width: auto !important; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px;
    padding: 8px 10px; border-right: none; border-bottom: 1px solid var(--border); overflow: visible;
  }
  .sidebar-actions { flex-direction: row; align-items: center; gap: 6px; }
  .sidebar-actions .btn-block { width: auto; display: inline-block; }
  .sync-time { display: none; }
  .tree { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .tree-group > summary { padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; }
  .tree-group .nav { padding-left: 0; }
  .tree-group[open] { width: 100%; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav li a { padding: 5px 9px; font-size: 13px; border: 1px solid var(--border); }
  .nav li.active a { border-color: var(--primary); }
  .nav.bottom { margin-top: 0; border-top: none; padding-top: 0; }
  .splitter { display: none; }

  .mail-page .layout { height: auto; overflow: visible; }
  .panes { flex-direction: column; }
  .list-pane { width: auto !important; border-right: none; }
  .list-scroll { overflow: visible; }
  .mail-page.has-preview .list-pane { display: none; }
  .mail-head { display: none; }
  .preview-pane { border-top: 1px solid var(--border); }
  .preview-bar .btn { padding: 5px 8px; font-size: 12px; }
  .mail-subject { font-size: 16px; }
  .mail-page .html-body { height: 70vh; flex: none; }
  .preview-body-html { display: block; overflow: visible; }

  .content { padding: 10px; }
  .page-head { margin-bottom: 8px; gap: 8px; }
  .page-head h1 { font-size: 17px; }
  .preview-standalone .html-body { height: 60vh; }
  .panel { padding: 14px 12px; }
  .form-row { grid-template-columns: 1fr; }
  table.data { font-size: 13px; }
  .login-box { margin: 30px 12px; padding: 20px; }
}

/* ---------- 一覧と入力フォームの共通部品（受取請求書・取込ルールで使う） ---------- */
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input[type=search] {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--input); color: var(--text); font: inherit; min-width: 220px;
}
.filters input::placeholder { color: #6b7480; }

table.grid { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); }
table.grid th, table.grid td { padding: 6px 10px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.grid th:last-child, table.grid td:last-child { border-right: none; }
table.grid th { background: var(--panel-2); font-size: 12px; color: var(--muted); position: sticky; top: 0; }
table.grid tbody tr:hover { background: var(--hover); }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.strong { font-weight: 600; color: var(--text); }
table.grid td.ellipsis { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.btn-sm { padding: 2px 8px; font-size: 12px; }

/* 状態のボタン。押すたび 未確認 → 確認済 → 支払済 と回す */
.tagbtn {
  font: inherit; font-size: 12px; cursor: pointer; padding: 2px 10px; border-radius: 10px;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
}
.tagbtn:hover { background: var(--hover); }
.tagbtn.wait { border-color: var(--accent); color: var(--accent); }
.tagbtn.on { border-color: var(--ok); color: var(--ok); }

.pager { display: flex; gap: 10px; align-items: center; margin-top: 12px; }

/* 入力フォーム */
.card-box { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px 18px; margin-bottom: 14px; }
.card-box h3 { margin-top: 0; }
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; }
.fields label { display: block; font-size: 12px; color: var(--muted); }
.fields label.w2 { grid-column: span 2; }
/* 1行に並べたい組（取込ルールの「基本」など）。狭い画面では折り返す */
.fields.one-row { display: flex; flex-wrap: wrap; }
.fields.one-row > label { flex: 1 1 110px; }
.fields.one-row > label.w2 { flex: 2 1 240px; }
.fields input {
  display: block; width: 100%; margin-top: 3px; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: 4px; background: var(--input); color: var(--text); font: inherit;
}
.fields input:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
.unit { color: #6b7480; font-size: 11px; }

/* 合計欄。入力するたび JS が書き換える */
.calc-total {
  position: sticky; bottom: 0; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 18px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.calc-total .parts { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.calc-total .parts b { color: var(--text); font-variant-numeric: tabular-nums; }
.calc-total .sum { margin-left: auto; display: flex; gap: 20px; align-items: baseline; }
.calc-total .unit-price b { font-size: 22px; color: var(--primary); font-variant-numeric: tabular-nums; }
.calc-total .grand b { font-size: 16px; font-variant-numeric: tabular-nums; }
.form-actions .spacer { flex: 1; }

/* メールから取り込んだときの出どころ表示 */
.from-mail {
  display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px;
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: 8px; padding: 10px 14px;
}
.from-mail .ico { font-size: 18px; }
/* 拾ってきた元データ（長いURLで枠を押し広げない） */
.prefill-src { word-break: break-all; }

/* メール本文の下の、他アプリへの受け渡し */
.preview-foot {
  border-top: 1px solid var(--border); background: var(--panel-2);
  padding: 8px 14px; display: flex; gap: 8px; flex-wrap: wrap;
}

/* 一覧の絞り込みの select（.filters input と同じ見た目） */
.filters select {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--input); color: var(--text); font: inherit;
}

.checks { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.checks .check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
.steps-checks .check { min-width: 130px; }
.fields select {
  display: block; width: 100%; margin-top: 3px; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: 4px; background: var(--input); color: var(--text); font: inherit;
}
input.mini { width: 70px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 4px;
             background: var(--input); color: var(--text); font: inherit; text-align: right; }
.btn-app { border-color: var(--primary); color: var(--primary); }
.btn-app:hover { background: #16233a; }

/* レールの区切り線（売り側のアプリと支払い側を分ける） */
.app-item-cut { border-bottom: 1px solid var(--line); }

/* ---------- 受取請求書 ---------- */
.invoice-list td.nowrap { white-space: nowrap; }
.invoice-list tr.overdue td.nowrap:first-child { color: var(--danger); font-weight: 700; }
.invoice-list .issue-cell { text-align: center; }
form.stack textarea { min-height: 120px; font-family: inherit; }

/* 受取請求書: 受け取り方と取り込みの目印 */
.head-actions { margin-left: auto; }
.page-head .head-actions + .btn { margin-left: 0; }
.method { font-size: 11px; border-radius: 10px; padding: 1px 8px; border: 1px solid var(--border); }
.method.mail { border-color: var(--ok); color: var(--ok); }
.method.link { border-color: var(--primary); color: var(--primary); }
.method.portal { border-color: var(--accent); color: var(--accent); }
/* 受け取り方の選択（取込ルール）。3つを並べて、それぞれに一言添える */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; max-width: 1000px; }
.choices .choice {
  display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer; color: var(--text); font-size: 13px;
}
.choices .choice:has(input:checked) { border-color: var(--primary); }
.choices .choice input { margin: 3px 0 0; }
.choices .choice small { display: block; color: var(--muted); font-size: 11px; line-height: 1.4; margin-top: 2px; }
.warn-dot {
  display: inline-block; width: 18px; height: 18px; line-height: 17px; text-align: center;
  border-radius: 50%; background: var(--accent); color: #0a0c0f; font-weight: 700; font-size: 12px; cursor: help;
}
.grid tr.row-off td { opacity: .45; }
/* ---------- 入力画面の「一組」（アプリ共通。`_form.html` の section マクロ） ----------
   入力欄が多い画面は、どこからどこまでが1組か分からなくなる。
   見出し＋ひとこと説明＋欄を箱に入れて、箱で区切る。見出しの左に色の棒を出して目印にする。 */
.form-section {
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2);
  padding: 12px 14px 14px; margin-top: 12px;
}
.form-section + .form-section { margin-top: 12px; }
.form-section > .sec-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; color: var(--text); margin: 0 0 3px;
}
.form-section > .sec-title::before {
  content: ""; flex: none; width: 3px; height: 14px; border-radius: 2px; background: var(--primary);
}
.form-section > .sec-hint { font-size: 11px; color: var(--muted); margin: 0 0 10px; line-height: 1.45; }
.form-section > .sec-hint:last-child { margin-bottom: 0; }
.form-section .check { margin-bottom: 6px; }
/* 設定のような1項目ずつの欄は、幅いっぱいに広げない（読みづらい） */
.form-section > label > input[type="text"], .form-section > label > input[type="email"],
.form-section > label > input[type="url"] { width: 320px; }
.form-section > label > input[type="number"] { width: 120px; }
.form-section > label > textarea { width: 320px; }
/* 設定のかたまり。パスが読める広さにする */
.stack.narrow { max-width: 760px; }
/* 入力欄とそのすぐ右の［保存］。1項目ずつ直せる設定画面用 */
.form-section .row-save { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.form-section .row-save input[type="text"], .form-section .row-save input[type="email"],
.form-section .row-save input[type="url"] { width: 320px; }
.form-section .row-save input[type="number"] { width: 110px; }
/* パス（ブラウザ・保存先）は長いので、その欄だけ広くする */
.form-section .row-save input.path { width: 560px; }
/* 同じ枠の中だが**別扱い**にしたいもの（専用ブラウザの作り直しなど）。点線で仕切る */
.form-section .sec-aside {
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border);
}
.next-steps .step-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.reset-row { display: flex; align-items: center; gap: 10px; margin-top: 26px;
              padding-top: 12px; border-top: 1px solid var(--border); }
.form-section .sec-aside > .aside-title { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }

.sub-block { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
.sub-block .muted { margin-bottom: 8px; }
.supplier-form { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }

/* 請求書: 専用ブラウザの状態表 */
table.kv { border-collapse: collapse; }
table.kv th { text-align: left; padding: 4px 16px 4px 0; color: var(--muted); font-weight: normal; vertical-align: top; white-space: nowrap; }
table.kv td { padding: 4px 0; }

/* サイト自動取得の状態 */
.recipe { font-size: 11px; border-radius: 10px; padding: 1px 8px; border: 1px solid var(--border); color: var(--muted); }
.recipe.ok { border-color: var(--ok); color: var(--ok); }
.recipe.broken { border-color: var(--danger); color: var(--danger); }
.recipe.recorded { border-color: var(--accent); color: var(--accent); }
.recipe.recording, .recipe.testing { border-color: var(--primary); color: var(--primary); }
.recipe-note { max-width: 260px; white-space: normal; margin-top: 3px; }
/* 取込ルールの設定画面の「自動化」欄は ○ か ✕ だけ。詳しい状態は title（マウスを乗せると出る）。
   請求書一覧のほうは**手を打つ行にだけボタン**が出る（済んでいる行は空） */
.auto-cell { text-align: center; white-space: nowrap; }
.auto-yes { color: var(--ok); font-weight: 700; cursor: help; }
.auto-no { color: var(--muted); cursor: help; }

/* サイト取得の進み具合 */
/* ダッシュボードの数字タイル。押すとその一覧へ飛ぶ */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px;
         max-width: 1100px; margin-bottom: 6px; }
.tile {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--line);
  border-radius: 10px; padding: 14px 16px; color: var(--text);
}
.tile:hover { background: var(--panel-2); text-decoration: none; border-color: var(--primary); }
.tile.danger { border-left-color: var(--danger); }
.tile.accent { border-left-color: var(--accent); }
.tile-num { font-size: 26px; font-weight: 700; line-height: 1.1; }
.tile-unit { font-size: 13px; font-weight: normal; color: var(--muted); margin-left: 3px; }
.tile-label { font-size: 13px; }
.tile-sub { font-size: 11px; color: var(--muted); }

.job-box { display: none; align-items: center; gap: 10px; margin-bottom: 14px;
           background: var(--panel); border: 1px solid var(--primary); border-radius: 8px; padding: 10px 14px; }
.job-box.on { display: flex; }
.job-step { font-weight: 600; }
.spinner { width: 14px; height: 14px; flex: none; border-radius: 50%;
           border: 2px solid var(--border); border-top-color: var(--primary); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.nav li.sub2 a { padding-left: 30px; }

/* 仕入先が未登録の請求書に出す案内 */
.need-supplier { display: flex; align-items: center; gap: 8px; margin-top: 6px;
                 font-size: 12px; color: var(--accent); }
.unknown-name { color: var(--accent); }
.need-supplier.unknown { color: var(--danger); }

/* 左上: 「Kurimoto Core Apps MAIL」。アプリ名のうしろに英字で今のアプリを添える */
.topbar .brand { display: flex; align-items: baseline; gap: 8px; }
.brand-app { font-size: 16px; font-weight: 600; letter-spacing: .08em; color: var(--primary); }

/* ---------- メール一覧: 選ぶ・まとめて動かす・ドラッグ ---------- */
.col-pick { flex: none; width: 28px; text-align: center; padding: 0 4px; }
.col-pick input { margin: 0; vertical-align: middle; cursor: pointer; }
.mail-head .col-pick { border-right: 1px solid var(--line); }
.mail-item.picked, .mail-item.picked:hover { background: #2a3548; }
.mail-item.picked.active { background: var(--sel); }
.mail-item[draggable="true"] .mail-link { cursor: grab; }
.pick-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--panel-2); flex: none;
}
.pick-bar[hidden] { display: none; }
.pick-bar .pick-count { font-size: 13px; }
.pick-bar select { max-width: 260px; }
/* 受取請求書の一覧: チェックした行 */
.invoice-list th.col-pick, .invoice-list td.col-pick { width: 28px; text-align: center; padding: 0 4px; }
.invoice-list tbody tr.picked td { background: #2a3548; }
/* 落とせるフォルダの目印（メールを掴んでいる間だけ） */
.sidebar li.drop-mail > a { outline: 2px solid var(--primary); outline-offset: -2px; background: var(--hover); }
.drag-ghost {
  position: fixed; top: -100px; left: -100px; padding: 4px 10px; border-radius: 6px;
  background: var(--primary); color: #0a0c0f; font-weight: 700; font-size: 13px;
}
/* 宛先「全アカウント」で欄を隠す。上の form.stack 付きの指定（display:inline-block）に負けないよう同じ強さで後ろに置く */
form.stack .cond-row input[hidden], .cond-row span[hidden] { display: none; }
form.stack .cond-row select[data-to-mode] { width: 140px; }
/* 受け取り方は「取り込む」に印が無いとグレー（app.js が付け外しする） */
label.is-off { color: var(--muted); }
label.is-off select:disabled { opacity: .5; cursor: default; }
/* チェックを横に並べる行（仕分けルールの 取り込む／既読） */
form.stack .check-row { display: flex; gap: 28px; flex-wrap: wrap; align-items: center; }
form.stack .check-row label.check { margin: 0; }
/* 仕分けルール: 箱の中の2段目の見出し（上に線）と、フォルダ→既読→取り込む の1行 */
.form-section > .sec-sub { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
form.stack .proc-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
/* プルダウンは行の 3 分の 2。箱（.panel 860px）の中で 既読・取り込む が同じ行に収まるよう、文字との間は詰める */
form.stack .proc-row .proc-folder { flex: 0 1 60%; min-width: 300px; margin: 0; display: flex; align-items: center; gap: 8px; }
form.stack .proc-row .proc-folder select { flex: 1; width: auto; margin: 0; }
form.stack .proc-row .proc-text { flex: none; white-space: nowrap; }
form.stack .proc-row label.check { margin: 0; white-space: nowrap; }
[data-invoice-source-row][hidden] { display: none; }
.rule-form.panel { max-width: 960px; }   /* 仕分け後の処理の1行が収まる幅 */
/* 仕分けルールの一覧: 行を掴んで並び替え */
.rules-table tr[draggable="true"] { cursor: grab; }
.rules-table tr.dragging { opacity: .45; }
.rules-table tr.drop-before > td { box-shadow: inset 0 2px 0 0 var(--primary); }
.rules-table tr.drop-after > td { box-shadow: inset 0 -2px 0 0 var(--primary); }
.rules-table .rule-order { white-space: nowrap; }
.rules-table .grip { color: var(--muted); letter-spacing: -2px; margin-right: 4px; }

/* 仕分けルール: 受け取り方の箱の 締め日／支払月／支払日 を横に並べる */
form.stack .terms-row { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
form.stack .terms-row label { margin: 0; }
form.stack .terms-row select { width: 120px; margin-top: 4px; }

/* 仕分けルールの一覧は 1 ルール＝1 行。長い分は「…」で切る（全文は title） */
.rules-table { table-layout: fixed; }
.rules-table th:nth-child(1) { width: 64px; }
.rules-table th:nth-child(2) { width: 18%; }
.rules-table th:nth-child(3) { width: 38%; }
.rules-table th:nth-child(5) { width: 64px; }
.rules-table th:nth-child(6) { width: 140px; }
.rules-table td { vertical-align: middle; }
.rules-table td.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 受取請求書の表: 見出しを押して並び替え */
table.grid th.sortable a { color: inherit; display: inline-block; }
table.grid th.sortable a:hover { color: var(--text); text-decoration: none; }
table.grid th.sortable.on a { color: var(--text); }
table.grid th .sort-mark { font-size: 10px; margin-left: 3px; color: var(--primary); }

/* 仕分けルール: サイトのログイン情報（受け取り方が「サイトで操作」のときだけ） */
form.stack .site-box { margin-top: 10px; }
form.stack .site-box[hidden] { display: none; }
form.stack .site-box > label > input[type=url] { width: 100%; max-width: 520px; }
form.stack .site-row { display: flex; gap: 16px; flex-wrap: wrap; }
form.stack .site-row label { margin: 0; }
form.stack .site-row input { width: 200px; }
form.stack .site-row select { width: 300px; }
form.stack .site-row label[hidden] { display: none; }

/* メール一覧の見出し: 押して並び替え */
.mail-head .sort-link { color: inherit; }
.mail-head .sort-link:hover { color: var(--text); text-decoration: none; }
.mail-head .sort-link.on { color: var(--text); }
.mail-head .sort-mark { font-size: 9px; margin-left: 3px; color: var(--primary); }

/* 受取請求書: 請求書番号の重なり */
.invoice-list td.dup-no { color: var(--danger); font-weight: 600; }
.invoice-list .dup-mark { color: var(--danger); margin-right: 4px; text-decoration: none; }
.dup-banner a { color: inherit; text-decoration: underline; margin: 0 2px; }

/* 仕分けルールの一覧: 見出しの右端で幅を変える */
.rules-table th { position: relative; }
.rules-table th .col-resize { position: absolute; top: 0; right: -4px; width: 9px; height: 100%; cursor: col-resize; z-index: 3; }
.rules-table th .col-resize::after { content: ""; position: absolute; top: 20%; bottom: 20%; left: 4px; width: 1px; background: var(--line); }
.rules-table th .col-resize:hover::after, body.dragging .rules-table th .col-resize::after { background: var(--primary); }

/* 仕分けルール: 録って再生の状態と、事務所の Chrome の待ち行列 */
.recipe-state { font-size: 12px; color: var(--muted); margin-right: 6px; white-space: nowrap; }
.recipe-state.ok { color: var(--ok); }
.recipe-state.broken { color: var(--danger); }
.recipe-state.recording, .recipe-state.testing { color: var(--accent); }
.site-jobs { margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.site-jobs-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; font-weight: 600; }
.site-jobs-table td.one-line { max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
