:root {
    /* Color Palette - Premium Forest & Warm Ivory Theme */
    --bg-color: #f6f5f0;
    --bg-dark: #efede4;
    --glass-bg: #ffffff;
    --glass-border: rgba(30, 56, 40, 0.06);
    
    --primary: #1e3828;            /* 深いフォレストグリーン */
    --primary-light: #2c4f39;      /* 中間色のフォレストグリーン */
    --primary-hover: #13271b;      /* 極深緑 */
    --accent: #2e573f;             /* やや明るいグリーン */
    --accent-light: #8fa08e;       /* アクセント用の淡いグリーン */
    --accent-gradient: linear-gradient(135deg, #1e3828 0%, #2e573f 100%);
    
    --text-main: #1d2d22;          /* 濃いフォレストブラック */
    --text-secondary: #5a6e60;     /* 落ち着いたフォレストグレー */
    --border-color: rgba(30, 56, 40, 0.12);
    --success: #2c4f39;
    --warning: #b8860b;            /* ゴールドベージュ系 */
    --danger: #b22222;
    --radius: 12px;
    --shadow: 0 10px 15px -3px rgba(30, 56, 40, 0.03), 0 4px 6px -2px rgba(30, 56, 40, 0.01);

    /* Sidebar - Premium Dark Green */
    --sidebar-bg: #132c1e;
    --sidebar-active-bg: #223f2d;
    --sidebar-text: #8da293;
    --sidebar-text-active: #ffffff;
    --sidebar-border: rgba(255, 255, 255, 0.08);

    --input-bg: #ffffff;
    --input-focus-bg: #ffffff;
    --search-bg: rgba(255, 255, 255, 0.85);

    --fc-btn-bg: rgba(30, 56, 40, 0.05);
    --fc-btn-text: #1d2d22;
    --fc-btn-hover: rgba(30, 56, 40, 0.1);
    --select-arrow: #1d2d22;

    --btn-secondary-bg: rgba(30, 56, 40, 0.04);
    --btn-secondary-text: var(--text-main);
    --btn-danger-bg: rgba(178, 34, 34, 0.08);
}

.freee-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    color: white !important;
    text-decoration: none !important;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
    cursor: pointer;
}

.freee-badge.quote {
    background: #2c4f39;
}

.freee-badge.invoice {
    background: #6a9bd1;
}

.freee-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

[data-theme="light"] {
    --bg-color: #f6f5f0;
    --bg-dark: #efede4;
    --text-main: #1d2d22;
    --text-secondary: #5a6e60;
    --border-color: rgba(30, 56, 40, 0.12);
    --glass-bg: #ffffff;

    --sidebar-bg: #132c1e;
    --input-bg: #ffffff;
    --input-focus-bg: #ffffff;
    --search-bg: rgba(255, 255, 255, 0.85);

    --fc-btn-bg: rgba(30, 56, 40, 0.05);
    --fc-btn-text: #1d2d22;
    --fc-btn-hover: rgba(30, 56, 40, 0.1);

    --btn-secondary-bg: rgba(30, 56, 40, 0.04);
    --btn-secondary-text: var(--text-main);
    --btn-danger-bg: rgba(178, 34, 34, 0.08);
    --glass-border: rgba(30, 56, 40, 0.06);
}

[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select {
    color: var(--text-main) !important;
}

[data-theme="light"] .glass-input::placeholder {
    color: var(--text-secondary);
}

[data-theme="dark"] {
    --bg-color: #141815;           /* 極深緑ブラック */
    --bg-dark: #0e110f;
    --glass-bg: rgba(22, 28, 24, 0.85);
    --glass-border: rgba(255, 255, 255, 0.06);
    --text-main: #e8eee8;
    --text-secondary: #8da293;
    --border-color: rgba(255, 255, 255, 0.08);
    
    --primary: #2e573f;
    --primary-light: #8fa08e;
    --accent-gradient: linear-gradient(135deg, #2e573f 0%, #467a5b 100%);
    
    --sidebar-bg: #0b110d;
    --sidebar-active-bg: #1e3828;
    --sidebar-text: #8da293;
    --sidebar-text-active: #ffffff;
    --sidebar-border: rgba(255, 255, 255, 0.05);

    --input-bg: rgba(0, 0, 0, 0.25);
    --input-focus-bg: rgba(0, 0, 0, 0.4);
    --search-bg: rgba(255, 255, 255, 0.04);

    --fc-btn-bg: rgba(255, 255, 255, 0.06);
    --fc-btn-text: #ffffff;
    --fc-btn-hover: rgba(255, 255, 255, 0.12);

    --btn-secondary-bg: rgba(255, 255, 255, 0.06);
    --btn-secondary-text: var(--text-main);
    --btn-danger-bg: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    color: var(--text-main) !important;
}

[data-theme="dark"] .glass-input::placeholder {
    color: var(--text-secondary);
}

[data-theme="dark"] .glass-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', 'Noto Sans JP', sans-serif;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    background-image: url('https://www.transparenttextures.com/patterns/rice-paper-2.png');
}

/* Utilities */
.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.gap-8 {
    gap: 8px;
}

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

.p-20 {
    padding: 20px;
}

.p-24 {
    padding: 24px;
}

.app-container {
    display: flex;
    height: 100vh;
    padding: 16px;
    gap: 16px;
}

/* Glassmorphism & Card Effect */
.glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass:hover {
    box-shadow: 0 12px 30px rgba(30, 56, 40, 0.05);
    transform: translateY(-2px);
}

.glass-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    outline: none;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.glass-input:focus {
    border-color: var(--primary);
    background: var(--input-focus-bg);
    box-shadow: 0 0 0 2px rgba(61, 74, 62, 0.2);
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 5000;
    min-width: 220px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(16px);
    display: none;
    flex-direction: column;
}

.dropdown:hover .dropdown-menu {
    display: flex;
}

/* Bridge the gap for hover stability */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -50px;
    right: -50px;
    height: 30px;
    /* Testing background: rgba(255,0,0,0.1); */
    z-index: -1;
}

/* Ensure items don't bleed out of rounded corners since overflow:hidden is removed */
.dropdown-item:first-child {
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

.dropdown-item:last-child {
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

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

/* Sidebar Styling */
.sidebar {
    width: 280px;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    padding: 32px 20px;
    background: var(--sidebar-bg) !important;         /* .glassの背景白を強制上書き */
    border: 1px solid var(--sidebar-border) !important; /* .glassのボーダーを強制上書き */
    box-shadow: none !important;                       /* サイドバーはフラットに保つため.glassの影を無効化 */
    backdrop-filter: none !important;                  /* 余計なぼかし効果を排除 */
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding-left: 8px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
    margin: 0;
}

.logo h2 .logo-sub {
    font-weight: 400;
    opacity: 0.95;
    font-size: 0.95rem;
}

.logo .logo-tagline {
    font-size: 0.65rem;
    color: var(--sidebar-text);
    margin-top: 4px;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background-color: transparent;
    border: 2px solid var(--sidebar-text);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238da293' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='12' cy='12' r='10'/%3e%3ccircle cx='12' cy='12' r='2'/%3e%3cline x1='12' y1='2' x2='12' y2='10'/%3e%3cline x1='12' y1='14' x2='12' y2='22'/%3e%3cline x1='22' y1='12' x2='14' y2='12'/%3e%3cline x1='10' y1='12' x2='2' y2='12'/%3e%3cline x1='19.07' y1='4.93' x2='13.41' y2='10.59'/%3e%3cline x1='10.59' y1='13.41' x2='4.93' y2='19.07'/%3e%3cline x1='19.07' y1='19.07' x2='13.41' y2='13.41'/%3e%3cline x1='10.59' y1='10.59' x2='4.93' y2='4.93'/%3e%3c/svg%3e");
    background-size: 80%;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    box-shadow: none;
}

/* 新しいロゴプレートと画像用スタイル */
.logo-plate {
    background: #192c1f !important;
    padding: 10px 14px !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(25, 44, 31, 0.28) !important;
    margin-bottom: 32px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    width: calc(100% - 16px) !important; /* サイドバーのパディングを考慮 */
    box-sizing: border-box !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.logo-plate:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(25, 44, 31, 0.36) !important;
}

.logo-img-sidebar {
    width: 100% !important;
    height: auto !important;
    max-height: 48px !important;
    object-fit: contain !important;
    display: block !important;
}

.logo-img-main {
    max-width: 100% !important;
    height: auto !important;
    max-height: 72px !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
}

nav ul {
    list-style: none;
}

/* メニュー項目が増えても、ナビ部分だけ縦スクロールさせ、ロゴとフッター（利用規約・
   ユーザー情報）は常に表示する。サイドバーは .app-container(height:100vh) の
   フレックス子なので高さが確定し、nav を flex:1 + overflow で内部スクロールできる。 */
.sidebar nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar nav::-webkit-scrollbar { width: 6px; }
.sidebar nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 3px; }
.sidebar nav::-webkit-scrollbar-track { background: transparent; }

nav li {
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--sidebar-text);
    font-weight: 500;
    font-size: 0.95rem;
}

nav li:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--sidebar-text-active);
    transform: translateX(4px);
}

nav li.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-active);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 600;
}

nav li i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-legal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin-bottom: 12px;
    padding: 0 2px;
    font-size: 0.72rem;
    line-height: 1.5;
}

.sidebar-legal-links a {
    color: var(--sidebar-text);
    text-decoration: none;
}

.sidebar-legal-links a:hover {
    color: #ffffff;
    text-decoration: underline;
}

.sidebar .user-profile {
    display: flex !important;
    align-items: center;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid var(--sidebar-border) !important;
    border-radius: 8px !important;
    padding: 10px 12px !important;
    gap: 12px !important;
    transition: all 0.2s ease;
}

.sidebar .user-profile:hover {
    background: rgba(255, 255, 255, 0.06) !important;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--sidebar-active-bg);
    border: 1px solid var(--sidebar-border);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.875rem;
}

.sidebar .user-info .name {
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 0.9rem !important;
    margin: 0 !important;
}

.sidebar .user-info p {
    color: var(--sidebar-text) !important;
}

.sidebar .user-profile button {
    color: var(--sidebar-text) !important;
}

.sidebar .user-profile button:hover {
    color: #ffffff !important;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
}

.top-bar {
    min-height: 72px;
    border-radius: var(--radius);
    padding: 8px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 100;
    overflow: visible;
    /* 幅が狭い時はボタンが重ならず折り返すように（バーは縦に伸びる） */
    flex-wrap: wrap;
    gap: 8px 12px;
}

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

.view-actions {
    display: flex;
    gap: 12px;
    /* 狭い時はボタン・検索窓を折り返して右側の見切れを防ぐ */
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* 顧客検索の入力欄は固定幅＋上限100%で、右端からはみ出さないようにする
   （.glass-input の width:100% を上書き） */
#customer-search {
    width: 220px;
    max-width: 100%;
    flex: 0 1 220px;
}

.search-box {
    background: var(--search-bg);
    border-radius: var(--radius);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 260px;
    flex-shrink: 0;
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    outline: none;
    width: 100%;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    /* 狭い時はボタンを折り返して重なりを防ぐ（ドロップダウンは下に開くので折り返しでも問題なし） */
    flex-wrap: wrap;
    row-gap: 8px;
    flex: 1;
    min-width: 0;
    justify-content: flex-end;
}

.top-actions::-webkit-scrollbar {
    display: none;
}

.top-actions>*,
.view-actions>* {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

.clock {
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--accent-light);
    letter-spacing: 1px;
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--fc-btn-hover);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--btn-danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
    color: white;
}

/* View Container */
.view-content {
    flex: 1;
    overflow-y: auto;
}

.view-content[data-view="kanban"] {
    overflow-y: hidden;
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Customer Detail Modal Enhancements */
.customer-details-container {
    color: var(--text-primary);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.detail-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 8px 16px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    position: relative;
    transition: color 0.3s;
}

.tab-btn.active {
    color: var(--accent-light);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-light);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.btn-line {
    background: #06C755;
    color: white;
    font-size: 0.8rem;
    padding: 8px 16px;
}

.btn-line:hover {
    background: #05b04a;
    box-shadow: 0 4px 12px rgba(6, 199, 85, 0.3);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.bike-card-mini {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line, rgba(0,0,0,0.08));
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
/* 自転車カードは押すと編集できる。ホバーで「押せる」ことを視覚的に示す */
.bike-card-mini:hover {
    border-color: var(--green, #5a7d4f);
    box-shadow: 0 2px 10px rgba(90,125,79,.12);
    background: rgba(90,125,79,0.04);
}

.bike-model {
    font-weight: 600;
    font-size: 0.95rem;
}

.bike-serial {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.log-item {
    padding: 12px;
    border-left: 2px solid var(--accent-color);
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 12px;
    border-radius: 0 8px 8px 0;
}

.log-date {
    font-size: 0.75rem;
    color: var(--accent-light);
    margin-bottom: 4px;
}

.log-work {
    font-weight: 600;
    font-size: 0.9rem;
}

.log-notes {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

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

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    width: 100%;
    max-width: 800px;
    border-radius: var(--radius);
    padding: 24px;
    max-height: 85vh;
    overflow-y: auto;
}

/* 横に項目が多いモーダル（AI一括読み取り等）用の広い幅。小さい画面では常に余白を残す */
.modal-content.modal-wide {
    max-width: min(1180px, 96vw);
}

/* タブで内容量が変わっても高さが安定するよう最小の高さを確保（内容が多ければ max-height まで自動で伸びる） */
.modal-content.modal-minh {
    min-height: min(70vh, 640px);
}

/* 中身が少ない確認・お礼ポップアップ用。横の間延びを防ぐ細い幅 */
.modal-content.modal-narrow {
    max-width: 460px;
}

.hidden {
    display: none;
}

/* Modal Header & Close Button */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.close-modal {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 1.75rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
    padding-bottom: 4px;
    /* Adjustment for center alignment */
}

.close-modal:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-color: #ef4444;
    transform: rotate(90deg);
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 20px;
}

.status-dot.warning {
    background: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

.success {
    color: var(--success);
}

.status-dot.success {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

/* Dashboard & Animation Update */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-stats-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.btn-stats-settings {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-stats-settings:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent);
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    /* 中間幅でツールバーのボタンが重なるのを防ぐ（縦並び＋折り返し） */
    .top-bar {
        flex-direction: column;
        height: auto;
        align-items: stretch;
        gap: 10px;
        padding: 12px 16px;
    }
    .sync-status {
        margin-right: 0 !important;
    }
    .top-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.dashboard-side {
    padding: 24px;
    border-radius: var(--radius);
}

.focus-card {
    background: rgba(143, 160, 142, 0.1);
    border: 1px solid var(--accent-light);
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
}

.focus-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.focus-customer {
    color: var(--accent-light);
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.focus-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.relative {
    position: relative;
}

.delete-btn-absolute {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: none;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    z-index: 10;
    transition: all 0.2s;
}

.delete-btn-absolute:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
}

.hover-show-delete:hover .delete-btn-absolute,
.hover-show-delete:active .delete-btn-absolute {
    display: flex;
}


/* Animations */
.slide-up {
    animation: slideUp 0.5s ease-out forwards;
    opacity: 0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive Adjustments (Focus: Task Input & Details) */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        padding: 8px;
        overflow-y: auto;
        height: auto;
    }

    body {
        height: auto;
        overflow-y: auto;
    }

    .sidebar {
        width: 100%;
        margin-bottom: 8px;
        padding: 12px;
        height: auto;
    }

    .sidebar nav ul {
        display: flex;
        overflow-x: auto;
        gap: 4px;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

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

    .sidebar nav li {
        width: auto;
        white-space: nowrap;
        padding: 8px 12px;
        margin-bottom: 0;
    }

    .logo {
        margin-bottom: 12px;
        justify-content: center;
    }

    .sidebar-footer {
        display: none;
    }

    .top-bar {
        padding: 8px 12px;
        flex-direction: column;
        height: auto;
        gap: 8px;
        align-items: stretch;
    }

    .top-actions {
        order: 1;
        width: 100%;
        padding: 4px 0;
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 12px;
        scrollbar-width: none;
        -ms-overflow-style: none;
        align-items: center;
    }

    .top-actions>*,
    .view-actions>* {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }

    .search-box {
        order: 2;
        width: 100% !important;
        margin-top: 4px;
        flex-shrink: 0;
    }

    .top-actions .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
        height: 38px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .clock {
        display: none;
    }

    .modal-content {
        max-width: 95%;
        padding: 16px;
        margin: 10px;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .view-actions {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .view-actions::-webkit-scrollbar {
        display: none;
    }

    .view-actions .btn {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .grid-2,
    .task-detail-grid,
    .dashboard-layout,
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }

    .task-info-panel {
        position: static;
        margin-bottom: 16px;
    }

    .detail-table {
        display: block;
        overflow-x: auto;
    }

    .sync-status {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
}

/* Detail Table Grid Styles */
.detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.detail-table th,
.detail-table td {
    border: 1px solid var(--border-color);
    padding: 14px 16px;
    text-align: left;
    transition: background 0.2s;
}

.detail-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="light"] .detail-table {
    background: #fff;
}

[data-theme="light"] .detail-table th {
    background: #f8fafc;
}

/* Form Grid Layout */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-full {
    grid-column: 1 / -1;
}

.modal-form label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.glass-select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    outline: none;
    appearance: none;
    /* Remove default arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.glass-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* File Input Sytling */
.file-upload-box {
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.file-upload-box:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Placeholder Transparency */
::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

/* Image Preview Styling */
.file-upload-box {
    position: relative;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-height: 200px;
    border-radius: 4px;
}

.remove-img-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s;
}

.remove-img-btn:hover {
    background: #ef4444;
}

/* Zoom Modal */
.image-zoom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    cursor: zoom-out;
}

.image-zoom-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);

}

/* Authentication Overlay */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 32px;
}

.auth-card .logo {
    justify-content: center;
}

.auth-logo-wrap {
    margin-bottom: 14px;
    align-items: center;
}

.logo-img-auth {
    width: min(220px, 58vw);
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 24px;
    display: block;
    box-shadow: 0 14px 32px rgba(25, 44, 31, 0.18);
}

.auth-theme-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 22px;
    font-weight: 600;
}

.auth-loading-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.auth-legal-links {
    margin: 18px 0 0;
    font-size: 0.72rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.auth-legal-links a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.text-danger {
    color: #ef4444;
}

.w-full {
    width: 100%;
}

.mb-24 {
    margin-bottom: 24px;
}

.text-center {
    text-align: center;
}

/* FullCalendar Theme Overrides */
.fc {
    --fc-border-color: var(--border-color);
    --fc-button-text-color: var(--fc-btn-text);
    --fc-button-bg-color: var(--fc-btn-bg);
    --fc-button-border-color: var(--border-color);
    --fc-event-bg-color: var(--primary);
    --fc-event-border-color: var(--primary);
    --fc-today-bg-color: rgba(143, 160, 142, 0.08);
    --fc-page-bg-color: #ffffff;
}

.fc {
    color: var(--text-main);
}

.fc-theme-standard .fc-scrollgrid {
    border-color: var(--fc-border-color);
}

.fc-theme-standard td,
.fc-theme-standard th {
    border-color: var(--fc-border-color);
}

.fc-col-header-cell-cushion,
.fc-daygrid-day-number {
    color: var(--text-secondary);
    text-decoration: none !important;
}

.fc-col-header-cell-cushion:hover,
.fc-daygrid-day-number:hover {
    color: var(--text-main);
}

.fc-list-event-title,
.fc-list-event-time {
    color: var(--text-main) !important;
}

[data-theme="light"] .fc-list-day-cushion {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .fc-list-event:hover td {
    background-color: rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] .fc-list-day-text,
[data-theme="light"] .fc-list-day-side-text {
    color: var(--text-main) !important;
}


/* Helper for today's highlighting */
.fc-day-today {
    background-color: rgba(143, 160, 142, 0.1) !important;
}

/* Buttons */
.fc-button-primary {
    background: var(--fc-btn-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--fc-btn-text) !important;
    text-shadow: none !important;
    box-shadow: none !important;
    transition: all 0.2s;
}

.fc-button-primary:hover,
.fc-button-primary:focus {
    background: var(--fc-btn-hover) !important;
    border-color: var(--border-color) !important;
    color: var(--fc-btn-text) !important;
}

.fc-button-active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
}

.fc-button-primary:disabled {
    opacity: 0.4 !important;
    background: var(--fc-btn-bg) !important;
    color: var(--fc-btn-text) !important;
}

/* Toolbar Title */
.fc-toolbar-title {
    font-size: 1.25rem !important;
    font-weight: 600;
    color: var(--text-main);
}

/* Events */
.fc-event {
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 0.85rem;
    cursor: pointer;
}

/* TimeGrid slots */
.fc-timegrid-slot-label-cushion {
    color: var(--text-secondary);
}

.fc-timegrid-axis-cushion {
    color: var(--text-secondary);
}

/* List View */
.fc-list {
    border-color: var(--border-color);
}

.fc-list-day-cushion {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.fc-list-event:hover td {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Memo View Styles */
.notes-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.notes-container {
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.notes-textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.1rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    width: 100%;
    height: 100%;
}

.flex-1 {
    flex: 1;
}

.flex-col {
    flex-direction: column;
}

.h-full {
    height: 100%;
}

.mb-16 {
    margin-bottom: 16px;
}

.items-center {
    align-items: center;
}

.text-sm {
    font-size: 0.875rem;
}

/* Zebra List for Dashboard Items */
.zebra-list {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.zebra-list>div {
    margin-bottom: 0 !important;
    border-radius: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.zebra-list>div:last-child {
    border-bottom: none;
}

.zebra-list>div:nth-child(even) {
    background: rgba(255, 255, 255, 0.1) !important;
    /* Lighter "White-ish" */
}

.zebra-list>div:nth-child(odd) {
    background: rgba(255, 255, 255, 0.03) !important;
    /* Subtle "Gray-ish" */
}

.zebra-list>div:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

/* Bulk Preview Styles */
.bulk-preview-container {
    margin-top: 16px;
    max-height: 250px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.bulk-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.bulk-preview-table th {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
    color: var(--text-secondary);
}

.bulk-preview-table td {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.bulk-summary {
    font-size: 0.8rem;
    color: var(--accent);
    margin-bottom: 8px;
    font-weight: bold;
}

/* ============================
   Gemini AI Analysis Styles
   ============================ */

.ai-analysis-section {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 24px;
}

[data-theme="light"] .ai-analysis-section {
    border-top-color: rgba(0, 0, 0, 0.1);
}

.ai-result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 900px) {
    .ai-result-grid {
        grid-template-columns: 1fr;
    }
}

.ai-result-card {
    padding: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: fadeInUp 0.5s ease-out both;
}

.ai-result-card:nth-child(1) {
    animation-delay: 0s;
}

.ai-result-card:nth-child(2) {
    animation-delay: 0.1s;
}

.ai-result-card:nth-child(3) {
    animation-delay: 0.2s;
}

.ai-result-card:nth-child(4) {
    animation-delay: 0.3s;
}

.ai-result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .ai-card-header {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

.ai-card-header h4 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.ai-card-body {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.ai-card-body p {
    margin-bottom: 8px;
}

.ai-card-body strong {
    color: var(--text-main);
}

.ai-card-body ul.ai-list {
    list-style: none;
    padding: 0;
    margin: 8px 0;
}

.ai-card-body ul.ai-list li {
    padding: 6px 0 6px 20px;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

[data-theme="light"] .ai-card-body ul.ai-list li {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

.ai-card-body ul.ai-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-size: 0.8rem;
}

.ai-card-body ul.ai-list li:last-child {
    border-bottom: none;
}

/* Loading Animation */
.ai-loading-animation {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--accent);
    opacity: 0;
    animation: aiPulse 2s ease-out infinite;
}

.ai-pulse-ring.delay-1 {
    animation-delay: 0.5s;
}

.ai-pulse-ring.delay-2 {
    animation-delay: 1s;
}

@keyframes aiPulse {
    0% {
        transform: scale(0.5);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

.ai-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: aiSpin 0.8s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

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

/* Print Styles */
@media print {

    /* すべての要素を完全に非表示にする */
    body> :not(#print-area) {
        display: none !important;
    }

    /* print-area のみ強制的に表示する */
    #print-area {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        background: white !important;
        color: black !important;
    }

    /* Hide scrollbars and fix height for print */
    body {
        background: white !important;
        height: auto !important;
        overflow: visible !important;
    }
}

/* ==========================================
   手書きサイン（署名）関連スタイル
   ========================================== */
.signature-terms-container {
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 20px;
    color: var(--text-main);
}
.signature-terms-container h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--accent-light);
    font-weight: bold;
}
.signature-terms-container ol {
    padding-left: 20px;
    margin: 0;
}
.signature-terms-container li {
    margin-bottom: 8px;
}
.signature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
@media (max-width: 600px) {
    .signature-grid {
        grid-template-columns: 1fr;
    }
}
.signature-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.signature-label {
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--text-main);
}
.signature-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 160px;
    background: #ffffff;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    cursor: crosshair;
    touch-action: none; /* タブレットスクロール防止 */
}
.signature-canvas-wrapper-compact {
    height: 120px;
}
.signature-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}
.signature-canvas-wrapper:hover {
    border-color: var(--primary);
}
.signature-actions {
    display: flex;
    justify-content: flex-end;
}
.signature-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
}
.signature-status-badge.signed {
    color: var(--success);
    border-color: rgba(103, 146, 103, 0.3);
    background: rgba(103, 146, 103, 0.1);
}
.signature-preview-container {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border-color);
}
.signature-preview-box {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.signature-preview-img {
    max-height: 60px;
    max-width: 100%;
    object-fit: contain;
    background: white;
    border-radius: 4px;
    padding: 2px;
}

/* ============================
   AI Document Scan (OCR) Styles
   ============================ */

.drag-drop-area {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.drag-drop-area:hover, .drag-drop-area.drag-over {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.1);
}

.drag-drop-icon {
    font-size: 2.5rem;
    color: var(--accent);
    opacity: 0.8;
    transition: transform 0.3s ease;
}

.drag-drop-area:hover .drag-drop-icon {
    transform: translateY(-5px);
}

/* 脈動するローディング表示 */
.scan-pulse-loader {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    margin: 24px auto;
    position: relative;
    z-index: 1;
}

.scan-pulse-loader::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    animation: aiPulse 1.5s ease-out infinite;
    z-index: -1;
}

/* ドラフト2カラムレイアウト */
.draft-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 24px;
    margin-top: 16px;
}

@media (max-width: 768px) {
    .draft-layout {
        grid-template-columns: 1fr;
    }
}

.draft-image-pane {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 400px;
    overflow: hidden;
}

.draft-image-pane img {
    max-width: 100%;
    max-height: 370px;
    object-fit: contain;
    border-radius: 4px;
}

.draft-form-pane {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.matching-proposal-box {
    margin-bottom: 16px;
    padding: 16px;
    border-radius: var(--radius);
    border-style: solid;
    border-width: 1px;
    transition: all 0.3s ease;
}

.matching-proposal-box.match-perfect {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.3);
}

.matching-proposal-box.match-partial {
    background: rgba(245, 158, 11, 0.06);
    border-color: rgba(245, 158, 11, 0.3);
}

.matching-proposal-box.match-none {
    background: rgba(255, 255, 255, 0.02);
    border-color: var(--border-color);
}

.matching-candidates-list {
    max-height: 150px;
    overflow-y: auto;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.matching-candidate-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.matching-candidate-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
}

.matching-candidate-item.selected {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent);
}

.matching-candidate-item .candidate-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.matching-candidate-item .candidate-name {
    font-weight: bold;
    color: var(--text-main);
    margin-bottom: 2px;
}

/* ==========================================
   Mail Broadcast (お知らせメール送信) Styles
   ========================================== */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mail-target-list label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    border: 1px solid transparent;
}

.mail-target-list label:hover {
    background: rgba(255, 255, 255, 0.05);
}

.mail-target-list input[type="checkbox"] {
    accent-color: var(--accent);
}

/* ==========================================
   Community Board (共有板) Styles
   ========================================== */
.community-header {
    align-items: flex-start;
}

.community-guideline {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 16px 20px;
    margin: 16px 0 20px;
    background: rgba(46, 139, 87, 0.08);
    border-color: rgba(46, 139, 87, 0.18);
}

.community-guideline div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.community-guideline strong {
    color: var(--primary);
}

.community-guideline span {
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.6;
}

.community-layout {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.community-panel,
.community-thread-panel {
    padding: 18px;
    min-height: 560px;
}

.community-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.community-search {
    position: relative;
    flex: 1;
}

.community-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.community-search input {
    padding-left: 34px;
    width: 100%;
}

.community-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.community-category {
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.community-category.active,
.community-category:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.community-post-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(100vh - 360px);
    overflow-y: auto;
    padding-right: 4px;
}

.community-post-item {
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    padding: 14px;
    cursor: pointer;
    transition: 0.18s ease;
}

.community-post-item:hover,
.community-post-item.active {
    border-color: rgba(46, 139, 87, 0.55);
    box-shadow: 0 8px 22px rgba(26, 79, 50, 0.08);
    transform: translateY(-1px);
}

.community-post-item.official {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(46, 139, 87, 0.1));
    border-color: rgba(26, 79, 50, 0.32);
}

.community-post-item h3 {
    font-size: 1rem;
    line-height: 1.4;
    margin: 8px 0 6px;
    color: var(--text-main);
}

.community-post-item p {
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.55;
    margin: 0 0 10px;
}

.community-post-topline {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.community-category-badge,
.community-status,
.community-official-badge,
.community-pinned-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.72rem;
    font-weight: 800;
    background: rgba(26, 79, 50, 0.08);
    color: var(--primary);
}

.community-official-badge {
    background: var(--primary);
    color: #fff;
}

.community-pinned-badge {
    background: rgba(245, 158, 11, 0.16);
    color: #9a5a00;
}

.community-status {
    background: rgba(100, 116, 139, 0.12);
    color: var(--text-secondary);
}

.community-status.solved {
    background: rgba(46, 139, 87, 0.16);
    color: var(--accent);
}

.community-post-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-size: 0.76rem;
}

.community-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.community-tags span {
    color: var(--accent);
    background: rgba(46, 139, 87, 0.08);
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.74rem;
    font-weight: 700;
}

.community-empty,
.community-thread-empty {
    min-height: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-secondary);
    gap: 8px;
}

.community-empty-icon {
    font-size: 2.4rem;
    line-height: 1;
}

.community-thread {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.community-thread-head {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.community-thread-head h2 {
    font-size: 1.45rem;
    line-height: 1.45;
    margin: 10px 0 8px;
    color: var(--primary);
}

.community-body {
    color: var(--text-main);
    line-height: 1.85;
    white-space: normal;
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 18px;
}

.community-thread-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.community-replies {
    border-top: 1px solid var(--border-color);
    padding-top: 18px;
}

.community-replies h3 {
    font-size: 1rem;
    margin-bottom: 12px;
}

.community-reply {
    border-left: 3px solid rgba(46, 139, 87, 0.28);
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0 8px 8px 0;
    padding: 12px 14px;
    margin-bottom: 10px;
    line-height: 1.7;
}

.community-reply-delete {
    border: none;
    background: transparent;
    color: #b91c1c;
    font-size: 0.74rem;
    cursor: pointer;
    font-weight: 700;
}

.community-reply-form {
    border-top: 1px solid var(--border-color);
    padding-top: 18px;
}

.community-compose-note {
    background: rgba(185, 28, 28, 0.06);
    border: 1px solid rgba(185, 28, 28, 0.16);
    color: #8a2b2b;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.82rem;
    line-height: 1.6;
}

@media (max-width: 980px) {
    .community-layout,
    .community-guideline {
        grid-template-columns: 1fr;
    }

    .community-post-list {
        max-height: none;
    }

    .community-panel,
    .community-thread-panel {
        min-height: auto;
    }
}
