/* ============================================================
   1. デザインシステム変数
   ============================================================ */
:root {
    --legal-primary-dark: #001a17;
    --legal-primary: #00453e;
    --legal-accent: #00c2a8;
    --legal-interactive: #0d6efd;
    --legal-bg-light: #f8fafc;
    --legal-text-main: #1e293b;
    --legal-text-muted: #64748b;
    --font-family-soft: 'Inter', 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif;
    --sidebar-width: 280px;
    /* ハイライト用カラー定義 */
    --highlight-active: #f59e0b; /* Amber */
    --highlight-done: #10b981; /* Emerald */
    --text-scale-xxs: 0.65rem;
    --text-scale-xs: 0.7rem;
    --text-scale-sm: 0.75rem;
    --text-scale-md: 0.8rem;
    --text-scale-lg: 0.85rem;
    --text-scale-xl: 0.9rem;
    --text-scale-xxl: 0.95rem;
    --base-font-size: var(--text-scale-md);
    --bs-primary: #2c7be5;
    --bs-success: #00a870;
    --bs-warning: #f6c343;
    --bs-danger: #e63757;
}

/* ============================================================
   2. 基本設定 
   ============================================================ */
html, body {
    height: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    position: fixed; 
}

/* Blazorのルート要素も固定 */
#app {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

*, *::before, *::after {
    box-sizing: border-box;
}

a, .btn-link {
    color: var(--legal-interactive);
}

/* ============================================================
   2.5. 文字サイズ
   ============================================================ */
/* クラスによるルートのフォントサイズ変更 (Bootstrapのremを自動スケールさせる) */
:root:has(.page.text-size-xxs) { font-size: 81.25%; }
:root:has(.page.text-size-xs) { font-size: 87.5%; }
:root:has(.page.text-size-sm) { font-size: 93.75%; }
:root:has(.page.text-size-md) { font-size: 100%; }
:root:has(.page.text-size-lg) { font-size: 106.25%; }
:root:has(.page.text-size-xl) { font-size: 112.5%; }
:root:has(.page.text-size-xxl) { font-size: 118.75%; }

/* システム全体のスムーズなスケールトランジション */
html, body, .page {
    transition: font-size 0.2s ease;
}

.extra-small {
    font-size: 0.75rem;
}


/* ============================================================
   タイポグラフィ・UI基礎
   ============================================================ */
.majestic-title {
    font-weight: 800;
    font-size: 1.5em;
    color: var(--legal-primary);
    letter-spacing: 0.05em;
    margin-bottom: 0.4em !important;
    display: flex;
    align-items: center; transform: translateY(2px); }

    .majestic-title .bi {
        line-height: 1;
        display: block;
        transform: translateY(-1.1px);
    }

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6em 1.25em 0.7em 1.25em;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

/* ============================================================
   3. サイドバー 
   ============================================================ */
.sidebar {
    background-image: linear-gradient(180deg, var(--legal-primary-dark) 0%, var(--legal-primary) 100%) !important;
    letter-spacing: 0.05em;
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
    user-select: none;
    z-index: 1030;
}

    .sidebar .top-row {
        background-color: transparent !important; border-bottom: 1px solid rgba(255,255,255,0.1);
        min-height: 3.5rem;
        height: auto;
        display: flex;
        align-items: center;
        padding: 0 1.5rem;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        justify-content: space-between;
    }

    .sidebar .navbar-brand {
        font-weight: 800;
        color: #ffffff !important;
        letter-spacing: 0.1em;
        font-size: 1.1em;
        text-decoration: none;
    }

    .sidebar .navbar-toggler {
        background-color: transparent;
        border: none;
        padding: 0.25rem 0.5rem;
        font-size: 1em;
        cursor: pointer;
        outline: none;
        box-shadow: none !important;
    }

        .sidebar .navbar-toggler:focus, .sidebar .navbar-toggler:active {
            outline: none;
            box-shadow: none !important;
            transform: scale(0.95);
        }

.nav-item {
    padding: 0.2rem 0.8rem;
}

.sidebar .nav-link {
    display: flex !important;
    align-items: center !important;
    padding: 0.7rem 1.0rem !important;
    color: rgba(255, 255, 255, 0.75) !important;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95em;
    text-decoration: none;
}

    .sidebar .nav-link .bi {
        font-size: 1.2em;
        width: 1.8em;
        margin-right: 0.5rem !important;
        display: inline-flex;
        justify-content: center;
        opacity: 0.8;
        transform: translateY(-2px); /* アイコンのベースラインを微調整 */
    }

    .sidebar .nav-link:hover {
        color: #ffffff !important;
        background-color: rgba(255, 255, 255, 0.1) !important;
        transform: translateX(3px);
    }

        .sidebar .nav-link:hover .bi {
            opacity: 1;
        }

    .sidebar .nav-link.active {
        color: #ffffff !important;
        background-color: rgba(0, 194, 168, 0.25) !important;
        font-weight: 700;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        border-left: 3px solid var(--legal-accent);
    }

/* 訴訟管理メニュー専用のスタイル */
.litigation-nav-link {
    color: #d8b4fe !important;
    border-left: 3px solid transparent;
}

    .litigation-nav-link.active {
        border-left: 3px solid #d8b4fe !important;
        background-color: rgba(111, 66, 193, 0.15) !important;
        color: #ffffff !important;
    }

.nav-scrollable {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

    .nav-scrollable::-webkit-scrollbar {
        width: 6px;
    }

    .nav-scrollable::-webkit-scrollbar-track {
        background: transparent;
    }

    .nav-scrollable::-webkit-scrollbar-thumb {
        background-color: rgba(255, 255, 255, 0.2);
        border-radius: 20px;
    }

#nav-toggle-checkbox {
    display: none !important;
}

/* Sidebar History Item */
.history-item {
    background-color: rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

    .history-item:hover {
        background-color: rgba(255, 255, 255, 0.15);
        border-left: 2px solid #ffc107; /* warning color */
        transform: translateX(3px);
    }

@media (min-width: 768px) {
    .sidebar {
        width: var(--sidebar-width);
        min-width: var(--sidebar-width);
        height: 100dvh;
        position: sticky;
        top: 0;
    }

        .sidebar .navbar-toggler {
            display: none;
        }

    .nav-content {
        display: block !important;
    }

    .nav-scrollable {
        height: calc(100vh - 3.5rem);
    }

    .page {
        height: 100dvh;
        overflow: hidden;
    }

    main {
        height: 100dvh;
        overflow-y: auto;
        overflow: hidden !important;
        flex: 1;
        scroll-behavior: smooth;
    }
}

/* ============================================================
   4. フォーム と ボタン 
   ============================================================ */
.form-control, .form-select, .input-group-text {
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background-color: #ffffff;
}

.input-group-text {
    background-color: #f1f5f9;
    color: #64748b;
    font-weight: 700;
}

.form-control:focus, .form-select:focus {
    border-color: var(--legal-interactive) !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15) !important;
    outline: none;
}

.btn-majestic {
    border-radius: 50px;
    padding: 0.7em 2.5em;
    font-weight: 700;
    letter-spacing: 0.03em;
    transition: all 0.2s;
    border: none;
}

.btn-save {
    background-color: var(--legal-interactive);
    color: white !important;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.15);
}

    .btn-save:hover {
        background-color: #0b5ed7 !important;
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(13, 110, 253, 0.2);
    }

.btn-cancel {
    background-color: #f1f5f9;
    color: #64748b !important;
    border: 1px solid #e2e8f0;
}

    .btn-cancel:hover {
        background-color: #e2e8f0 !important;
    }

.label-small {
    color: var(--legal-text-muted);
    font-size: 0.8em;
    font-weight: 700;
    margin-bottom: 0.4em;
    display: block;
}

.input-refined-sm {
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    box-shadow: none;
    transition: all 0.2s;
}

    .input-refined-sm:focus {
        border-color: var(--legal-interactive);
        box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
        outline: none;
    }

/* ============================================================
   5. モーダル と ログイン
   ============================================================ */
.majestic-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.majestic-modal-dialog {
    width: 90%;
    max-width: 850px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    overflow: hidden;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPopIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.login-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 10000;
    background-color: var(--legal-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.login-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.input-refined-lg {
    height: 3.5rem;
    font-size: 1.1em;
    border-radius: 12px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    font-weight: 700;
}

.btn-login {
    background-color: var(--legal-accent) !important;
    color: #ffffff !important;
    font-size: 1.1em;
    box-shadow: 0 4px 15px rgba(0, 194, 168, 0.4);
    border: none;
    width: 100%;
    border-radius: 50px;
    padding: 0.8em;
    font-weight: bold;
}

    .btn-login:hover {
        background-color: #009688 !important;
        transform: translateY(-2px);
    }

/* ============================================================
   6. 共通グリッド と カレンダー 
   ============================================================ */
.day-view-scroll {
    scroll-behavior: smooth;
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* --- A. Day View Grid --- */
.calendar-grid {
    display: grid;
    grid-template-rows: 60px auto;
    position: relative;
    min-width: 800px;
}

.time-grid-container {
    position: relative;
    padding-left: 60px;
    min-height: 900px;
}

/* Common Grid Elements */
.time-row, .time-slot {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
    box-sizing: border-box;
}

.time-label {
    position: absolute;
    left: -60px;
    width: 60px;
    text-align: center;
    top: -10px;
    font-size: 0.75em;
    color: #94a3b8;
    font-weight: 600;
    background-color: transparent;
}

.time-axis .time-slot {
    font-size: 0.75em;
    color: #94a3b8;
    font-weight: 600;
    align-items: flex-start;
    padding-top: 8px;
}

.time-axis-header, .room-header, .task-header {
    background: #fff;
    z-index: 200;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.click-slot {
    width: 100%;
    height: 100%;
    cursor: pointer;
}

    .click-slot:hover {
        background-color: rgba(13, 110, 253, 0.05);
    }

.room-column, .task-column, .time-axis {
    min-height: 900px;
    position: relative;
    background-image: linear-gradient(#f1f5f9 1px, transparent 1px);
    background-size: 100% 60px;
    background-position: 0 0;
    border-right: 1px solid #f1f5f9;
}

.time-axis {
    grid-column: 1;
    background-color: #fcfcfc;
    border-right: 1px solid #e2e8f0;
}

/* Entry Cards (Day View) */
.entry-card, .schedule-entry-card {
    position: absolute;
    width: 94%;
    left: 3%;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    z-index: 20;
    overflow: visible !important;
    border-left-width: 4px !important;
    border-left-style: solid !important;
    padding: 2px 6px;
    background: #fff;
    transition: all 0.15s;
    font-size: 0.8em;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-top: 1px solid rgba(0,0,0,0.05);
    border-right: 1px solid rgba(0,0,0,0.05);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

    .entry-card:hover, .schedule-entry-card:hover {
        z-index: 100;
        transform: scale(1.02);
        box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    }

    /* Day View ハイライト */
    .schedule-entry-card.target-highlight-active {
        border: 2px solid var(--highlight-active) !important;
        border-left: 6px solid var(--highlight-active) !important;
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4) !important;
        z-index: 50;
        transform: scale(1.01);
    }

    .schedule-entry-card.target-highlight-done {
        border: 2px solid var(--highlight-done) !important;
        border-left: 6px solid var(--highlight-done) !important;
        box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3) !important;
        z-index: 49;
        opacity: 0.95;
    }

.entry-content, .entry-inner, .entry-subject, .entry-time {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 100%;
}

.entry-subject {
    font-weight: 700;
}

.entry-time {
    font-size: 0.8em;
    color: #64748b;
}

/* Now Indicator */
.now-indicator {
    position: absolute;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 1000;
    height: 1px;
}

.now-dot {
    position: absolute;
    left: -5px;
    top: -5px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    z-index: 1000;
}

.now-indicator-schedule .now-dot {
    left: 65px;
}

.now-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    background: #ef4444;
}

.now-indicator-schedule .now-line {
    left: 70px;
}

/* --- C. Week/Month View Grid --- */
.week-grid, .month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    height: auto;
    background-color: #cbd5e1;
    gap: 1px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
}

.week-col, .month-cell, .grid-cell {
    background-color: #fff;
    min-height: 140px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: background-color 0.1s;
    border: none !important;
}

    .week-col:hover, .month-cell:hover, .grid-cell:hover {
        background-color: #f8fafc;
    }

.bg-today {
    background-color: #f0f9ff !important;
}

/* Mini Entries */
.mini-entry {
    font-size: 0.85em;
    padding: 3px 6px;
    margin-bottom: 3px;
    border-radius: 4px;
    overflow: visible !important;
    font-weight: 600;
    color: #334155;
    border-left-width: 3px !important;
    border-left-style: solid !important;
    cursor: pointer;
    background-color: #f1f5f9;
    position: relative;
    border: 1px solid transparent;
}

.mini-entry-text {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.mini-entry:hover {
    opacity: 0.8;
    z-index: 10;
}

/* Mini Entry ハイライト */
.mini-entry.target-highlight-mini-active {
    border: 2px solid var(--highlight-active) !important;
    box-shadow: 0 0 5px rgba(245, 158, 11, 0.3);
}

.mini-entry.target-highlight-mini-done {
    border: 2px solid var(--highlight-done) !important;
}

.completed-line {
    opacity: 0.6;
    text-decoration: line-through;
    background-color: #f1f5f9 !important;
    border-left-color: #94a3b8 !important;
    color: #94a3b8;
}

/* Headers */
.grid-header {
    background-color: #f8fafc;
    font-weight: 700;
    text-align: center;
    padding: 8px;
    font-size: 0.9em;
    border-bottom: none !important;
}

.day-number {
    font-weight: 700;
    font-size: 0.9em;
    margin-bottom: 4px;
    text-align: right;
    padding-right: 4px;
}

.fc-event-normal {
    opacity: 0.6;
    border: 1px solid #ddd !important;
    filter: grayscale(80%);
}

.fc-event-highlight {
    background-color: var(--legal-accent) !important;
    border: 2px solid #d63384 !important;
    color: #fff !important;
    opacity: 1;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    transform: scale(1.02);
    z-index: 10;
}

.task-card-fixed {
    border-left: 4px solid #0d6efd;
}

.task-card-free {
    border-left: 4px solid #198754;
}

/* List Card Highlight */
.task-card-item {
    transition: all 0.2s;
    border: 1px solid #e2e8f0;
}

.target-highlight-list-active {
    border: 2px solid var(--highlight-active) !important;
    border-left-width: 6px !important;
    background-color: #fff !important;
    transform: translateX(-2px);
}

.target-highlight-list-done {
    border: 2px solid var(--highlight-done) !important;
    border-left-width: 6px !important;
    background-color: #f0fdfa !important;
}

/* ============================================================
   7. トースト通知 (Toast)
   ============================================================ */
.toast-container-majestic {
    position: fixed;
    top: 5rem; /* 位置はremのままでOK */
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75em;
    pointer-events: none;
    white-space: pre-wrap;
}

.toast-majestic {
    justify-content: center;
    text-align: center;
    pointer-events: auto;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    gap: 0.75em;
    padding: 0.8em 1.5em;
    border-radius: 50px;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    min-width: 240px;
    max-width: 400px;
    transition: transform 0.2s ease;
    animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.7);
    width: 100%;
    animation: toast-countdown 3s linear forwards;
}

@keyframes toast-countdown {
    from { width: 100%; }
    to { width: 0%; }
}

.toast-success {
    background-color: #10b981;
}

.toast-danger {
    background-color: #ef4444;
}

.toast-warning {
    background-color: #f59e0b;
}

.toast-deleted {
    background-color: #495057;
}

.toast-info {
    background-color: #3b82f6;
}

/* ============================================================
   8. アニメーション と ユーティリティ 
   ============================================================ */
.animate-fade {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-refined {
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.05);
}

.cursor-pointer {
    cursor: pointer;
}

.transition-all {
    transition: all 0.2s ease;
}

.opacity-60 {
    opacity: 0.6;
}

/* テーブルのホバー色を少し明るいグレー（#f8fafc）に統一 */
.table-hover-custom tbody tr:hover td {
    background-color: #f8fafc !important;
}

.status-badge {
    display: inline-block;
    min-width: 85px;
    text-align: center;
}

/* ツールチップ (Tooltip Fixed) */
.majestic-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    visibility: hidden;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 99999;
    padding: 0;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    margin-top: 5px;
}

.tooltip-header {
    padding: 8px 12px;
    color: #fff;
    font-weight: 700;
    font-size: 0.8em;
}

.tooltip-body {
    padding: 10px;
    font-size: 0.85em;
    color: #334155;
    white-space: normal;
    text-align: left;
}

.entry-card:hover .majestic-tooltip,
.schedule-entry-card:hover .majestic-tooltip,
.mini-entry:hover .majestic-tooltip {
    visibility: visible;
    opacity: 1;
}

/* サジェストドロップダウン */
.suggest-container {
    position: relative;
    width: 100%;
}

.suggest-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 2000;
    width: 100%;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.08);
    list-style: none;
    padding: 0.5em 0;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

    .suggest-dropdown li {
        padding: 0.7em 1.2em;
        cursor: pointer;
    }

        .suggest-dropdown li:hover {
            background-color: var(--legal-bg-light);
        }

/* ホバー時の浮き上がりエフェクト（汎用） */
.shadow-hover {
    transition: all 0.2s ease;
}

    .shadow-hover:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0,0,0,0.08) !important;
    }

/* カラーピッカー (Color Picker) */
.color-picker-wrapper {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.color-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

    .color-circle.selected {
        transform: scale(1.1);
        box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--legal-accent);
    }

.hover-bg-light {
    transition: background-color 0.2s;
}

    .hover-bg-light:hover {
        background-color: #f1f5f9 !important;
    }

/* ============================================================
   9. レイアウト・ヘッダー用
   ============================================================ */
/* メインレイアウト用 */
.layout-sidebar-right {
    flex-direction: row-reverse !important;
}

    .layout-sidebar-right .sidebar {
        border-left: 1px solid rgba(255,255,255,0.1);
        box-shadow: -4px 0 15px rgba(0,0,0,0.1);
    }

.top-row {
    min-height: 3.5rem;
    height: auto !important;
    padding-top: 0.5rem;
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* 打刻ボタン専用スタイル */
.attendance-btn-mono {
    background-color: #ffffff;
    color: #475569;
    border: 1px solid #e2e8f0;
    padding: 0.35rem 1.2rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

    .attendance-btn-mono:disabled {
        opacity: 0.5;
        background-color: #f8fafc;
        cursor: not-allowed;
    }

.btn-hover-blue:not(:disabled):hover {
    background-color: #f0f9ff;
    color: #0284c7;
    border-color: #bae6fd;
}

.btn-hover-red:not(:disabled):hover {
    background-color: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.btn-hover-yellow:not(:disabled):hover {
    background-color: #fffbeb;
    color: #d97706;
    border-color: #fde68a;
}

.btn-hover-cyan:not(:disabled):hover {
    background-color: #ecfeff;
    color: #0891b2;
    border-color: #a5f3fc;
}

.attendance-time {
    margin-left: 0.5rem;
    font-size: 0.85em;
    opacity: 0.8;
}

.memo-badge {
    font-size: 0.65rem !important;
    padding: 0 !important;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(-35%, -25%) !important;
    border-width: 1.5px !important;
    font-weight: 800;
}

.memo-info-pill {
    font-size: 0.75rem;
    background-color: #f1f5f9;
    border-radius: 50px;
    padding: 2px 10px;
    color: #475569;
    display: flex;
    gap: 8px;
    border: 1px solid #e2e8f0;
}

.text-unread {
    color: #dc2626;
}

.text-undone {
    color: #0284c7;
}

/* 伝言メモアイコン用エフェクト */
.hover-primary-container:hover .memo-icon {
    color: var(--legal-primary) !important;
    transform: scale(1.1);
}

.hover-primary-container:hover .memo-text {
    color: var(--legal-primary) !important;
}

/* ============================================================
   10. サブナビゲーション・会計用
   ============================================================ */
.search-box-wide {
    min-width: 400px;
}

.sub-tab-link {
    border: none !important;
    border-bottom: 3px solid transparent !important;
}

.sub-tab-active {
    color: var(--legal-primary) !important; /* #00453e (または #0f766e) */
    background-color: transparent !important;
    border-bottom-color: var(--legal-primary) !important;
}

.sub-tab-inactive:hover {
    border-bottom-color: #cbd5e1 !important;
    color: var(--legal-primary) !important;
}

.sub-tab-divider {
    border-color: #e2e8f0 !important;
    margin-top: -2px;
}

/* ============================================================
   11. ユーザーUI用
   ============================================================ */
.avatar-circle-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    flex-shrink: 0;
}

.icon-circle-md {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* メンテナンス・メニュー用共通スタイル */
.menu-icon-circle {
    width: 56px;
    height: 56px;
    min-width: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

/* ホバー時にアイコンを少し浮かせる演出 */
.card-refined.shadow-hover:hover .menu-icon-circle {
    transform: scale(1.1);
}

/* カラーバリエーション */
.bg-soft-blue {
    background-color: rgba(13, 110, 253, 0.1) !important;
    color: #0d6efd !important;
}

.bg-soft-red {
    background-color: rgba(220, 53, 69, 0.1) !important;
    color: #dc3545 !important;
}

.bg-soft-purple {
    background-color: rgba(111, 66, 193, 0.1) !important;
    color: #6f42c1 !important;
}

.bg-soft-cyan {
    background-color: rgba(13, 202, 240, 0.1) !important;
    color: #0891b2 !important;
}

.bg-soft-amber {
    background-color: rgba(255, 193, 7, 0.1) !important;
    color: #b45309 !important;
}

.bg-soft-green {
    background-color: rgba(25, 135, 84, 0.1) !important;
    color: #198754 !important;
}

.bg-soft-gray {
    background-color: rgba(108, 117, 125, 0.1) !important;
    color: #6c757d !important;
}

.bg-soft-indigo {
    background-color: rgba(79, 70, 229, 0.1) !important;
    color: #4f46e5 !important;
}

.bg-soft-yellow {
    background-color: rgba(255, 235, 59, 0.2) !important;
    color: #fbc02d !important;
}

.bg-soft-gold {
    background-color: rgba(255, 160, 0, 0.15) !important;
    color: #ff8f00 !important;
}

.bg-soft-orange {
    background-color: rgba(253, 126, 20, 0.12) !important;
    color: #fd7e14 !important;
}

.bg-soft-winered {
    background-color: rgba(139, 0, 0, 0.1) !important;
    color: #8b0000 !important;
}

/* フォルダ＋人のアイコン重ね合わせ */
.icon-stack {
    position: relative;
    display: inline-block;
}

    .icon-stack .icon-overlay-person {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -20%) scale(0.5); /* フォルダの中央に人を小さく */
        color: inherit;
    }

    .icon-stack .icon-overlay {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(1.1);
        font-size: 0.8em;
        color: #b91c1c;
        text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    }

/* ============================================================
   12. モバイル向けレスポンシブ (Mobile Overrides)
   ============================================================ */
@media (max-width: 768px) {
    /* 1. タイトルの改行防止 */
    .majestic-title {
        font-size: 1.3em !important;
        white-space: nowrap;
    }

    /* 2. サイドバー（メインメニュー）のスマホ固定 */
    .sidebar {
        width: 100vw;
        height: auto;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1030;
    }

    .nav-scrollable {
        max-height: calc(100vh - 3.5rem);
        background-color: var(--legal-primary);
        border-bottom: 1px solid rgba(0,0,0,0.1);
        box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    }

    .nav-content {
        display: none;
    }

    #nav-toggle-checkbox:checked ~ .nav-content {
        display: block !important;
        animation: slideDown 0.3s ease-out;
    }

    /* 3. メイン領域のヘッダー被り防止 */
    main {
        padding-top: 3.5rem !important;
        padding-bottom: 5rem;
    }

    .form-control, .form-select, input, select {
        max-width: 100% !important;
    }

    .card-refined, .card-body {
        overflow-x: hidden;
    }

    .justify-content-between.mb-2.text-start {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

        /* 右側にあったボタン群を、タイトルの下に折り返させる */
        .justify-content-between.mb-2.text-start > div:last-child {
            width: 100% !important;
            flex-wrap: wrap !important;
            justify-content: flex-start !important;
            gap: 0.5rem !important;
        }

            /* ボタンやセレクトボックスを、スマホで押しやすいように「縦に全幅(100%)」で並べる */
            .justify-content-between.mb-2.text-start > div:last-child > * {
                flex: 1 1 100%;
                margin-left: 0 !important;
                margin-right: 0 !important;
            }
}

/* ============================================================
   13. 共通ペインレイアウト用
   ============================================================ */
.majestic-sidebar {
    width: 100%;
    height: auto;
    max-height: 180px; /* スマホでは高さを抑えてスクロール */
    flex-shrink: 0;
}

.majestic-main {
    width: 100%;
    min-width: 0;
    flex-grow: 1;
}

@media (min-width: 768px) {
    .majestic-sidebar {
        width: 250px !important; /* PCでは幅を固定 */
        max-height: 100% !important;
    }

    .majestic-main {
        width: calc(100% - 250px) !important;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto !important;
    }

}

/* デバッグ用 */
/** {
    outline: 1px solid red !important;
}*/

/*.page {
    background-color: rgba(255, 0, 0, 0.1) !important;
}

main {
    background-color: rgba(0, 255, 0, 0.1) !important;
}

.content {
    background-color: rgba(0, 0, 255, 0.1) !important;
}*/

/* Sidebar Hidden State for LINE Inbox etc */
.page {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}
.sidebar-hidden .sidebar {
    width: 0 !important;
    min-width: 0 !important;
    transform: translateX(-100%);
    opacity: 0;
    overflow: hidden;
}
.layout-sidebar-right.sidebar-hidden .sidebar {
    transform: translateX(100%);
}

/* --- Custom Utility Classes (Refactoring) --- */
.w-80px { width: 80px !important; }
.w-100px { width: 100px !important; }
.w-120px { width: 120px !important; }
.w-150px { width: 150px !important; }
.w-200px { width: 200px !important; }
.w-250px { width: 250px !important; }

.min-w-100px { min-width: 100px !important; }
.min-w-120px { min-width: 120px !important; }

.fs-xs { font-size: 0.75rem !important; }
.fs-sm { font-size: 0.85rem !important; }
.lh-sm { line-height: 1.2 !important; }

.icon-n1 { transform: translateY(-1px) !important; }

/* Global Placeholder Style */
.form-control::placeholder,
.form-select::placeholder {
    color: #adb5bd !important;
    opacity: 0.8 !important;
}





