/* =============================================================================
   PortalWeb - アプリケーション共通スタイルシート
   デザインコンセプト：Windows Forms 風の業務アプリケーション UI
   DB の M_AppSettings に格納されたデザイン設定が MainLayout から
   CSS カスタムプロパティ（var(--xxx)）として注入される。
   ============================================================================= */

/* ─── CSS カスタムプロパティのデフォルト値 ─────────────────────────────────────
   MainLayout の HeadContent で上書きされる。
   DB 未接続時・初回レンダリング前のフォールバックとして機能する。 */
:root {
    --titlebar-bg-color:   #1a3a5c;
    --titlebar-font-color: #ffffff;
    --menubar-bg-color:    #2d6a9f;
    --menubar-font-color:  #ffffff;
    --accent-color:        #0d6efd;
    --base-font-family:    Meiryo, "Yu Gothic UI", "Segoe UI", sans-serif;
    --base-font-size:      14px;

    /* シェルの高さ定数 */
    --titlebar-height:  35px;
    --menubar-height:   32px;
    --statusbar-height: 24px;
}

/* ─── ページ全体リセット ─────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: var(--base-font-family);
    font-size: var(--base-font-size);
    background-color: #f0f0f0;
    color: #1a1a1a;
    overflow: hidden; /* アプリ全体のスクロールは .app-content で制御する */
}

a {
    color: var(--accent-color);
}

/* ─── アプリシェル（全体レイアウト）────────────────────────────────────────── */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ─── タイトルバー ─────────────────────────────────────────────────────────── */
.app-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--titlebar-height);
    min-height: var(--titlebar-height);
    background-color: var(--titlebar-bg-color);
    color: var(--titlebar-font-color);
    padding: 0 12px;
    flex-shrink: 0;
    user-select: none;
}

.titlebar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.titlebar-appname {
    font-weight: bold;
    flex-shrink: 0;
}

.titlebar-separator {
    opacity: 0.6;
    flex-shrink: 0;
}

.titlebar-pagetitle {
    font-weight: normal;
    opacity: 0.85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.titlebar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    flex-shrink: 0;
    margin-left: 16px;
}

.titlebar-username {
    opacity: 0.9;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.titlebar-clock {
    font-size: 12px;
    font-family: "Courier New", Courier, monospace;
    letter-spacing: 0.05em;
    opacity: 0.85;
}

.titlebar-logout {
    color: var(--titlebar-font-color);
    text-decoration: none;
    padding: 2px 10px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 2px;
    font-size: 12px;
    white-space: nowrap;
    transition: background-color 0.15s;
}

.titlebar-logout:hover {
    background-color: rgba(255, 255, 255, 0.18);
    color: var(--titlebar-font-color);
    text-decoration: none;
}

/* ─── メニューバー ─────────────────────────────────────────────────────────── */
.app-menubar {
    display: flex;
    align-items: center;
    height: var(--menubar-height);
    min-height: var(--menubar-height);
    background-color: var(--menubar-bg-color);
    padding: 0 4px;
    flex-shrink: 0;
    position: relative;
    z-index: 900;
}

/* ドロップダウン外クリック検知用透明オーバーレイ */
.menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: transparent;
    cursor: default;
}

.menu-item-wrapper {
    position: relative;
}

/* ドロップダウンボタンの開閉インジケータ */
.menu-chevron {
    font-size: 9px;
    margin-left: 3px;
    opacity: 0.75;
    vertical-align: middle;
}

/* メニューバーボタン（グループ・リーフ共通） */
.menubar-btn {
    display: inline-block;
    background: transparent;
    border: 1px solid transparent;
    color: var(--menubar-font-color);
    padding: 0 12px;
    height: calc(var(--menubar-height) - 4px);
    line-height: calc(var(--menubar-height) - 6px);
    cursor: pointer;
    font-size: var(--base-font-size);
    font-family: var(--base-font-family);
    white-space: nowrap;
    text-decoration: none;
    border-radius: 2px;
    transition: background-color 0.12s;
}

.menubar-btn:hover,
.menubar-btn.active {
    background-color: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.35);
    color: var(--menubar-font-color);
    text-decoration: none;
}

/* ドロップダウンメニュー本体 */
.menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: #ffffff;
    border: 1px solid #a0a0a0;
    box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.22);
    z-index: 999;
    padding: 3px 0;
}

/* ドロップダウンの各メニュー項目 */
.menu-dropdown-item {
    display: block;
    padding: 6px 20px;
    color: #1a1a1a;
    text-decoration: none;
    font-size: var(--base-font-size);
    font-family: var(--base-font-family);
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.1s;
}

.menu-dropdown-item:hover {
    background-color: var(--accent-color);
    color: #ffffff;
    text-decoration: none;
}

/* ─── コンテンツエリア ─────────────────────────────────────────────────────── */
.app-content {
    flex: 1;
    overflow-y: auto;
    background-color: #f0f0f0;
    display: flex;
    flex-direction: column;
    min-height: 0; /* flex item がスクロールできるために必要 */
}

.content-area {
    flex: 1;
    padding: 12px 16px;
    min-height: 0; /* flex child が正しく縮小できるために必要 */
    overflow: auto;
}

/* チャット等の全高ページはパディングなし・フルハイトで表示する */
.content-area:has(.chat-shell) {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ─── ステータスバー ───────────────────────────────────────────────────────── */
.app-statusbar {
    display: flex;
    align-items: center;
    height: var(--statusbar-height);
    min-height: var(--statusbar-height);
    background-color: #f0f0f0;
    border-top: 1px solid #a8a8a8;
    padding: 0 10px;
    font-size: 11px;
    color: #505050;
    flex-shrink: 0;
    gap: 12px;
}

.statusbar-connection {
    color: #0a7a2e;
    font-size: 11px;
}

.statusbar-spacer {
    flex: 1;
}

.statusbar-message {
    font-size: 11px;
    color: #444;
}

/* ─── ログインページ ───────────────────────────────────────────────────────── */
.login-page {
    background-color: #f0f0f0;
    min-height: 100vh;
}

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-dialog {
    width: 360px;
    background-color: #f5f5f5;
    border: 1px solid #9e9e9e;
    box-shadow: 3px 4px 10px rgba(0, 0, 0, 0.28);
}

.login-titlebar {
    background-color: var(--titlebar-bg-color);
    color: var(--titlebar-font-color);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: bold;
    user-select: none;
}

.login-body {
    padding: 20px 24px 28px;
}

.login-subtitle {
    font-size: 12px;
    color: #555;
    margin: 0 0 16px;
}

.login-error-message {
    background-color: #fde8e8;
    border: 1px solid #d43f3f;
    color: #9b1c1c;
    padding: 7px 12px;
    margin-bottom: 14px;
    font-size: 12px;
    border-radius: 2px;
}

.login-field-group {
    margin-bottom: 14px;
}

.login-label {
    display: block;
    font-size: 12px;
    color: #333;
    margin-bottom: 4px;
}

.login-input {
    display: block;
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #b0b0b0;
    background-color: #ffffff;
    font-size: 14px;
    font-family: var(--base-font-family);
    color: #1a1a1a;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.login-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.22);
}

.login-btn-row {
    margin-top: 22px;
    text-align: right;
}

.login-btn {
    background-color: var(--accent-color);
    color: #ffffff;
    border: 1px solid var(--accent-color);
    padding: 6px 28px;
    font-size: 14px;
    font-family: var(--base-font-family);
    cursor: pointer;
    border-radius: 2px;
    transition: filter 0.12s;
}

.login-btn:hover {
    filter: brightness(1.12);
}

/* ─── 共通 UI コンポーネント ───────────────────────────────────────────────── */

/* パネル（コンテンツ内のグループ化用コンテナ） */
.panel {
    background-color: #ffffff;
    border: 1px solid #c8c8c8;
    margin-bottom: 12px;
}

.panel-header {
    background-color: #e4e4e4;
    border-bottom: 1px solid #c8c8c8;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: bold;
    color: #333;
    user-select: none;
}

.panel-body {
    padding: 10px 12px;
}

/* データグリッド風テーブル */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--base-font-size);
}

.data-table th {
    background-color: #e0e0e0;
    border: 1px solid #c0c0c0;
    padding: 5px 10px;
    font-weight: bold;
    text-align: left;
    white-space: nowrap;
    user-select: none;
}

.data-table td {
    border: 1px solid #d0d0d0;
    padding: 4px 10px;
    background-color: #ffffff;
    vertical-align: middle;
}

.data-table tbody tr:hover td {
    background-color: #e8f0ff;
}

.data-table tbody tr.selected td {
    background-color: var(--accent-color);
    color: #ffffff;
}

/* 標準アクションボタン（グレー系） */
.btn-action {
    background-color: #e8e8e8;
    border: 1px solid #a8a8a8;
    color: #1a1a1a;
    padding: 4px 14px;
    font-size: var(--base-font-size);
    font-family: var(--base-font-family);
    cursor: pointer;
    border-radius: 2px;
    transition: background-color 0.12s;
}

.btn-action:hover {
    background-color: #d4d4d4;
}

/* プライマリアクションボタン（アクセントカラー） */
.btn-primary-action {
    background-color: var(--accent-color);
    border: 1px solid var(--accent-color);
    color: #ffffff;
    padding: 4px 14px;
    font-size: var(--base-font-size);
    font-family: var(--base-font-family);
    cursor: pointer;
    border-radius: 2px;
    transition: filter 0.12s;
}

.btn-primary-action:hover {
    filter: brightness(1.1);
}

/* 危険操作ボタン（削除等） */
.btn-danger-action {
    background-color: #dc3545;
    border: 1px solid #dc3545;
    color: #ffffff;
    padding: 4px 14px;
    font-size: var(--base-font-size);
    font-family: var(--base-font-family);
    cursor: pointer;
    border-radius: 2px;
    transition: filter 0.12s;
}

.btn-danger-action:hover {
    filter: brightness(1.1);
}

/* アクセス拒否ページ */
.access-denied-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
}

/* ─── Blazor エラー UI ─────────────────────────────────────────────────────── */
#blazor-error-ui {
    background-color: #fffbe0;
    border-top: 1px solid #e8c04e;
    color: #333;
    display: none;
    bottom: 0;
    left: 0;
    padding: 10px 20px;
    position: fixed;
    width: 100%;
    z-index: 9000;
    font-size: 13px;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.12);
}

#blazor-error-ui .reload {
    cursor: pointer;
    margin-left: 8px;
    color: var(--accent-color);
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: 0.6;
}

/* ─── フォームバリデーション ───────────────────────────────────────────────── */
.valid.modified:not([type="checkbox"]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
    font-size: 12px;
    margin-top: 3px;
}

/* ─── Blazor エラーバウンダリ ──────────────────────────────────────────────── */
.blazor-error-boundary {
    background-color: #b32121;
    padding: 10px 10px 10px 3.7rem;
    color: #ffffff;
}

.blazor-error-boundary::after {
    content: "コンポーネントでエラーが発生しました。";
}

/* ─── モーダルダイアログ ───────────────────────────────────────────────────── */

/* ダイアログ背景オーバーレイ（クリックで閉じる場合に使用） */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ダイアログ本体 */
.dialog {
    background: #f5f5f5;
    border: 1px solid #999;
    box-shadow: 4px 6px 14px rgba(0, 0, 0, 0.32);
    min-width: 380px;
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* ダイアログのタイトルバー */
.dialog-titlebar {
    background-color: var(--titlebar-bg-color);
    color: var(--titlebar-font-color);
    padding: 7px 16px;
    font-size: 14px;
    font-weight: bold;
    user-select: none;
    flex-shrink: 0;
}

/* ダイアログの本文エリア */
.dialog-body {
    padding: 18px 20px;
    overflow-y: auto;
    flex: 1;
}

/* ダイアログのフッターボタン行 */
.dialog-footer {
    padding: 10px 20px 14px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #d0d0d0;
    flex-shrink: 0;
}

/* ─── フォームレイアウト ───────────────────────────────────────────────────── */

/* 2カラムラベル＋入力フィールド */
.form-group {
    display: grid;
    grid-template-columns: 120px 1fr;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.form-group-wide {
    display: grid;
    grid-template-columns: 120px 1fr;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
}

.form-label {
    font-size: 12px;
    color: #444;
    text-align: right;
    padding-right: 6px;
    white-space: nowrap;
}

.form-input {
    padding: 4px 8px;
    border: 1px solid #b0b0b0;
    background: #fff;
    font-size: var(--base-font-size);
    font-family: var(--base-font-family);
    outline: none;
    width: 100%;
    box-sizing: border-box;
    color: #1a1a1a;
}

.form-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.22);
}

.form-input[readonly],
.form-input:disabled {
    background: #ebebeb;
    color: #666;
}

.form-static {
    font-size: var(--base-font-size);
    color: #333;
    padding: 4px 0;
}

/* チェックボックスグループ（ロール割り当て等） */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    padding: 4px 0;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: var(--base-font-size);
    cursor: pointer;
    user-select: none;
}

.checkbox-item input[type="checkbox"] {
    cursor: pointer;
    width: 14px;
    height: 14px;
}

/* ─── アラートメッセージ ───────────────────────────────────────────────────── */

.alert {
    padding: 7px 12px;
    margin-bottom: 10px;
    font-size: 13px;
    border-radius: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-info {
    background: #e8f4fd;
    border: 1px solid #90c8f0;
    color: #1a5276;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #7d5a00;
}

.alert-error {
    background: #fde8e8;
    border: 1px solid #d43f3f;
    color: #9b1c1c;
}

/* ─── ツールバー（パネルヘッダー内のボタン行） ─────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.toolbar-spacer {
    flex: 1;
}

/* パネルヘッダーをツールバーとして使う場合の flex レイアウト */
.panel-header.with-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* ─── 権限マトリクス ───────────────────────────────────────────────────────── */

/* 権限グリッドの固定ヘッダー付きテーブル */
.permission-table {
    border-collapse: collapse;
    font-size: var(--base-font-size);
}

.permission-table th {
    background-color: #e0e0e0;
    border: 1px solid #c0c0c0;
    padding: 4px 10px;
    text-align: center;
    white-space: nowrap;
    user-select: none;
    font-weight: bold;
}

.permission-table th.screen-col {
    text-align: left;
    min-width: 130px;
}

.permission-table td {
    border: 1px solid #d0d0d0;
    padding: 4px 10px;
    background-color: #fff;
    text-align: center;
    vertical-align: middle;
}

.permission-table td.screen-name-cell {
    text-align: left;
    background-color: #f5f5f5;
    font-weight: bold;
}

.permission-table td input[type="checkbox"] {
    cursor: pointer;
    width: 15px;
    height: 15px;
}

/* 無効ユーザー行の表示 */
.row-inactive td {
    color: #999;
    background-color: #fafafa !important;
}

/* テキスト右寄せ */
.text-right {
    text-align: right;
}

/* テキスト中央 */
.text-center {
    text-align: center;
}

/* ─── デザイン設定画面：カラーピッカー ────────────────────────────────────── */

/* カラーピッカー（input[type="color"]）のスタイル */
.color-picker {
    width: 40px;
    height: 28px;
    padding: 1px 2px;
    border: 1px solid #b0b0b0;
    cursor: pointer;
    background: transparent;
    flex-shrink: 0;
}

.color-picker:focus {
    border-color: var(--accent-color);
    outline: none;
}

/* カラーピッカー + テキスト入力の横並びコンテナ */
.color-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* カラーコードのテキスト入力（#RRGGBB 用） */
.color-hex-input {
    max-width: 110px;
    font-family: "Courier New", Courier, monospace;
    font-size: 13px;
}

/* ─── ステータスバー：接続状態インジケーター ──────────────────────────────── */

/* 接続中（緑） */
.statusbar-connection.connected {
    color: #0a7a2e;
}

/* 切断中（赤・点滅） */
.statusbar-connection.disconnected {
    color: #cc3300;
    animation: statusbar-blink 1s step-end infinite;
}

@keyframes statusbar-blink {
    50% { opacity: 0.3; }
}

/* ─── アラートメッセージ：閉じるボタン ───────────────────────────────────── */

/* 閉じるボタンを配置するため padding-right を確保する */
.alert {
    position: relative;
}

.alert:has(.alert-close) {
    padding-right: 36px;
}

.alert-close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: inherit;
    opacity: 0.6;
    padding: 2px 4px;
}

.alert-close:hover {
    opacity: 1;
}

/* ─── ローディングスピナー ────────────────────────────────────────────────── */

/* 画面全体をオーバーレイするローディング表示 */
.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.75);
    z-index: 9000;
    gap: 16px;
}

/* スピナー本体（回転する円弧） */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: var(--accent-color, #0d6efd);
    border-radius: 50%;
    animation: loading-spin 0.8s linear infinite;
}

@keyframes loading-spin {
    to { transform: rotate(360deg); }
}

/* スピナー下部のメッセージテキスト */
.loading-message {
    font-size: 13px;
    color: #555;
}

/* ─── DataGrid：データなし表示 ────────────────────────────────────────────── */

.empty-message {
    padding: 24px;
    text-align: center;
    color: #888;
    font-size: 13px;
}

/* ─── プロフィールアイコン（UserAvatar コンポーネント） ──────────────────────── */

/* 画像・イニシャル両方に共通するスタイル */
.user-avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: inline-flex;
    vertical-align: middle;
}

/* イニシャルアイコン専用スタイル */
.user-avatar-initials {
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    user-select: none;
    line-height: 1;
}

/* タイトルバーのプロフィールリンク（アイコン＋ユーザー名を横並びにする） */
.titlebar-profile-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}

.titlebar-profile-link:hover {
    background: rgba(255, 255, 255, 0.15);
    text-decoration: none;
    color: inherit;
}

/* =============================================================================
   チャット機能スタイル（Chat.razor / ChannelSidebar / MessageThread 等）
   ============================================================================= */

/* ─── チャット全体シェル ──────────────────────────────────────────────────── */

/* ページ全体を左サイドバー・中央・右サイドバーの3列に分割するコンテナ */
.chat-shell {
    display: flex;
    height: 100%; /* 親の .content-area:has(.chat-shell) が flex child として残り全高を確保 */
    overflow: hidden;
    background: var(--body-bg, #f5f5f5);
}

/* ─── 左サイドバー（チャンネル一覧） ─────────────────────────────────────── */

.chat-sidebar {
    width: 240px;
    min-width: 200px;
    background: var(--sidebar-bg, #2c2d30);
    color: #ccc;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.chat-sidebar-header {
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.chat-sidebar-section {
    margin-bottom: 4px;
}

.chat-sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #999;
}

.chat-sidebar-add-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
}

.chat-sidebar-add-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.chat-channel-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    cursor: pointer;
    border-radius: 4px;
    margin: 1px 6px;
    font-size: 14px;
    color: #ccc;
    transition: background 0.1s, color 0.1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-channel-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.chat-channel-item.active {
    background: var(--accent-color, #0078d4);
    color: #fff;
}

.chat-channel-item.has-unread {
    color: #fff;
    font-weight: 700;
}

.chat-channel-icon {
    font-size: 13px;
    flex-shrink: 0;
}

.chat-channel-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-unread-badge {
    background: #e74c3c;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 6px;
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
}

/* ─── 中央エリア（メッセージスレッド＋入力） ──────────────────────────────── */

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    min-width: 0;
    position: relative; /* 検索結果オーバーレイの基準位置 */
}

/* チャンネルヘッダー */
.chat-channel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid #e5e5e5;
    background: #fff;
    flex-shrink: 0;
}

.chat-channel-header-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.chat-channel-header-desc {
    font-size: 12px;
    color: #888;
    font-weight: 400;
}

.chat-icon-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    color: #555;
    transition: background 0.15s;
}

.chat-icon-btn:hover {
    background: #f0f0f0;
}

/* チャンネル未選択時の空状態 */
.chat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #888;
    padding: 32px;
}

.chat-empty-icon {
    font-size: 48px;
}

.chat-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: #555;
}

.chat-empty-desc {
    font-size: 14px;
    text-align: center;
    max-width: 320px;
    line-height: 1.6;
}

/* ─── メッセージスレッド ──────────────────────────────────────────────────── */

.chat-thread {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* 日付セパレーター */
.chat-date-separator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: #999;
    font-size: 12px;
}

.chat-date-separator::before,
.chat-date-separator::after {
    content: "";
    flex: 1;
    border-top: 1px solid #e5e5e5;
}

/* タイピングインジケーター */
.chat-typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    font-size: 12px;
    color: #888;
    font-style: italic;
}

.chat-typing-dots {
    display: flex;
    gap: 3px;
}

.chat-typing-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #aaa;
    animation: typing-bounce 1.2s infinite ease-in-out;
}

.chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%            { transform: translateY(-4px); }
}

/* ローディング中のプレースホルダー */
.chat-loading {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 14px;
    gap: 8px;
}

/* ─── メッセージアイテム ──────────────────────────────────────────────────── */

.chat-message {
    display: flex;
    gap: 10px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.1s;
    position: relative; /* ツールバーの absolute 配置基準 */
}

.chat-message:hover {
    background: #f8f8f8;
    /* ホバー時に後続メッセージより前面に出してツールバーが隠れないようにする */
    z-index: 1;
}

.chat-message.own {
    background: #eef6ff;
}

.chat-message.own:hover {
    background: #e5f1ff;
}

.chat-message.deleted {
    opacity: 0.55;
}

/* 検索結果クリックで対象メッセージをハイライトするアニメーション */
@keyframes messageHighlight {
    0%   { background: #fff3cd; }
    70%  { background: #fff3cd; }
    100% { background: transparent; }
}
.chat-message.chat-message-highlight {
    animation: messageHighlight 2s ease-out;
}

.chat-message-avatar {
    flex-shrink: 0;
    padding-top: 2px;
}

.chat-message-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chat-message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.chat-message-sender {
    font-weight: 700;
    font-size: 14px;
    color: #1a1a1a;
}

.chat-message-time {
    font-size: 11px;
    color: #aaa;
}

.chat-message-edited,
.chat-message-pinned {
    font-size: 11px;
    color: #bbb;
}

.chat-message-reply-preview {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #888;
    border-left: 2px solid #ccc;
    padding-left: 6px;
}

.chat-message-reply-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 240px;
}

.chat-message-content {
    font-size: 14px;
    color: #222;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-message-deleted-text {
    color: #aaa;
    font-style: italic;
}

/* リアクション */
.chat-message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.chat-reaction-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #f0f0f0;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 1px 7px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.1s;
}

.chat-reaction-chip:hover {
    background: #e0e8f8;
    border-color: #c0d0ea;
}

.chat-reaction-count {
    font-size: 11px;
    font-weight: 700;
    color: #555;
}

/* アクションボタン（返信等） */
.chat-message-actions {
    display: none;
    gap: 4px;
}

.chat-message:hover .chat-message-actions {
    display: flex;
}

.chat-action-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    color: #666;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
}

.chat-action-btn:hover {
    background: #e8ecf0;
    border-color: #aaa;
    color: #333;
}

/* ── ホバーアクションツールバー ─────────────────────────────────────────── */

/* メッセージ右上に浮かぶツールバー */
.chat-message-toolbar {
    position: absolute;
    top: 4px;
    right: 8px;
    display: flex;
    gap: 2px;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    padding: 2px 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
    z-index: 10;
}

/* ツールバー用ボタンは既存 .chat-action-btn を継承しつつ小さく */
.chat-message-toolbar .chat-action-btn {
    border: none;
    padding: 3px 5px;
    font-size: 14px;
    line-height: 1;
    border-radius: 5px;
}

.chat-message-toolbar .chat-action-btn:hover {
    border: none;
    background: #e8ecf0;
}

/* 危険アクション（削除）は赤ホバー */
.chat-action-danger:hover {
    background: #fde8e8 !important;
    color: #b91c1c !important;
}

/* 絵文字ピッカーラッパー（相対配置してピッカーをドロップダウン表示） */
.chat-toolbar-emoji-wrap {
    position: relative;
}

/* 絵文字ピッカードロップダウン（5列×4行） */
.chat-emoji-picker {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    padding: 6px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    z-index: 20;
    width: 196px;
}

.chat-emoji-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 3px;
    border-radius: 5px;
    transition: background 0.1s;
    line-height: 1;
}

.chat-emoji-btn:hover {
    background: #f0f0f0;
}

/* リアクションチップ（クリック可能なボタンに変更） */
.chat-reaction-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 10px;
    border: 1px solid #d0d7de;
    background: #f6f8fa;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
}

.chat-reaction-chip:hover {
    background: #e8ecf0;
    border-color: #aaa;
}

/* 自分がリアクション済みのチップを青くする */
.chat-reaction-chip.my-reaction {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.chat-reaction-count {
    font-size: 11px;
    font-weight: 600;
    color: #555;
}

.my-reaction .chat-reaction-count {
    color: #1d4ed8;
}

/* @メンション候補ドロップダウン */
.chat-input-row { position: relative; }

.chat-mention-dropdown {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    right: 60px;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    z-index: 50;
    max-height: 220px;
    overflow-y: auto;
}

.chat-mention-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.chat-mention-item:last-child { border-bottom: none; }

.chat-mention-item:hover { background: #f6f8fa; }

.chat-mention-item-name { font-size: 13px; font-weight: 600; flex: 1; }

.chat-mention-query { color: #0078d4; }

/* インライン編集フォーム */
.chat-message-edit-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.chat-edit-input {
    width: 100%;
    border: 1px solid #0078d4;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    resize: vertical;
    font-family: inherit;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,120,212,.15);
}

.chat-edit-actions {
    display: flex;
    gap: 6px;
}

.btn-sm {
    padding: 3px 10px;
    font-size: 12px;
}

/* @メンションハイライト */
.chat-mention {
    color: #0078d4;
    font-weight: 600;
    background: #e8f4fd;
    border-radius: 3px;
    padding: 0 2px;
}

/* ─── メッセージ入力エリア ────────────────────────────────────────────────── */

.chat-input-area {
    border-top: 1px solid #e5e5e5;
    padding: 10px 16px 12px;
    background: #fff;
    flex-shrink: 0;
}

.chat-reply-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0f4fa;
    border-radius: 4px;
    padding: 6px 10px;
    margin-bottom: 6px;
    font-size: 12px;
}

.chat-reply-bar-label {
    color: var(--accent-color, #0078d4);
    font-weight: 600;
    flex-shrink: 0;
}

.chat-reply-bar-preview {
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.chat-reply-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    font-size: 14px;
    padding: 0 4px;
    border-radius: 3px;
    transition: color 0.1s;
}

.chat-reply-close:hover {
    color: #333;
}

.chat-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-textarea {
    flex: 1;
    resize: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    max-height: 160px;
    overflow-y: auto;
    transition: border-color 0.15s;
    outline: none;
}

.chat-textarea:focus {
    border-color: var(--accent-color, #0078d4);
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.12);
}

.chat-send-btn {
    background: var(--accent-color, #0078d4);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.chat-send-btn:hover:not(:disabled) {
    background: #005fa3;
}

.chat-send-btn:disabled {
    background: #bbb;
    cursor: default;
}

.chat-input-hint {
    margin-top: 4px;
    font-size: 11px;
    color: #aaa;
}

/* ─── 右サイドバー（メンバー一覧） ───────────────────────────────────────── */

.chat-members-panel {
    width: 220px;
    min-width: 180px;
    background: #f9f9f9;
    border-left: 1px solid #e5e5e5;
    overflow-y: auto;
    flex-shrink: 0;
}

.chat-members-header {
    padding: 12px 14px 8px;
    font-size: 13px;
    font-weight: 700;
    color: #444;
    border-bottom: 1px solid #e5e5e5;
}

.chat-members-section-label {
    padding: 8px 14px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #999;
}

.chat-member-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    transition: background 0.1s;
}

.chat-member-row:hover {
    background: #f0f0f0;
}

.chat-member-row.offline {
    opacity: 0.6;
}

.chat-member-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.chat-member-info {
    flex: 1;
    min-width: 0;
}

.chat-member-name {
    font-size: 13px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-member-role {
    font-size: 10px;
    color: #888;
}

/* ─── オンライン状態インジケーター ───────────────────────────────────────── */

/* メンバーアバター右下に表示する丸いドット */
.chat-presence {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 2px solid #f9f9f9;
}

.chat-presence.online  { background: #2ecc71; }
.chat-presence.offline { background: #aaa; }

/* DM 選択ダイアログ・チャンネル作成ダイアログ内のユーザー一覧 */
.chat-presence-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-presence-dot.online  { background: #2ecc71; }
.chat-presence-dot.offline { background: #ccc; }

/* ─── ユーザー選択リスト（DM・チャンネル作成） ──────────────────────────── */

.chat-user-list {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    margin-top: 4px;
}

.chat-user-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid #f0f0f0;
}

.chat-user-row:last-child {
    border-bottom: none;
}

.chat-user-row:hover {
    background: #f5f5f5;
}

.chat-user-row.selected {
    background: #eef6ff;
}

.chat-user-name {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.chat-user-check {
    color: var(--accent-color, #0078d4);
    font-weight: 700;
    font-size: 14px;
}

/* ─── チャンネル種別セレクター（チャンネル作成ダイアログ） ────────────────── */

.chat-type-selector {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.chat-type-option {
    flex: 1;
    min-width: 120px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.chat-type-option:hover {
    border-color: #aaa;
    background: #f8f8f8;
}

.chat-type-option.selected {
    border-color: var(--accent-color, #0078d4);
    background: #eef6ff;
}

.chat-type-label {
    font-size: 13px;
    font-weight: 700;
    color: #333;
}

.chat-type-desc {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
    line-height: 1.4;
}

/* ─── ChannelSidebar 固有クラス補完 ─────────────────────────────────────── */

/* サイドバータイトルテキスト */
.chat-sidebar-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

/* DM / グループ / オープン各セクションのラッパー */
.chat-section {
    padding: 4px 0;
}

/* セクション見出し（種別ラベル＋追加ボタン） */
.chat-section-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #999;
}

/* ─── MessageThread 固有クラス補完 ─────────────────────────────────────── */

/* ローディング中の中央配置プレースホルダー */
.chat-thread-loading {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

/* メッセージなし時の案内エリア */
.chat-thread-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #888;
    font-size: 14px;
    min-height: 120px;
}

/* メッセージなし時の大きいアイコン */
.chat-thread-empty-icon {
    font-size: 40px;
    margin-bottom: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 3 — ファイル添付・スレッドパネル・チャンネル検索 スタイル
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── ファイル添付ボタン ─────────────────────────────────────────────────── */
.chat-attach-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    color: #555;
    background: none;
    border: none;
    flex-shrink: 0;
    transition: background .15s;
}
.chat-attach-btn:hover { background: #f0f0f0; }

/* ── ペンディングファイルプレビュー ─────────────────────────────────────── */
.chat-pending-files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 12px 0;
}
.chat-pending-file {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f6f8fa;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    color: #333;
}
.chat-pending-file-icon { font-size: 14px; }
.chat-pending-file-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pending-file-size { color: #888; }
.chat-pending-file-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    padding: 0 2px;
    font-size: 11px;
    line-height: 1;
}
.chat-pending-file-remove:hover { color: #c00; }

/* ── 添付ファイル表示（MessageItem 内） ─────────────────────────────────── */
.chat-message-attachments {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.chat-attachment-image-wrap {
    display: inline-block;
    max-width: 320px;
    border-radius: 6px;
    overflow: hidden;
    cursor: zoom-in;
}
.chat-attachment-image {
    display: block;
    max-width: 320px;
    max-height: 240px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}
.chat-attachment-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f6f8fa;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 6px 10px;
    text-decoration: none;
    color: #333;
    font-size: 13px;
    max-width: 300px;
}
.chat-attachment-file:hover { background: #edf2ff; border-color: #4a90d9; }
.chat-attachment-icon { font-size: 16px; }
.chat-attachment-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.chat-attachment-size { color: #888; font-size: 11px; flex-shrink: 0; }

/* ── 画像ライトボックス ─────────────────────────────────────────────────── */
.chat-lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    cursor: zoom-out;
}
.chat-lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
    cursor: default;
}

/* ── スレッド返信数バッジ ────────────────────────────────────────────────── */
.chat-thread-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    background: none;
    border: none;
    color: #4a90d9;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background .15s;
}
.chat-thread-badge:hover { background: #e8f0fe; }

/* ── スレッドパネル ──────────────────────────────────────────────────────── */
.chat-thread-panel {
    width: 340px;
    flex-shrink: 0;
    border-left: 1px solid #e1e4e8;
    display: flex;
    flex-direction: column;
    background: #fff;
    height: 100%;
    overflow: hidden;
}
.chat-thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e1e4e8;
    background: #f6f8fa;
    flex-shrink: 0;
}
.chat-thread-title {
    font-size: 14px;
    font-weight: 700;
    color: #24292f;
}
.chat-thread-parent {
    border-bottom: 1px solid #e1e4e8;
    padding: 4px 0;
    flex-shrink: 0;
    background: #fafafa;
}
.chat-thread-separator {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 12px;
    color: #888;
    font-weight: 600;
    flex-shrink: 0;
    background: #f6f8fa;
    border-bottom: 1px solid #e1e4e8;
}
.chat-thread-replies {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.chat-thread-input {
    border-top: 1px solid #e1e4e8;
    flex-shrink: 0;
}
.chat-thread-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #888;
    font-size: 13px;
}

/* ── チャンネル内検索バー ────────────────────────────────────────────────── */
.chat-search-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    margin: 0 8px;
}
.chat-search-input {
    flex: 1;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 13px;
    outline: none;
    min-width: 0;
}
.chat-search-input:focus { border-color: #4a90d9; box-shadow: 0 0 0 2px rgba(74,144,217,.2); }

/* ── 検索結果オーバーレイ ───────────────────────────────────────────────── */
.chat-search-results {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 10;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.chat-search-results-header {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #555;
    border-bottom: 1px solid #e1e4e8;
    background: #f6f8fa;
    flex-shrink: 0;
}
.chat-search-loading,
.chat-search-empty {
    padding: 32px;
    text-align: center;
    color: #888;
    font-size: 13px;
}
.chat-search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background .12s;
}
.chat-search-result-item:hover { background: #f6f8fa; }
.chat-search-result-body { flex: 1; min-width: 0; }
.chat-search-result-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}
.chat-search-result-name { font-size: 13px; font-weight: 700; color: #24292f; }
.chat-search-result-time { font-size: 11px; color: #888; }
.chat-search-result-text {
    font-size: 13px;
    color: #444;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ─── ホーム画面コンテンツ ────────────────────────────────────────────────── */

/* ホーム画面のトピック等コンテンツ本体（改行を保持して表示する） */
.home-content-body {
    white-space: pre-wrap;
    line-height: 1.7;
    min-height: 80px;
}

/* ─── ホーム画面管理 ───────────────────────────────────────────────────────── */

/* 管理画面のテキストエリア（本文入力用） */
.home-mgr-textarea {
    width: 100%;
    min-height: 160px;
    resize: vertical;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.6;
}

/* ─── 出勤情報画面 ─────────────────────────────────────────────────────────── */

/* ステータスボタン行（ボタン群 + テレワーク + スペーサー + 更新ボタン） */
.attendance-action-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* 共通ステータスボタン */
.btn-attendance {
    padding: 7px 18px;
    border: 2px solid transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.1s, box-shadow 0.1s;
    white-space: nowrap;
}
.btn-attendance:hover:not(:disabled) { filter: brightness(0.88); }
.btn-attendance:disabled { opacity: 0.6; cursor: not-allowed; }
/* 現在選択中のステータスを枠線で強調 */
.btn-attendance.active { box-shadow: 0 0 0 2.5px #333; }

/* 勤務開始（水色） */
.btn-working { background: #5bc8f5; color: #12607a; }
/* 休憩中（緑） */
.btn-break   { background: #6bc97c; color: #1a5228; }
/* 離席（黄） */
.btn-away    { background: #e8c830; color: #5a4500; }
/* 外出（オレンジ） */
.btn-out     { background: #f5a044; color: #6a3000; }
/* 退勤（ピンク） */
.btn-left    { background: #f07095; color: #6a1030; }

/* テレワークチェックボックスラベル */
.attendance-telework-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: #f8f8f8;
    white-space: nowrap;
}
.attendance-telework-label input[type="checkbox"] { cursor: pointer; }
.attendance-telework-label:has(input:checked) {
    background-color: #e8f4ff;
    border-color: var(--accent-color);
}

/* ↻ 更新ボタン */
.btn-refresh {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    border: 1px solid #b0b0b0;
    border-radius: 50%;
    background-color: #f0f0f0;
    cursor: pointer;
    color: #555;
    transition: background-color 0.1s;
    flex-shrink: 0;
}
.btn-refresh:hover:not(:disabled) {
    background-color: #dde8ff;
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.btn-refresh:disabled { opacity: 0.6; cursor: not-allowed; }

@keyframes attendance-spin { to { transform: rotate(360deg); } }
.btn-refresh-spinning { animation: attendance-spin 0.8s linear infinite; }

/* 備考入力エリア（ボタン行の直下にインライン展開） */
.attendance-remarks-area {
    margin-top: 10px;
    padding: 10px 12px;
    background-color: #fafafa;
    border: 1px solid #d8d8d8;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* 自分の行をハイライト */
.attendance-my-row { background-color: #f0f6ff !important; }
.attendance-my-row:hover { background-color: #e4f0ff !important; }

/* ── 勤務表（/worksheet） ── */
.ws-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ws-info { display: flex; flex-wrap: wrap; gap: 4px 24px; margin-bottom: 10px; font-size: 13px; }
.ws-info dt { color: #666; display: inline; }
.ws-info dd { display: inline; margin: 0 0 0 6px; font-weight: bold; }

/* 休日行は Excel の様式に合わせて灰色にする（.data-table の td 背景より優先させる） */
.data-table tr.ws-row-off td { background-color: #d9d9d9; }
.data-table tbody tr.ws-row-off:hover td { background-color: #cfcfcf; }
.data-table td.ws-num { text-align: right; width: 70px; font-variant-numeric: tabular-nums; }
.data-table tr.ws-total td { background-color: #fff7b3; font-weight: bold; }

.ws-time {
    width: 66px;
    padding: 2px 4px;
    text-align: center;
    border: 1px solid #b8b8b8;
    border-radius: 3px;
    font: inherit;
}
.ws-remarks { width: 100%; min-width: 160px; padding: 2px 6px; border: 1px solid #b8b8b8; border-radius: 3px; font: inherit; }
.ws-time.ws-invalid { border-color: #d33; background-color: #fff0f0; }

.ws-summary { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; }
.ws-summary table { border-collapse: collapse; background: #fff; }
.ws-summary th { background-color: #fff7b3; border: 1px solid #c0c0c0; padding: 3px 10px; text-align: left; font-weight: normal; white-space: nowrap; }
.ws-summary td { border: 1px solid #d0d0d0; padding: 3px 10px; text-align: right; min-width: 70px; font-variant-numeric: tabular-nums; }
.ws-absence { width: 70px; text-align: right; padding: 1px 4px; border: 1px solid #b8b8b8; border-radius: 3px; font: inherit; }
.ws-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.ws-dirty { color: #c25b00; font-size: 12px; }
/* 承認状態のバッジ（勤務表・申請書・承認画面で共通） */
.status-badge { display: inline-block; padding: 1px 10px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.status-badge-draft     { background: #eceff1; color: #455a64; }
.status-badge-submitted { background: #fff3cd; color: #8a6d00; }
.status-badge-approved  { background: #d9f2e1; color: #1b6e3a; }
.status-badge-returned  { background: #fde0e0; color: #a12626; }
.req-detail { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; font-size: 13px; margin-bottom: 10px; }
.req-detail dt { color: #666; }
.req-detail dd { margin: 0; }
.ws-stamp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px; }
.ws-link-button { display: inline-block; text-decoration: none; }

/* 出勤状態バッジ（一覧テーブル） */
.attendance-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
/* 仕様書 §4 の色指定に準拠 */
.status-none    { background: #f0f0f0; color: #999; }
.status-working { background: #dff4fb; color: #1a7fa0; }
.status-break   { background: #e4f5e9; color: #2a7a3b; }
.status-away    { background: #fdf8dc; color: #856a00; }
.status-out     { background: #fef0dc; color: #8a4800; }
.status-left    { background: #fce9ef; color: #8a2040; }

/* ── ホーム画面：外部サイトへのリンク ── */
.ext-link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.ext-link-head { line-height: 1.6; }
.ext-link-head a { font-weight: bold; }
/* URL はリンクにせず、グレーの文字で表示する（リンク先を事前に確認できるようにするため） */
.ext-link-url { color: #888; font-size: 12px; word-break: break-all; }
.ext-link-desc { color: #444; font-size: 13px; line-height: 1.6; margin-top: 2px; }

/* ── ホーム画面設定：外部サイトへのリンクの登録欄 ── */
.ext-link-edit { border: 1px solid #d0d7de; border-radius: 4px; padding: 10px 12px; margin-bottom: 10px; background: #fafbfc; display: flex; flex-direction: column; gap: 8px; }
.ext-link-edit-row { display: flex; gap: 12px; flex-wrap: wrap; }
.ext-link-edit-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
/* 横幅の配分は、横並びの行の中だけに効かせる（縦並びの親では、flex-basis が高さになってしまうため） */
/* 項目名は、入力欄の上で左寄せにする（既定の .form-label は、左の列に置く前提で右寄せのため） */
.ext-link-edit-field .form-label { text-align: left; padding-right: 0; }
.ext-link-edit-row > .ext-link-edit-field { flex: 1 1 200px; }
.ext-link-edit-row > .ext-link-edit-url { flex: 2 1 280px; }
.ext-link-edit-row > .ext-link-edit-order { flex: 0 0 90px; }
.ext-link-edit-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ext-link-add { margin-top: 4px; }

/* ─── カレンダー画面 ─────────────────────────────────────────────────────── */
.cal-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cal-title { min-width: 110px; text-align: center; font-size: 15px; }
.cal-select { width: 88px; }
.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 0 0 8px; font-size: 12.5px; }
.cal-legend-item { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.cal-legend-note { color: #888; margin-left: auto; }
.cal-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 3px; border: 1px solid rgba(0,0,0,.12); }

/* 予定の種類ごとの色（種類は CalendarKinds。自由な色指定はさせず、ここで決める） */
.cal-k-holiday  { background: #fde8e8; color: #9b1c1c; }
.cal-k-event    { background: #dbeafe; color: #0b3d6f; }
.cal-k-deadline { background: #fff1c2; color: #7a5200; }
.cal-k-notice   { background: #e7f5ea; color: #145a2b; }
.cal-k-other    { background: #ececec; color: #444; }

.cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal-grid th { background: #f3f5f7; border: 1px solid #d0d7de; padding: 4px; text-align: center; font-weight: bold; }
.cal-grid th.cal-sun { color: #c0392b; }
.cal-grid th.cal-sat { color: #1f5fbf; }
.cal-cell { border: 1px solid #d0d7de; vertical-align: top; height: 104px; padding: 3px 4px; overflow: visible; background: #fff; }
.cal-cell.cal-out { background: #f6f8fa; }
.cal-cell.cal-out .cal-dn { opacity: .55; }
.cal-is-today { outline: 2px solid var(--accent-color, #0d6efd); outline-offset: -2px; }
.cal-dayhead { display: flex; align-items: center; gap: 4px; }
.cal-dn { background: none; border: 0; padding: 0 2px; font: inherit; font-weight: bold; cursor: pointer; color: inherit; border-radius: 3px; }
.cal-dn:hover { background: #eef3fa; }
.cal-dn:focus-visible, .cal-more:focus-visible { outline: 2px solid var(--accent-color, #0d6efd); }
.cal-red { color: #c0392b; }
.cal-blue { color: #1f5fbf; }
.cal-today { font-size: 11px; color: var(--accent-color, #0d6efd); font-weight: bold; }
.cal-hol { display: block; color: #c0392b; font-size: 11.5px; font-weight: bold; line-height: 1.35; }
.cal-hol-inline { display: inline; margin-left: 6px; }
.cal-it { margin-top: 2px; padding: 1px 4px; border-radius: 3px; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.45; }
.cal-it a { color: inherit; text-decoration: underline; }
.cal-time { font-weight: bold; margin-right: 4px; }
.cal-more { background: none; border: 0; padding: 0 2px; margin-top: 2px; font-size: 11.5px; color: #555; cursor: pointer; text-decoration: underline; }

/* 狭い画面用の一覧（広い画面では隠す） */
.cal-agenda { display: none; }
.cal-agenda-day { border-bottom: 1px solid #e3e8ee; padding: 6px 2px; }
.cal-agenda-day.cal-is-today { outline: 2px solid var(--accent-color, #0d6efd); outline-offset: -2px; }
.cal-agenda-date { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 4px; margin-bottom: 2px; }
.cal-empty { color: #666; margin: 6px 0; }
@media (max-width: 700px) {
    .cal-grid { display: none; }
    .cal-agenda { display: block; }
    .cal-legend-note { margin-left: 0; }
    .cal-it { white-space: normal; }
}

/* 日別の詳細 */
.cal-detail { min-width: 320px; max-width: 560px; }
.cal-detail-row { padding: 6px 0; border-bottom: 1px solid #eef1f4; }
.cal-detail-desc { color: #555; font-size: 12.5px; margin-top: 2px; }
.cal-detail-kind { color: #888; font-size: 11.5px; margin-left: 6px; }

/* 予定の登録・編集ダイアログ（カレンダー・予定管理画面で共通） */
.cal-edit { min-width: 340px; max-width: 640px; width: 92vw; max-height: 92vh; display: flex; flex-direction: column; }
.cal-edit .dialog-body { overflow-y: auto; }
.cal-edit-row { display: flex; gap: 12px; flex-wrap: wrap; }
.cal-edit-row > .form-group { flex: 1 1 200px; min-width: 0; }
.cal-edit-hint { color: #666; font-size: 12px; margin: 2px 0 6px; }
.cal-edit-exceptions { margin-top: 8px; padding: 8px 10px; border: 1px solid #e3e8ee; border-radius: 4px; background: #fafbfc; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.cal-edit-exception { display: inline-flex; align-items: center; gap: 6px; }
.cal-edit-btn { padding: 0 8px; font-size: 11.5px; margin-left: 8px; }
.cal-edit .dialog-footer { display: flex; align-items: center; }

/* 複数日の予定の帯。最初の日の枠に、またぐ列の数の幅で、1 本だけ描く（隣の枠まで、のびる。幅 = 列の数 × 枠の幅 + 列の間の分）。
   前の週から続く・次の週へ続くときは、端を平らにする */
.cal-lane { height: 20px; margin-top: 2px; }
.cal-band { position: relative; z-index: 1; box-sizing: border-box; height: 20px; line-height: 19px; padding: 0 6px; border-radius: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11.5px;
            width: calc(var(--span, 1) * 100% + (var(--span, 1) - 1) * 9px); }
.cal-band a { color: inherit; text-decoration: underline; }
.cal-band-from { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-band-to { border-top-right-radius: 0; border-bottom-right-radius: 0; }
/* 画面では隠し、印刷では出す（上限を超える予定・帯。画面では「ほか n 件」にまとめる） */
.cal-extra { display: none; }
.cal-print-title { display: none; }

/* 印刷（A4 横）：操作の部品を隠し、月の表を、ページいっぱいに出す。予定は、省略せずに、全件を出す */
@media print {
    @page { size: A4 landscape; margin: 8mm; }
    html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
    .app-shell { display: block !important; height: auto !important; }
    .app-content { overflow: visible !important; background: #fff !important; display: block !important; }
    .content-area { padding: 0 !important; }
    .app-titlebar, .app-menubar, .app-statusbar, #blazor-error-ui, .dialog-overlay, .components-reconnect-container { display: none !important; }
    .cal-panel { border: 0 !important; margin: 0 !important; }
    .cal-panel > .panel-header, .cal-legend input, .cal-legend-note, .cal-more, .cal-agenda { display: none !important; }
    .cal-panel > .panel-body { padding: 0 !important; }
    .cal-print-title { display: block; font-size: 15pt; font-weight: bold; margin: 0 0 3mm; }
    .cal-legend { margin: 0 0 3mm; }
    .cal-extra { display: block !important; }
    .cal-grid { display: table !important; width: 100%; font-size: 9pt; }
    .cal-cell { height: 25mm; padding: 1mm 1.5mm; }   /* 表の行は、この高さ以上（予定が多い日は、広がる） */
    .cal-grid tr { break-inside: avoid; }
    .cal-it, .cal-band, .cal-swatch, .cal-hol { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .cal-it, .cal-band { font-size: 8.5pt; }
    /* 1 日だけの予定は、折り返して、全文を出す（帯は、1 行） */
    .cal-it { white-space: normal; overflow: visible; text-overflow: clip; }
    .cal-hol { font-size: 8.5pt; }
    .cal-it a, .cal-band a { text-decoration: none; }
}

/* ============================================================
   地図（/map）
   Leaflet の CSS（wwwroot/lib/leaflet/leaflet.css）は、地図画面を開いたときに JS が読み込む。ここは、画面の枠と一覧・編集パネル。
   ============================================================ */
.map-notice { font-size: 12px; color: #6a5200; background: #fff8e1; border: 1px solid #f0d98c; border-radius: 4px; padding: 6px 10px; margin-bottom: 10px; line-height: 1.6; }
.map-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 12px; align-items: start; }
.map-side { min-width: 0; }
.map-canvas-wrap { position: relative; min-width: 0; }
.map-canvas { height: min(72vh, 680px); min-height: 380px; border: 1px solid #b9c4d0; border-radius: 4px; z-index: 0; }
.map-canvas.map-picking { cursor: crosshair; }
.map-canvas.map-picking .leaflet-grab { cursor: crosshair; }
.map-pick-banner { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 500; background: rgba(26, 58, 92, 0.92); color: #fff; font-size: 12px; padding: 4px 12px; border-radius: 12px; pointer-events: none; white-space: nowrap; max-width: 90%; overflow: hidden; text-overflow: ellipsis; }
.map-draft-pin { width: 22px; height: 22px; border-radius: 50%; background: #e8542f; border: 3px solid #fff; box-shadow: 0 0 0 2px #e8542f, 0 2px 6px rgba(0, 0, 0, 0.4); box-sizing: border-box; }

.map-filter { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 6px; font-size: 13px; }
.map-filter-item { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.map-search { margin-bottom: 8px; }
.map-empty { color: #6b7785; font-size: 13px; margin: 8px 0; }
.map-list { list-style: none; margin: 0; padding: 0; max-height: min(58vh, 560px); overflow-y: auto; border: 1px solid #d5dde6; border-radius: 4px; }
.map-item { display: flex; align-items: stretch; gap: 4px; border-bottom: 1px solid #e6ebf1; }
.map-item:last-child { border-bottom: 0; }
.map-item-selected { background: #e8f1fb; }
.map-item-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; text-align: left; background: transparent; border: 0; padding: 8px 10px; cursor: pointer; font: inherit; color: inherit; }
.map-item-main:hover { background: #f2f6fb; }
.map-item-name { font-weight: bold; overflow-wrap: anywhere; }
.map-item-sub { flex-basis: 100%; font-size: 12px; color: #5b6b7b; overflow-wrap: anywhere; }
.map-item-actions { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 4px 6px; }
.map-item-actions .btn-action, .map-item-actions .btn-danger-action { padding: 2px 8px; font-size: 12px; }
.map-badge { font-size: 11px; padding: 0 6px; border-radius: 8px; border: 1px solid #b9c4d0; background: #f1f4f8; white-space: nowrap; }
.map-badge-all { background: #e4f5e9; border-color: #8fcf9f; }
.map-badge-invited { background: #fdf8dc; border-color: #e0cf7a; }
.map-badge-private { background: #fce9ef; border-color: #e9a9bc; }

.map-editor { border: 1px solid #d5dde6; border-radius: 4px; padding: 10px; background: #fbfcfe; }
.map-editor-title { font-weight: bold; margin-bottom: 8px; }
.map-editor-hint { font-size: 12px; color: #6b7785; margin-top: 2px; }
.map-editor-pos { display: flex; gap: 8px; flex-wrap: wrap; }
.map-editor-pos label { flex: 1 1 120px; font-size: 12px; color: #5b6b7b; }
.map-invitees { max-height: 180px; overflow-y: auto; }
.map-editor-footer { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 10px; }

.map-popup { display: flex; flex-direction: column; gap: 4px; font-size: 13px; overflow-wrap: anywhere; }
.map-popup-meta { font-size: 11px; color: #5b6b7b; }
.map-popup-desc { white-space: pre-wrap; }

@media (max-width: 800px) {
    .map-layout { grid-template-columns: minmax(0, 1fr); }
    .map-canvas-wrap { order: -1; }
    .map-canvas { height: 56vh; min-height: 300px; }
    .map-list { max-height: 40vh; }
}
.cal-detail-place { font-size: 12px; margin: 2px 0 0 18px; color: #3a4a5a; overflow-wrap: anywhere; }

/* 地図：種類別のマーカー・検索結果・現在地・住所検索 */
.map-pin { background: transparent; border: 0; }
.map-pin span { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: #6b7785; border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45); box-sizing: border-box; font-size: 14px; line-height: 1; color: #fff; }
.map-pin-office span { background: #1f5fa8; }
.map-pin-customer span { background: #2e8b57; }
.map-pin-parking span { background: #7a4fb5; }
.map-pin-facility span { background: #d9822b; }
.map-pin-other span { background: #6b7785; }
.map-search-pin { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 4px solid #e8542f; box-sizing: border-box; box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0, 0, 0, 0.4); }
.map-locate-pin { width: 16px; height: 16px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-sizing: border-box; box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.3); }
.map-search-box { margin-bottom: 8px; }
.map-search-row { display: flex; gap: 4px; }
.map-search-row .form-input { flex: 1; min-width: 0; }
.map-search-msg { color: #8a5a00; }
.map-search-results { list-style: none; margin: 4px 0 0; padding: 0; border: 1px solid #d5dde6; border-radius: 4px; max-height: 180px; overflow-y: auto; background: #fff; }
.map-search-results li + li { border-top: 1px solid #e6ebf1; }
.map-search-results button { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 6px 10px; cursor: pointer; font: inherit; color: inherit; overflow-wrap: anywhere; }
.map-search-results button:hover { background: #f2f6fb; }
/* Tips ▸ ExcelVBA：目次（左）と、説明・サンプルコード（右） */
.tips-lead { font-size: 13px; line-height: 1.7; margin: 0 0 12px; color: #33414f; }
.tips-key { display: inline-block; padding: 0 5px; border: 1px solid #b9c4d0; border-bottom-width: 2px; border-radius: 3px; background: #f7f9fb; font-family: Consolas, monospace; font-size: 11px; }
.tips-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.tips-toc { position: sticky; top: 0; max-height: calc(100vh - 190px); overflow-y: auto; border: 1px solid #d5dde6; border-radius: 4px; padding: 8px; background: #fbfcfe; min-width: 0; }
.tips-filter { margin-bottom: 6px; }
.tips-toc-cat { font-size: 12px; font-weight: bold; color: #1f3a5f; margin: 10px 0 2px; padding-left: 4px; border-left: 4px solid #2d6a9f; }
.tips-toc-list { list-style: none; margin: 0; padding: 0; }
.tips-toc-item { display: block; padding: 5px 8px; font-size: 13px; line-height: 1.4; color: #1c2733; text-decoration: none; border-radius: 3px; overflow-wrap: anywhere; }
.tips-toc-item:hover { background: #e8f1fb; }
.tips-toc-item.active { background: #2d6a9f; color: #fff; font-weight: bold; }
.tips-empty { color: #6b7785; font-size: 13px; margin: 8px 4px; }
.tips-content { min-width: 0; }
.tips-title { font-size: 20px; margin: 0 0 4px; padding-bottom: 6px; border-bottom: 3px solid #1f3a5f; }
.tips-summary { color: #5b6b7b; font-size: 13px; margin: 6px 0 14px; }
.tips-heading { font-size: 15px; margin: 22px 0 8px; padding-left: 8px; border-left: 5px solid #2d6a9f; }
.tips-paragraph { font-size: 14px; line-height: 1.8; margin: 8px 0; }
.tips-list { font-size: 14px; line-height: 1.75; margin: 8px 0; padding-left: 22px; }
.tips-list li { margin: 3px 0; overflow-wrap: anywhere; }
.tips-inline-code { font-family: Consolas, "MS Gothic", monospace; font-size: 12.5px; background: #eef2f6; border: 1px solid #dde4ec; border-radius: 3px; padding: 0 4px; overflow-wrap: anywhere; }
.tips-note { display: flex; gap: 8px; align-items: baseline; font-size: 13.5px; line-height: 1.7; margin: 10px 0; padding: 8px 12px; border-radius: 4px; border: 1px solid; }
.tips-note > strong { flex: none; }
.tips-note > span { min-width: 0; overflow-wrap: anywhere; }
.tips-note-info { background: #eef6fd; border-color: #b6d4f0; }
.tips-note-warn { background: #fff8e1; border-color: #f0d98c; }
.tips-code { margin: 10px 0 14px; border: 1px solid #cfd8e3; border-radius: 4px; overflow: hidden; }
.tips-code-head { display: flex; align-items: center; gap: 8px; padding: 4px 8px; background: #e8eef5; border-bottom: 1px solid #cfd8e3; }
.tips-code-title { flex: 1; min-width: 0; font-size: 12.5px; font-weight: bold; color: #1f3a5f; overflow-wrap: anywhere; }
.tips-copy-msg { font-size: 12px; color: #1b7a3b; }
.tips-copy-btn { padding: 2px 12px; font-size: 12px; }
.tips-code-body { margin: 0; padding: 10px 12px; overflow-x: auto; background: #f8fafc; font-family: Consolas, "MS Gothic", monospace; font-size: 13px; line-height: 1.55; tab-size: 4; white-space: pre; color: #1c2733; }
.tips-code-body code { font: inherit; background: none; padding: 0; color: inherit; }
.vba-keyword { color: #0000cc; font-weight: bold; }
.vba-type { color: #2b7a9b; }
.vba-comment { color: #2e7d32; }
.vba-string { color: #a31515; }
.vba-number { color: #098658; }
.tips-pager { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 22px; padding-top: 12px; border-top: 1px solid #d5dde6; }
.tips-pager .btn-action { text-decoration: none; }

@media (max-width: 800px) {
    .tips-layout { grid-template-columns: minmax(0, 1fr); }
    .tips-toc { position: static; max-height: 260px; }
}
/* チャットの未読バッジ（メニュー） */
.menu-badge {
    display: inline-block;
    min-width: 18px;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: 9px;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    vertical-align: middle;
}

/* ログイン前後のページの補助（案内・リンク） */
.login-info-message {
    margin-bottom: 12px;
    padding: 8px 10px;
    background: #e4f5e9;
    border: 1px solid #6bc97c;
    color: #1b5e20;
    font-size: 13px;
}

.login-note {
    margin: 0 0 12px;
    font-size: 13px;
    color: #555;
}

.login-links {
    margin-top: 16px;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
