/* =========================================================================
   社内顧客管理システム — デザインシステム
   ========================================================================= */

:root {
  /* 面 */
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-alt: #f7f9fc;
  --border: #e8ecf3;
  --border-strong: #d6dce6;

  /* 文字 */
  --text: #101828;
  --text-soft: #414b5a;
  --muted: #737e8f;

  /* ブランド */
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef0fe;

  /* セマンティック */
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #1d4ed8;
  --info-soft: #dbeafe;

  /* サイドバー */
  --side-bg: #111827;
  --side-bg-soft: #1b2536;
  --side-text: #aeb7c6;
  --side-text-strong: #f3f5f9;
  --side-accent: #6366f1;

  /* 余白リズム（4pxベース） */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 40px; --sp-8: 56px;

  /* 効果 */
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 1px rgba(16, 24, 40, .03);
  --shadow: 0 2px 4px rgba(16, 24, 40, .05), 0 6px 16px rgba(16, 24, 40, .05);
  --shadow-lg: 0 16px 44px rgba(16, 24, 40, .16);
  --ring: 0 0 0 3px rgba(79, 70, 229, .18);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Meiryo", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 6px;
}

h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; margin: 0 0 4px; }
h2 { font-size: 1.075rem; font-weight: 650; margin: var(--sp-7) 0 var(--sp-3); letter-spacing: -.01em; }
section { margin-top: var(--sp-2); }

/* =========================================================================
   アプリシェル（サイドバー + メイン）
   ========================================================================= */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px; flex: none;
  background: var(--side-bg);
  color: var(--side-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  padding: 20px 22px 16px;
  font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand a { color: var(--side-text-strong); }
.sidebar-brand a:hover { text-decoration: none; }
.sidebar-brand .brand-sub { display: block; font-size: .68rem; font-weight: 500; color: var(--muted); margin-top: 3px; letter-spacing: .02em; }

.sidebar-nav { padding: 12px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--side-text); font-size: .9rem; font-weight: 500;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--side-bg-soft); color: var(--side-text-strong); text-decoration: none; }
.nav-item.active { background: var(--side-accent); color: #fff; }
.nav-item.active .nav-ico { opacity: 1; }
.nav-ico { width: 18px; height: 18px; flex: none; opacity: .8; }

.sidebar-foot {
  border-top: 1px solid rgba(255,255,255,.07);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.side-user { display: flex; align-items: center; gap: 10px; }
.side-avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  background: var(--side-accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .82rem;
}
.side-user-meta { min-width: 0; }
.side-user-name { color: var(--side-text-strong); font-size: .84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-role { color: var(--muted); font-size: .72rem; }
.sidebar-foot .foot-links { display: flex; gap: 14px; font-size: .78rem; }
.sidebar-foot .foot-links a { color: var(--side-text); }
.sidebar-foot .foot-links a:hover { color: var(--side-text-strong); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 40px 44px 72px; }

/* =========================================================================
   ログイン
   ========================================================================= */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -10%, #1e293b 0%, #0b1220 60%);
  padding: 24px;
}
.login-card {
  background: #fff; padding: 40px 34px 34px; border-radius: 16px;
  width: 360px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 15px;
}
.login-card h1 { text-align: center; font-size: 1.22rem; margin: 0 0 2px; }
.login-card .login-sub { text-align: center; color: var(--muted); font-size: .82rem; margin: 0 0 10px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; color: var(--text-soft); font-weight: 500; }
.login-card input {
  padding: 11px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: .98rem;
  transition: border-color .12s, box-shadow .12s;
}
.login-card input:focus { border-color: var(--primary); box-shadow: var(--ring); outline: none; }
.login-card button {
  margin-top: 8px; padding: 12px; background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius-sm); font-size: .98rem; font-weight: 600; cursor: pointer;
  transition: background .12s;
}
.login-card button:hover { background: var(--primary-dark); }

/* =========================================================================
   通知
   ========================================================================= */
.alert, .error { background: var(--danger-soft); color: #b91c1c; padding: 10px 14px; border-radius: var(--radius-sm); font-size: .86rem; margin: 0 0 14px; border: 1px solid #fbcfce; }
.notice { background: var(--success-soft); color: #15803d; padding: 10px 14px; border-radius: var(--radius-sm); font-size: .86rem; margin: 0 0 14px; border: 1px solid #bbf7d0; }

/* 操作フィードバック（フラッシュ通知） */
.flash {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid;
  font-size: .88rem; font-weight: 600; margin: 0 0 var(--sp-5);
  box-shadow: var(--shadow-sm); animation: flash-in .22s ease-out;
}
.flash::before { font-size: 1rem; line-height: 1; }
.flash-success { background: var(--success-soft); color: #15803d; border-color: #bbf7d0; }
.flash-success::before { content: "✓"; }
.flash-error { background: var(--danger-soft); color: #b91c1c; border-color: #fbcfce; }
.flash-error::before { content: "!"; font-weight: 800; }
.flash-info { background: var(--info-soft); color: #1d4ed8; border-color: #bfdbfe; }
.flash-info::before { content: "ℹ"; }
.flash-warn { background: var(--warn-soft); color: #b45309; border-color: #fde68a; }
.flash-warn::before { content: "⚠"; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* =========================================================================
   ページヘッダ
   ========================================================================= */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: var(--sp-6); }
.page-head h1 { margin: 0; }
.page-head .page-sub { color: var(--muted); font-size: .85rem; margin: 4px 0 0; }
.actions { display: flex; align-items: center; gap: 8px; }
.actions form { margin: 0; }
.crumb { margin: -6px 0 18px; font-size: .85rem; color: var(--muted); }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--primary); }

/* =========================================================================
   ボタン
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text-soft); cursor: pointer; font-size: .875rem; font-weight: 550;
  transition: background .12s, border-color .12s, box-shadow .12s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--panel-alt); border-color: var(--border-strong); text-decoration: none; color: var(--text); }
.btn.primary, button.primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(79,70,229,.25);
}
.btn.primary:hover, button.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn.danger { background: #fff; color: var(--danger); border-color: #f2c4c4; }
.btn.danger:hover { background: var(--danger-soft); border-color: #eeadad; color: var(--danger); }
button.primary { padding: 9px 16px; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 600; cursor: pointer; }

button.linklike { background: none; border: none; padding: 0; cursor: pointer; font-size: .82rem; color: var(--primary); font-weight: 550; }
button.linklike:hover { text-decoration: underline; }
button.linklike.danger { color: var(--danger); }

/* =========================================================================
   ダッシュボードカード
   ========================================================================= */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 18px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 20px 18px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); opacity: .0; transition: opacity .15s; }
.card:hover::before { opacity: .7; }
.card-label { color: var(--muted); font-size: .78rem; font-weight: 600; letter-spacing: .01em; }
.card-value { font-size: 1.95rem; font-weight: 750; margin-top: 6px; letter-spacing: -.02em; color: var(--text); }
.card-link { display: block; }
.card-link:hover { text-decoration: none; box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--border-strong); }
.card-alert::before { background: var(--danger); opacity: .85; }
.card-alert .card-value { color: #b91c1c; }
.card-warn::before { background: var(--warn); opacity: .85; }
.card-warn .card-value { color: #b45309; }

/* =========================================================================
   テーブル
   ========================================================================= */
.grid {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.grid th, .grid td { text-align: left; padding: 13px 18px; border-bottom: 1px solid var(--border); font-size: .875rem; }
.grid th {
  background: var(--panel-alt); color: var(--muted); font-weight: 600; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .045em; white-space: nowrap;
  position: sticky; top: 0;
}
.grid tbody tr:last-child td { border-bottom: none; }
.grid tbody tr { transition: background .1s; }
.grid tbody tr:nth-child(even) { background: color-mix(in srgb, var(--panel-alt) 45%, transparent); }
.grid tbody tr:hover { background: var(--primary-soft); }
.grid td a { font-weight: 600; }
.empty { color: var(--muted); text-align: center; padding: 40px 24px; font-size: .9rem; }

/* 横スクロール用ラッパー（テーブルのモバイル横あふれ対策） */
.table-wrap { width: 100%; overflow-x: auto; border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
.table-wrap .grid { border-radius: 0; }
@media (max-width: 720px) {
  .table-wrap .grid { min-width: 560px; }
}

/* =========================================================================
   バッジ
   ========================================================================= */
.badge {
  display: inline-flex; align-items: center;
  background: #eef1f6; color: #48515f;
  padding: 3px 11px; border-radius: 999px; font-size: .76rem; font-weight: 600;
  white-space: nowrap;
}
.badge.is-success { background: var(--success-soft); color: #15803d; }
.badge.is-warn    { background: var(--warn-soft);    color: #b45309; }
.badge.is-danger  { background: var(--danger-soft);  color: #b91c1c; }
.badge.is-info    { background: var(--info-soft);    color: #1d4ed8; }
.badge.is-primary { background: var(--primary-soft); color: var(--primary-dark); }
.badge.is-muted   { background: #eef1f6;             color: #7a8595; }

/* =========================================================================
   検索フィルタ
   ========================================================================= */
.filter { display: flex; gap: 10px; margin: 0 0 18px; flex-wrap: wrap; align-items: center; }
.filter input[type=text], .filter select {
  padding: 9px 13px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: .9rem; background: #fff; transition: border-color .12s, box-shadow .12s;
}
.filter input[type=text] { flex: 1; min-width: 240px; }
.filter input[type=text]:focus, .filter select:focus { border-color: var(--primary); box-shadow: var(--ring); outline: none; }
.filter button { padding: 9px 20px; background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; font-size: .9rem; }
.filter button:hover { background: var(--primary-dark); }
.filter .clear { color: var(--muted); font-size: .85rem; }
.result-count { color: var(--muted); font-size: .82rem; margin: 0 0 12px; font-weight: 500; }

/* タブ（要返信ビュー切替） */
.tabs { display: flex; gap: 4px; margin: 0 0 18px; border-bottom: 1px solid var(--border); }
.tabs .tab {
  padding: 9px 16px; font-size: .88rem; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs .tab:hover { color: var(--text); text-decoration: none; }
.tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* サイドバー要返信件数バッジ */
.nav-badge {
  margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 999px;
  background: var(--danger-soft); color: #b91c1c; font-size: .72rem; font-weight: 700;
  text-align: center;
}
.nav-item.active .nav-badge { background: rgba(255,255,255,.25); color: #fff; }

/* 行内アクション（要返信操作） */
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row-actions form { margin: 0; display: flex; gap: 4px; align-items: center; }
.row-actions .btn { padding: 5px 10px; font-size: .8rem; }
.row-actions select { padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: .8rem; background: #fff; }
.row-actions input[type=text] { padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: .8rem; }

/* 監督系（ヒント・一括バー・経過日数・対応履歴） */
.hint { background: var(--info-soft); color: #1d4ed8; padding: 10px 14px; border-radius: var(--radius-sm); font-size: .85rem; margin: 0 0 14px; }
.hint.danger-hint { background: var(--danger-soft); color: #b91c1c; }
.followups-grid td { vertical-align: top; }
.chk-col { width: 34px; text-align: center; }
.note-line { max-width: 320px; white-space: normal; }

.bulk-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; margin: 0 0 14px; font-size: .85rem;
}
.bulk-bar select, .bulk-bar input[type=text] { padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: .82rem; background: #fff; }
.bulk-bar input[type=text] { min-width: 200px; }
.bulk-sep { color: var(--muted); }

.age { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #eef1f6; color: #64748b; }
.age.age-warn { background: var(--warn-soft); color: #b45309; }
.age.age-danger { background: var(--danger-soft); color: #b91c1c; }

/* 統括: 担当者別 可視化バー / セクション見出しリンク */
.obar-cell { width: 160px; }
.obar { display: block; height: 10px; min-width: 2px; border-radius: 999px; background: var(--primary); opacity: .85; }
.h2-link { font-size: .8rem; font-weight: 600; margin-left: 8px; color: var(--primary); text-decoration: none; }
.h2-link:hover { text-decoration: underline; }

.act-done { display: inline-block; }
.act-done > summary { list-style: none; cursor: pointer; }
.act-done > summary::-webkit-details-marker { display: none; }
.act-done[open] > summary { margin-bottom: 6px; }
.done-fields { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; }
.done-fields input[type=text] { min-width: 160px; }

/* =========================================================================
   カレンダー
   ========================================================================= */
.cal-title { margin: 0 0 12px; }
.cal-legend { display: flex; gap: 12px; margin: 0 0 12px; font-size: .8rem; }
.cal-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.cal-chip::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--chip, transparent); }
.cal-chip.is-meeting::before { background: #4f46e5; }
.cal-chip.is-snooze::before { background: #b45309; }
.cal-chip.is-activity::before { background: #15803d; }
.cal-chip.is-shared::before { background: var(--panel); box-shadow: inset 0 0 0 2px #0078d4; }

table.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.cal th { padding: 9px 8px; font-size: .76rem; font-weight: 600; color: var(--muted); border: 1px solid var(--border); background: var(--panel-alt); }
table.cal th.sun, .cal-cell.sun { color: #b91c1c; }
table.cal th.sat { color: #1d4ed8; }
.cal-cell { border: 1px solid var(--border); height: 116px; vertical-align: top; padding: 5px 5px 4px; overflow: hidden; }
.cal-cell.out { background: var(--panel-alt); }
.cal-cell-link { cursor: pointer; transition: background .1s; }
.cal-cell-link:hover { background: var(--primary-soft); }
.cal-cell-link.out:hover { background: #eef1f5; }
.cal-cell.out .cal-day { color: #b8c0cc; }
.cal-cell.today { background: #f6f8ff; }
.cal-day {
  font-size: .78rem; font-weight: 600; color: var(--text-soft); margin-bottom: 4px;
  display: flex; align-items: center; justify-content: space-between; min-height: 22px;
}
.cal-add {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: .9rem; line-height: 1; padding: 0 3px; border-radius: 3px; opacity: 0;
  transition: opacity .12s, background .12s;
}
.cal-cell:hover .cal-add { opacity: 1; }
.cal-add:hover { background: var(--primary); color: #fff; }
.cal-event {
  display: block; width: 100%; text-align: left; border: none; font-family: inherit;
  font-size: .72rem; line-height: 1.5; padding: 2px 6px; margin-bottom: 1px; cursor: pointer;
  border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text); background: transparent;
}
.cal-event::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--dot, var(--primary)); margin-right: 6px; vertical-align: middle;
}
button.cal-event:disabled { cursor: default; }
.cal-event:hover { text-decoration: none; background: var(--panel-alt); }
.cal-event .cal-time { font-weight: 700; margin-right: 4px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-event.is-meeting::before { background: #4f46e5; }
.cal-event.is-snooze::before { background: #b45309; }
.cal-event.is-activity::before { background: #15803d; }
.cal-event.is-shared { cursor: default; }
.cal-event.is-shared::before { box-shadow: 0 0 0 1.5px var(--panel), 0 0 0 3px var(--dot, var(--primary)); background: var(--panel); }
.cal-more {
  display: block; font-size: .7rem; color: var(--muted); padding: 1px 6px; margin-top: 1px;
  cursor: pointer;
}
.cal-cell-link:hover .cal-more { color: var(--primary); }

.cal-daynum {
  color: inherit; text-decoration: none; display: inline-flex; align-items: center;
  justify-content: center; min-width: 22px; height: 22px; border-radius: 50%;
}
.cal-daynum:hover { background: var(--border); text-decoration: none; }
.cal-cell.today .cal-daynum { background: var(--primary); color: #fff; font-weight: 700; }
.cal-cell.today .cal-daynum:hover { background: var(--primary-dark); }

/* 個人/全体 切り替え */
.scope-switch { display: flex; align-items: center; gap: 4px; margin: 0 0 14px; }
.scope-btn {
  padding: 6px 16px; font-size: .84rem; font-weight: 600; color: var(--text-soft);
  border: 1px solid var(--border-strong); background: var(--panel); text-decoration: none;
}
.scope-btn:first-of-type { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.scope-btn:nth-of-type(2) { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }
.scope-btn:hover { background: var(--info-soft); text-decoration: none; }
.scope-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.scope-hint { margin-left: 10px; font-size: .78rem; color: var(--muted); }

/* =========================================================================
   カレンダー共通シェル（左サイドバー＋ツールバー＋本体）
   ========================================================================= */
/* カレンダーだけは中央寄せの幅制限を外して画面いっぱいに使う。 */
.container:has(.cal-shell) { max-width: none; padding: 20px 24px 24px; }

/* 参考「社内カレンダー」= Fluent UI(Outlook風)。CRM全体のテーマは変えず、
   カレンダー配下だけトークンを Fluent 値へ再スコープして見た目を寄せる。 */
.cal-shell {
  --primary: #0078d4; --primary-soft: #eff6fc;
  --border: #e1dfdd; --border-strong: #c8c6c4;
  --panel: #ffffff; --panel-alt: #f3f2f1;
  --muted: #605e5c; --text: #201f1e; --text-soft: #605e5c;
  --radius: 4px; --radius-sm: 4px;
  --fx-today: #f3f9fd; --fx-grid: #edebe9; --fx-danger: #a4262c; --fx-accent: #0078d4;
}
.cal-shell { display: flex; gap: 16px; align-items: stretch; }
/* 日/週ビューは画面全体をスクロールさせず、時間帯の中だけをスクロールさせる。 */
html.cal-fixed-view, html.cal-fixed-view body { height: 100%; overflow: hidden; }
.cal-shell.is-fixed { height: calc(100vh - 64px); }

.cal-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* 左サイドバー */
.cal-side {
  flex: 0 0 208px; width: 208px; display: flex; flex-direction: column; gap: 18px;
  padding-right: 4px; overflow-y: auto;
}
.mini-cal { user-select: none; }
.mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mini-title { font-size: .82rem; font-weight: 700; color: var(--text); }
.mini-nav {
  width: 22px; height: 22px; line-height: 20px; text-align: center; border-radius: 6px;
  color: var(--muted); font-size: 1rem; text-decoration: none;
}
.mini-nav:hover { background: var(--panel-alt); color: var(--text); text-decoration: none; }
.mini-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mini-grid th {
  font-size: .64rem; font-weight: 600; color: var(--muted); padding: 2px 0; text-align: center;
}
.mini-grid th.sun { color: var(--fx-danger); } .mini-grid th.sat { color: var(--fx-accent); }
.mini-grid td.sun a { color: var(--fx-danger); } .mini-grid td.sat a { color: var(--fx-accent); }
.mini-grid td { text-align: center; padding: 1px; }
.mini-grid td a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; font-size: .72rem; color: var(--text);
  text-decoration: none;
}
.mini-grid td a:hover { background: var(--panel-alt); text-decoration: none; }
.mini-grid td.out a { color: #c2c9d4; }
.mini-grid td.today a { color: var(--primary); font-weight: 700; }
.mini-grid td.sel a { background: var(--primary); color: #fff; }
.mini-grid td.today.sel a { background: var(--primary); color: #fff; }

.cal-side-sec { border-top: 1px solid var(--border); padding-top: 12px; }
.cal-side-h { margin: 0 0 8px; font-size: .75rem; font-weight: 600; color: var(--text-soft); }
.cal-check {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px;
  font-size: .82rem; color: var(--text-soft); text-decoration: none; cursor: pointer;
}
.cal-check:hover { background: var(--panel-alt); text-decoration: none; }
.cal-check-box {
  width: 15px; height: 15px; flex: none; border: 2px solid var(--border-strong);
  border-radius: 4px; background: var(--panel); position: relative;
}
.cal-check.on { color: var(--text); font-weight: 600; }
.cal-check.on .cal-check-box { background: var(--primary); border-color: var(--primary); }
.cal-check.on .cal-check-box::after {
  content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.cal-legend-row { display: flex; align-items: center; gap: 8px; padding: 3px 6px; font-size: .8rem; color: var(--text-soft); }
.cal-dot { width: 11px; height: 11px; flex: none; border-radius: 3px; }
.cal-dot.is-ring { background: var(--panel) !important; box-shadow: inset 0 0 0 2px var(--ring, var(--primary)); }

/* ツールバー */
.cal-bar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 14px;
  background: var(--panel-alt); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 16px;
}
.cal-bar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-new { white-space: nowrap; }
.cal-arrow {
  width: 30px; height: 30px; line-height: 28px; text-align: center; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--panel); color: var(--text-soft);
  font-size: 1.1rem; text-decoration: none;
}
.cal-arrow:hover { background: var(--panel); color: var(--primary); border-color: var(--primary); text-decoration: none; }
.cal-bar-title { font-size: 1.125rem; font-weight: 600; color: var(--text); margin-left: 6px; }
.cal-tabs { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--panel); }
.cal-tab {
  padding: 6px 16px; font-size: .84rem; font-weight: 600; color: var(--text-soft);
  text-decoration: none; border-left: 1px solid var(--border-strong);
}
.cal-tab:first-child { border-left: none; }
.cal-tab:hover { background: var(--panel-alt); text-decoration: none; }
.cal-tab.active { background: var(--primary); color: #fff; }

/* 日ビュー本体 */
.day-cal {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}

/* 週ビュー本体 */
.week-cal {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.week-gutter {
  flex: 0 0 62px; padding: 6px 8px 0; font-size: .72rem; font-weight: 600; color: var(--muted);
  text-align: right; border-right: 1px solid var(--border); font-variant-numeric: tabular-nums;
}
.week-head { display: flex; border-bottom: 1px solid var(--border); background: var(--panel-alt); }
.week-col-head {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center;
  gap: 1px; padding: 6px 2px; border-left: 1px solid var(--border);
  text-decoration: none; color: var(--text-soft);
}
.week-col-head:hover { background: var(--primary-soft); text-decoration: none; }
.week-col-head .wk-wd { font-size: .72rem; font-weight: 600; }
.week-col-head .wk-dnum { font-size: 1rem; font-weight: 700; color: var(--text); line-height: 1.4; }
.week-col-head.sun .wk-wd { color: var(--fx-danger); } .week-col-head.sat .wk-wd { color: var(--fx-accent); }
.week-col-head.today .wk-dnum {
  background: var(--primary); color: #fff; border-radius: 50%;
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
}
.week-allday { display: flex; border-bottom: 2px solid var(--border); background: var(--panel-alt); }
.week-allday .week-gutter { padding-top: 6px; }
.week-allday-cell {
  flex: 1 1 0; min-width: 0; border-left: 1px solid var(--border); padding: 4px;
  display: flex; flex-direction: column; gap: 3px;
}
/* タイムグリッド（日・週の時間軸）。1日=グリッド高さ(1152px)に対する%で絶対配置する */
.tt-allday {
  flex: 0 0 auto; display: flex; align-items: flex-start;
  border-bottom: 2px solid var(--border); background: var(--panel-alt);
}
.tt-allday-label {
  flex: 0 0 62px; padding: 8px 8px 8px 0; text-align: right;
  font-size: .72rem; font-weight: 600; color: var(--muted); border-right: 1px solid var(--border);
}
.tt-allday-slot { flex: 1; display: flex; flex-wrap: wrap; gap: 5px; padding: 7px 10px; align-items: center; }
.tt-chip {
  display: inline-block; max-width: 100%; border: none; border-left: 3px solid var(--c, var(--primary));
  background: color-mix(in srgb, var(--c, var(--primary)) 16%, #fff); color: var(--text);
  font-family: inherit; font-size: .75rem; font-weight: 600; line-height: 1.3; padding: 3px 8px; border-radius: var(--radius-sm);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tt-chip.is-shared { cursor: default; }
.tt-chip:hover { box-shadow: var(--shadow-sm); text-decoration: none; }

.tt-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; background: var(--panel); }
.tt-grid { position: relative; display: flex; min-height: 1152px; }
.tt-gutter { flex: 0 0 62px; border-right: 1px solid var(--border); }
.tt-hour { height: 48px; position: relative; box-sizing: border-box; }
.tt-hour > span {
  position: absolute; top: -8px; right: 8px; font-size: .72rem; font-weight: 600;
  color: var(--muted); font-variant-numeric: tabular-nums; padding: 0 2px;
}
.tt-hour:first-child > span { top: 2px; }
.tt-cols { flex: 1 1 auto; display: flex; }
.tt-col { flex: 1 1 0; min-width: 0; position: relative; border-left: 1px solid var(--border); }
.tt-col.today { background: var(--fx-today); }
.tt-lines { position: absolute; inset: 0; pointer-events: none; }
.tt-line { height: 48px; border-bottom: 1px solid var(--border); box-sizing: border-box; }
.tt-line:nth-child(odd) { border-bottom-color: color-mix(in srgb, var(--border) 55%, transparent); }
.tt-events { position: absolute; inset: 0; }
.tt-events.clickable { cursor: pointer; }
.tt-event {
  position: absolute; box-sizing: border-box; overflow: hidden; margin: 0 2px;
  border: 1px solid color-mix(in srgb, var(--c, var(--primary)) 45%, #fff);
  border-left: 3px solid var(--c, var(--primary));
  background: color-mix(in srgb, var(--c, var(--primary)) 15%, #fff);
  color: var(--text); border-radius: var(--radius-sm); padding: 2px 6px;
  font-family: inherit; text-align: left; cursor: pointer; line-height: 1.2;
  display: flex; flex-direction: column; gap: 1px; min-height: 16px;
  transition: box-shadow .12s, filter .12s;
}
.tt-event:hover { box-shadow: var(--shadow); filter: brightness(.97); text-decoration: none; z-index: 4; }
button.tt-event:disabled { cursor: default; }
.tt-event.is-shared { cursor: default; }
.tt-ev-time { font-size: .6875rem; font-weight: 400; color: var(--text-soft); opacity: .85; font-variant-numeric: tabular-nums; }
.tt-ev-label { font-size: .75rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-ev-sub { font-size: .6875rem; color: var(--muted); opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-add {
  align-self: flex-start; border: 1px dashed var(--border-strong); background: transparent;
  color: var(--muted); cursor: pointer; font-size: .78rem; line-height: 1;
  padding: 5px 9px; border-radius: 999px;
}
.slot-add:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.shared-tag {
  display: inline-block; padding: 0 5px; margin-right: 2px; border-radius: 4px;
  background: #0078d4; color: #fff; font-size: .66rem; font-weight: 700; vertical-align: 1px;
}
/* 一覧（アジェンダ）ビュー */
.agenda-empty { color: var(--muted); padding: 24px 0; }
.agenda { display: flex; flex-direction: column; gap: 14px; }
.agenda-day { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.agenda-day.is-today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.agenda-date {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: var(--bg-soft, #f8fafc); border-bottom: 1px solid var(--border);
}
.agenda-date-link { font-weight: 700; font-size: .92rem; color: var(--text); }
.agenda-date-link:hover { color: var(--primary); }
.agenda-wd { color: var(--muted); font-weight: 600; }
.agenda-today-tag { padding: 0 7px; border-radius: 999px; background: var(--primary); color: #fff; font-size: .68rem; font-weight: 700; }
.agenda-items { display: flex; flex-direction: column; }
.agenda-row {
  display: flex; align-items: baseline; gap: 12px; padding: 8px 14px;
  border-left: 4px solid var(--border); border-top: 1px solid var(--border);
  color: var(--text); text-decoration: none;
}
.agenda-row:first-child { border-top: none; }
.agenda-row.is-meeting { border-left-color: #4f46e5; }
.agenda-row.is-snooze { border-left-color: #b45309; }
.agenda-row.is-activity { border-left-color: #15803d; }
.agenda-row.is-shared { background: var(--info-soft); cursor: default; }
a.agenda-row:hover { background: var(--info-soft); text-decoration: none; }
.agenda-time { flex: 0 0 3.4em; font-size: .8rem; font-weight: 700; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.agenda-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.agenda-label { font-weight: 600; font-size: .9rem; }
.agenda-sub { font-size: .76rem; color: var(--muted); }

/* 現在時刻インジケータ（赤線） */
.now-line {
  position: absolute; left: 62px; right: 0; height: 0; border-top: 2px solid var(--fx-danger, #a4262c);
  display: none; pointer-events: none; z-index: 3;
}
.now-dot {
  position: absolute; left: -5px; top: -5px; width: 10px; height: 10px;
  background: var(--fx-danger, #a4262c); border-radius: 50%;
}

.cal-dialog { border: none; border-radius: var(--radius); padding: 0; box-shadow: var(--shadow); max-width: 620px; width: 92%; }
.cal-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.cal-dialog .form { max-width: none; box-shadow: none; border: none; }
.form-row { display: flex; gap: 16px; align-items: flex-end; }
.form-row > label { flex: 1; }
.chk-inline { flex-direction: row !important; align-items: center; gap: 8px !important; flex: 0 0 auto; padding-bottom: 10px; }
.chk-inline input { width: auto; }

/* =========================================================================
   フォーム
   ========================================================================= */
.form {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 28px; max-width: 680px; display: flex; flex-direction: column; gap: 16px;
  box-shadow: var(--shadow-sm);
}
.form label { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; color: var(--text-soft); font-weight: 600; }
.form input, .form select, .form textarea {
  padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: .93rem; font-family: inherit; color: var(--text); font-weight: 400;
  transition: border-color .12s, box-shadow .12s;
}
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--primary); box-shadow: var(--ring); outline: none; }
.form .row { display: flex; gap: 16px; }
.form .row label { flex: 1; }
.form .req { color: var(--danger); }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.checkbox { flex-direction: row !important; align-items: center; gap: 8px !important; }
.checkbox input { width: auto; }

/* =========================================================================
   詳細
   ========================================================================= */
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px 28px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow-sm);
}
.detail-grid .full { grid-column: 1 / -1; }
.detail-grid .dt { display: block; color: var(--muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 3px; }

/* 顧客詳細のセクションジャンプナビ（打ち合わせ/案件/対応履歴） */
.section-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--sp-5) 0 calc(-1 * var(--sp-4)); }
.section-nav a {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px;
  border-radius: 999px; background: var(--panel); border: 1px solid var(--border);
  color: var(--text-soft); font-size: .82rem; font-weight: 600; box-shadow: var(--shadow-sm);
  transition: border-color .12s, color .12s;
}
.section-nav a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.section-nav .n { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; }
section[id] { scroll-margin-top: 18px; }

.inline-form { margin: 14px 0; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 18px; box-shadow: var(--shadow-sm); }
.inline-form summary { cursor: pointer; color: var(--primary); font-size: .88rem; font-weight: 600; padding: 12px 0; list-style: none; }
.inline-form summary::-webkit-details-marker { display: none; }
.inline-form summary::before { content: "＋"; margin-right: 6px; }
.inline-form[open] summary::before { content: "−"; }
.inline-form form { display: flex; flex-direction: column; gap: 13px; padding: 6px 0 16px; }
.inline-form .row { display: flex; gap: 16px; }
.inline-form .row label { flex: 1; }
.inline-form label { display: flex; flex-direction: column; gap: 5px; font-size: .8rem; color: var(--text-soft); font-weight: 600; }
.inline-form input, .inline-form select, .inline-form textarea {
  padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-family: inherit; font-size: .9rem;
  transition: border-color .12s, box-shadow .12s;
}
.inline-form input:focus, .inline-form select:focus, .inline-form textarea:focus { border-color: var(--primary); box-shadow: var(--ring); outline: none; }

.owner-chip { margin-top: 4px; font-size: .74rem; color: var(--muted); }
.assign-form { margin-top: 4px; }
.assign-form select { font-size: .74rem; padding: 2px 4px; max-width: 12rem; }
.mine-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 10px 0 4px; font-size: .82rem; }

/* =========================================================================
   タイムライン
   ========================================================================= */
.timeline { list-style: none; padding: 0; margin: 14px 0; }
.timeline li { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.timeline li.empty { text-align: center; color: var(--muted); }
.tl-head { display: flex; align-items: center; gap: 10px; font-size: .78rem; color: var(--muted); margin-bottom: 6px; justify-content: flex-start; }
.tl-user { font-weight: 600; color: var(--text-soft); }
.tl-body { white-space: pre-wrap; color: var(--text-soft); }

/* =========================================================================
   行内アクション
   ========================================================================= */
.rowactions { white-space: nowrap; display: flex; gap: 12px; align-items: center; }
.rowactions form { margin: 0; }
.tl-actions { display: inline-flex; gap: 12px; align-items: center; margin-left: auto; }
.tl-actions form { margin: 0; }

/* =========================================================================
   メール本文
   ========================================================================= */
.mailbody {
  white-space: pre-wrap; word-break: break-word;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  font-size: .9rem; color: var(--text-soft); margin: 0; box-shadow: var(--shadow-sm);
}

/* メール本文から推測した打ち合わせ日程の候補 */
.date-hint {
  margin: 12px 0 16px; padding: 12px 14px; border: 1px solid var(--border);
  border-left: 3px solid var(--primary); border-radius: var(--radius);
  background: var(--primary-soft, #eff6fc);
}
.date-hint__lead { display: block; font-size: .82rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.date-hint__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.date-chip {
  border: 1px solid var(--border-strong); background: var(--panel); color: var(--text);
  border-radius: 999px; padding: 5px 12px; font-size: .82rem; font-family: inherit;
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s;
}
.date-chip:hover { border-color: var(--primary); color: var(--primary); }
.date-chip.is-top { border-color: var(--primary); }
.date-chip.is-selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.date-chip__flag { font-size: .7rem; font-weight: 700; color: var(--danger); margin-left: 2px; }
.date-chip.is-selected .date-chip__flag { color: #ffe0b2; }
.date-hint__note { margin: 8px 0 0; }
.date-hint__chips { flex-direction: column; align-items: stretch; }
.date-cand { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.avail-badge {
  font-size: .74rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
}
.avail-badge.is-free { background: #dcfce7; color: #15803d; }
.avail-badge.is-busy { background: #fee2e2; color: #b91c1c; }
.avail-badge.is-unknown { background: #e0e7ff; color: #3730a3; }
.avail-detail { font-size: .76rem; color: var(--text-soft); }
.avail-link { font-size: .74rem; color: var(--primary); text-decoration: none; white-space: nowrap; }
.avail-link:hover { text-decoration: underline; }

/* 候補日ごとの空き確認カード＋時間帯タイムライン */
.avail-cards { display: flex; flex-direction: column; gap: 12px; }
.avail-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--panel); }
.avail-card.is-conflict { border-color: #fecaca; background: #fef2f2; }
.avail-card.is-free { border-color: #bbf7d0; background: #f0fdf4; }
.avail-card__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.avail-card__head .avail-when { font-weight: 600; }
.avail-card__head .avail-link { margin-left: auto; }

.tl { font-size: .72rem; --tl-h: 18px; --tl-pad: 44px; }
.tl__ruler { position: relative; height: 15px; margin-left: var(--tl-pad); border-bottom: 1px solid var(--border); }
.tl__tick { position: absolute; transform: translateX(-50%); color: var(--text-soft); white-space: nowrap; }
.tl__row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.tl__label { width: 38px; flex: none; text-align: right; color: var(--text-soft); }
.tl__track { position: relative; flex: 1; height: var(--tl-h); background: rgba(0,0,0,.05); border-radius: 4px; overflow: hidden; }
.tl__bar { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; background: #94a3b8; }
.tl__bar.is-hit { background: #ef4444; }
.tl__bar.is-cand { background: #6366f1; }
.tl__bar.is-cand.is-hit { background: #ef4444; box-shadow: inset 0 0 0 2px #4338ca; }
.tl__empty { position: absolute; left: 8px; top: 1px; color: var(--text-soft); }

.avail-card__foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.avail-slot { font-size: .74rem; font-weight: 700; color: #4338ca; background: #e0e7ff; padding: 2px 8px; border-radius: 999px; }
.avail-chip { font-size: .74rem; color: var(--text); background: rgba(0,0,0,.05); padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.avail-chip.is-hit { background: #fee2e2; color: #b91c1c; font-weight: 700; }
.avail-chip.is-allday { background: #e0e7ff; color: #3730a3; }
.avail-more { font-size: .74rem; color: var(--muted); align-self: center; }

/* =========================================================================
   メール系画面（受信詳細・起票確認）の整理
   ごちゃつき対策: 縦に並ぶブロックを区切り線＋余白で分け、視線の切れ目を作る
   ========================================================================= */
.mailview > section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.mailview > section:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.mailview h2 { margin: 0 0 14px; }
.mailview > p.muted { margin: 6px 0 0; }

/* 空き確認カード: 状態を左アクセントで一目化し、タイムラインを主役に */
.mailview .avail-card { border-left-width: 3px; }
.avail-card.is-conflict { border-left-color: #ef4444; }
.avail-card.is-free { border-left-color: #22c55e; }
.mailview .tl { --tl-h: 20px; font-size: .74rem; }
.mailview .avail-card__foot { align-items: center; }

/* =========================================================================
   ユーティリティ
   ========================================================================= */
.muted { color: var(--muted); font-size: .85rem; }

/* =========================================================================
   タグ
   ========================================================================= */
.tag-section { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel); border: 1px solid var(--border-strong);
  color: var(--text-soft); padding: 4px 11px; border-radius: 999px; font-size: .8rem; font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.tag-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.tag-remove { margin: 0; display: inline-flex; }
.tag-remove button {
  background: none; border: none; padding: 0 0 0 2px; cursor: pointer;
  color: var(--muted); font-size: 1rem; line-height: 1;
}
.tag-remove button:hover { color: var(--danger); }
.tag-add { display: inline-flex; gap: 6px; margin: 0; }
.tag-add select { padding: 7px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-family: inherit; font-size: .85rem; }
.tag-add .btn { padding: 7px 13px; }
.color-field input[type=color] { width: 52px; height: 38px; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; cursor: pointer; }

/* =========================================================================
   ページネーション
   ========================================================================= */
.pagination { display: flex; align-items: center; gap: 16px; justify-content: center; margin: 24px 0 0; font-size: .88rem; }
.pagination a { padding: 7px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; box-shadow: var(--shadow-sm); font-weight: 550; }
.pagination a:hover { background: var(--panel-alt); text-decoration: none; }
.pagination span { color: var(--muted); }

/* =========================================================================
   レスポンシブ
   ========================================================================= */
@media (max-width: 820px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .sidebar-brand { border-bottom: none; padding: 14px 18px; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; padding: 0 10px 10px; }
  .sidebar-foot { border-top: none; flex-direction: row; align-items: center; margin-left: auto; padding: 10px 18px; }
  .container { padding: 22px 18px 48px; }
  .detail-grid { grid-template-columns: 1fr; }
  .form .row, .inline-form .row { flex-direction: column; gap: 13px; }
  html.cal-fixed-view, html.cal-fixed-view body { height: auto; overflow: visible; }
  .cal-shell { flex-direction: column; }
  .cal-shell.is-fixed { height: auto; }
  .cal-side { flex-basis: auto; width: 100%; flex-direction: row; flex-wrap: wrap; gap: 14px; overflow: visible; }
  .cal-side .mini-cal { flex: 0 0 auto; }
  .cal-side-sec { border-top: none; padding-top: 0; }
  .container:has(.cal-shell) { padding: 22px 18px 48px; }
  .tt-scroll { max-height: 62vh; }
  .week-col-head .wk-wd { font-size: .64rem; }
}

/* 案件フォルダ: 決定事項ログ ============================================= */
.decision-log { list-style: none; margin: 14px 0 0; padding: 0; }
.decision-log > li {
  display: flex; gap: 14px; padding: 12px 0;
  border-top: 1px solid var(--border, #e5e7eb);
}
.decision-log > li:first-child { border-top: none; }
.decision-log > li.empty {
  display: block; color: #6b7280; border-top: none; padding: 10px 0;
}
.dec-date {
  flex: 0 0 auto; min-width: 96px; font-variant-numeric: tabular-nums;
  font-weight: 600; color: #374151;
}
.dec-body { flex: 1 1 auto; }
.dec-content { white-space: pre-wrap; }
.dec-meta {
  display: flex; align-items: center; gap: 12px;
  margin-top: 4px; font-size: .82rem; color: #6b7280;
}
.dec-meta form { display: inline; }

/* 案件フォルダ: 左フォルダ欄 + 右中身の2カラム ============================ */
.folder-shell { display: flex; gap: 22px; align-items: flex-start; }
.folder-list {
  flex: 0 0 258px; position: sticky; top: 18px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; align-self: flex-start;
}
.folder-list-head {
  display: flex; flex-direction: column; gap: 2px;
  padding: 4px 8px 12px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.fl-title { font-weight: 700; color: var(--text); font-size: .95rem; }
.fl-owner { font-size: .8rem; color: var(--muted); }
.folder-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.folder-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 8px; text-decoration: none;
  color: var(--text-soft); transition: background .12s;
}
.folder-item:hover { background: var(--panel-alt); }
.folder-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.fl-ico { width: 18px; height: 18px; flex: 0 0 auto; opacity: .8; }
.fl-name {
  flex: 1 1 auto; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; font-size: .9rem;
}
.folder-item .badge { flex: 0 0 auto; }
.folder-empty { color: var(--muted); padding: 10px; font-size: .88rem; }
.fl-add { display: block; text-align: center; margin-top: 10px; }
.folder-main { flex: 1 1 auto; min-width: 0; }

@media (max-width: 900px) {
  .folder-shell { flex-direction: column; }
  .folder-list { position: static; width: 100%; flex-basis: auto; }
  .folder-items { flex-direction: row; flex-wrap: wrap; }
  .folder-item { flex: 1 1 220px; }
}
