/* Admin UI for the dashboard and CRUD pages. Lightweight shared styling. */
:root {
    --admin-blue: #0c447c;
    --admin-blue-soft: #e8f1fb;
    --admin-bg: #f4f6f9;
    --admin-surface: #ffffff;
    --admin-border: #d7e0ea;
    --admin-text: #17202a;
    --admin-muted: #6b7b8b;
    --admin-shadow: 0 10px 30px rgba(19, 41, 63, 0.08);
    --admin-radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.admin-page {
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--admin-text);
    background: linear-gradient(180deg, #f8fafc 0%, var(--admin-bg) 100%);
}

a { color: #185fa5; text-decoration: none; }
a:hover { text-decoration: none; }

.admin-topbar {
    --header-bg-start: var(--admin-blue);
    --header-bg-end: #124f8f;
    --header-subtext-color: #c6dcf3;
    --header-button-border: rgba(255, 255, 255, 0.35);
}

.layout,
.admin-layout {
    display: flex;
    min-height: calc(100vh - 64px);
}

.sidebar,
.admin-sidebar {
    width: 196px;
    padding: 14px 0;
    background: var(--admin-surface);
    border-right: 1px solid var(--admin-border);
    flex-shrink: 0;
}

.nav-section,
.sidebar-group {
    font-size: 10px;
    font-weight: 700;
    color: #8b98a7;
    padding: 12px 18px 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.nav-item,
.nav {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 500;
    color: #5b6674;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: background-color 0.12s, color 0.12s, border-color 0.12s;
    text-decoration: none;
}

a.nav-item,
a.nav-item:visited {
    color: #5b6674;
}

.nav-icon,
.sidebar-mobile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    color: currentColor;
    opacity: 0.9;
    border-radius: 5px;
    background: #f2f4f7;
    border: 1px solid #d4dbe3;
}

.nav-icon svg,
.sidebar-mobile-icon svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-icon svg,
.sidebar-mobile-icon svg {
    width: 13px;
    height: 13px;
}

.nav-count,
.nav .count {
    margin-left: auto;
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #e6f1fb;
    color: #0c447c;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
}

.sidebar-mobile-nav {
    display: none;
}

.sidebar-switcher {
    display: none;
    padding: 10px 16px 12px;
}

.sidebar-switcher-label {
    display: block;
    margin: 0 0 6px;
    color: #8b98a7;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sidebar-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    background: #fff;
    color: var(--admin-text);
    font: inherit;
    outline: none;
}

.nav-item:hover,
.nav:hover {
    background: var(--admin-blue-soft);
    color: var(--admin-blue);
    border-left-color: var(--surface-nav-hover-border);
    text-decoration: none;
}

.nav-item.active,
.nav.active {
    background: #e6f1fb;
    color: var(--surface-nav-active-border);
    border-left-color: var(--surface-nav-active-border);
    text-decoration: none;
}

.content-area,
.admin-main {
    flex: 1;
    padding: 24px 32px 24px 50px;
    overflow: auto;
}

.admin-main > .page-head,
.admin-main > .stats,
.admin-main > .card,
.admin-main > .pw-settings,
.admin-main > .pw-success,
.admin-main > .pw-err,
.admin-main > .alert,
.admin-main > .view-mode-toolbar,
.admin-main > .list-view-wrap,
.admin-main > .editor-topbar-standalone,
.admin-main > .content-hero,
.admin-main > .content-thumb {
    width: min(960px, 100%);
    margin-left: 0;
    margin-right: auto;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* gap: 16px; */
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.page-head > * {
    min-width: 0;
}

h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.25;
}

.card {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    box-shadow: var(--admin-shadow);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat {
    padding: 20px 22px;
}

.stat-link {
    display: block;
    color: inherit;
    text-decoration: none;
    box-shadow: none;
    transition: border-color 0.12s ease;
}

.stat-link:hover {
    border-color: var(--surface-nav-hover-border);
    text-decoration: none;
}

.stat-link:focus-visible {
    outline: 2px solid var(--surface-nav-active-border);
    outline-offset: 2px;
}

.stat-label {
    color: var(--admin-muted);
    font-size: 13px;
}

.stat-value {
    display: block;
    margin-top: 8px;
    font-size: 34px;
    font-weight: 800;
    color: var(--admin-text);
}

.stat-unit {
    color: var(--admin-muted);
    font-size: 13px;
}

.preview-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.admin-preview-modal[hidden] {
    display: none;
}

.admin-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.admin-preview-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 24, 45, 0.52);
}

.admin-preview-modal-panel {
    position: relative;
    width: min(1120px, calc(100vw - 32px));
    height: min(86vh, 860px);
    margin: 7vh auto 0;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 28px 60px rgba(8, 24, 45, 0.28);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.admin-preview-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--admin-border);
    background: #f8fafc;
}

.admin-preview-modal-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--admin-text);
    min-width: 0;
}

.admin-preview-modal-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-preview-iframe {
    flex: 1 1 auto;
    width: 100%;
    border: 0;
    background: #fff;
}

.section-card {
    overflow: hidden;
    border-radius: 14px;
}

.section-card table {
    width: 100%;
}

.responsive-table-card {
    overflow: hidden;
    border-radius: 14px;
}

.responsive-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.section-card .section-title {
    padding: 18px 20px 14px;
    border-bottom: 1px solid #e7edf4;
    font-size: 14px;
    font-weight: 800;
    color: var(--admin-text);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th, td {
    padding: 12px 14px;
    border-bottom: 1px solid #edf1f5;
    text-align: left;
    vertical-align: top;
}

th {
    font-size: 12px;
    color: #6e7d8d;
    background: #f9fbfd;
    font-weight: 700;
    letter-spacing: 0.02em;
}

tr:last-child td { border-bottom: 0; }

.responsive-table thead th:first-child,
table thead th:first-child {
    padding-left: 20px;
}

.responsive-table thead th:last-child,
table thead th:last-child {
    padding-right: 20px;
}

.responsive-table .cell-title,
.responsive-table .cell-section,
.responsive-table .cell-type,
.responsive-table .cell-date,
.responsive-table .cell-status,
.responsive-table .cell-count,
.responsive-table .cell-actions {
    min-width: 0;
}

.responsive-table td,
table td {
    font-size: 13px;
    color: var(--admin-text);
}

.responsive-table .cell-index {
    display: inline-block;
    min-width: 1.6em;
    margin-right: 6px;
    color: var(--admin-muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.responsive-table .cell-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.55;
}

.responsive-table .cell-section,
.responsive-table .cell-type,
.responsive-table .cell-date,
.responsive-table .cell-status,
.responsive-table .cell-count {
    color: var(--admin-muted);
    font-size: 12px;
}

.responsive-table a {
    color: #185fa5;
    font-weight: 700;
}

.responsive-table .badge {
    font-size: 11px;
    padding: 3px 8px;
}

.responsive-table .actions {
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
}

.responsive-table .actions .btn,
.responsive-table .actions button {
    padding: 7px 11px;
    border-radius: 9px;
    font-size: 12px;
    white-space: nowrap;
}

.responsive-table .actions form {
    margin: 0;
    display: inline-flex;
    flex: 0 0 auto;
}

.responsive-table tr {
    transition: background-color 0.12s ease;
}

.responsive-table tr:hover td {
    background: #fafcff;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e6f1fb;
    color: #0c447c;
    font-size: 12px;
    font-weight: 700;
}

.badge.training { background: #e6f1fb; color: #0c447c; }
.badge.download { background: #f7eddc; color: #9b5f00; }
.badge.notice { background: #edf7e2; color: #4f7f17; }
.badge.pub { background: #edf7e2; color: #4f7f17; }
.badge.draft { background: #f4f6f9; color: #6b7b8b; }
.badge.new { background: #e6f1fb; color: #1a66b8; }
.badge.campaign { background: #fff3dd; color: #b27418; }
.badge.update { background: #e8f4dd; color: #5a8c21; }

.muted { color: var(--admin-muted); }

.btn, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    border: 1px solid #185fa5;
    border-radius: 10px;
    background: #185fa5;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    border: 1px solid #185fa5;
    border-radius: 10px;
    background: #185fa5;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover, button:hover { background: #0c447c; text-decoration: none; }
.btn-primary:hover { background: #0c447c; text-decoration: none; }
.btn.secondary, button.secondary { background: #fff; color: #185fa5; }
.btn.secondary:hover, button.secondary:hover {
    background: #eef2f6;
    border-color: #c4ccd6;
    color: #27415f;
}
.btn.danger, button.danger { border-color: #b93434; background: #b93434; }
.btn.danger:hover, button.danger:hover {
    background: #c94b4b;
    border-color: #c94b4b;
    color: #fff;
}

.btn.mini, button.mini {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 7px;
}

/* ── Icon-only action buttons (admin list rows) ── */
/* Square buttons used for 編集 / 複製 / 削除 with an SVG icon inside.
   The trailing rules override the .responsive-table / .admin-block-card-footer
   padding rules that target generic .btn/button by name. */
.icon-action,
.responsive-table .actions .icon-action,
.responsive-table .actions button.icon-action,
.responsive-table .actions .btn.icon-action,
.admin-block-card-footer .icon-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.icon-action.mini,
.admin-block-card-footer .icon-action.mini {
    width: 28px;
    height: 28px;
}
.icon-action svg {
    width: 16px;
    height: 16px;
    display: block;
}
.icon-action.mini svg {
    width: 14px;
    height: 14px;
}

/* ブロック表示の編集（鉛筆）アイコンは細い線2本のため、14pxサイズだと
   コピー/削除より視覚的に薄く見える。mini時のみストロークを少し太くする。 */
.admin-block-card-footer .icon-action.mini[aria-label="編集"] svg {
    stroke-width: 2.5;
}

/* CSS tooltip for hover/focus on elements with [data-tooltip]. */
[data-tooltip] {
    position: relative;
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: #1f2a37;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 30;
}
[data-tooltip]:hover::before,
[data-tooltip]:focus-visible::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #1f2a37;
    pointer-events: none;
    z-index: 30;
}

/* ── List view-mode toggle (admin list pages) ── */
.view-mode-toolbar {
    display: flex;
    justify-content: flex-start;
    margin: -4px 0 12px;
}

.view-mode-toggle {
    display: inline-flex;
    align-items: center;
    background: #eef2f6;
    border: 1px solid var(--admin-border);
    border-radius: 9px;
    padding: 2px;
}

.view-mode-btn {
    padding: 5px 12px;
    border: 0;
    background: transparent;
    color: var(--admin-muted);
    font-size: 12px;
    font-weight: 700;
    border-radius: 7px;
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s;
}

.view-mode-btn:hover {
    color: var(--admin-text);
    background: transparent;
}

.view-mode-btn.is-active {
    background: var(--admin-surface);
    color: var(--admin-blue);
    box-shadow: 0 1px 2px rgba(8, 24, 45, 0.08);
}

.list-view-wrap[data-view-mode="table"] .list-view-block { display: none; }
.list-view-wrap[data-view-mode="block"] .list-view-table { display: none; }

.empty-block {
    padding: 32px 24px;
    text-align: center;
    color: var(--admin-muted);
}

/* ── Admin block grid (mirrors portal home cards) ── */
.admin-block-card-wrap {
    padding: 16px 18px;
}

/* Type-filter tabs at the top of the block panel — mirrors portal .tabs */
.admin-block-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
    padding: 2px;
    width: fit-content;
    border-radius: 10px;
    background: #f3f5f8;
}

.admin-block-tabs .tab {
    border: 0;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 8px;
    background: transparent;
    color: #58697d;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.admin-block-tabs .tab.is-active {
    background: #3f63a8;
    color: #fff;
}

.admin-block-tabs .tab:not(.is-active):hover {
    background: #e1e4ea;
    color: #394552;
}

.admin-block-card.is-hidden {
    display: none;
}

/* ── Reorder handle (table right edge / block top-left corner) ── */
.reorder-handle {
    appearance: none;
    background: transparent;
    border: 0;
    padding: 4px 6px;
    color: var(--admin-muted);
    font-size: 16px;
    line-height: 1;
    cursor: grab;
    border-radius: 6px;
    transition: background-color 0.12s, color 0.12s;
}

.reorder-handle:hover {
    background: #eef2f6;
    color: var(--admin-text);
}

.reorder-handle:active {
    cursor: grabbing;
}

.cell-reorder {
    width: 36px;
    text-align: center;
}

.responsive-table .cell-reorder {
    padding-left: 4px;
    padding-right: 6px;
}

.reorder-handle-block {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 3;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 2px 4px rgba(8, 24, 45, 0.1);
}

.admin-block-card {
    position: relative;
}

[data-reorder-id].is-reordering {
    opacity: 0.4;
}

.responsive-table tr.is-reordering td {
    background: #f5f8fc;
}

[data-reorder-container].is-reordering-active {
    cursor: grabbing;
}

/* ── HERO content section (above article title) ───────────────────── */
.content-hero {
    margin-bottom: 9px;
    padding: 16px 18px 18px;
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    box-shadow: var(--admin-shadow);
}

.content-hero[hidden] {
    display: none;
}

.content-hero-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.content-hero-header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 0;
}

.content-hero-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
    /* When the header wraps on narrow viewports, push the actions to the
       right edge instead of letting them fall to the start of the new line.
       Matches the .content-thumb-header-actions placement. */
    margin-left: auto;
    justify-content: flex-end;
}

.content-hero-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    background: #fff;
    border: 1px solid #d6dde7;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.content-hero-action-btn:hover {
    background: #f4f6f9;
    border-color: #b6c1cf;
}

.content-hero-action-btn-danger {
    color: #b42318;
    border-color: #f3c7c1;
}

.content-hero-action-btn-danger:hover {
    background: #fef2f1;
    border-color: #e58a82;
}

.content-hero-delete-form {
    margin: 0;
    display: inline;
}

.content-hero-pdf-download-only {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: #f4f6f9;
    border: 1px dashed #c5cfdc;
    border-radius: 12px;
    color: #475569;
    font-size: 13px;
}

.content-hero-pdf-download-only-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #e5e9f0;
    font-size: 18px;
    color: #64748b;
    flex-shrink: 0;
}

.hero-pdf-modal .editor-image-modal-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.hero-pdf-modal .editor-image-modal-option input[type="radio"] {
    accent-color: #2563eb;
    margin: 0;
}

body.hero-pdf-modal-open {
    overflow: hidden;
}

/* Scroll-to-top button — admin theme (mirrors portal). */
.admin-scroll-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 40;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid #d5dde8;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--admin-text, #1f2937);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    cursor: pointer;
}

.admin-scroll-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.admin-scroll-top:hover {
    border-color: #3f63a8;
    background: #f5f9ff;
}

.admin-scroll-top .scroll-top-icon {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #e6f0ff;
    color: #3f63a8;
    font-size: 14px;
    line-height: 1;
    font-weight: 800;
}

.admin-scroll-top .scroll-top-text {
    font-size: 12px;
    font-weight: 700;
}

@media (max-width: 720px) {
    .admin-scroll-top {
        right: 12px;
        bottom: 12px;
        padding: 9px 12px;
    }
    .admin-scroll-top .scroll-top-text {
        font-size: 11px;
    }
}

/* HERO collapse toggle */
.content-hero-collapse-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: #fff;
    border: 1px solid #d6dde7;
    border-radius: 8px;
    color: #475569;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s, transform 0.2s ease;
}

.content-hero-collapse-toggle:hover {
    background: #f4f6f9;
    border-color: #b6c1cf;
}

.content-hero.is-collapsed .content-hero-collapse-toggle,
.content-thumb.is-collapsed .content-hero-collapse-toggle {
    transform: rotate(-90deg);
}

.content-hero.is-collapsed .content-hero-preview,
.content-hero.is-collapsed .content-hero-uploader,
.content-hero.is-collapsed .content-hero-placeholder {
    display: none;
}

.content-hero-hint-collapsed {
    display: none;
    color: #94a3b8;
    font-style: italic;
}

.content-hero.is-collapsed .content-hero-hint-default {
    display: none;
}

.content-hero.is-collapsed .content-hero-hint-collapsed {
    display: inline;
}

.content-hero.is-collapsed {
    padding-bottom: 14px;
}

.content-hero.is-collapsed .content-hero-header {
    margin-bottom: 0;
}

/* Thumbnail section */
.content-thumb {
    margin-bottom: 9px;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid #e6edf4;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.content-thumb-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.content-thumb-header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 0;
}

.content-thumb-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
    /* HERO側の .content-hero-header-actions と同じ挙動。
       ヘッダーが折り返しても右端に張り付ける。 */
    margin-left: auto;
    justify-content: flex-end;
}

.content-thumb-eyebrow {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--admin-muted);
}

.content-thumb-hint {
    font-size: 12px;
    color: var(--admin-muted);
}

.content-thumb-hint-collapsed {
    display: none;
    color: #94a3b8;
    font-style: italic;
}

.content-thumb.is-collapsed .content-thumb-hint-default {
    display: none;
}

.content-thumb.is-collapsed .content-thumb-hint-collapsed {
    display: inline;
}

.content-thumb.is-collapsed .content-thumb-body,
.content-thumb.is-collapsed .content-thumb-empty {
    display: none;
}

.content-thumb-empty {
    padding: 18px;
    background: #f4f6f9;
    border: 1px dashed #c5cfdc;
    border-radius: 10px;
    color: #6b7b8b;
    font-size: 13px;
    text-align: center;
}

.content-thumb-body {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 18px;
    align-items: start;
}

.content-thumb-preview-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.content-thumb-preview {
    /* ポータルの一覧カードの実表示サイズ（203×100, アスペクト比 2.03:1）に合わせる。
       実カードは grid-template-columns: minmax(185px, 1fr) で広がるが、
       実環境での描画幅 ≒ 203px なのでそれを基準に揃える。
       レスポンシブで横幅が変わっても aspect-ratio で高さが追従し、比率が崩れない。 */
    --thumb-focus-x: 50%;
    --thumb-focus-y: 50%;
    --thumb-zoom: 1;
    width: 203px;
    aspect-ratio: 203 / 100;
    border-radius: 10px;
    border: 1px solid #e2e8ef;
    background: #f4f6f9;
    overflow: hidden;
    cursor: grab;
    user-select: none;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.content-thumb-preview.is-dragging {
    cursor: grabbing;
}

.content-thumb-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--thumb-focus-x) var(--thumb-focus-y);
    transform: scale(var(--thumb-zoom));
    transform-origin: var(--thumb-focus-x) var(--thumb-focus-y);
    display: block;
    pointer-events: none;
}

.content-thumb-focus-tools {
    width: 203px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.content-thumb-focus-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-thumb-focus-label {
    font-size: 11px;
    color: var(--admin-muted);
    font-weight: 700;
    flex: 0 0 auto;
}

.content-thumb-zoom-slider {
    flex: 1 1 auto;
    min-width: 0;
}

.content-thumb-focus-hint {
    margin: 0;
    font-size: 10px;
    color: var(--admin-muted);
    line-height: 1.4;
}

.content-thumb-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #94a3b8;
}

.content-thumb-preview-empty-icon {
    font-size: 28px;
}

.content-thumb-preview-empty-text {
    font-size: 11px;
    font-weight: 700;
}

.content-thumb-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.content-thumb-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.content-thumb-option {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 8px 10px;
    align-items: start;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #d6dde7;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s, border-color 0.15s;
}

.content-thumb-option:hover:not(.is-disabled) {
    background: #f5f8fc;
}

.content-thumb-option.is-active {
    background: #eaf2ff;
    border-color: #8fb6e4;
}

.content-thumb-option.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.content-thumb-option input[type="radio"] {
    margin: 2px 0 0 0;
    accent-color: #2563eb;
    grid-row: 1 / span 2;
}

.content-thumb-option-title {
    font-weight: 700;
    color: var(--admin-text);
}

.content-thumb-option.is-active .content-thumb-option-title {
    color: #185fa5;
}

.content-thumb-option-note {
    grid-column: 2;
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.4;
}

.content-thumb-regen-form {
    grid-column: 2;
    margin: 6px 0 0;
}

.content-thumb-regen-form .mini {
    font-size: 11px;
    padding: 4px 10px;
}

.content-thumb-custom {
    margin: 0;
}

.content-thumb-custom-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 22px 16px;
    border: 1.5px dashed #c5cfdc;
    border-radius: 10px;
    background: #fafbfd;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.content-thumb-custom-drop:hover {
    border-color: #8fb6e4;
    background: #f0f6ff;
}

.content-thumb-custom-drop input[type="file"] {
    display: none;
}

.content-thumb-custom-icon {
    font-size: 22px;
    color: #6b7b8b;
}

.content-thumb-custom-prompt {
    font-size: 12px;
    color: var(--admin-muted);
    font-weight: 600;
}

.content-thumb.is-uploading .content-thumb-custom-drop {
    pointer-events: none;
    opacity: 0.6;
}

.content-thumb.is-uploading .content-thumb-custom-prompt {
    color: #2563eb;
    font-weight: 700;
}

@media (max-width: 640px) {
    .content-thumb-body {
        grid-template-columns: 1fr;
    }
    .content-thumb-preview {
        width: 100%;
        max-width: 280px;
    }
}

.content-hero-eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    /* color: var(--admin-blue); */
    color: var(--admin-muted);
    text-transform: uppercase;
}

.content-hero-hint {
    font-size: 12px;
    color: var(--admin-muted);
}

.content-hero-placeholder {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 18px;
    border: 1px dashed #c9d3e0;
    border-radius: 12px;
    background: #f8fafc;
    color: var(--admin-muted);
}

.content-hero-placeholder-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #eef2f6;
    color: var(--admin-blue);
    display: grid;
    place-items: center;
    font-size: 22px;
    font-weight: 700;
    flex-shrink: 0;
}

.content-hero-placeholder-text {
    font-size: 13px;
    font-weight: 600;
}

/* Uploader — when content exists but no hero yet */
.content-hero-uploader {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.content-hero-uploader-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 36px 22px;
    border: 2px dashed #c9d3e0;
    border-radius: 14px;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.12s, background-color 0.12s;
}

.content-hero-uploader-drop:hover {
    border-color: var(--admin-blue);
    background: #eef4fb;
}

.content-hero-uploader-drop input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.content-hero-uploader-icon {
    font-size: 22px;
    color: var(--admin-blue);
    font-weight: 800;
}

.content-hero-uploader-prompt {
    font-size: 13px;
    color: var(--admin-muted);
    font-weight: 600;
}

.content-hero-uploader-note {
    font-size: 12px;
    color: #6b7b8b;
    text-align: center;
    margin-top: -4px;
}

.content-hero.is-uploading .content-hero-uploader-drop {
    pointer-events: none;
    opacity: 0.6;
}

.content-hero.is-uploading .content-hero-uploader-prompt {
    color: var(--admin-primary, #2563eb);
    font-weight: 700;
}

/* アップロード／変換中のスピナー（テキスト末尾の "〇" がくるくる回る） */
.upload-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 4px;
    vertical-align: -1px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: upload-spinner-rot 0.8s linear infinite;
}

@keyframes upload-spinner-rot {
    to { transform: rotate(360deg); }
}

.content-hero-uploader > .btn {
    align-self: flex-start;
}

/* Preview — mirrors portal-detail styling */
.content-hero-preview {
    display: flex;
    flex-direction: column;
    gap: 12px;
}


.content-hero-delete-form {
    margin: 0;
    display: inline-flex;
}

/* video-wrap and friends — copied from portal so admin matches visually */
.content-hero .video-wrap {
    background: #0C1929;
    border-radius: 14px;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    max-height: 380px;
}

.content-hero-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.content-hero .video-wrap .video-play-ring {
    position: absolute;
    pointer-events: none;
    z-index: 1;
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 2px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transition: opacity 0.12s;
}

/* Show play-ring only as a label hint when the <video> hasn't started yet.
   With native controls the user can hit the browser's play button instead. */
.content-hero .video-wrap .video-label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 12px 16px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.68), rgba(0, 0, 0, 0));
    color: #fff;
    pointer-events: none;
    z-index: 1;
}

.content-hero .video-wrap .video-label-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 3px;
}

.content-hero .video-wrap .video-label-dur {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
}

/* download-file-card — copied from portal */
.content-hero .download-file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid #d9e3ee;
    border-radius: 14px;
    background: #f8fafc;
    color: var(--admin-text);
    text-decoration: none;
}

.content-hero .download-file-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #f6e7be;
    color: #9b5f00;
    font-size: 24px;
    flex: 0 0 auto;
    font-weight: 800;
}

.content-hero .download-file-card-title {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 700;
}

.content-hero .download-file-card-meta {
    font-size: 12px;
    color: var(--admin-muted);
}

.content-hero .image-wrap {
    background: #0C1929;
    border-radius: 14px;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    max-height: 380px;
}

.content-hero .image-wrap .content-hero-image {
    width: 100%;
    height: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    object-fit: contain;
    display: block;
    max-width: none;
    max-height: none;
}

.content-hero .pdf-wrap {
    background: #1a2433;
    border-radius: 14px;
    aspect-ratio: 16 / 9;
    position: relative;
    overflow: hidden;
    max-height: 480px;
}

.content-hero .pdf-wrap .content-hero-pdf {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #fff;
}

.content-hero-image {
    display: block;
    max-width: 100%;
    max-height: 360px;
    margin: 0 auto;
    border-radius: 12px;
    border: 1px solid #e2e8ef;
    background: #fff;
}

.admin-block-grid {
    /* Match portal home (.content-grid): minmax(185px, 1fr) + 12px gap */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 12px;
}

.admin-block-grid-notice {
    /* Notice cards use the same column rhythm as content cards. */
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
}

@media (max-width: 524px) {
    .admin-block-grid,
    .admin-block-grid-notice {
        /* Force 2 columns on narrow screens (mirrors portal home behavior). */
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
}

.admin-block-card {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.12s;
}

.admin-block-card:hover {
    border-color: var(--surface-nav-hover-border);
}

.admin-block-card-link {
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
    flex: 1 1 auto;
}

.admin-block-card-link:hover {
    text-decoration: none;
    color: inherit;
}

.admin-block-thumb {
    /* Match portal .content-art: 100px tall, same cover crop behavior. */
    height: 100px;
    display: grid;
    place-items: center;
    background: #eef2f6;
    color: #6b7b8b;
    position: relative;
    overflow: hidden;
}

.admin-block-thumb.has-thumb {
    background: transparent;
}

.admin-block-thumb-img {
    --thumb-focus-x: 50%;
    --thumb-focus-y: 50%;
    --thumb-zoom: 1;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--thumb-focus-x) var(--thumb-focus-y);
    transform: scale(var(--thumb-zoom));
    transform-origin: var(--thumb-focus-x) var(--thumb-focus-y);
    display: block;
}

.admin-block-card.is-video .admin-block-thumb {
    background-color: #dcecf9;
    color: #3f63a8;
}

.admin-block-card.is-text .admin-block-thumb {
    background-color: #dff0d0;
    color: #3b7720;
}

.admin-block-card.is-download .admin-block-thumb {
    background-color: #f7e4c1;
    color: #9a620c;
}

.admin-block-thumb-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.65);
    display: grid;
    place-items: center;
    font-size: 18px;
    font-weight: 800;
}

.admin-block-status-pill {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(8, 24, 45, 0.78);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.admin-block-body {
    padding: 10px 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 auto;
}

.admin-block-title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
    color: var(--admin-text);
    word-break: break-word;
}

.admin-block-index {
    color: var(--admin-muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-right: 4px;
}

.admin-block-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--admin-muted);
    margin-top: auto;
}

.admin-block-meta .badge {
    font-size: 10px;
}

.admin-block-card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 8px 12px 12px;
    border-top: 1px dashed var(--admin-border);
    margin-top: 4px;
}

.admin-block-card-footer .btn,
.admin-block-card-footer button {
    flex: 0 0 auto;
}

.admin-block-card-footer form {
    margin: 0;
    /* form 自身を flex レイアウトから消し、中の button を編集 <a> と同じ
       直接の flex アイテムとして並べる。これがないと form の box 分だけ
       コピー/削除ボタンが編集ボタンとズレる。 */
    display: contents;
}

/* Notice block card variant */
.admin-block-card-notice .admin-block-card-link {
    padding: 12px 14px 8px;
    gap: 8px;
    position: relative;
}

.admin-block-notice-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--admin-muted);
}

.admin-block-notice-date {
    color: var(--admin-muted);
}

.admin-block-card-notice .admin-block-status-pill {
    position: static;
    background: rgba(185, 52, 52, 0.12);
    color: #b93434;
    border: 1px solid rgba(185, 52, 52, 0.3);
}

.admin-block-card-notice .admin-block-title {
    font-size: 14px;
    line-height: 1.5;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

label {
    display: block;
    margin: 14px 0 6px;
    font-weight: 700;
}

input[type="text"], input[type="password"], input[type="date"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c9d4e2;
    border-radius: 10px;
    font: inherit;
    background: #fff;
}

textarea {
    min-height: 220px;
    line-height: 1.7;
}

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    background: #fff3cd;
    border: 1px solid #f3d37b;
}

.pw-settings {
    display: grid;
    gap: 24px;
}

.pw-section + .pw-section {
    margin-top: 0;
}

.pw-section-title {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--admin-text);
}

.pw-card {
    width: 100%;
    max-width: none;
    padding: 28px;
}

.pw-label {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--admin-text);
}

.pw-input-wrap {
    position: relative;
    margin-bottom: 10px;
}

.pw-input {
    width: 100%;
    padding: 10px 38px 10px 12px;
    border: 1px solid #c9d4e2;
    border-radius: 10px;
    font: inherit;
    background: #fff;
    color: var(--admin-text);
}

.pw-input:focus {
    outline: none;
    border-color: #378add;
    box-shadow: 0 0 0 2px rgba(55, 138, 221, 0.15);
}

.pw-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #59697c;
    cursor: pointer;
    box-shadow: none;
    line-height: 0;
}

.pw-toggle:hover,
.pw-toggle:focus {
    background: transparent;
}

.pw-divider {
    height: 1px;
    margin: 8px 0 18px;
    background: #e6edf4;
}

.pw-strength {
    height: 4px;
    margin-top: 2px;
    margin-bottom: 8px;
    border-radius: 999px;
    background: var(--admin-border);
    transition: width 0.2s ease, background 0.2s ease;
    width: 0;
}

.pw-strength-label {
    min-height: 16px;
    margin-bottom: 14px;
    font-size: 11px;
    color: var(--admin-muted);
}

.pw-help {
    margin-bottom: 18px;
    font-size: 11px;
    line-height: 1.6;
    color: var(--admin-muted);
}

.pw-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #e6f1fb;
    color: #0c447c;
}

.pw-note-icon {
    flex-shrink: 0;
    margin-top: 1px;
    color: #185fa5;
}

.pw-note-text {
    font-size: 12px;
    line-height: 1.6;
}

.pw-submit {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    margin-top: 20px;
}

.pw-success,
.pw-err {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 13px;
}

.pw-success {
    background: #edf7e2;
    border: 1px solid #cde2ac;
    color: #4f7f17;
}

.pw-err {
    background: #fcebeb;
    border: 1px solid #f09595;
    color: #a32d2d;
}

.pw-success.show,
.pw-err.show {
    display: block;
}

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #082340, #185fa5);
}

.login .card {
    width: min(400px, calc(100vw - 32px));
    padding: 26px;
}

.editor-page-head {
    align-items: flex-start;
    flex-wrap: wrap;
}

.editor-head-title {
    flex: 1 1 420px;
    min-width: 0;
}

.editor-head-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px 14px;
    flex: 1 1 100%;
    min-width: 0;
    flex-wrap: wrap;
    margin-top: 6px;
}

.editor-kicker {
    margin: 0;
    flex: 1 1 320px;
    color: var(--admin-muted);
    font-size: 13px;
}

.editor-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    flex: 0 1 auto;
    margin-left: auto;
}

.editor-actions .btn,
.editor-actions button {
    padding: 6px 9px;
    font-size: 12px;
    min-height: 30px;
    line-height: 1;
    min-width: 0;
    border-radius: 9px;
    box-sizing: border-box;
}

.editor-actions .btn.secondary,
.editor-actions button.secondary {
    padding-inline: 10px;
}

.editor-actions .btn + .btn,
.editor-actions .btn + button,
.editor-actions button + .btn,
.editor-actions button + button {
    margin-left: 0;
}

.editor-shell {
    overflow: hidden;
}

.editor-topbar {
    padding: 14px 20px;
    border-bottom: 1px solid #e6edf4;
    background: #fbfcfe;
}

.editor-topbar-standalone {
    padding: 14px 20px;
    margin-bottom: 9px;
    background: #fff;
    border: 1px solid #e6edf4;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.editor-meta-grid {
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex-wrap: nowrap;
}

.editor-field {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 6px;
    align-items: center;
    flex: 1 1 0;
    min-width: 0;
}

.editor-field label {
    margin: 0;
    font-size: 11px;
    color: var(--admin-muted);
    font-weight: 700;
    white-space: nowrap;
}

.editor-field .mini {
    width: 100%;
    font-size: 13px;
}

.status-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 10px;
    background: #edf7e2;
    color: #4f7f17;
    font-size: 13px;
    font-weight: 700;
}

.status-chip.draft {
    background: #f4f6f9;
    color: #6b7b8b;
}

.editor-title-wrap {
    padding: 12px 16px 0;
}

.editor-label {
    display: block;
    margin: 0 0 6px;
    color: var(--admin-muted);
    font-size: 11px;
    font-weight: 700;
}

.editor-title {
    width: 100%;
    padding: 0 0 10px;
    border: 0;
    border-bottom: 1px solid #e2e9f1;
    outline: none;
    background: transparent;
    font-size: 22px;
    font-weight: 700;
    color: var(--admin-text);
}

.editor-title::placeholder {
    color: #c1c9d3;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 16px;
    border-bottom: 1px solid #e6edf4;
    background: #fbfcfe;
}

.editor-toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.editor-toolbar-group-tight {
    gap: 6px;
    flex-wrap: nowrap;
}

.editor-toolbar-divider {
    color: #c1c9d3;
    font-size: 13px;
    line-height: 1;
    flex: 0 0 8px;
    width: 8px;
    text-align: center;
    user-select: none;
}

.tool-btn,
.tool-select {
    height: 30px;
    min-height: 30px;
    border: 1px solid #d5deea;
    border-radius: 8px;
    background: #fff;
    color: #334457;
    font: inherit;
}

.tool-btn {
    min-width: 30px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}

.tool-btn:hover {
    background: #edf4fb;
    color: #185fa5;
}

.tool-btn.is-active {
    background: #eaf2ff;
    color: #185fa5;
    border-color: #8fb6e4;
    box-shadow: inset 0 0 0 1px rgba(24, 95, 165, 0.08);
}

.tool-btn.is-active .tool-color-swatch,
.tool-btn.is-active .tool-highlight-swatch {
    border-color: #8fb6e4;
    box-shadow: 0 0 0 1px rgba(24, 95, 165, 0.12);
}

.tool-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 0;
    color: var(--admin-muted);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.tool-chip {
    padding: 0 10px;
}

.tool-icon {
    min-width: 30px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tool-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    display: block;
}

.tool-icon-number svg {
    width: 22px;
    height: 18px;
}

.tool-icon-number-text {
    font-size: 11px;
    font-weight: 700;
    fill: currentColor;
}

.tool-quote {
    min-width: 70px;
    padding: 0 10px;
    gap: 6px;
    justify-content: center;
}

.tool-quote-mark {
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    color: currentColor;
}

.tool-quote-label {
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.tool-text {
    min-width: 30px;
}

.tool-select {
    padding: 0 8px;
    min-width: 62px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.tool-color {
    min-width: 82px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #fff;
    border-color: #d5deea;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}

.tool-color-label {
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.editor-swatch,
.tool-color-swatch,
.tool-highlight-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex: 0 0 auto;
    display: inline-block;
    border: 1px solid #c7d1de;
    box-sizing: border-box;
}

.tool-color-swatch {
    background: #111111;
}

.tool-highlight-swatch {
    background: #f6dfaf;
    border-color: #e9d79d;
}

.tool-highlight {
    min-width: 82px;
    padding: 0 10px;
    background: #fff;
    border-color: #d5deea;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.tool-highlight-label {
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.tool-highlight-swatch {
    border-radius: 2px;
    margin-left: -2px;
    align-self: center;
}

.editor-color-picker {
    position: fixed;
    z-index: 2200;
    width: 266px;
    max-width: calc(100vw - 24px);
    padding: 12px;
    border: 1px solid #d5deea;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(22, 38, 64, 0.16);
}

.editor-color-picker-section + .editor-color-picker-footer {
    margin-top: 10px;
}

.editor-color-picker-title {
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--admin-muted);
}

.editor-color-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.editor-color-choice {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #d5deea;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.editor-color-choice:hover {
    transform: translateY(-1px);
}

.editor-color-picker-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.editor-color-extract {
    height: 30px;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid #d5deea;
    border-radius: 8px;
    background: #fff;
    color: #185fa5;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}

.editor-color-history-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.editor-color-history-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--admin-muted);
    white-space: nowrap;
}

.editor-color-history {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
}

.editor-color-history-swatch {
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid #d5deea;
    border-radius: 5px;
}

.editor-color-history-empty {
    color: var(--admin-muted);
    font-size: 11px;
}

.editor-surface {
    padding: 14px 16px 16px;
}

.editor-body {
    min-height: 420px;
    padding: 14px 16px 20px;
    outline: none;
    border: 1px solid #e1e8f0;
    border-radius: 12px;
    background: #fff;
    line-height: 1.8;
    font-size: 14px;
    color: var(--color-text-primary, #1a1a1a);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.editor-body:empty::before {
    content: attr(data-placeholder);
    color: #c2c9d3;
}

.editor-body h2 {
    margin: 16px 0 8px;
    font-size: 18px;
    font-weight: 500;
}

.editor-body h3 {
    margin: 14px 0 6px;
    font-size: 15px;
    font-weight: 500;
}

.editor-body p {
    margin: 0 0 8px;
}

.editor-body blockquote {
    margin: 8px 0;
    padding: 4px 12px;
    min-height: 1.6em;
    border-left: 3px solid #378ADD;
    background: #E6F1FB;
    color: var(--color-text-secondary);
    line-height: 1.6;
    border-radius: 0 6px 6px 0;
}

.editor-body ul,
.editor-body ol {
    margin: 8px 0;
    padding-left: 20px;
}

.editor-body li {
    margin: 3px 0;
}

.editor-body img {
    max-width: 100%;
    display: block;
    margin: 8px 0;
    border-radius: 8px;
}

.editor-body a {
    color: #185FA5;
    text-decoration: underline;
}

.editor-highlight {
    background: #fff2b2;
}

.editor-file-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    padding: 9px 14px;
    border-radius: 8px;
    background: #f5f5f5;
    border: 0.5px solid rgba(0, 0, 0, 0.12);
    color: var(--admin-text);
    text-decoration: none;
    font-size: 13px;
    line-height: 1.4;
}

.editor-file-link:hover {
    border-color: #c4ccd6;
    text-decoration: none;
}

.editor-file-link-icon {
    width: 30px;
    height: 30px;
    background: #FAEEDA;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.editor-file-link-body {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.editor-file-link-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-file-link-meta {
    font-size: 11px;
    color: var(--admin-muted);
}

.editor-link-modal[hidden] {
    display: none;
}

.editor-link-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-link-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 24, 45, 0.4);
}

.editor-link-modal-panel {
    position: relative;
    width: min(360px, calc(100vw - 32px));
    background: #fff;
    border-radius: 12px;
    padding: 20px 22px 16px;
    box-shadow: 0 24px 56px rgba(8, 24, 45, 0.28);
}

.editor-link-modal-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--admin-text);
    margin: 0 0 14px;
}

.editor-link-modal-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--admin-text);
    margin: 12px 0 6px;
}

.editor-link-modal-label:first-of-type {
    margin-top: 0;
}

.editor-link-modal-input {
    width: 100%;
    padding: 8px 11px;
    font: inherit;
    font-size: 13px;
    color: var(--admin-text);
    background: #fff;
    border: 1px solid #d8dee7;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.12s, box-shadow 0.12s;
}

.editor-link-modal-input::placeholder {
    color: #b6c0cc;
}

.editor-link-modal-input:focus {
    border-color: #185fa5;
    box-shadow: 0 0 0 2px rgba(24, 95, 165, 0.15);
}

.editor-link-modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 18px;
}

.editor-link-modal-actions-right {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.editor-link-modal-actions .btn,
.editor-link-modal-actions button {
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
}

.editor-link-modal-unlink {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: #b93434;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}

.editor-link-modal-unlink[hidden] {
    display: none;
}

.editor-link-modal-unlink:hover {
    background: #fcefef;
    color: #a52929;
    border-color: #f1d6d6;
}

.editor-body img[data-editor-selected="1"],
.editor-body .video-embed[data-editor-selected="1"] {
    outline: 2px solid #185fa5;
    outline-offset: 2px;
}

.editor-body .file-embed.is-dragging,
.editor-body .video-embed.is-dragging {
    opacity: 0.4;
}

.editor-body .video-embed[data-editor-selected="1"] {
    border-radius: 12px;
}

.editor-media-toolbar {
    position: fixed;
    z-index: 1100;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.editor-media-toolbar[hidden] {
    display: none;
}

.editor-media-toolbar-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid #fff;
    background: rgba(8, 24, 45, 0.78);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(8, 24, 45, 0.28);
    transition: background-color 0.12s, transform 0.12s;
}

.editor-media-toolbar-btn span {
    display: inline-block;
    line-height: 1;
}

.editor-media-edit-btn:hover {
    background: #185fa5;
    transform: scale(1.05);
}

.editor-media-delete-btn:hover {
    background: #b93434;
    transform: scale(1.05);
}

.editor-media-delete-btn span {
    transform: translateY(-1px);
}

.editor-media-edit-btn span {
    transform: translateY(-1px);
    font-size: 13px;
}

.editor-image-modal[hidden],
.editor-video-modal[hidden],
.editor-file-modal[hidden] {
    display: none;
}

.editor-image-modal,
.editor-video-modal,
.editor-file-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-file-modal .editor-image-modal-panel {
    width: min(520px, calc(100vw - 32px));
}

.editor-image-modal-section-row > .editor-image-modal-col {
    flex: 1 1 0;
    min-width: 0;
}

.editor-file-modal.is-viewer-hidden [data-editor-file-viewer-only] {
    display: none;
}

.editor-file-modal-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    border: 1px solid #d8dee7;
    background: #fdecec;
    color: #c0392b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.editor-file-modal.is-non-pdf .editor-file-modal-thumb {
    background: #eef2f6;
    color: #4a5663;
}

.editor-file-modal.is-non-pdf [data-editor-file-pdf-only] {
    display: none;
}

.file-embed {
    margin: 12px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 0.5px solid rgba(0, 0, 0, 0.12);
    background: #fff;
}

.file-embed-frame-wrap {
    position: relative;
}

.file-embed-frame {
    display: block;
    width: 100%;
    height: 480px;
    border: 0;
    background: #f5f8fc;
}

.editor-body .file-embed-click-capture {
    position: absolute;
    inset: 0;
    background: transparent;
    cursor: pointer;
    z-index: 2;
}

.editor-body .file-embed[data-editor-selected="1"] .file-embed-click-capture {
    /* Selected → allow iframe (PDF viewer) interaction. */
    display: none;
}

.file-embed-download {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #f5f8fc;
    border-top: 0.5px solid rgba(0, 0, 0, 0.12);
    color: var(--admin-text);
    text-decoration: none;
    font-size: 13px;
    transition: background-color 0.12s, color 0.12s;
}

.file-embed-download:hover {
    background: #E6F1FB;
    color: #185FA5;
    text-decoration: none;
}

.file-embed-download-icon {
    width: 30px;
    height: 30px;
    background: #FAEEDA;
    color: #854F0B;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 800;
}

.file-embed-download-body {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.file-embed-download-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: text;
}

.file-embed-download-name.is-editing {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    background: #fff;
    outline: 2px solid #185fa5;
    outline-offset: 2px;
    border-radius: 3px;
    padding: 1px 4px;
    cursor: text;
    min-width: 80px;
}

.file-embed-download-meta {
    font-size: 11px;
    color: var(--admin-muted);
}

.file-embed.no-download .file-embed-download {
    display: none;
}

.file-embed.no-viewer .file-embed-frame-wrap {
    display: none;
}

.editor-body .file-embed[data-editor-selected="1"] {
    outline: 2px solid #185fa5;
    outline-offset: 2px;
}

.editor-image-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 24, 45, 0.4);
}

.editor-image-modal-panel {
    position: relative;
    width: min(360px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: #fff;
    border-radius: 12px;
    padding: 18px 20px 14px;
    box-shadow: 0 24px 56px rgba(8, 24, 45, 0.28);
    will-change: transform;
}

.editor-image-modal-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--admin-text);
    margin: 0 0 14px;
    padding-right: 24px;
    cursor: grab;
    user-select: none;
    position: relative;
}

.editor-image-modal-title::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 12px;
    background-image:
        radial-gradient(circle, #b6c0cc 1.4px, transparent 1.6px),
        radial-gradient(circle, #b6c0cc 1.4px, transparent 1.6px);
    background-size: 4px 4px, 4px 4px;
    background-position: 0 0, 0 8px;
    background-repeat: repeat-x;
    opacity: 0.7;
}

.editor-image-modal-title.is-dragging {
    cursor: grabbing;
}

.editor-image-modal-section {
    margin-bottom: 14px;
}

.editor-image-modal-replace-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.editor-image-modal-replace-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #d8dee7;
    background: #f5f8fc;
    flex-shrink: 0;
}

.editor-image-modal-replace-btn {
    flex: 1;
    appearance: none;
    background: #fff;
    border: 1px dashed #b6c0cc;
    border-radius: 8px;
    padding: 12px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--admin-blue, #185fa5);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}

.editor-image-modal-replace-btn:hover:not(:disabled) {
    background: #eaf2ff;
    border-color: #8fb6e4;
    border-style: solid;
}

.editor-image-modal-replace-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.editor-image-modal-replace-icon {
    font-size: 15px;
    line-height: 1;
}

.editor-image-modal-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--admin-text);
    margin: 0 0 8px;
}

.editor-image-modal-hint {
    margin-top: 6px;
    font-size: 11px;
    color: var(--admin-muted);
}

.editor-image-modal-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.editor-image-modal-number-input {
    width: 96px;
    padding: 7px 10px;
    font: inherit;
    font-size: 13px;
    color: var(--admin-text);
    background: #fff;
    border: 1px solid #d8dee7;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.12s, box-shadow 0.12s;
}

.editor-image-modal-number-input:focus {
    border-color: #185fa5;
    box-shadow: 0 0 0 2px rgba(24, 95, 165, 0.15);
}

.editor-image-modal-text-input {
    width: 100%;
    padding: 7px 11px;
    font: inherit;
    font-size: 13px;
    color: var(--admin-text);
    background: #fff;
    border: 1px solid #d8dee7;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.12s, box-shadow 0.12s;
    box-sizing: border-box;
}

.editor-image-modal-text-input:focus {
    border-color: #185fa5;
    box-shadow: 0 0 0 2px rgba(24, 95, 165, 0.15);
}

.editor-image-modal-input-suffix {
    font-size: 13px;
    color: var(--admin-text);
    font-weight: 500;
}

.editor-image-modal-input-hint {
    font-size: 11px;
    color: var(--admin-muted);
    flex: 1 1 100%;
}

.editor-image-modal-input-note {
    font-size: 11px;
    color: var(--admin-muted);
    line-height: 1.5;
    flex: 1 1 100%;
    margin-top: 2px;
    padding: 6px 8px;
    background: #fdf6e3;
    border-left: 2px solid #e0a83f;
    border-radius: 0 4px 4px 0;
    color: #7a5a16;
}

.editor-image-modal-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.editor-image-modal-option {
    appearance: none;
    background: #fff;
    border: 1px solid #d8dee7;
    border-radius: 8px;
    padding: 7px 12px;
    font: inherit;
    font-size: 13px;
    color: var(--admin-text);
    cursor: pointer;
    transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}

.editor-image-modal-option:hover {
    background: #f5f8fc;
}

.editor-image-modal-option.is-active {
    background: #eaf2ff;
    border-color: #8fb6e4;
    color: #185fa5;
    font-weight: 700;
}

.editor-image-modal-section-row {
    display: flex;
    align-items: flex-start;
    gap: 18px;
}

.editor-image-modal-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.editor-image-modal-col > .editor-image-modal-label {
    margin: 0;
}

.editor-image-modal-position-grid {
    display: grid;
    grid-template-columns: repeat(3, 36px);
    gap: 4px;
}

.editor-image-modal-align-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.editor-image-modal-align {
    appearance: none;
    background: #fff;
    border: 1px solid #d8dee7;
    border-radius: 6px;
    padding: 7px 10px;
    font: inherit;
    font-size: 13px;
    color: var(--admin-text);
    cursor: pointer;
    min-width: 64px;
    text-align: center;
    transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}

.editor-image-modal-align:hover {
    background: #f5f8fc;
}

.editor-image-modal-align.is-active {
    background: #eaf2ff;
    border-color: #8fb6e4;
    color: #185fa5;
    font-weight: 700;
}

.editor-image-modal-position {
    appearance: none;
    width: 36px;
    height: 36px;
    background: #fff;
    border: 1px solid #d8dee7;
    border-radius: 6px;
    font: inherit;
    font-size: 15px;
    color: var(--admin-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}

.editor-image-modal-position:hover:not(:disabled) {
    background: #f5f8fc;
}

.editor-image-modal-position.is-active {
    background: #eaf2ff;
    border-color: #8fb6e4;
    color: #185fa5;
    font-weight: 700;
}

.editor-image-modal-position:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.editor-image-modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
}

.editor-image-modal-actions-right {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.editor-image-modal-actions .btn,
.editor-image-modal-actions button {
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
}

.editor-image-modal-delete {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: #b93434;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}

.editor-image-modal-delete:hover {
    background: #fcefef;
    color: #a52929;
    border-color: #f1d6d6;
}

.video-embed {
    margin: 12px 0;
}

.video-embed video {
    width: 100%;
    max-width: 720px;
    display: block;
    border-radius: 12px;
    background: #000;
}

.editor-help {
    margin-top: 10px;
    color: var(--admin-muted);
    font-size: 12px;
}

.attachment-panel {
    margin-top: 16px;
    overflow: hidden;
}

.attachment-panel .section-title {
    background: #fbfcfe;
}

.attachment-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    padding: 16px 20px 0;
}

.attachment-form .actions {
    width: 100%;
}

.attachment-form input[type="file"] {
    max-width: 100%;
}

@media (max-width: 920px) {
    .layout,
    .admin-layout {
        flex-direction: column;
    }

    .sidebar,
    .admin-sidebar {
        width: 100%;
        padding: 0;
        border-right: 0;
        border-bottom: 1px solid var(--admin-border);
    }

    .sidebar-mobile-nav {
        display: block;
        display: flex;
        align-items: stretch;
        gap: 10px;
        overflow-x: auto;
        padding: 12px 16px 14px;
        background: var(--admin-surface);
        border-top: 1px solid var(--admin-border);
        border-bottom: 1px solid var(--admin-border);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .sidebar-mobile-nav::-webkit-scrollbar {
        display: none;
    }

    .sidebar-mobile-item {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        gap: 10px;
        padding: 0 12px;
        min-width: 132px;
        min-height: 30px;
        border: 1px solid var(--surface-nav-border);
        border-radius: 9px;
        background: #fff;
        color: #536273;
        font-size: 12px;
        font-weight: 700;
        white-space: nowrap;
        line-height: 1;
        transition: border-color 0.12s, color 0.12s, background-color 0.12s, box-shadow 0.12s;
    }

    .sidebar-mobile-item .nav-icon {
        width: 17px;
        height: 17px;
    }

    .sidebar-mobile-item:hover {
        border-color: var(--surface-nav-hover-border);
        color: #34527f;
    }

    .sidebar-mobile-item.is-active {
        background: #eaf2ff;
        border-color: var(--surface-nav-active-border);
        color: var(--surface-nav-active-border);
        box-shadow: inset 0 0 0 1px var(--surface-nav-active-border);
    }

    .sidebar-mobile-label {
        min-width: 0;
        line-height: 1;
    }

    .sidebar-mobile-count {
        min-width: 18px;
        padding: 1px 6px;
        border-radius: 999px;
        background: #edf4fb;
        color: var(--surface-nav-active-border);
        font-size: 10px;
        text-align: center;
    }

    .sidebar-desktop-nav {
        display: none;
    }

    .content-area,
    .admin-main {
        padding: 24px;
    }

    .stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .editor-meta-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 720px) {
    .content-area,
    .admin-main {
        padding: 18px 16px 24px;
    }

    .page-head {
        align-items: center;
        flex-direction: row;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 14px;
    }

    .page-head .btn,
    .page-head .btn-primary {
        width: auto;
        max-width: fit-content;
        align-self: auto;
        padding: 8px 12px;
        font-size: 12px;
    }

    .editor-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .editor-actions .btn,
    .editor-actions button {
        flex: 1 1 92px;
        min-width: 0;
        white-space: nowrap;
        min-height: 30px;
        line-height: 1;
    }

    .stats {
        gap: 12px;
    }

    .card {
        border-radius: 14px;
    }

    .section-card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .responsive-table-card {
        overflow: visible;
    }

    .responsive-table,
    .editor-shell table,
    .attachment-panel table {
        min-width: 0;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table tbody {
        display: block;
    }

    .responsive-table tr {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px 10px;
        padding: 12px 14px 11px;
        border-bottom: 1px solid #e7edf4;
        background: #fff;
    }

    .responsive-table td {
        display: block;
        padding: 0;
        border: 0;
        background: transparent;
        min-width: 0;
    }

    .responsive-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        font-size: 10px;
        font-weight: 700;
        color: var(--admin-muted);
        letter-spacing: 0.02em;
    }

    .responsive-table .cell-title::before {
        display: none;
    }

    .responsive-table .cell-title {
        grid-column: 1 / span 3;
        grid-row: 1;
        font-size: 15px;
        font-weight: 800;
        line-height: 1.45;
        color: var(--admin-text);
    }

    .responsive-table .cell-status {
        grid-column: 4;
        grid-row: 1;
        text-align: right;
        justify-self: end;
        align-self: start;
    }

    .responsive-table .cell-status::before,
    .responsive-table .cell-actions::before {
        display: none;
    }

    .responsive-table .cell-type::before,
    .responsive-table .cell-date::before,
    .responsive-table .cell-count::before,
    .responsive-table .cell-reorder::before {
        display: none;
    }

    .responsive-table .cell-reorder {
        /* Reorder via drag is desktop-only; hide handle in mobile card layout. */
        display: none;
    }

    .responsive-table-dashboard .cell-section::before {
        display: none;
    }

    .responsive-table-dashboard .cell-section,
    .responsive-table-dashboard .cell-type,
    .responsive-table-dashboard .cell-date {
        grid-row: 2;
    }

    .responsive-table-dashboard .cell-section {
        grid-column: 1;
    }

    .responsive-table-dashboard .cell-type {
        grid-column: 2;
        align-self: center;
    }

    .responsive-table-dashboard .cell-date {
        grid-column: 3;
        align-self: center;
    }

    .responsive-table-content .cell-actions {
        grid-row: 2;
        grid-column: 3 / 5;
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        flex-wrap: nowrap;
        margin-top: 0;
        justify-self: end;
        align-self: center;
    }

    .responsive-table-notice .cell-actions {
        grid-row: 2;
        grid-column: 3 / 5;
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        flex-wrap: nowrap;
        margin-top: 0;
        justify-self: end;
        align-self: center;
    }

    .responsive-table-content .cell-type,
    .responsive-table-content .cell-date,
    .responsive-table-content .cell-count,
    .responsive-table-notice .cell-type,
    .responsive-table-notice .cell-date {
        grid-row: 2;
    }

    .responsive-table-content .cell-type,
    .responsive-table-notice .cell-type {
        grid-column: 1;
        align-self: center;
    }

    .responsive-table-content .cell-date,
    .responsive-table-notice .cell-date {
        grid-column: 2;
        align-self: center;
    }

    .responsive-table-content .cell-count {
        display: none;
    }

    .responsive-table-content .cell-count::before {
        display: none;
    }

    .responsive-table .badge {
        font-size: 10px;
        padding: 3px 7px;
        border-radius: 999px;
    }

    .responsive-table .actions {
        justify-content: flex-end;
        gap: 8px;
        width: 100%;
        margin-top: 2px;
        flex-wrap: nowrap;
    }

    .responsive-table .actions .btn,
    .responsive-table .actions button {
        flex: 0 0 auto;
        padding: 7px 10px;
        font-size: 11px;
        border-radius: 9px;
        white-space: nowrap;
    }

    .responsive-table tr:last-child td {
        border-bottom: 0;
    }

    .pw-settings {
        gap: 18px;
        width: 100%;
    }

    .pw-card {
        padding: 20px;
    }

    .pw-section-title {
        margin-bottom: 10px;
    }

    .pw-note {
        padding: 10px 12px;
    }

    .pw-help {
        margin-bottom: 16px;
    }

    .editor-topbar,
    .editor-title-wrap,
    .editor-toolbar,
    .editor-surface,
    .attachment-form {
        padding-left: 16px;
        padding-right: 16px;
    }

    .editor-field {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .editor-toolbar {
        gap: 4px;
    }

    .tool-btn,
    .tool-select {
        height: 30px;
        min-height: 30px;
        font-size: 12px;
    }

    .tool-btn {
        padding: 0 10px;
    }

    .tool-icon {
        padding: 0 8px;
    }

    .tool-icon svg {
        width: 17px;
        height: 17px;
    }

    .tool-quote {
        min-width: 68px;
        padding: 0 9px;
    }

    .tool-quote-mark {
        font-size: 14px;
    }

    .tool-icon-number svg {
        width: 20px;
        height: 17px;
    }

    .tool-chip[data-editor-command="ul"],
    .tool-chip[data-editor-command="ol"] {
        min-width: 30px;
        padding: 0 8px;
    }

    .tool-select {
        padding: 0 8px;
        min-width: 62px;
        font-size: 12px;
    }

    .editor-toolbar-divider {
        font-size: 15px;
    }

    .tool-color {
        min-width: 82px;
        padding: 0 10px;
    }

    .tool-highlight {
        min-width: 82px;
        padding: 0 10px;
    }

    .editor-color-picker {
        width: min(266px, calc(100vw - 24px));
        padding: 10px;
        border-radius: 12px;
    }

    .editor-color-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }

    .editor-color-choice {
        width: 100%;
        aspect-ratio: 1 / 1;
        height: auto;
    }

    .editor-color-picker-footer {
        gap: 8px;
    }

    .editor-color-history-swatch {
        width: 16px;
        height: 16px;
    }

    .editor-body {
        min-height: 320px;
        padding: 16px 14px 20px;
        font-size: 14px;
    }
}

@media (max-width: 640px) {
    .stats {
        gap: 10px;
    }

    .stat {
        padding: 14px 12px;
    }

    .stat-label {
        font-size: 11px;
        line-height: 1.4;
    }

    .stat-value {
        font-size: 24px;
        margin-top: 6px;
    }

    .stat-unit {
        font-size: 11px;
    }

    .editor-meta-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .nav-item,
    .nav {
        padding: 8px 14px;
        font-size: 12px;
    }

    .nav-section,
    .sidebar-group {
        padding: 10px 14px 4px;
        font-size: 9px;
    }

    .nav-count,
    .nav .count {
        min-width: 18px;
    }

    .pw-input {
        padding: 9px 36px 9px 12px;
    }

    .pw-toggle {
        right: 8px;
    }

    .editor-meta-grid {
        gap: 8px;
    }

    .editor-field .mini {
        width: 100%;
    }

    .editor-field {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
    }

    .editor-field .mini,
    .status-chip {
        width: 100%;
    }

    .tool-chip[data-editor-command="ul"],
    .tool-chip[data-editor-command="ol"] {
        min-width: 30px;
        padding: 0 8px;
    }

    .tool-icon svg {
        width: 16px;
        height: 16px;
    }

    .tool-quote {
        min-width: 66px;
        padding: 0 8px;
    }

    .tool-quote-mark {
        font-size: 13px;
    }

    .tool-icon-number svg {
        width: 19px;
        height: 16px;
    }

    .editor-toolbar-divider {
        font-size: 14px;
    }

    .tool-color {
        min-width: 82px;
        padding: 0 10px;
    }

    .tool-color-label {
        font-size: 12px;
    }

    .tool-color-swatch {
        width: 10px;
        height: 10px;
    }

    .editor-color-picker {
        width: min(248px, calc(100vw - 20px));
        padding: 10px;
    }

    .editor-color-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .editor-color-choice {
        width: 100%;
    }

    .editor-color-extract {
        width: 100%;
    }

    .editor-color-history-wrap {
        width: 100%;
        justify-content: space-between;
    }

    .attachment-form {
        padding-top: 12px;
    }
}

@media (max-width: 560px) {
    .sidebar-mobile-nav {
        gap: 8px;
        padding: 10px 12px 12px;
    }

    .sidebar-mobile-item {
        flex: 1 1 0;
        justify-content: center;
        align-items: center;
        min-width: 0;
        padding: 0;
        gap: 0;
        min-height: 30px;
        border-radius: 9px;
    }

    .sidebar-mobile-item .nav-icon {
        width: 18px;
        height: 18px;
        border-radius: 8px;
    }

    .sidebar-mobile-item .nav-icon svg {
        width: 12px;
        height: 12px;
    }

    .sidebar-mobile-label,
    .sidebar-mobile-count {
        display: none;
    }

    .sidebar-mobile-item.is-active {
        box-shadow: inset 0 0 0 1px var(--surface-nav-active-border), 0 1px 0 rgba(12, 68, 124, 0.04);
    }
}

/* --- ログインロック管理 --- */
/* パスワード管理画面（.pw-settings / .pw-card）と同じ枠組みに乗せ、
   テーブルやチップ等のロック画面固有要素だけここで定義する */

.lock-search {
    margin-bottom: 18px;
}

.lock-search-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin-top: 6px;
}

.lock-search-row .pw-input {
    flex: 1 1 auto;
    min-width: 0;
}

/* .pw-input と高さを揃えるため stretch + 同じ縦パディングを当てる */
.lock-search-row .btn {
    padding-top: 10px;
    padding-bottom: 10px;
    white-space: nowrap;
}

.lock-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--surface-nav-border);
}

.lock-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
}

.lock-table th,
.lock-table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--surface-nav-border);
    vertical-align: middle;
}

.lock-table thead th {
    color: var(--admin-muted);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.04em;
    background: #f7f9fc;
}

.lock-table tbody tr:last-child td {
    border-bottom: 0;
}

.lock-table tbody tr:hover {
    background: #fafcff;
}

.lock-table .mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: #2c3a4d;
}

.lock-col-num {
    text-align: center;
    width: 64px;
}

.lock-col-action {
    width: 90px;
    text-align: right;
}

.lock-col-action .btn {
    padding: 5px 12px;
    font-size: 12px;
    min-width: 64px;
}

.lock-role {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
}

.lock-role-admin {
    background: #e7f1fb;
    color: #185fa5;
}

.lock-role-portal {
    background: #eef4ec;
    color: #4f7f17;
}

.lock-status {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}

.lock-status-permanent {
    background: #fde9ea;
    color: #a52929;
}

.lock-status-temp {
    background: #fff3dd;
    color: #b27418;
}

.lock-status-record {
    background: #eef4fb;
    color: #5a6b80;
}

.lock-empty {
    padding: 32px 4px;
    text-align: center;
    color: var(--admin-muted);
    font-size: 13px;
    background: #fafbfd;
    border: 1px dashed var(--surface-nav-border);
    border-radius: 12px;
}

.lock-bulk-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--surface-nav-border);
}

.lock-audit {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.7;
    background: #f7f9fc;
    border: 1px solid var(--surface-nav-border);
    border-radius: 10px;
    padding: 14px 16px;
    margin: 0;
    overflow-x: auto;
    white-space: pre;
    color: #2c3a4d;
}

/* 許可IPリスト */
.lock-allowlist {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

.lock-allowlist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--surface-nav-border);
    border-radius: 10px;
    gap: 12px;
}

.lock-allowlist-default {
    background: #f7f9fc;
}

.lock-allowlist-tag {
    display: inline-flex;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    color: #5a6b80;
    background: #eef4fb;
    border-radius: 6px;
}

.lock-allowlist-empty {
    padding: 14px 4px;
    color: var(--admin-muted);
    font-size: 12px;
}

.lock-allowlist-add {
    border-top: 1px solid var(--surface-nav-border);
    padding-top: 16px;
}

.lock-current-ip {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--surface-nav-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.lock-current-ip-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.lock-current-ip-label {
    color: var(--admin-muted);
    font-weight: 600;
}

.lock-current-ip-link {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: #185fa5;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
}

.lock-current-ip-link:hover {
    text-decoration: underline;
}

/* 通常テキストボタンの mini 版だけ対象にする。
   .icon-action を兼ねた正方形アイコンボタンは padding: 0 を維持したいので除外
   （これがないと .btn.secondary.icon-action.mini の <a> が padding 4 10 で潰れる）。 */
.btn.mini:not(.icon-action),
.btn.secondary.mini:not(.icon-action) {
    padding: 4px 10px;
    font-size: 11px;
    min-width: 0;
}

@media (max-width: 720px) {
    .lock-table th,
    .lock-table td {
        padding: 10px 12px;
    }
    .lock-col-action {
        width: auto;
    }
    .lock-bulk-actions {
        flex-direction: column;
    }
    .lock-bulk-actions .btn {
        width: 100%;
    }
}
