/* ==========================================================================
   小物ツール集 共通スタイル
   各ページはこのファイルを読み込み、ページ固有のスタイルだけを <style> に書く
   ========================================================================== */

:root {
    color-scheme: light;

    --bg: #f5f7f2;
    --bg-accent:
        radial-gradient(1200px 500px at 10% -10%, rgba(139, 195, 74, 0.16), transparent 60%),
        radial-gradient(900px 400px at 100% 0%, rgba(205, 220, 57, 0.12), transparent 60%);
    --surface: #ffffff;
    --surface-2: #f2f6ee;
    --surface-3: #e8efe1;
    --border: #e1e8da;
    --border-strong: #c9d6bd;
    --text: #1c2418;
    --text-muted: #5c6854;
    --text-subtle: #8a9681;

    --brand: #7cb342;
    --brand-strong: #4e7d27;
    --brand-hover: #426b20;
    --brand-soft: rgba(124, 179, 66, 0.12);
    --brand-softer: rgba(124, 179, 66, 0.06);
    --on-brand: #ffffff;

    --success: #2e7d32;
    --success-soft: rgba(46, 125, 50, 0.1);
    --warning: #9a6700;
    --warning-soft: rgba(245, 166, 35, 0.14);
    --danger: #c62828;
    --danger-soft: rgba(198, 40, 40, 0.09);
    --info: #1565c0;
    --info-soft: rgba(21, 101, 192, 0.09);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(28, 36, 24, 0.06);
    --shadow: 0 1px 3px rgba(28, 36, 24, 0.06), 0 6px 20px rgba(28, 36, 24, 0.06);
    --shadow-lg: 0 10px 40px rgba(28, 36, 24, 0.14);
    --focus-ring: 0 0 0 3px rgba(124, 179, 66, 0.35);

    --font-sans:
        -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
        "Yu Gothic UI", Meiryo, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Consolas", "Menlo", "Noto Sans Mono", monospace;

    --header-h: 60px;
    --page-max: 1040px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0f130d;
        --bg-accent:
            radial-gradient(1200px 500px at 10% -10%, rgba(139, 195, 74, 0.1), transparent 60%),
            radial-gradient(900px 400px at 100% 0%, rgba(205, 220, 57, 0.05), transparent 60%);
        --surface: #171c14;
        --surface-2: #1d2419;
        --surface-3: #252e20;
        --border: #2a3424;
        --border-strong: #3a4732;
        --text: #e6ecdf;
        --text-muted: #a6b19b;
        --text-subtle: #7b8672;
        --brand: #9ccc65;
        --brand-strong: #8bc34a;
        --brand-hover: #a5d36f;
        --brand-soft: rgba(156, 204, 101, 0.14);
        --brand-softer: rgba(156, 204, 101, 0.07);
        --on-brand: #11200a;
        --success: #81c784;
        --success-soft: rgba(129, 199, 132, 0.12);
        --warning: #ffca63;
        --warning-soft: rgba(255, 202, 99, 0.12);
        --danger: #ef9a9a;
        --danger-soft: rgba(239, 154, 154, 0.12);
        --info: #90caf9;
        --info-soft: rgba(144, 202, 249, 0.12);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 6px 20px rgba(0, 0, 0, 0.25);
        --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f130d;
    --bg-accent:
        radial-gradient(1200px 500px at 10% -10%, rgba(139, 195, 74, 0.1), transparent 60%),
        radial-gradient(900px 400px at 100% 0%, rgba(205, 220, 57, 0.05), transparent 60%);
    --surface: #171c14;
    --surface-2: #1d2419;
    --surface-3: #252e20;
    --border: #2a3424;
    --border-strong: #3a4732;
    --text: #e6ecdf;
    --text-muted: #a6b19b;
    --text-subtle: #7b8672;
    --brand: #9ccc65;
    --brand-strong: #8bc34a;
    --brand-hover: #a5d36f;
    --brand-soft: rgba(156, 204, 101, 0.14);
    --brand-softer: rgba(156, 204, 101, 0.07);
    --on-brand: #11200a;
    --success: #81c784;
    --success-soft: rgba(129, 199, 132, 0.12);
    --warning: #ffca63;
    --warning-soft: rgba(255, 202, 99, 0.12);
    --danger: #ef9a9a;
    --danger-soft: rgba(239, 154, 154, 0.12);
    --info: #90caf9;
    --info-soft: rgba(144, 202, 249, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 6px 20px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* --------------------------------------------------------------------------
   ベース
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg-accent), var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
}

h1,
h2,
h3,
h4 {
    line-height: 1.35;
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.01em;
}

p {
    margin: 0;
}

a {
    color: var(--brand-strong);
}

img,
svg,
canvas,
video {
    max-width: 100%;
}

code,
kbd,
pre,
.mono {
    font-family: var(--font-mono);
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

::selection {
    background: var(--brand-soft);
}

.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;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -48px;
    z-index: 200;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--brand-strong);
    color: var(--on-brand);
    text-decoration: none;
    transition: top 0.15s;
}

.skip-link:focus {
    top: 12px;
}

[hidden] {
    display: none !important;
}

/* --------------------------------------------------------------------------
   サイトヘッダー
   -------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.site-header__inner {
    max-width: var(--page-max);
    height: 100%;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    white-space: nowrap;
    border-radius: var(--radius-sm);
}

.brand__mark {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: #fff;
    background: linear-gradient(135deg, #9ccc65, #558b2f);
    box-shadow: 0 2px 6px rgba(85, 139, 47, 0.35);
    font-size: 15px;
}

.site-header__crumb {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--text-muted);
    font-size: 14px;
}

.site-header__crumb span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-header__actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition:
        background 0.15s,
        color 0.15s,
        border-color 0.15s;
}

.icon-btn:hover {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

.menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background 0.15s,
        border-color 0.15s;
}

.menu-btn:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}

/* ツール切替メニュー */
.tools-menu {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: none;
}

.tools-menu.is-open {
    display: block;
}

.tools-menu__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 8, 0.4);
    animation: fade-in 0.15s ease;
}

.tools-menu__panel {
    position: absolute;
    top: calc(var(--header-h) + 8px);
    right: max(16px, calc((100vw - var(--page-max)) / 2 + 16px));
    width: min(420px, calc(100vw - 32px));
    max-height: calc(100vh - var(--header-h) - 24px);
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    animation: pop-in 0.16s ease;
}

.tools-menu__group {
    padding: 10px 10px 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-subtle);
}

.tools-menu__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
}

.tools-menu__link:hover,
.tools-menu__link:focus-visible {
    background: var(--surface-2);
}

.tools-menu__link[aria-current="page"] {
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-weight: 600;
}

.tools-menu__icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--brand-softer);
    color: var(--brand-strong);
    font-size: 13px;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
}

@keyframes pop-in {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }
}

/* --------------------------------------------------------------------------
   ページレイアウト
   -------------------------------------------------------------------------- */
.page {
    width: 100%;
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 28px 16px 48px;
    flex: 1;
}

.page--narrow {
    max-width: 720px;
}

.page--wide {
    max-width: 1320px;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.page-header__icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #9ccc65, #558b2f);
    color: #fff;
    font-size: 22px;
    box-shadow: 0 6px 16px rgba(85, 139, 47, 0.28);
}

.page-header h1 {
    font-size: clamp(22px, 3.2vw, 28px);
}

.page-header p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 2px;
}

.site-footer {
    border-top: 1px solid var(--border);
    color: var(--text-subtle);
    font-size: 13px;
    text-align: center;
    padding: 20px 16px 28px;
}

.site-footer a {
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   カード
   -------------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
}

/* 縦に並ぶブロック同士の間隔（グリッド内は gap に任せる） */
:is(.card, .stack, .grid, .grid-2, .grid-3) + :is(.card, .stack, .grid, .grid-2, .grid-3) {
    margin-top: 20px;
}

:is([class*="grid"], .row, .stack) > :is(.card, .stack, .grid, .grid-2, .grid-3) {
    margin-top: 0;
}

.card--flush {
    padding: 0;
    overflow: hidden;
}

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

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
}

.card-title > i,
.card-title > .fa,
.card-title > .fas {
    color: var(--brand-strong);
    font-size: 15px;
}

.card-desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: -10px;
    margin-bottom: 16px;
}

/* --------------------------------------------------------------------------
   レイアウトユーティリティ
   -------------------------------------------------------------------------- */
.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stack-sm {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.row--end {
    justify-content: flex-end;
}

.row--between {
    justify-content: space-between;
}

.grow {
    flex: 1;
    min-width: 0;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-2 {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.grid-auto {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

@media (max-width: 760px) {
    .grid-2,
    .grid-3 {
        grid-template-columns: minmax(0, 1fr);
    }
}

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

.subtle {
    color: var(--text-subtle);
}

.small {
    font-size: 13px;
}

.mono {
    font-family: var(--font-mono);
    font-size: 0.95em;
}

.break {
    word-break: break-all;
    overflow-wrap: anywhere;
}

.mt-0 {
    margin-top: 0 !important;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.divider {
    height: 1px;
    background: var(--border);
    border: 0;
    margin: 20px 0;
}

/* --------------------------------------------------------------------------
   ボタン
   -------------------------------------------------------------------------- */
.btn {
    --btn-bg: var(--surface);
    --btn-fg: var(--text);
    --btn-border: var(--border-strong);
    --btn-hover-bg: var(--surface-2);

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid var(--btn-border);
    border-radius: 10px;
    background: var(--btn-bg);
    color: var(--btn-fg);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s,
        transform 0.05s,
        box-shadow 0.15s;
}

.btn:hover {
    background: var(--btn-hover-bg);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    --btn-bg: var(--brand-strong);
    --btn-fg: var(--on-brand);
    --btn-border: var(--brand-strong);
    --btn-hover-bg: var(--brand-hover);
    box-shadow: 0 1px 2px rgba(78, 125, 39, 0.3);
}

.btn-soft {
    --btn-bg: var(--brand-soft);
    --btn-fg: var(--brand-strong);
    --btn-border: transparent;
    --btn-hover-bg: color-mix(in srgb, var(--brand) 22%, transparent);
}

.btn-ghost {
    --btn-bg: transparent;
    --btn-fg: var(--text-muted);
    --btn-border: transparent;
    --btn-hover-bg: var(--surface-2);
}

.btn-danger {
    --btn-bg: transparent;
    --btn-fg: var(--danger);
    --btn-border: color-mix(in srgb, var(--danger) 40%, transparent);
    --btn-hover-bg: var(--danger-soft);
}

.btn-sm {
    min-height: 32px;
    padding: 5px 11px;
    font-size: 13px;
    border-radius: 8px;
}

.btn-lg {
    min-height: 48px;
    padding: 12px 22px;
    font-size: 15px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 40px;
    padding: 0;
}

.btn-sm.btn-icon {
    width: 32px;
}

.btn .spinner {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* --------------------------------------------------------------------------
   フォーム
   -------------------------------------------------------------------------- */
fieldset.field,
fieldset.fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

fieldset > legend.label {
    padding: 0;
    margin-bottom: 6px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.hint {
    font-size: 12px;
    color: var(--text-subtle);
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 13px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    transition:
        border-color 0.15s,
        box-shadow 0.15s,
        background 0.15s;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-subtle);
}

.input:hover,
.select:hover,
.textarea:hover {
    border-color: color-mix(in srgb, var(--brand) 50%, var(--border-strong));
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--focus-ring);
}

.input[aria-invalid="true"],
.textarea[aria-invalid="true"] {
    border-color: var(--danger);
}

.input-lg {
    min-height: 50px;
    font-size: 16px;
    padding: 12px 16px;
}

.textarea {
    min-height: 140px;
    resize: vertical;
    line-height: 1.6;
}

.textarea.mono,
.input.mono {
    font-size: 14px;
}

.select {
    appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%238a9681' stroke-width='1.6' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

.input-group {
    display: flex;
    gap: 8px;
}

.input-group > .input {
    flex: 1;
    min-width: 0;
}

@media (max-width: 560px) {
    .input-group--stack {
        flex-direction: column;
    }
}

/* チェックボックス / ラジオをチップ風に表示する: <label class="check"><input type="checkbox"><span>…</span></label> */
.check {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    transition:
        background 0.15s,
        border-color 0.15s;
}

.check:hover {
    border-color: var(--border-strong);
    background: var(--surface-2);
}

.check input {
    appearance: none;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 1.5px solid var(--border-strong);
    border-radius: 5px;
    background: var(--surface);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition:
        background 0.15s,
        border-color 0.15s;
}

.check input[type="radio"] {
    border-radius: 50%;
}

.check input::after {
    content: "";
    width: 10px;
    height: 6px;
    border-left: 2px solid var(--on-brand);
    border-bottom: 2px solid var(--on-brand);
    transform: translateY(-1px) rotate(-45deg) scale(0);
    transition: transform 0.12s ease;
}

.check input[type="radio"]::after {
    width: 8px;
    height: 8px;
    border: 0;
    border-radius: 50%;
    background: var(--on-brand);
    transform: scale(0);
}

.check input:checked {
    background: var(--brand-strong);
    border-color: var(--brand-strong);
}

.check input:checked::after {
    transform: translateY(-1px) rotate(-45deg) scale(1);
}

.check input[type="radio"]:checked::after {
    transform: scale(1);
}

.check:has(input:checked) {
    border-color: color-mix(in srgb, var(--brand) 55%, transparent);
    background: var(--brand-softer);
}

.check:has(input:focus-visible) {
    box-shadow: var(--focus-ring);
}

.check:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
}

.check-group {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.check-group--wide {
    grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
}

/* セグメント切替: <div class="segmented"><button aria-pressed="true">…</button>…</div> */
.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    padding: 3px;
    gap: 2px;
    border-radius: 11px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.segmented > button,
.segmented > label {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 13px;
    border-radius: 8px;
    cursor: pointer;
    transition:
        background 0.15s,
        color 0.15s;
}

.segmented > button:hover,
.segmented > label:hover {
    color: var(--text);
}

.segmented > button[aria-pressed="true"],
.segmented > button[aria-selected="true"],
.segmented > label:has(input:checked) {
    background: var(--surface);
    color: var(--brand-strong);
    box-shadow: var(--shadow-sm);
}

.segmented > label {
    position: relative;
}

.segmented > label input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented > label:has(input:focus-visible) {
    box-shadow: var(--focus-ring);
}

/* レンジスライダー */
.range {
    width: 100%;
    height: 6px;
    appearance: none;
    border-radius: 999px;
    background: linear-gradient(
        to right,
        var(--brand-strong) 0%,
        var(--brand-strong) var(--range-pct, 50%),
        var(--surface-3) var(--range-pct, 50%)
    );
    cursor: pointer;
}

.range::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--brand-strong);
    box-shadow: var(--shadow-sm);
}

.range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--brand-strong);
}

/* --------------------------------------------------------------------------
   タブ: <div class="tabs" role="tablist"><button class="tab" role="tab" aria-selected="true">
   -------------------------------------------------------------------------- */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 14px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition:
        color 0.15s,
        background 0.15s;
}

.tab:hover {
    color: var(--text);
    background: var(--surface-2);
}

.tab[aria-selected="true"] {
    color: var(--brand-strong);
}

.tab[aria-selected="true"]::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: var(--brand-strong);
}

.tab .badge {
    font-size: 11px;
    padding: 1px 7px;
}

/* --------------------------------------------------------------------------
   アラート / バッジ
   -------------------------------------------------------------------------- */
.alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 14px;
    line-height: 1.6;
}

.alert > i {
    margin-top: 3px;
}

.alert-error {
    background: var(--danger-soft);
    border-color: color-mix(in srgb, var(--danger) 30%, transparent);
    color: var(--danger);
}

.alert-success {
    background: var(--success-soft);
    border-color: color-mix(in srgb, var(--success) 30%, transparent);
    color: var(--success);
}

.alert-warning {
    background: var(--warning-soft);
    border-color: color-mix(in srgb, var(--warning) 30%, transparent);
    color: var(--warning);
}

.alert-info {
    background: var(--info-soft);
    border-color: color-mix(in srgb, var(--info) 25%, transparent);
    color: var(--info);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    background: var(--surface-3);
    color: var(--text-muted);
    white-space: nowrap;
}

.badge-brand {
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.badge-success {
    background: var(--success-soft);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-info {
    background: var(--info-soft);
    color: var(--info);
}

/* --------------------------------------------------------------------------
   テーブル / キーバリュー / コード
   -------------------------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th,
.table td {
    padding: 10px 14px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

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

.table tbody tr:hover td {
    background: var(--brand-softer);
}

.kv {
    display: grid;
    grid-template-columns: minmax(110px, max-content) 1fr;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 14px;
}

.kv > dt,
.kv > dd {
    margin: 0;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
}

.kv > dt {
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
}

.kv > dd {
    min-width: 0;
    overflow-wrap: anywhere;
}

.kv > dt:nth-last-of-type(1),
.kv > dd:last-of-type {
    border-bottom: 0;
}

@media (max-width: 520px) {
    .kv {
        grid-template-columns: 1fr;
    }

    .kv > dt {
        border-bottom: 0;
        padding-bottom: 2px;
    }

    .kv > dt:nth-last-of-type(1) {
        border-bottom: 0;
    }
}

.stat {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.stat__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.stat__value {
    margin-top: 2px;
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.code-block {
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-all;
    overflow: auto;
    max-height: 480px;
}

kbd {
    padding: 1px 6px;
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--surface);
    font-size: 12px;
}

/* --------------------------------------------------------------------------
   状態表示
   -------------------------------------------------------------------------- */
.spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid var(--brand-soft);
    border-top-color: var(--brand-strong);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 16px;
    color: var(--text-muted);
    font-size: 14px;
}

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 36px 16px;
    color: var(--text-subtle);
    font-size: 14px;
    text-align: center;
}

.empty > i {
    font-size: 28px;
    opacity: 0.6;
}

/* トースト */
.toast-region {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transform: translateX(-50%);
    pointer-events: none;
    width: max-content;
    max-width: calc(100vw - 32px);
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    border-radius: 12px;
    background: #1f2a19;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.2s ease;
    pointer-events: auto;
}

:root[data-theme="dark"] .toast {
    background: #e6ecdf;
    color: #11180d;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .toast {
        background: #e6ecdf;
        color: #11180d;
    }
}

.toast i {
    color: #9ccc65;
}

.toast--error i {
    color: #ef5350;
}

.toast.is-leaving {
    animation: toast-out 0.2s ease forwards;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(6px);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (max-width: 640px) {
    .page {
        padding-top: 20px;
    }

    .card {
        padding: 18px;
        border-radius: var(--radius);
    }

    .page-header__icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
        border-radius: 12px;
    }

    .menu-btn__label {
        display: none;
    }

    .site-header__crumb {
        display: none;
    }
}

@media print {
    .site-header,
    .site-footer,
    .toast-region {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .card {
        box-shadow: none;
    }
}
