:root {
  --bg: #f5f6f8; --surface: #fff; --text: #1f2328; --muted: #6a737d; --border: #dde1e6;
  --primary: #2563eb; --primary-hover: #1d4ed8; --danger: #dc2626; --ok: #16a34a; --warn: #d97706;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1115; --surface: #181b21; --text: #e6e8eb; --muted: #9aa3ad; --border: #2c313a; --primary: #3b82f6; --primary-hover: #60a5fa; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.7 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .4em 0; }
h2 { font-size: 1.15rem; margin: 1.2em 0 .5em; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 12px; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 1.2rem; color: var(--text); }
.nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
main.container { padding-top: 20px; padding-bottom: 40px; min-height: 70vh; }
.site-footer { border-top: 1px solid var(--border); padding: 20px 0; color: var(--muted); font-size: .85rem; text-align: center; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.card > h2:first-child { margin-top: 0; }
.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.inline { display: inline; }
ul.plain { margin: 0; padding-left: 1.2em; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.span-3 { grid-column: 1 / -1; }

.btn { display: inline-block; background: var(--primary); color: #fff; border: 1px solid var(--primary); border-radius: 6px; padding: 8px 16px; font: inherit; cursor: pointer; line-height: 1.4; text-align: center; }
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-sm { padding: 3px 10px; font-size: .85rem; }
.btn-lg { padding: 11px 26px; font-size: 1.05rem; }
.btn-block { display: block; width: 100%; }
.btn-outline { background: transparent; color: var(--primary); }
.btn-outline:hover { background: rgba(37, 99, 235, .08); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
button.link { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; padding: 0; }

.form label { display: block; margin-bottom: 14px; font-weight: 600; font-size: .92rem; }
.form label.check { font-weight: normal; }
.form small { display: block; color: var(--muted); font-weight: normal; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); font: inherit; font-weight: normal;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.form textarea, .form select { margin-bottom: 10px; }
.form-actions { margin-top: 20px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { width: auto; flex: 1 1 180px; margin: 0; }
.inline-form.compact input { flex: 0 0 90px; padding: 3px 6px; }
.input-prefix { display: flex; align-items: stretch; margin-top: 4px; }
.input-prefix span { padding: 8px 10px; background: var(--border); border-radius: 6px 0 0 6px; font-weight: normal; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.input-prefix input { margin: 0; border-radius: 0 6px 6px 0; }
.pw-field { border: 1px solid var(--border); border-radius: 6px; padding: 10px 14px 14px; margin: 0 0 14px; }
.pw-field legend { font-weight: 600; padding: 0 4px; }
.pw-field select { margin-bottom: 8px; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; border: 1px solid; }
.alert-success { background: rgba(22, 163, 74, .1); border-color: rgba(22, 163, 74, .4); }
.alert-error { background: rgba(220, 38, 38, .1); border-color: rgba(220, 38, 38, .4); }
.badge { display: inline-block; font-size: .75rem; padding: 0 7px; border-radius: 10px; background: var(--border); margin-right: 3px; white-space: nowrap; }
.badge-ok { background: rgba(22, 163, 74, .18); color: var(--ok); }
.badge-danger { background: rgba(220, 38, 38, .18); color: var(--danger); }

.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; font-size: .92rem; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { background: var(--bg); font-weight: 600; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table .actions { white-space: nowrap; }
.table .actions > * { margin-right: 6px; }
@media (max-width: 720px) {
  .table { display: block; overflow-x: auto; }
}

.thumb-sm { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; vertical-align: middle; margin-right: 6px; }
.thumb-lg { max-width: 100%; max-height: 360px; border-radius: 6px; border: 1px solid var(--border); }

.hero { text-align: center; padding: 30px 0 10px; }
.hero h1 { font-size: 2rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 20px 0 30px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.feature h3 { margin: 0 0 6px; font-size: 1rem; }
.feature p { margin: 0; color: var(--muted); font-size: .9rem; }

.dropzone { position: relative; border: 2px dashed var(--border); border-radius: var(--radius); padding: 24px; text-align: center; margin-bottom: 14px; transition: border-color .15s, background .15s; }
.dropzone.dragover { border-color: var(--primary); background: rgba(37, 99, 235, .06); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dropzone p { margin: 4px 0; }
.file-list { list-style: none; padding: 0; margin: 10px 0 0; text-align: left; font-size: .9rem; }
.file-list li { padding: 3px 0; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; }
.file-list li.bad { color: var(--danger); }
.progress { position: relative; height: 22px; background: var(--border); border-radius: 11px; overflow: hidden; margin-bottom: 12px; }
.progress-bar { height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.progress span { position: absolute; inset: 0; text-align: center; font-size: .8rem; line-height: 22px; }

.search { display: flex; gap: 8px; margin: 10px 0 14px; }
.search input { margin: 0; flex: 1; }
.pager { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin: 16px 0; }
.pager a, .pager span { padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); }
.pager .current { background: var(--primary); color: #fff; border-color: var(--primary); }

.meter { height: 12px; background: var(--border); border-radius: 6px; overflow: hidden; }
.meter-bar { height: 100%; width: 0; background: var(--ok); }
.meter-bar.warn { background: var(--danger); }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 16px 0; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.meta input { margin: 0; }
.breadcrumb { margin: 0 0 8px; }
.description { white-space: normal; }
.danger-zone { border-color: rgba(220, 38, 38, .4); }
.error-code { font-size: 3rem; margin: 0; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 6px 14px; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; }
.tabs a:hover { background: var(--surface); border-color: var(--border); text-decoration: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; color: var(--muted); font-size: .85rem; }
.stat span { display: block; font-size: 1.4rem; font-weight: 700; color: var(--text); }
.stat-warn span { color: var(--danger); }
.prose ul { padding-left: 1.4em; }
[hidden] { display: none !important; }
.btn-ourt { background: #111827; border-color: #111827; }
.btn-ourt:hover { background: #374151; }
@media (prefers-color-scheme: dark) { .btn-ourt { background: #f3f4f6; border-color: #f3f4f6; color: #111827; } .btn-ourt:hover { background: #d1d5db; } }
.avatar { display: inline-block; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; vertical-align: middle; flex: none; }
.avatar-sm { width: 24px; height: 24px; font-size: .75rem; margin-right: 6px; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.8rem; }
.avatar-initial { background: var(--primary); color: #fff; text-align: center; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.nav-user, .owner-line { display: inline-flex; align-items: center; }
.account-card { display: grid; grid-template-columns: max-content 1fr; gap: 0 20px; align-items: start; }
.account-card > p { grid-column: 1 / -1; }
