/* ========================================
   ACE SCHEDULE v2 - スタイルシート
   全機能版: D&D, 検索, コメント, アクティビティ,
   ダークモード, 並び替え, マークダウン, PWA
   ======================================== */

/* === リセット・基本 === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: #4f46e5; text-decoration: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* === ボタン === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: #4f46e5; color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-outline { background: transparent; color: #6c757d; border: 1px solid #dee2e6; }
.btn-outline:hover { background: #f8f9fa; border-color: #adb5bd; }
.btn-danger { background: #dc3545; color: #fff; }
.btn-danger:hover { background: #c82333; }
.btn-icon { background: transparent; border: none; color: #6c757d; padding: 8px; border-radius: 8px; cursor: pointer; }
.btn-icon:hover { background: #e9ecef; color: #1a1a2e; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-logout { background: transparent; color: #6c757d; border: 1px solid #dee2e6; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 16px; transition: all 0.2s; }
.btn-logout:hover { background: #dc3545; color: #fff; border-color: #dc3545; }

.required { color: #dc3545; }

/* === ヘッダー === */
.top-header {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-title { font-size: 18px; font-weight: 600; flex: 1; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #eef2ff;
    color: #4f46e5;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}
.menu-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: #6c757d;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}
.menu-toggle:hover { background: #f3f4f6; }
.header-settings-link { color: #adb5bd; font-size: 14px; margin-left: 8px; transition: color 0.2s; }
.header-settings-link:hover { color: #4f46e5; }

/* === サイドバー === */
.sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
}
.sidebar {
    position: fixed;
    top: 0; left: -280px;
    width: 280px;
    height: 100%;
    background: #fff;
    z-index: 200;
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
    transition: left 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.sidebar.open { left: 0; }
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}
.sidebar-title {
    font-size: 16px;
    font-weight: 700;
    color: #4f46e5;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-nav { padding: 12px 0; flex: 1; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
}
.sidebar-link:hover { background: #f3f4f6; }
.sidebar-link.active { background: #eef2ff; color: #4f46e5; }
.sidebar-link i { width: 18px; text-align: center; font-size: 15px; }
.sidebar-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sidebar-divider { height: 1px; background: #e5e7eb; margin: 8px 0; }
.sidebar-label { padding: 8px 20px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: #adb5bd; letter-spacing: 0.5px; }

/* === ログイン画面 === */
.login-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.login-box {
    background: #fff;
    border-radius: 20px;
    padding: 48px 40px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.login-icon { font-size: 48px; color: #4f46e5; margin-bottom: 16px; }
.login-box h1 { font-size: 24px; margin-bottom: 8px; color: #1a1a2e; }
.login-box p { color: #6c757d; margin-bottom: 24px; font-size: 14px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form input {
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}
.login-form input:focus { border-color: #4f46e5; }
.login-btn { width: 100%; padding: 14px; font-size: 16px; border-radius: 12px; }
.login-error { color: #dc3545; font-size: 14px; margin-top: 8px; }
.hidden { display: none !important; }

/* === メインコンテンツ === */
.main-content-full {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 60px);
}

/* === ローディング・エラー === */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 60px 20px;
    color: #6c757d;
    font-size: 16px;
}
.loading-sm {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    color: #adb5bd;
}
.error-msg {
    padding: 20px;
    background: #fff3f3;
    color: #dc3545;
    border-radius: 12px;
    text-align: center;
}

/* === トースト通知 === */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s;
    transition: opacity 0.3s;
}
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }
.toast.info { background: #3b82f6; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* === ダッシュボード === */
.dashboard { padding: 8px 0; }
.dash-greeting { font-size: 22px; margin-bottom: 20px; color: #1a1a2e; }

.dashboard-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.dashboard-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.dashboard-card h3 { font-size: 16px; margin-bottom: 8px; }
.card-desc-small { font-size: 13px; color: #6c757d; margin-bottom: 12px; }

.personal-card { border-left: 4px solid #4f46e5; }

/* 期限が近いタスクカード */
.urgent-card { border-left: 4px solid #ef4444; cursor: default; }
.urgent-card:hover { transform: none; }
.urgent-card h3 { color: #ef4444; display: flex; align-items: center; gap: 8px; }
.urgent-task-list { display: flex; flex-direction: column; gap: 6px; }
.urgent-task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 8px;
    background: #fef2f2;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.urgent-task-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.urgent-task-item.overdue { background: #fecaca; }
.urgent-task-item.today { background: #fff7ed; }
.urgent-task-item.soon { background: #fef9c3; }
.urgent-task-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.urgent-task-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.urgent-scope { font-size: 11px; padding: 1px 8px; background: rgba(0,0,0,0.06); border-radius: 4px; color: #6c757d; flex-shrink: 0; }
.urgent-task-date { font-weight: 600; font-size: 12px; color: #ef4444; flex-shrink: 0; margin-left: 8px; }
.urgent-task-item.today .urgent-task-date { color: #f97316; }
.urgent-task-item.soon .urgent-task-date { color: #d97706; }

.dash-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.dash-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #6c757d;
    padding: 4px 10px;
    background: #f8f9fa;
    border-radius: 8px;
}
.dash-stat.todo { color: #f59e0b; background: #fff8e1; }
.dash-stat.progress { color: #3b82f6; background: #eff6ff; }
.dash-stat.done { color: #10b981; background: #ecfdf5; }

.dash-members { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.member-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: #eef2ff;
    color: #4f46e5;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.dash-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 24px 0 12px;
}
.dash-section-header h3 { font-size: 16px; color: #6c757d; }

.dashboard-projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.dash-admin { margin-top: 32px; padding-top: 20px; border-top: 1px solid #e5e7eb; }

.empty-text { color: #adb5bd; font-size: 14px; padding: 20px; text-align: center; }

/* === ボード画面 === */
.board-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}
.board-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #6c757d;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tab-btn:hover { background: #e9ecef; }
.tab-btn.active { background: #4f46e5; color: #fff; }
.board-actions { display: flex; gap: 8px; }

/* === フィルターバー === */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar input[type="text"] {
    flex: 1;
    min-width: 150px;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
}
.filter-bar input[type="text"]:focus { border-color: #4f46e5; }
.filter-bar select {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    background: #fff;
    cursor: pointer;
}
.filter-bar select:focus { border-color: #4f46e5; }

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    align-items: start;
}
.board-column {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 12px;
    min-height: 200px;
}
.column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 4px 8px;
}
.column-header h2 {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
.column-count {
    background: #dee2e6;
    color: #495057;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}
.column-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 40px;
    transition: background 0.2s;
    border-radius: 8px;
    padding: 2px;
}
.column-cards.drag-over {
    background: rgba(79, 70, 229, 0.08);
    outline: 2px dashed #4f46e5;
    outline-offset: -2px;
}

/* === タスクカード === */
.task-card {
    background: #fff;
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
    position: relative;
    user-select: none;
}
.task-card:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.1); }
.task-card[draggable="true"] { cursor: grab; }
.task-card[draggable="true"]:active { cursor: grabbing; }
.task-card.dragging {
    opacity: 0.4;
    transform: rotate(2deg);
}
.touch-clone {
    opacity: 0.85;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    border-radius: 10px;
    transform: rotate(3deg);
}
.drop-indicator {
    height: 3px;
    background: #4f46e5;
    border-radius: 2px;
    margin: 4px 0;
    animation: pulseIndicator 1s infinite;
}
@keyframes pulseIndicator {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.card-action-btn {
    background: none;
    border: none;
    color: #adb5bd;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}
.task-card:hover .card-action-btn { opacity: 1; }
.card-action-btn:hover { color: #dc3545; background: #fee; }

/* 期限バッジ */
.due-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
}
.due-badge.overdue { background: #fecaca; color: #dc2626; }
.due-badge.today { background: #fed7aa; color: #ea580c; }
.due-badge.soon { background: #fef3c7; color: #d97706; }

.card-label {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
    background: #e9ecef;
    color: #495057;
}
.task-card[data-label="visit"] .card-label { background: #dbeafe; color: #1d4ed8; }
.task-card[data-label="meeting"] .card-label { background: #fce7f3; color: #be185d; }
.task-card[data-label="task"] .card-label { background: #d1fae5; color: #059669; }
.task-card[data-label="confirm"] .card-label { background: #fef3c7; color: #d97706; }
.card-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; word-break: break-word; }
.card-desc { font-size: 12px; color: #6c757d; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: #adb5bd; }
.card-meta-item { display: inline-flex; align-items: center; gap: 4px; }
.card-priority {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbbf24;
}
.card-priority.high { background: #ef4444; }
.card-priority.medium { background: #fbbf24; }
.card-priority.low { background: #10b981; }

/* === カレンダー === */
.calendar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.calendar-header h2 { font-size: 18px; flex: 0 0 auto; }
.calendar-grid { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}
.calendar-weekdays span {
    padding: 10px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #6c757d;
}
.calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-day {
    min-height: 80px;
    padding: 6px;
    border: 1px solid #f0f0f0;
    position: relative;
}
.calendar-day.other-month { background: #fafafa; }
.calendar-day.today { background: #eef2ff; }
.day-number { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.day-number span { background: #4f46e5; color: #fff; padding: 2px 6px; border-radius: 4px; }
.day-task {
    font-size: 11px;
    padding: 2px 4px;
    border-radius: 3px;
    margin-bottom: 2px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #e9ecef;
    color: #495057;
}
.day-task[data-label="visit"] { background: #dbeafe; color: #1d4ed8; }
.day-task[data-label="meeting"] { background: #fce7f3; color: #be185d; }
.day-task[data-label="task"] { background: #d1fae5; color: #059669; }
.day-task[data-label="confirm"] { background: #fef3c7; color: #d97706; }
.day-task-more { font-size: 10px; color: #6c757d; }

/* === リスト表示 === */
.list-table {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.list-table-header {
    display: grid;
    grid-template-columns: 60px 1fr 80px 60px 90px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    font-size: 13px;
    color: #6c757d;
}
.list-item {
    display: grid;
    grid-template-columns: 60px 1fr 80px 60px 90px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 14px;
}
.list-item:hover { background: #f8f9fa; }
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fbbf24;
}
.status-dot.todo { background: #f59e0b; }
.status-dot.in-progress { background: #3b82f6; }
.status-dot.done { background: #10b981; }
.item-title { font-weight: 500; }
.item-label { font-size: 12px; padding: 2px 8px; border-radius: 4px; text-align: center; }
.item-label.visit { background: #dbeafe; color: #1d4ed8; }
.item-label.meeting { background: #fce7f3; color: #be185d; }
.item-label.task { background: #d1fae5; color: #059669; }
.item-label.confirm { background: #fef3c7; color: #d97706; }
.item-priority { text-align: center; }
.item-date { font-size: 13px; color: #6c757d; }

/* === アクティビティタイムライン === */
.activity-timeline {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.activity-content { flex: 1; min-width: 0; }
.activity-user { font-weight: 600; font-size: 13px; margin-right: 6px; }
.activity-text { font-size: 13px; color: #495057; }
.activity-text strong { color: #1a1a2e; }
.activity-time { display: block; font-size: 11px; color: #adb5bd; margin-top: 2px; }

/* === メモ === */
.memo-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.memo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}
.memo-card {
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
    border: 1px solid #e5e7eb;
    min-height: 120px;
}
.memo-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.memo-card-actions { position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity 0.2s; }
.memo-card:hover .memo-card-actions { opacity: 1; }
.memo-card-title { font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.memo-card-preview { font-size: 13px; color: #495057; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 12px; word-break: break-word; }
.memo-card-footer { display: flex; align-items: center; justify-content: space-between; }
.memo-card-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.memo-tag { font-size: 11px; padding: 2px 8px; background: rgba(0,0,0,0.06); border-radius: 4px; color: #6c757d; }
.memo-card-date { font-size: 11px; color: #adb5bd; }
.memo-empty { text-align: center; padding: 60px 20px; color: #adb5bd; }
.memo-empty i { font-size: 48px; margin-bottom: 12px; display: block; }

/* マークダウンプレビュー */
.memo-md-hint { font-size: 11px; color: #adb5bd; font-weight: 400; }
.memo-preview {
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    min-height: 200px;
    line-height: 1.7;
}
.md-rendered h2 { font-size: 18px; margin: 8px 0 4px; }
.md-rendered h3 { font-size: 16px; margin: 6px 0 4px; }
.md-rendered h4 { font-size: 14px; margin: 4px 0 2px; }
.md-rendered strong { font-weight: 700; }
.md-rendered em { font-style: italic; }
.md-rendered code {
    background: #e9ecef;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}
.md-rendered ul { padding-left: 20px; margin: 4px 0; }
.md-rendered li { margin: 2px 0; }
.md-rendered a { color: #4f46e5; text-decoration: underline; }
.memo-card-preview.md-rendered {
    white-space: normal;
}

.modal-header-actions { display: flex; align-items: center; gap: 4px; }

/* === コメント === */
.comment-divider { height: 1px; background: #e5e7eb; margin: 16px 0; }
.comment-section-title { font-size: 14px; color: #495057; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.comment-list { max-height: 200px; overflow-y: auto; margin-bottom: 10px; }
.comment-item { padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.comment-item:last-child { border-bottom: none; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-user { font-size: 12px; font-weight: 600; color: #4f46e5; display: flex; align-items: center; gap: 4px; }
.comment-time { font-size: 11px; color: #adb5bd; }
.comment-text { font-size: 13px; color: #495057; padding-left: 20px; }
.comment-empty { font-size: 12px; color: #adb5bd; text-align: center; padding: 12px; }
.comment-input-area {
    display: flex;
    gap: 8px;
    align-items: center;
}
.comment-input-area input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
}
.comment-input-area input:focus { border-color: #4f46e5; }
.btn-icon-xs {
    background: none;
    border: none;
    color: #adb5bd;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 11px;
    border-radius: 4px;
}
.btn-icon-xs:hover { color: #dc3545; background: #fee; }

.modal-task-full { max-width: 560px; }

/* === モーダル === */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal {
    background: #fff;
    border-radius: 16px;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-memo { max-width: 600px; }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 12px;
}
.modal-header h2 { font-size: 18px; }
.modal-body { padding: 0 24px 16px; }
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 24px 20px;
    border-top: 1px solid #f0f0f0;
}

/* === フォーム === */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #495057; margin-bottom: 4px; }
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: #4f46e5; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* === メモカラーピッカー === */
.memo-color-picker { display: flex; gap: 8px; padding: 4px 0; }
.memo-color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    cursor: pointer;
    transition: transform 0.15s;
}
.memo-color-option:hover { transform: scale(1.15); }
.memo-color-option.selected { border-color: #4f46e5; box-shadow: 0 0 0 2px #c7d2fe; }

/* === パスワード表示 === */
.password-display {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    word-break: break-all;
    margin: 12px 0;
    user-select: all;
    letter-spacing: 0.5px;
}

/* === ユーザー管理 === */
.admin-container { max-width: 600px; margin: 0 auto; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.admin-header h2 { font-size: 18px; display: flex; align-items: center; gap: 8px; }
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    flex-wrap: wrap;
}
.user-info { display: flex; align-items: center; gap: 12px; }
.user-avatar { font-size: 32px; color: #adb5bd; }
.user-name { font-weight: 600; font-size: 15px; }
.user-role { font-size: 12px; color: #6c757d; }
.user-actions { display: flex; gap: 6px; }
.user-password-area {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
    width: 100%;
}
.user-pw-label { font-size: 12px; color: #6c757d; font-weight: 600; white-space: nowrap; }
.user-pw-value { font-family: 'Courier New', monospace; font-size: 13px; word-break: break-all; flex: 1; min-width: 100px; }
.pw-hidden { color: #adb5bd; letter-spacing: 2px; }
.pw-text { color: #1a1a2e; }
.pw-none { color: #dc3545; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 12px; }

/* === プロジェクト設定 === */
.settings-sections {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.settings-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.settings-card h3 { font-size: 16px; color: #1a1a2e; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.settings-card h4 { font-size: 14px; color: #6c757d; margin: 16px 0 10px; }
.settings-danger { border: 1px solid #fecaca; }
.settings-danger h3 { color: #dc3545; }
.danger-text { font-size: 13px; color: #6c757d; margin-bottom: 12px; }
.settings-container {
    max-width: 600px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.settings-container h2 { font-size: 20px; margin-bottom: 8px; }
.settings-container h3 { font-size: 15px; color: #6c757d; margin: 20px 0 12px; }
.settings-container hr { border: none; border-top: 1px solid #e5e7eb; margin: 24px 0; }
.member-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.member-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
}
.member-add { display: flex; gap: 8px; flex-wrap: wrap; }

/* === フォントサイズ設定 === */
.settings-desc { font-size: 13px; color: #6c757d; margin-bottom: 16px; }
.font-size-control {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}
.font-size-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border-radius: 50%;
    flex-shrink: 0;
}
.font-size-display {
    flex: 1;
    text-align: center;
}
.font-size-value {
    font-size: 24px;
    font-weight: 700;
    color: #4f46e5;
    display: block;
    margin-bottom: 8px;
}
.font-size-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}
.font-size-bar-fill {
    height: 100%;
    background: #4f46e5;
    border-radius: 4px;
    transition: width 0.2s;
}
.font-size-preview {
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 16px;
    text-align: center;
    color: #495057;
    border: 1px solid #e5e7eb;
}

/* === ダークモード切り替えスイッチ === */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    cursor: pointer;
}
.toggle-switch input { display: none; }
.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #dee2e6;
    border-radius: 28px;
    transition: background 0.3s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: #4f46e5; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(24px); }
#darkModeLabel { font-size: 14px; font-weight: 600; color: #495057; }

/* ============================================
   ダークモード
   ============================================ */
html.dark-mode {
    color-scheme: dark;
}
html.dark-mode body {
    background: #0f172a;
    color: #e2e8f0;
}
html.dark-mode .top-header {
    background: #1e293b;
    border-bottom-color: #334155;
}
html.dark-mode .header-title { color: #e2e8f0; }
html.dark-mode .sidebar {
    background: #1e293b;
    box-shadow: 2px 0 12px rgba(0,0,0,0.3);
}
html.dark-mode .sidebar-header { border-bottom-color: #334155; }
html.dark-mode .sidebar-link { color: #cbd5e1; }
html.dark-mode .sidebar-link:hover { background: #334155; }
html.dark-mode .sidebar-link.active { background: #312e81; color: #a5b4fc; }
html.dark-mode .sidebar-divider { background: #334155; }
html.dark-mode .sidebar-overlay { background: rgba(0,0,0,0.6); }

html.dark-mode .dashboard-card,
html.dark-mode .settings-card,
html.dark-mode .modal,
html.dark-mode .task-card,
html.dark-mode .list-table,
html.dark-mode .calendar-grid,
html.dark-mode .activity-timeline,
html.dark-mode .filter-bar {
    background: #1e293b;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

html.dark-mode .board-column { background: #0f172a; }
html.dark-mode .column-cards.drag-over { background: rgba(99,102,241,0.15); outline-color: #6366f1; }

html.dark-mode .task-card { background: #1e293b; border: 1px solid #334155; }
html.dark-mode .task-card:hover { box-shadow: 0 3px 8px rgba(0,0,0,0.4); }
html.dark-mode .card-title { color: #e2e8f0; }
html.dark-mode .card-desc { color: #94a3b8; }
html.dark-mode .card-meta { color: #64748b; }
html.dark-mode .card-label { background: #334155; color: #cbd5e1; }

html.dark-mode .memo-card { background: #1e293b !important; border-color: #334155; }
html.dark-mode .memo-card-title { color: #e2e8f0; }
html.dark-mode .memo-card-preview { color: #94a3b8; }

html.dark-mode .form-group input,
html.dark-mode .form-group textarea,
html.dark-mode .form-group select,
html.dark-mode .filter-bar input,
html.dark-mode .filter-bar select,
html.dark-mode .comment-input-area input {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}
html.dark-mode .form-group label { color: #94a3b8; }
html.dark-mode .form-group input:focus,
html.dark-mode .form-group textarea:focus,
html.dark-mode .form-group select:focus { border-color: #6366f1; }

html.dark-mode .modal-footer { border-top-color: #334155; }
html.dark-mode .modal-header h2 { color: #e2e8f0; }

html.dark-mode .dash-greeting { color: #e2e8f0; }
html.dark-mode .dash-stat { background: #334155; color: #94a3b8; }
html.dark-mode .dash-stat.todo { background: #422006; color: #fbbf24; }
html.dark-mode .dash-stat.progress { background: #172554; color: #60a5fa; }
html.dark-mode .dash-stat.done { background: #052e16; color: #34d399; }

html.dark-mode .column-header h2 { color: #cbd5e1; }
html.dark-mode .column-count { background: #334155; color: #94a3b8; }

html.dark-mode .list-table-header { background: #0f172a; border-bottom-color: #334155; color: #64748b; }
html.dark-mode .list-item { border-bottom-color: #1e293b; color: #cbd5e1; }
html.dark-mode .list-item:hover { background: #334155; }

html.dark-mode .calendar-weekdays { background: #0f172a; border-bottom-color: #334155; }
html.dark-mode .calendar-weekdays span { color: #64748b; }
html.dark-mode .calendar-day { border-color: #1e293b; }
html.dark-mode .calendar-day.other-month { background: #0c1322; }
html.dark-mode .calendar-day.today { background: #1e1b4b; }
html.dark-mode .day-number { color: #cbd5e1; }

html.dark-mode .tab-btn { color: #94a3b8; }
html.dark-mode .tab-btn:hover { background: #334155; }
html.dark-mode .tab-btn.active { background: #4f46e5; color: #fff; }

html.dark-mode .btn-outline { color: #94a3b8; border-color: #334155; }
html.dark-mode .btn-outline:hover { background: #334155; border-color: #475569; }
html.dark-mode .btn-logout { color: #94a3b8; border-color: #334155; }
html.dark-mode .btn-icon { color: #94a3b8; }
html.dark-mode .btn-icon:hover { background: #334155; color: #e2e8f0; }

html.dark-mode .user-badge { background: #312e81; color: #a5b4fc; }

html.dark-mode .settings-desc { color: #64748b; }
html.dark-mode .settings-card h3 { color: #e2e8f0; }
html.dark-mode .font-size-bar { background: #334155; }
html.dark-mode .font-size-preview { background: #0f172a; border-color: #334155; color: #cbd5e1; }
html.dark-mode #darkModeLabel { color: #cbd5e1; }
html.dark-mode .toggle-slider { background: #475569; }

html.dark-mode .user-item { background: #1e293b; }
html.dark-mode .user-name { color: #e2e8f0; }
html.dark-mode .user-password-area { background: #0f172a; }
html.dark-mode .pw-text { color: #e2e8f0; }
html.dark-mode .member-item { background: #0f172a; color: #cbd5e1; }

html.dark-mode .password-display { background: #0f172a; border-color: #334155; color: #e2e8f0; }

html.dark-mode .comment-divider { background: #334155; }
html.dark-mode .comment-item { border-bottom-color: #1e293b; }
html.dark-mode .comment-text { color: #94a3b8; }
html.dark-mode .activity-item { border-bottom-color: #334155; }
html.dark-mode .activity-text { color: #94a3b8; }
html.dark-mode .activity-text strong { color: #e2e8f0; }

html.dark-mode .urgent-task-item { background: #1e293b; }
html.dark-mode .urgent-task-item.overdue { background: #450a0a; }
html.dark-mode .urgent-task-item.today { background: #431407; }
html.dark-mode .urgent-task-item.soon { background: #422006; }
html.dark-mode .urgent-task-title { color: #e2e8f0; }
html.dark-mode .urgent-scope { background: rgba(255,255,255,0.1); color: #94a3b8; }

html.dark-mode .memo-preview { background: #0f172a; border-color: #334155; color: #cbd5e1; }
html.dark-mode .md-rendered code { background: #334155; color: #e2e8f0; }

html.dark-mode .drop-indicator { background: #6366f1; }

html.dark-mode .error-msg { background: #450a0a; color: #fca5a5; }
html.dark-mode .settings-danger { border-color: #991b1b; }

html.dark-mode .empty-text { color: #475569; }
html.dark-mode .card-desc-small { color: #64748b; }
html.dark-mode .danger-text { color: #94a3b8; }

html.dark-mode .memo-color-option { border-color: #475569; }
html.dark-mode .memo-color-option.selected { border-color: #6366f1; box-shadow: 0 0 0 2px #4338ca; }
html.dark-mode .memo-tag { background: rgba(255,255,255,0.08); color: #94a3b8; }

/* === レスポンシブ === */
@media (max-width: 768px) {
    .main-content-full { padding: 12px; }
    .top-header { padding: 10px 12px; }
    .header-title { font-size: 15px; }
    .user-badge { display: none; }

    .board { grid-template-columns: 1fr; gap: 12px; }
    .board-column { min-height: auto; }

    .board-tabs { overflow-x: auto; }
    .tab-btn { padding: 6px 12px; font-size: 13px; }

    .calendar-day { min-height: 50px; padding: 4px; }
    .day-number { font-size: 11px; }
    .day-task { font-size: 9px; }

    .list-table-header { display: none; }
    .list-item {
        grid-template-columns: 30px 1fr;
        gap: 4px;
    }
    .list-item .item-label,
    .list-item .item-priority,
    .list-item .item-date { display: none; }

    .memo-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

    .modal { border-radius: 12px; margin: 8px; max-height: 95vh; }
    .modal-header { padding: 16px 16px 8px; }
    .modal-body { padding: 0 16px 12px; }
    .modal-footer { padding: 10px 16px 16px; }
    .form-row { grid-template-columns: 1fr; gap: 0; }

    .dashboard-projects { grid-template-columns: 1fr; }
    .dash-greeting { font-size: 18px; }

    .settings-container { padding: 16px; border-radius: 12px; }
    .user-item { padding: 12px 14px; }

    .filter-bar { flex-direction: column; }
    .filter-bar input[type="text"] { min-width: auto; width: 100%; }
    .filter-bar select { width: 100%; }
}

@media (max-width: 480px) {
    .memo-grid { grid-template-columns: 1fr; }
    .board-header { flex-direction: column; align-items: stretch; }
    .board-actions { justify-content: flex-end; }
}
