/* 既定: 現行ブルー。body.theme-* で切替（config.php の ui_theme） */
:root,
body.theme-blue {
    --main: #0b4f8a;
    --main-dark: #083a66;
    --main-soft: #eef4fa;
    --tag-bg: #e3eef9;
    --text: #222;
    --muted: #6b7280;
    --border: #d9dee5;
    --bg: #f4f6f9;
    --surface: #fff;
    --table-head: #f8fafc;
    --danger: #b42318;
    --success-bg: #e8f5ec;
    --error-bg: #fdecea;
}

/* ミント系（キャプチャ色 #12A3A2） */
body.theme-mint {
    --main: #12a3a2;
    --main-dark: #0d7e7d;
    --main-soft: #e6f6f6;
    --tag-bg: #d8f0ef;
    --text: #1f2a2a;
    --muted: #5f7373;
    --border: #c9dedd;
    --bg: #f3fafa;
    --surface: #fff;
    --table-head: #eef8f8;
    --danger: #b42318;
    --success-bg: #e8f5ec;
    --error-bg: #fdecea;
}

/* 白×赤（ロゴ赤 #CF1F28） */
body.theme-red {
    --main: #cf1f28;
    --main-dark: #a31820;
    --main-soft: #fceced;
    --tag-bg: #f8d9dd;
    --text: #1a1a1a;
    --muted: #6b7280;
    --border: #e5d0d3;
    --bg: #faf7f7;
    --surface: #fff;
    --table-head: #faf5f6;
    --danger: #a31820;
    --success-bg: #e8f5ec;
    --error-bg: #fdecea;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    font-size: 15px;
}

a { color: var(--main); }
code { font-family: Consolas, Menlo, monospace; font-size: 0.9em; word-break: break-all; }
h1 { font-size: 1.5rem; margin: 1.5rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 0 0 1rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 0.5rem; color: var(--main-dark); }

.inner { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.site-header { background: var(--surface); border-bottom: 3px solid var(--main); }
.site-header > .inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.brand {
    display: inline-flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: 1.1rem; color: var(--main-dark); text-decoration: none;
}
.brand-logo {
    display: block; height: 40px; width: auto; max-width: min(200px, 55vw);
}
.badge { background: var(--main); color: #fff; border-radius: 4px; padding: 1px 8px; font-size: 0.75rem; vertical-align: middle; }
.user { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }
.user form { margin: 0; }
.link-button { background: none; border: none; color: var(--main); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }

.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; padding-bottom: 0; }
.admin-nav a { padding: 8px 14px; text-decoration: none; color: var(--text); border-bottom: 3px solid transparent; margin-bottom: -3px; }
.admin-nav a.active { border-color: var(--main-dark); color: var(--main-dark); font-weight: 700; }

main { padding-bottom: 40px; }

/* 公式サイト footer.php と同じ構成。カタログダウンロードは置かない */
.l-footer {
    position: relative;
    width: 100%;
    background: #f5f5f5;
    margin-top: 24px;
}
.l-pagetop {
    position: absolute;
    right: 120px;
    top: 0;
    transform: translateY(-50%);
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: #d82122;
    text-decoration: none;
}
.l-pagetop::after {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -40%) rotate(45deg);
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    border-left: 3px solid #fff;
    border-top: 3px solid #fff;
}
.l-pagetop:hover { opacity: 0.7; }
.l-footer-inner { padding: 4% 5% 2.5%; }
.l-footer-nav-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0 auto;
}
.p-footer-copy {
    width: 100%;
    margin: 0 auto;
    text-align: center;
    font-size: 14px;
    line-height: 1.4;
    letter-spacing: 0.08em;
    font-weight: 500;
    color: #6c6c6c;
}
.p-footer-copy a { color: inherit; }
@media (max-width: 1250px) {
    .l-pagetop { right: 4%; }
}
@media (max-width: 767px) {
    .l-pagetop { right: 4%; width: 56px; height: 56px; }
}

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 24px; margin-bottom: 20px; }
.card.narrow { max-width: 480px; margin: 60px auto; }
.landing .actions { margin-top: 24px; }
.intro { margin-bottom: 20px; }
.notes { color: var(--muted); font-size: 0.9rem; padding-left: 1.2em; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.nowrap { white-space: nowrap; }

.flash { padding: 12px 16px; border-radius: 6px; margin: 16px 0; }
.flash-success { background: var(--success-bg); border: 1px solid #a6d8b5; }
.flash-error { background: var(--error-bg); border: 1px solid #f1b0aa; }
.flash-actions { margin-top: 8px; }
.preview-actions { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; }

.form label:not(.file-pick-btn) { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 12px; }
.form input[type=text], .form input[type=password], .form input[type=number], .form input[type=date], .form input[type=search], .form select, .form textarea {
    display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-weight: 400; box-sizing: border-box;
}
.form fieldset { border: 1px solid var(--border); border-radius: 6px; padding: 10px 14px; grid-column: 1 / -1; }
.form .check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin-right: 18px; }
.form.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 20px; }
.form.grid .wide { grid-column: 1 / -1; }
.form.inline, form.inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin: 0; }
.form.inline label { margin-bottom: 0; }
form.inline input[type=text] { padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px; }

.button {
    display: inline-block; padding: 8px 18px; border: 1px solid var(--main); border-radius: 6px; background: var(--surface);
    color: var(--main); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.button:hover { background: var(--main-soft); }
.button.primary { background: var(--main); color: #fff; }
.button.primary:hover { background: var(--main-dark); }
.button.danger { border-color: var(--danger); color: var(--danger); }
.button.small { padding: 3px 10px; font-size: 0.8rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.danger-zone { border-top: 1px dashed var(--border); padding-top: 16px; }

.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 8px; text-align: left; vertical-align: top; }
.table th { background: var(--table-head); white-space: nowrap; text-align: center; }
.table tr.inactive td { color: var(--muted); background: #fafafa; }
.file-table .col-status { white-space: nowrap; width: 1%; }
.file-table .col-actions { width: 280px; min-width: 260px; white-space: normal; }
.file-table .col-delete { width: 1%; text-align: right; white-space: nowrap; vertical-align: middle; }
.table tr.inactive td .button { color: var(--main); }
.table tr.inactive td .button.danger { color: var(--danger); }
.btn-file-action { min-width: 4.5em; box-sizing: border-box; text-align: center; }
.file-status { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.file-status form, .file-delete { margin: 0; }
.file-replace { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 0; }
.file-replace-pick { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; max-width: 100%; }
.file-replace-name {
    flex: 1 1 auto; min-width: 0; font-size: 0.8rem; font-weight: 400; line-height: 1.4;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
label.button.small.file-pick-btn {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    box-sizing: border-box; height: auto; padding: 3px 10px; margin: 0;
    font-size: 0.8rem; font-weight: 600; line-height: inherit;
}
.file-replace .file-pick-caption { display: block; line-height: inherit; transform: none; }
.file-row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }

.upload-form .file-pick { margin-bottom: 8px; }
.file-pick-title { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 12px; }
.file-pick-box {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
    padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--table-head);
}
.form label.file-pick-btn {
    display: inline-flex; align-items: center; justify-content: center; align-self: center;
    box-sizing: border-box; height: 40px; padding: 0 18px; margin: 0;
    line-height: 1; cursor: pointer;
}
.file-pick-caption { display: block; line-height: 1; transform: translateY(1px); }
.file-pick-input {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; opacity: 0;
}
.file-pick-name {
    flex: 1 1 200px; min-width: 0; font-weight: 400; font-size: 0.9rem; color: var(--text);
    word-break: break-all; line-height: 1.4;
}

.tag { display: inline-block; background: var(--tag-bg); color: var(--main-dark); border-radius: 4px; padding: 0 8px; font-size: 0.75rem; font-weight: 600; }
.tag.muted-tag { background: #eef0f3; color: var(--muted); }
.tag.danger { background: var(--error-bg); color: var(--danger); }

.file-group { border-top: 1px solid var(--border); padding-top: 4px; }
.file-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 10px 0; }
.file-row.old { border-top: 1px dashed var(--border); }
.file-name { font-weight: 600; word-break: break-all; }
.file-meta, .hash { color: var(--muted); font-size: 0.8rem; }
.file-note { font-size: 0.85rem; margin-top: 4px; }
details { margin: 0 0 10px; }
summary { cursor: pointer; color: var(--main); font-size: 0.9rem; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.page-head h1 { margin: 0; }
.filter-bar {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px;
    margin: 0 0 20px; padding-bottom: 4px;
}
.form.filter-bar > label {
    flex: 1 1 160px; min-width: 140px; max-width: 280px; margin: 0;
}
.form.filter-bar input,
.form.filter-bar select,
.form.filter-bar .button {
    height: 40px; box-sizing: border-box;
}
.form.filter-bar .button {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 18px; margin: 0; line-height: 1;
}
.filter-bar .filter-actions {
    display: flex; gap: 8px; align-items: center; align-self: flex-end; flex: 0 0 auto; margin: 0;
}
.form.grid:has(> .field-submit) input {
    height: 40px; box-sizing: border-box;
}
.form.grid > .field-submit {
    align-self: end; margin-bottom: 12px;
}
.form.grid > .field-submit .button {
    display: inline-flex; align-items: center; justify-content: center;
    height: 40px; padding: 0 18px; margin: 0; line-height: 1;
}
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pager a, .pager-current {
    min-width: 2rem; text-align: center; padding: 6px 10px; border-radius: 6px; text-decoration: none;
    color: var(--main); font-weight: 600; border: 1px solid transparent;
}
.pager a:hover { background: var(--main-soft); border-color: var(--border); }.pager-current { background: var(--main); color: #fff; }
.pager-nav { min-width: auto; padding-left: 12px; padding-right: 12px; }

@media (max-width: 640px) {
    .file-row { flex-direction: column; align-items: stretch; }
    .table { display: block; overflow-x: auto; }
}

