* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    line-height: 1.8;
    color: #333;
    background: #f5f5f5;
}
.app-layout { display: flex; min-height: 100vh; }

/* サイドバー */
.sidebar {
    width: 240px;
    background: #2c3e50;
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar-header {
    padding: 20px;
    border-bottom: 3px solid #17a2b8;
}
.logo-text {
    font-size: 18px;
    font-weight: bold;
    color: #17a2b8;
}
.sidebar-nav { padding: 10px 0; flex: 1; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: #ccc;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active {
    background: rgba(23,162,184,0.15);
    color: #17a2b8;
    border-left-color: #17a2b8;
}
.nav-icon { font-size: 20px; }
.nav-label { font-size: 15px; font-weight: 500; }

/* サイドバーフッター（ユーザー切替） */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 15px;
}
.user-switch {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-avatar {
    width: 36px;
    height: 36px;
    background: #17a2b8;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 14px; font-weight: 600; color: #fff; }
.user-role { font-size: 11px; color: #999; }
.user-switch-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #ccc;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.user-switch-btn:hover { background: rgba(23,162,184,0.3); color: #17a2b8; }

/* メインコンテンツ */
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.top-bar {
    background: #fff;
    border-bottom: 3px solid #17a2b8;
    padding: 15px 30px;
    flex-shrink: 0;
}
.page-title { font-size: 22px; color: #17a2b8; }
.content-area { padding: 30px; flex: 1; overflow-y: auto; }

/* カード */
.card {
    background: #fff;
    padding: 30px;
    margin-bottom: 20px;
}
.card h2 {
    font-size: 20px;
    color: #17a2b8;
    border-left: 5px solid #17a2b8;
    padding-left: 15px;
    margin-bottom: 25px;
}

/* テーブル */
table { width: 100%; border-collapse: collapse; }
th {
    background: #17a2b8;
    color: #fff;
    padding: 12px 15px;
    text-align: left;
    font-weight: bold;
    white-space: nowrap;
}
td { padding: 12px 15px; border: 1px solid #ddd; }
tr:nth-child(even) { background: #f8f9fa; }

/* バッジ */
.badge {
    display: inline-block;
    padding: 3px 12px;
    font-size: 13px;
    font-weight: bold;
    color: #fff;
}
.badge-progress { background: #17a2b8; }
.badge-pending { background: #6c757d; }
.badge-done { background: #28a745; }

/* チャット */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    background: #fff;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.chat-msg {
    max-width: 70%;
    padding: 12px 16px;
}
.msg-user {
    align-self: flex-end;
    background: #e7f6f8;
    border-left: 3px solid #17a2b8;
}
.msg-admin {
    align-self: flex-start;
    background: #f8f9fa;
    border-left: 3px solid #6c757d;
}
.msg-meta { font-size: 12px; color: #999; margin-bottom: 4px; }
.msg-author { font-weight: 600; color: #555; }
.msg-time { margin-left: 8px; }
.msg-body { font-size: 14px; line-height: 1.7; }
.chat-input-area {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    background: #fafafa;
}
.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #ddd;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}
.chat-input:focus { border-color: #17a2b8; }
.chat-send-btn {
    background: #17a2b8;
    color: #fff;
    border: none;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
    align-self: flex-end;
}
.chat-send-btn:hover { opacity: 0.8; }

/* 本棚 */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
}
.book-item {
    background: #f8f9fa;
    padding: 25px 15px;
    text-align: center;
    border: 2px solid #ddd;
    transition: border-color 0.2s;
    cursor: pointer;
}
.book-item:hover { border-color: #17a2b8; }
.book-cover { font-size: 48px; margin-bottom: 10px; }
.book-title { font-size: 14px; font-weight: 500; }

/* 案件 */
.project-list { display: flex; flex-direction: column; gap: 15px; }
.project-item {
    background: #f8f9fa;
    padding: 20px;
    border-left: 4px solid #17a2b8;
}
.project-name { font-size: 16px; font-weight: bold; margin-bottom: 5px; display: flex; align-items: center; gap: 10px; }
.project-meta { font-size: 13px; color: #666; margin-bottom: 5px; }
.project-stats { font-size: 12px; color: #17a2b8; font-weight: 600; margin-bottom: 8px; }
.progress-bar {
    height: 8px;
    background: #e9ecef;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: #17a2b8;
    transition: width 0.3s;
}

/* その他アクション */
.other-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}
.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 25px 15px;
    background: #f8f9fa;
    border: 2px solid #ddd;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
    cursor: pointer;
}
.action-card:hover { border-color: #17a2b8; background: #e7f6f8; }
.action-icon { font-size: 32px; }
.action-label { font-size: 14px; font-weight: 600; }
