/* ===========================================================
   Anken Agent (Infinity) — Common stylesheet
   =========================================================== */
:root {
    --sidebar-bg: #f3f6fb;
    --sidebar-active: #e4ecf9;
    --sidebar-border: #d8dde6;

    --primary: #1746a2;
    --primary-dark: #0c2c66;
    --primary-light: #e8f0ff;

    --danger: #d22d2d;
    --success: #0fa958;
    --warning: #f59e0b;

    --text-main: #1f2937;
    --text-muted: #6b7280;
    --text-soft: #9ca3af;

    --border: #e2e6ed;
    --border-strong: #c4cad4;
    --bg-subtle: #fafbfd;
}

html, body { height: 100%; }
body {
    background: #fff;
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
        "ヒラギノ角ゴ ProN W3", "Yu Gothic UI", Meiryo, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

/* === Layout === */
.app-layout { display: flex; min-height: 100vh; }
.app-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    align-self: flex-start;
    z-index: 50;
    transition: transform 0.25s ease;
}
.app-sidebar::-webkit-scrollbar { width: 6px; }
.app-sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }

/* モバイル用トップバー(ハンバーガー) - PC では非表示 */
.mobile-topbar { display: none; }
.mobile-menu-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--primary-dark);
    padding: 8px 12px;
    cursor: pointer;
    line-height: 1;
}
.mobile-brand {
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: 2px;
    font-size: 16px;
}

/* オーバーレイ - PC では非表示 */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 30, 80, 0.45);
    z-index: 40;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* ===== モバイル/タブレット ===== */
@media (max-width: 991px) {
    .app-layout { flex-direction: column; }

    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 8px;
        background: #fff;
        border-bottom: 1px solid var(--border);
        padding: 6px 8px;
        position: sticky;
        top: 0;
        z-index: 30;
    }

    .app-sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100vh;
        transform: translateX(-100%);
        box-shadow: 4px 0 16px rgba(15, 30, 80, 0.15);
    }
    .app-layout.sidebar-open .app-sidebar {
        transform: translateX(0);
    }
    .app-layout.sidebar-open .sidebar-overlay {
        display: block;
        opacity: 1;
    }

    .app-main { width: 100%; min-width: 0; }
    .container-fluid.p-4 { padding: 16px !important; }

    /* テーブルが横長すぎる時の対策 */
    .table { font-size: 13px; }
}

@media (max-width: 576px) {
    .app-sidebar { width: 84vw; max-width: 320px; }
    .page-title { font-size: 1.3rem; }
    .stat-card .stat-value { font-size: 22px; }
}
.sidebar-brand {
    padding: 18px 20px;
    border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-brand .brand-text {
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--primary-dark);
    font-size: 18px;
}
.sidebar-user {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-user i.bi { font-size: 28px; color: var(--primary); }
.sidebar-nav { padding: 12px 0; flex-grow: 1; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 14px;
}
.sidebar-link.sub { padding-left: 36px; font-size: 13px; color: var(--text-muted); }
.sidebar-link:hover { background: #e8effa; }
.sidebar-link.active { background: var(--sidebar-active); font-weight: 600; }
.sidebar-footer { border-top: 1px solid var(--sidebar-border); padding: 8px 0; }
.app-main {
    flex-grow: 1;
    background: #fff;
    min-width: 0;            /* flex で内側が縮まらず横はみ出すのを防ぐ */
    /* overflow-x: auto はやめる。指定すると子要素の position: sticky が
       app-main を基準にしてしまい、ビューポートに対して動かなくなる */
}
/* 横に長いテーブルは個別にスクロールさせる */
.table-responsive { overflow-x: auto; }

/* === Page parts === */
.page-title {
    font-weight: 800;
    margin-bottom: 20px;
    font-size: 1.6rem;
    color: var(--primary-dark);
}

.section { margin-bottom: 32px; }
.section h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.section h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: var(--primary);
    border-radius: 2px;
}

/* ===========================================================
   Forms — 入力 / ラベル / セクション
   =========================================================== */
.form-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(15, 30, 80, 0.03);
}

.form-card h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border);
}

.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 13px;
    color: #374151;
    margin-bottom: 4px;
}
.form-label .req {
    display: inline-block;
    background: #fde7e7;
    color: var(--danger);
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    line-height: 1.4;
}
.form-label .opt {
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 500;
}

.form-control,
select.form-control,
textarea.form-control,
input[type=text].form-control,
input[type=email].form-control,
input[type=password].form-control,
input[type=number].form-control,
input[type=date].form-control,
input[type=time].form-control,
input[type=url].form-control {
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    padding: 7px 11px;
    font-size: 14px;
    background: #fff;
    color: var(--text-main);
    box-shadow: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem rgba(23, 70, 162, 0.15);
    outline: none;
}
.form-control::placeholder { color: var(--text-soft); }
.form-control[readonly], .form-control:disabled {
    background: #f3f4f6;
    color: var(--text-muted);
}
textarea.form-control { min-height: 80px; resize: vertical; }

input[type=file].form-control {
    padding: 6px 10px;
    background: var(--bg-subtle);
}

/* select の矢印を統一 */
select.form-control {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7280' d='M8 11.5L2.5 6h11z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 32px;
}

.form-help { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* チェックボックス/ラジオ */
.form-check { padding-left: 1.6em; }
.form-check-input {
    width: 1.1em; height: 1.1em;
    margin-top: 0.2em;
    margin-left: -1.6em;
    border: 1px solid var(--border-strong);
}
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}
.form-check-label { font-size: 14px; }

/* チェックリスト（複数チェックを枠で囲む） */
.check-list {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    background: var(--bg-subtle);
    max-height: 220px;
    overflow-y: auto;
}
.check-list ul { list-style: none; padding: 0; margin: 0; }
.check-list li { display: inline-flex; align-items: center; gap: 6px; margin: 4px 14px 4px 0; }
.check-list li input[type=checkbox] { transform: translateY(1px); }

/* チェックボックス1個用の枠 */
.toggle-card {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 100%;
}

/* === Search box === */
.search-box {
    background: var(--bg-subtle);
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 20px;
}
.search-box .search-actions { margin-top: 12px; text-align: right; }

/* === Buttons === */
.btn { font-size: 14px; padding: 7px 16px; border-radius: 6px; font-weight: 500; }
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}
.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-danger { background-color: var(--danger); border-color: var(--danger); }
.btn-sm { font-size: 12px; padding: 4px 10px; }

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

/* === Tables === */
.table { font-size: 14px; }
.table thead th {
    background: #f4f6fa;
    font-weight: 600;
    border-bottom: 2px solid var(--border-strong);
    color: #374151;
}
.table tbody td { vertical-align: middle; }

/* phase / status badges */
.phase-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 12px;
    margin: 2px;
    background: #eef1f5;
    color: #475569;
    cursor: pointer;
    border: 1px solid #d8dde6;
    text-decoration: none;
}
.phase-badge:hover { background: #e2e8f0; color: #0f172a; }
.phase-badge.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.phase-badge.on:hover { background: var(--primary-dark); color: #fff; }
.phase-badge.disabled { cursor: not-allowed; opacity: 0.5; }
/* 現在ステータス(チェック済みの最右) */
.phase-badge.latest {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary);
    font-weight: 600;
}
.phase-latest-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 8px;
    font-size: 10px;
    background: #fff;
    color: var(--primary);
    font-weight: 700;
}
/* 詳細画面のフェーズ欄はタイトルから少し離す */
.phase-section { margin-top: 28px; }
.phase-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* 詳細画面のフェーズバッジは大きめに (一覧の phase-badge には影響させない) */
.phase-bar .phase-badge {
    font-size: 15px;
    padding: 10px 18px;
    border-radius: 22px;
    margin: 0;
}
.phase-bar .phase-badge i { font-size: 15px; }
.phase-bar .phase-latest-tag { font-size: 12px; padding: 1px 8px; }
/* 現場フォームのフェーズ複数チェック */
.phase-check-group > div { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.phase-check-group label { font-weight: 500; cursor: pointer; }
.phase-check-group input { margin-right: 4px; }

/* 同伴者(職人/実習生)の複数チェック — 詳細フォーム & 工程表モーダル共通 */
.companion-check-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #d8dde6;
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
}
.companion-check-group > div { display: flex; flex-wrap: wrap; gap: 6px 16px; width: 100%; }
.companion-check-group label,
.companion-check { font-weight: 500; cursor: pointer; margin: 0; white-space: nowrap; }
.companion-check-group input { margin-right: 4px; }

/* 添付ファイルのサムネイル */
.attach-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.attach-item {
    width: 108px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px;
    background: #fff;
    position: relative;
}
.attach-thumb { display: block; cursor: zoom-in; }
.attach-thumb img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}
.attach-fileicon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
    font-size: 34px;
    color: var(--primary);
    text-decoration: none;
}
.attach-name {
    font-size: 11px;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attach-name a { text-decoration: none; color: #475569; }
.attach-del { position: absolute; top: 2px; right: 2px; background: rgba(255,255,255,.85); border-radius: 6px; }

/* status pill */
.status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

/* ===========================================================
   Auth screen - polished 2-pane layout
   =========================================================== */
.auth-body {
    background: #f5f7fb;
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 0;
    margin: 0;
    overflow: hidden;
}
.auth-shell {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* === 左ペイン: ブランド === */
.auth-brand {
    flex: 1;
    background: linear-gradient(135deg, #0c2c66 0%, #07194a 60%, #050f33 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* 中央のソフトな光 */
.auth-brand::after {
    content: '';
    position: absolute;
    width: 520px; height: 520px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(95, 145, 230, 0.30) 0%, transparent 65%);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.auth-brand .brand-center {
    position: relative;
    z-index: 1;
    text-align: center;
}
.auth-brand .brand-title {
    font-size: 60px;
    font-weight: 800;
    letter-spacing: 10px;
    margin: 0;
    color: #fff;
    text-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

/* === 右ペイン: フォーム === */
.auth-form-pane {
    flex: 0.9;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border: none;
    animation: fadeUp 0.5s ease;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.auth-card h5 {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-dark);
    margin: 0 0 6px;
}
.auth-sub {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 28px;
}

.auth-card .form-group { margin-bottom: 16px; }
.auth-card .form-label {
    font-size: 12px;
    color: #4b5563;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* 入力にアイコン付き */
.auth-input-wrap {
    position: relative;
}
.auth-input-wrap > i.bi {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-soft);
    font-size: 16px;
    pointer-events: none;
}
.auth-input-wrap input {
    padding-left: 40px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid #d8dde6;
    background: #fafbfd;
    font-size: 14px;
    width: 100%;
    transition: all 0.15s;
}
.auth-input-wrap input:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(23, 70, 162, 0.12);
    outline: none;
}
.auth-input-wrap input:focus + i.bi,
.auth-input-wrap:focus-within > i.bi { color: var(--primary); }

.auth-card .btn-primary {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 8px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(23, 70, 162, 0.25);
    transition: transform 0.12s, box-shadow 0.12s;
}
.auth-card .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(23, 70, 162, 0.35);
}
.auth-card .btn-primary:active { transform: translateY(0); }

.auth-meta {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #eef0f4;
    text-align: center;
    font-size: 12.5px;
    color: var(--text-muted);
}
.auth-meta a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.auth-meta a:hover { text-decoration: underline; }

.auth-role-switch {
    margin-top: 14px;
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 11.5px;
}
.auth-role-switch a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    transition: all 0.12s;
}
.auth-role-switch a:hover {
    color: var(--primary-dark);
    border-color: var(--primary);
    background: var(--primary-light);
}
.auth-role-switch a.current {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
}

/* レスポンシブ */
@media (max-width: 900px) {
    .auth-shell { flex-direction: column; }
    .auth-brand {
        flex: 0 0 auto;
        min-height: 140px;
        padding: 30px 24px;
    }
    .auth-brand .brand-title { font-size: 32px; letter-spacing: 6px; }
    .auth-form-pane { padding: 32px 20px; }
}

/* === Dashboard cards === */
.stat-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
}
.stat-card .stat-label { color: var(--text-muted); font-size: 13px; }
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-top: 2px;
}

/* ===========================================================
   Manual / Tutorial pages
   =========================================================== */
html { scroll-behavior: smooth; }

/* マニュアルのトップで紹介するロールバナー */
.manual-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 6px 20px rgba(12, 44, 102, 0.18);
    display: flex;
    align-items: center;
    gap: 18px;
}
.manual-hero .hero-icon {
    width: 60px; height: 60px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
}
.manual-hero h1 {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 4px;
}
.manual-hero p { margin: 0; opacity: 0.9; font-size: 14px; }

/* 2カラムレイアウト */
.manual-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    align-items: start;
}
@media (max-width: 992px) {
    .manual-layout { grid-template-columns: 1fr; }
    .manual-toc-sticky { position: static !important; }
}

/* 左サイドの目次 */
.manual-toc-sticky {
    position: -webkit-sticky;   /* Safari 互換 */
    position: sticky;
    top: 16px;
    align-self: start;          /* grid 内で高さを内容ぶんに抑えて sticky を有効化 */
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 12px 16px 18px;
    box-shadow: 0 2px 8px rgba(15, 30, 80, 0.04);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    z-index: 5;
}
.manual-toc-sticky h5 {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0 0 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}
.manual-toc-sticky ol { list-style: none; padding: 0; margin: 0; counter-reset: toc; }
.manual-toc-sticky li {
    counter-increment: toc;
    margin: 0;
    padding: 0;
}
.manual-toc-sticky a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    color: #4b5563;
    text-decoration: none;
    font-size: 13px;
    border-radius: 6px;
    transition: all 0.12s;
    border-left: 3px solid transparent;
}
.manual-toc-sticky a:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}
.manual-toc-sticky a::before {
    content: counter(toc, decimal-leading-zero);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-soft);
    background: var(--bg-subtle);
    border-radius: 4px;
    padding: 2px 5px;
    min-width: 24px;
    text-align: center;
}
.manual-toc-sticky a.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    border-left-color: var(--primary-dark);
}
.manual-toc-sticky a.active::before {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* 各セクションのカード */
.manual-section {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 20px;
    box-shadow: 0 2px 6px rgba(15, 30, 80, 0.04);
    scroll-margin-top: 16px;
    transition: box-shadow 0.2s;
}
.manual-section:hover { box-shadow: 0 4px 14px rgba(15, 30, 80, 0.08); }
.manual-section:target { box-shadow: 0 0 0 3px var(--primary-light), 0 4px 16px rgba(23, 70, 162, 0.18); }

.manual-section .sec-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--primary-light);
}
.manual-section .sec-no {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(23, 70, 162, 0.25);
}
.manual-section .sec-title {
    flex-grow: 1;
}
.manual-section h2 {
    font-size: 19px;
    font-weight: 800;
    color: var(--primary-dark);
    margin: 0;
    line-height: 1.3;
}
.manual-section .sec-sub {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 2px;
}
.manual-section h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin: 18px 0 10px;
    padding-left: 10px;
    border-left: 4px solid var(--primary);
}

.manual-section p, .manual-section li { font-size: 14px; line-height: 1.85; color: #2d3543; }
.manual-section p { margin-bottom: 10px; }

/* ステップリスト */
.manual-section ol.steps {
    list-style: none;
    counter-reset: step;
    padding: 0;
    margin: 14px 0;
}
.manual-section ol.steps > li {
    counter-increment: step;
    position: relative;
    padding: 12px 14px 12px 50px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
}
.manual-section ol.steps > li::before {
    content: counter(step);
    position: absolute;
    left: 12px;
    top: 12px;
    width: 28px; height: 28px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

/* 通常のリスト */
.manual-section ul:not(.plain) {
    list-style: none;
    padding-left: 0;
    margin-bottom: 8px;
}
.manual-section ul:not(.plain) > li {
    position: relative;
    padding-left: 22px;
    margin-bottom: 4px;
}
.manual-section ul:not(.plain) > li::before {
    content: '\F26B';   /* bootstrap-icons check2 */
    font-family: "bootstrap-icons";
    position: absolute;
    left: 0;
    top: 2px;
    color: var(--primary);
    font-size: 13px;
}

/* コード・キー表示 */
.manual-section code,
.manual-section kbd {
    background: #f1f3f7;
    color: var(--primary-dark);
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 12.5px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    border: 1px solid var(--border);
}

/* TIP / INFO / WARN ボックス */
.manual-section .tip,
.manual-section .warn,
.manual-section .info {
    border-radius: 8px;
    padding: 12px 14px 12px 44px;
    margin: 14px 0;
    font-size: 13.5px;
    border-left: 4px solid;
    position: relative;
    line-height: 1.7;
}
.manual-section .tip::before,
.manual-section .info::before,
.manual-section .warn::before {
    font-family: "bootstrap-icons";
    position: absolute;
    left: 14px;
    top: 12px;
    font-size: 18px;
}
.manual-section .tip {
    background: #ecfdf5; border-color: #0fa958; color: #065f46;
}
.manual-section .tip::before { content: '\F299'; color: #0fa958; }      /* lightbulb */
.manual-section .info {
    background: #eff6ff; border-color: #1746a2; color: #0c2c66;
}
.manual-section .info::before { content: '\F431'; color: #1746a2; }     /* info-circle */
.manual-section .warn {
    background: #fffbeb; border-color: #f59e0b; color: #92400e;
}
.manual-section .warn::before { content: '\F33A'; color: #f59e0b; }     /* exclamation-triangle */

/* バッジ風強調 */
.manual-section .badge-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary);
    color: #fff;
    padding: 2px 10px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    margin: 0 2px;
}
.manual-section .badge-menu {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 12.5px;
    font-weight: 600;
    border: 1px solid #c7dafd;
    margin: 0 2px;
}

/* 戻るtopボタン */
.back-to-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(15, 30, 80, 0.25);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    font-size: 18px;
}
.back-to-top:hover { background: var(--primary-dark); }
.back-to-top.show { display: inline-flex; }

/* === Radio group === */
.radio-group {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}
.radio-group ul { list-style: none; padding: 0; margin: 0; display: inline-flex; gap: 8px; flex-wrap: wrap; }
.radio-group li { margin: 0; }
.radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
}
.radio-group label:has(input:checked) {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.radio-group input[type="radio"] { margin: 0; }

/* ===========================================================
   FullCalendar 領域 - polished design
   =========================================================== */
.calendar-area {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(15, 30, 80, 0.05);
}

/* --- Toolbar (前へ/次へ/today/月週リスト) --- */
.fc .fc-toolbar.fc-header-toolbar {
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 8px;
}
.fc .fc-toolbar-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: 1px;
}
.fc .fc-button-primary {
    background: #fff;
    border: 1px solid var(--border-strong);
    color: var(--text-main);
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 6px;
    box-shadow: none;
    transition: all 0.15s;
    text-transform: none;
    line-height: 1.4;
}
.fc .fc-button-primary:focus { box-shadow: 0 0 0 0.15rem rgba(23, 70, 162, 0.15); }
.fc .fc-button-primary:not(:disabled):hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}
.fc .fc-button-group > .fc-button { border-radius: 0; }
.fc .fc-button-group > .fc-button:first-child { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.fc .fc-button-group > .fc-button:last-child { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.fc .fc-today-button {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.fc .fc-today-button:not(:disabled):hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}
.fc .fc-icon { font-size: 14px; }

/* --- 全体の枠線・テーブル --- */
.fc-theme-standard td,
.fc-theme-standard th,
.fc-theme-standard .fc-scrollgrid {
    border-color: #eef0f4;
}
.fc-theme-standard .fc-scrollgrid {
    border-radius: 8px;
    overflow: hidden;
}

/* --- 列ヘッダー(日/月/火...) --- */
.fc .fc-col-header-cell {
    background: linear-gradient(180deg, #f6f8fc 0%, #eef2f8 100%);
    padding: 8px 0;
}
.fc .fc-col-header-cell-cushion {
    color: var(--text-main);
    text-decoration: none !important;
    font-weight: 700;
    font-size: 13px;
    padding: 6px 8px;
    letter-spacing: 0.5px;
}
.fc .fc-col-header-cell:nth-child(1) .fc-col-header-cell-cushion,  /* 日曜 */
.fc .fc-day-sun .fc-col-header-cell-cushion { color: #d22d2d; }
.fc .fc-col-header-cell:nth-child(7) .fc-col-header-cell-cushion,  /* 土曜 */
.fc .fc-day-sat .fc-col-header-cell-cushion { color: #1746a2; }

/* --- 日付セル --- */
.fc .fc-daygrid-day-frame { padding: 2px; }
.fc .fc-daygrid-day-top { justify-content: flex-end; padding: 4px 6px 2px; }
.fc .fc-daygrid-day-number {
    color: var(--text-main);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none !important;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1.4;
}
.fc .fc-daygrid-day.fc-day-sun .fc-daygrid-day-number { color: #d22d2d; }
.fc .fc-daygrid-day.fc-day-sat .fc-daygrid-day-number { color: #1746a2; }
.fc .fc-day-other .fc-daygrid-day-number { color: var(--text-soft); font-weight: 500; }

/* 土日の薄い背景 */
.fc .fc-day-sun { background: rgba(210, 45, 45, 0.025); }
.fc .fc-day-sat { background: rgba(23, 70, 162, 0.025); }

/* 当日 */
.fc .fc-day-today {
    background: linear-gradient(180deg, #fff8e1 0%, #fff3cd 100%) !important;
    box-shadow: inset 0 0 0 2px var(--primary);
}
.fc .fc-day-today .fc-daygrid-day-number {
    background: var(--primary);
    color: #fff !important;
    font-weight: 800;
    padding: 2px 8px;
}

/* セルにホバー */
.fc .fc-daygrid-day:hover { background: #f8fafd; }
.fc .fc-day-today:hover { background: linear-gradient(180deg, #fff5d0 0%, #ffeaa8 100%) !important; }

/* --- イベント (作業バー) --- */
.fc .fc-daygrid-event,
.fc .fc-timegrid-event {
    border-radius: 4px;
    border-width: 0;
    border-left-width: 3px;
    padding: 2px 6px;
    margin: 1px 2px;
    font-size: 11.5px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(15, 30, 80, 0.12);
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
    color: #fff;
}
.fc .fc-daygrid-event:hover,
.fc .fc-timegrid-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(15, 30, 80, 0.2);
    filter: brightness(1.05);
}
.fc-event-title-container { padding: 0 2px; }
.fc-event-title { font-weight: 600; letter-spacing: 0.2px; }
.fc-event-time { font-weight: 700; opacity: 0.95; }

/* リスト表示 */
.fc-list-event:hover td { background: var(--primary-light); }
.fc-list-day-cushion { background: #f4f6fa !important; }
.fc-list-day-text, .fc-list-day-side-text { color: var(--primary-dark) !important; font-weight: 700; }

/* week / day view の時間軸 */
.fc-timegrid-axis,
.fc-timegrid-slot-label {
    color: var(--text-muted);
    font-size: 11px;
}
.fc-timegrid-now-indicator-line { border-color: #d22d2d; }
.fc-timegrid-now-indicator-arrow { border-color: #d22d2d; color: #d22d2d; }

/* もっと表示 (+N more) */
.fc .fc-daygrid-more-link {
    color: var(--primary);
    font-weight: 700;
    font-size: 11px;
    padding: 2px 4px;
}
.fc .fc-daygrid-more-link:hover { background: var(--primary-light); border-radius: 4px; }

/* ポップオーバー */
.fc-popover { border-radius: 8px !important; box-shadow: 0 6px 24px rgba(15, 30, 80, 0.15) !important; }
.fc-popover-header { background: var(--primary) !important; color: #fff !important; padding: 8px 12px !important; }
.fc-popover-title { font-weight: 700; }

/* イベント詳細モーダル */
.event-modal { border-radius: 12px; overflow: hidden; border: none; }
.event-modal-header {
    color: #fff;
    padding: 16px 20px;
    border-bottom: none;
    align-items: center;
}
.event-modal-header .modal-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    color: #fff;
}
.event-modal-color {
    display: inline-block;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25);
}
.event-modal .modal-body { padding: 20px 24px; }
.event-modal-body {
    display: grid;
    grid-template-columns: 130px 1fr;
    column-gap: 16px;
    row-gap: 10px;
    margin: 0;
}
.event-modal-body dt {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.event-modal-body dt i.bi { color: var(--primary); font-size: 15px; }
.event-modal-body dd {
    margin: 0;
    color: var(--text-main);
    font-size: 14px;
    word-break: break-word;
}
.event-modal .modal-footer {
    border-top: 1px solid var(--border);
    padding: 12px 20px;
    gap: 8px;
}

/* ===========================================================
   工程表タブ + Kanban ボード
   =========================================================== */
.schedule-tabs {
    border-bottom: 2px solid var(--border);
}
.schedule-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    border-radius: 0;
    padding: 10px 18px;
    font-weight: 600;
    font-size: 14px;
    background: transparent;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.schedule-tabs .nav-link:hover {
    color: var(--primary-dark);
    background: var(--primary-light);
}
.schedule-tabs .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: transparent;
}

/* Kanban */
.kanban-board {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 260px;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 12px;
    align-items: start;
}
.kanban-board::-webkit-scrollbar { height: 10px; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }

.kanban-col {
    background: #f6f8fc;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 78vh;
}
.kanban-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    color: #fff;
    font-weight: 700;
    font-size: 13.5px;
    letter-spacing: 0.5px;
}
.kanban-col-count {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 1px 9px;
    font-size: 12px;
    font-weight: 700;
}
.kanban-color-secondary { background: #6b7280; }
.kanban-color-info      { background: #0891b2; }
.kanban-color-warning   { background: #f59e0b; }
.kanban-color-primary   { background: var(--primary); }
.kanban-color-success   { background: var(--success); }
.kanban-color-dark      { background: #374151; }

.kanban-col-body {
    padding: 8px;
    overflow-y: auto;
    flex-grow: 1;
}
.kanban-card {
    display: block;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.12s;
    box-shadow: 0 1px 1px rgba(15, 30, 80, 0.04);
}
.kanban-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 30, 80, 0.1);
    border-color: var(--primary);
}
.kanban-card-title {
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 14px;
    margin-bottom: 6px;
    line-height: 1.4;
}
.kanban-card-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin: 2px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    align-items: center;
}
.kanban-card-meta i.bi { color: var(--primary); font-size: 12px; }
.kanban-card-meta.dates { color: #4b5563; }
.kanban-chip {
    background: #eef1f5;
    color: #475569;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.kanban-empty {
    text-align: center;
    color: var(--text-soft);
    font-size: 12px;
    padding: 16px 0;
}

@media (max-width: 768px) {
    .kanban-board {
        grid-auto-columns: 78vw;
        scroll-snap-type: x mandatory;
    }
    .kanban-col { scroll-snap-align: start; max-height: 70vh; }
}

/* === スマホ用 FullCalendar 縮小 === */
@media (max-width: 768px) {
    .calendar-area { padding: 10px; border-radius: 8px; }

    /* ツールバー */
    .fc .fc-toolbar.fc-header-toolbar {
        flex-wrap: wrap;
        gap: 4px;
        margin-bottom: 8px;
    }
    .fc .fc-toolbar-chunk { display: flex; gap: 4px; }
    .fc .fc-toolbar-title { font-size: 15px !important; letter-spacing: 0; }
    .fc .fc-button-primary {
        padding: 4px 8px !important;
        font-size: 11.5px !important;
    }
    .fc .fc-icon { font-size: 11px; }

    /* 列ヘッダー (日/月/火...) */
    .fc .fc-col-header-cell { padding: 3px 0; }
    .fc .fc-col-header-cell-cushion {
        font-size: 10.5px !important;
        padding: 2px 1px !important;
        letter-spacing: 0;
    }

    /* 日付数字 */
    .fc .fc-daygrid-day-top { padding: 1px 2px !important; }
    .fc .fc-daygrid-day-number {
        font-size: 10.5px !important;
        padding: 1px 4px !important;
    }
    .fc .fc-day-today .fc-daygrid-day-number {
        padding: 1px 5px !important;
    }
    .fc .fc-daygrid-day-frame { min-height: 36px !important; padding: 1px; }

    /* イベントバー */
    .fc .fc-daygrid-event {
        font-size: 9.5px !important;
        padding: 0 3px !important;
        margin: 1px !important;
        border-left-width: 2px !important;
        border-radius: 3px !important;
    }
    .fc .fc-event-title,
    .fc .fc-event-time { font-size: 9.5px !important; }
    .fc-event-title-container { padding: 0 1px; }

    /* もっと表示 */
    .fc .fc-daygrid-more-link {
        font-size: 9.5px !important;
        padding: 1px 3px !important;
    }

    /* 週/日ビューの時間軸 */
    .fc-timegrid-axis,
    .fc-timegrid-slot-label { font-size: 9.5px !important; }
    .fc .fc-timegrid-event { font-size: 10px !important; padding: 1px 3px !important; }

    /* リストビュー */
    .fc .fc-list-event-time,
    .fc .fc-list-event-title { font-size: 12px !important; }
    .fc .fc-list-day-cushion { padding: 4px 8px !important; }

    /* カレンダー全体の高さ縮小 */
    .calendar-area .fc { height: auto !important; }
}

@media (max-width: 480px) {
    /* さらに狭い時はもう一段下げる */
    .fc .fc-toolbar-title { font-size: 13px !important; }
    .fc .fc-button-primary { padding: 3px 6px !important; font-size: 10.5px !important; }
    .fc .fc-daygrid-day-number { font-size: 9.5px !important; }
    .fc .fc-daygrid-event { font-size: 9px !important; }
    .fc .fc-col-header-cell-cushion { font-size: 9.5px !important; }
}

/* 凡例エリア */
.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--bg-subtle);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.calendar-legend .legend-item { display: inline-flex; align-items: center; gap: 6px; }
.calendar-legend .legend-color {
    width: 14px; height: 14px;
    border-radius: 3px;
    display: inline-block;
}

/* details/summary 折りたたみフォーム */
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 8px; }
