:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1d2330;
  --muted: #687384;
  --line: #e2e6ec;
  --primary: #1f5fbf;
  --primary-dark: #174a96;
  --green: #1e8a4c;
  --red: #c0392b;
  --amber: #a86400;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 15px; line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; }

/* ヘッダー */
.topbar { background: #16233a; color: #fff; }
.topbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.topbar .brand { color: #fff; font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; gap: 10px; }
.topbar .brand:hover { text-decoration: none; }
.topbar .logo { height: 36px; width: auto; background: #fff; border-radius: 6px; padding: 3px 6px; display: block; }
.topbar .company { color: #fff; font-size: 14px; font-weight: 600; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.3); }
.topbar .brand .company { border-left: none; padding-left: 0; font-size: 16px; font-weight: 700; }
.topbar .sub { color: #b9c4d6; font-size: 13px; }
.topbar .demo { background: #f0b429; color: #16233a; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 4px; }
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.topbar nav a { color: #d6deea; font-size: 14px; }
.topbar nav a.btn { color: #fff; }
.topbar .me { color: #c9d3e2; font-size: 13px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.3); }
.topbar .me b { color: #fff; font-weight: 600; margin-right: 2px; }

h1 { font-size: 22px; margin: 0 0 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 16px; margin: 0 0 12px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.title-row h1 { margin-bottom: 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card.narrow { max-width: 460px; margin: 32px auto 16px; }
.card.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.table-card { padding: 0; overflow-x: auto; }
.table-card h2 { padding: 16px 20px 0; }
.table-card > p { padding: 0 20px 16px; margin: 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }

/* フォーム */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
label .req, label .opt { font-weight: 400; font-size: 11px; margin-left: 6px; padding: 1px 6px; border-radius: 4px; }
label .req { background: #fde8e6; color: var(--red); }
label .opt { color: var(--muted); }
label.check { font-weight: 400; display: flex; gap: 8px; align-items: center; }
input:not([type=checkbox]):not([type=file]), select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 9px 12px; font: inherit; font-weight: 400;
  border: 1px solid #cbd2dc; border-radius: 8px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31,95,191,.25); border-color: var(--primary); }
input[readonly], textarea[readonly] { background: #f7f9fb; }
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

.drop { position: relative; border: 2px dashed #b8c3d3; border-radius: var(--radius); padding: 24px; text-align: center; margin: -6px 0 16px; background: #fafbfd; transition: .15s; }
.drop.over { border-color: var(--primary); background: #eef4fd; }
.drop.has-files { text-align: left; }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop-msg { color: var(--muted); }
.file-list { margin: 8px 0 0; padding-left: 20px; font-size: 14px; }
.file-list:empty { display: none; }

.btn {
  display: inline-block; padding: 9px 18px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid #cbd2dc; border-radius: 8px; background: #fff; color: var(--text); text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f1f4f8; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: #fdf0ee; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; padding: 11px; }
.btn:disabled { opacity: .6; cursor: default; }
.actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash-ok { background: #e7f5ec; color: #145c33; border: 1px solid #bfe3cc; }
.flash-err { background: #fdeceb; color: #8f2219; border: 1px solid #f3c4bf; }
.flash-warn { background: #fff5e0; color: #7a4a00; border: 1px solid #f1d9a4; font-weight: 600; }

/* 絞り込み */
.filters { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filters input, .filters select { margin-top: 0 !important; width: auto !important; }
.filters input { flex: 1; min-width: 220px; }

/* 一覧表 */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: none; }
table.list:not(.static) tbody tr { cursor: pointer; }
table.list:not(.static) tbody tr:hover { background: #f3f7fd; }
table.list .num { text-align: right; }
table.list td.what { max-width: 320px; }
table.list tr.inactive td { color: var(--muted); }
td.ops { white-space: nowrap; }
form.inline { display: inline; }

.status { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.st-green { background: #e3f4ea; color: var(--green); }
.st-gray { background: #eceff3; color: var(--muted); }
.st-red { background: #fdeceb; color: var(--red); }

/* 詳細 */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 14px; font-size: 14px; }
.kv .k { color: var(--muted); }
.copyrow { display: flex; gap: 8px; align-items: center; }
.copyrow input { margin-top: 0 !important; }
.mono.big { font-size: 18px; letter-spacing: 1px; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.stats div { background: #f7f9fb; border-radius: 8px; padding: 12px; text-align: center; }
.stats b { display: block; font-size: 26px; line-height: 1.2; }
.stats b.warn { color: var(--amber); }
.stats span { font-size: 12px; color: var(--muted); }
.detail-grid .card { margin-bottom: 16px; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 16px; border: 1px solid #f3c4bf; background: #fff; border-radius: var(--radius); padding: 16px 20px; flex-wrap: wrap; }
.mail-head { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 8px; }
.mail-head .btn { margin-left: auto; }
.badge { background: #16233a; color: #fff; font-size: 11px; padding: 1px 8px; border-radius: 4px; }
.mail-head + textarea { font-size: 13px; margin-top: 0; }

/* お客様画面 */
.dl-list { list-style: none; padding: 0; margin: 16px 0 0; }
.dl-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.dl-list li b { word-break: break-all; }

.drop.error { border-color: var(--red); background: #fdf3f2; }
.field-err { color: var(--red); font-size: 13px; font-weight: 600; margin: -8px 0 14px; }
.progress { margin: 0 0 16px; }
.progress .bar { height: 10px; background: #e6eaf0; border-radius: 99px; overflow: hidden; }
.progress .bar span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.progress .muted { margin-top: 6px; }

/* メニュー（今いる画面を強調） */
.topbar .tabs { display: flex; gap: 4px; }
.topbar nav a.tab { color: #c9d3e2; padding: 7px 14px; border-radius: 8px; font-weight: 600; }
.topbar nav a.tab:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.topbar nav a.tab.active { background: #fff; color: #16233a; }

/* メール送信 */
.st-amber { background: #fff3dc; color: var(--amber); }
.mail-subject { margin: 0 0 8px !important; font-weight: 600; }
.inline-select { width: auto !important; margin: 0 0 0 auto !important; padding: 4px 8px !important; font-size: 13px; }
.send-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 20px; }
.send-bar label.check { margin: 0; }
.btn-lg { padding: 12px 28px; font-size: 15px; }

.ok-mark { color: var(--green); font-weight: 600; }

/* 2段階認証 */
.card.wide-narrow { max-width: 560px; }
.code-input { font-size: 28px !important; letter-spacing: 8px; text-align: center; font-family: ui-monospace, Consolas, monospace; margin: 8px 0 14px !important; }
.setup-steps { padding-left: 22px; margin: 0 0 16px; }
.setup-steps > li { margin-bottom: 18px; }
.qr-box { margin: 12px 0 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; text-align: center; background: #fff; }
.qr-box #qr svg { display: block; margin: 0 auto 8px; }
.qr-box details { text-align: left; }
code.secret { display: block; font-size: 16px; letter-spacing: 1px; background: #f4f6f9; padding: 8px 10px; border-radius: 6px; word-break: break-all; }
.code-form { margin-top: 8px; }


/* 同じファイルを別の人にも送る */
.resend-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border: 1px solid #c7d7f2; background: #f3f7fd; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px; }
.resend-files { margin: -6px 0 16px; padding: 10px 14px 10px 32px; background: #f7f9fb; border-radius: 8px; }
.resend-files li { margin: 2px 0; }
.tpl-note { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); background: #f7f9fb; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }
