/* ===========================================================================
   自分専用の秘書アプリ － スタイル
   =========================================================================== */

/* 目の負担を減らすための方針
   ・背景に真っ黒（#000）は使わない … 白文字とのコントラストが強すぎて目が疲れるため
   ・文字に真っ白（#fff）は使わない … にじんで見える（ハレーション）のを避けるため
   ・青みを少し抑えた、彩度の低い色でまとめる
   ・面ごとの明るさの差を小さくして、視線を動かしたときのちらつきを減らす        */

:root {
  color-scheme: dark; /* 日付・時刻の入力欄など、ブラウザ標準の部品も暗くする */

  /* 面の明るさを3段階にはっきり分けて、重なりが見て分かるようにする
     背景（暗い） → カード（明るい） → カードの中の項目（また暗い）
     色みは緑に寄せて、全体を落ち着いたトーンでまとめている。          */
  --bg: #08120c;        /* いちばん奥：画面全体の背景（body でグラデーションをかける） */
  --surface: #21392c;   /* カード・パネル本体（背景よりはっきり明るく） */
  --surface-2: #0f1c14; /* カードの中の項目・入力欄（沈んで見える暗さ） */
  --surface-3: #2b4636; /* ボタンやチップの下地（カードより少し明るく） */

  --border: #3b5b48;      /* 枠線もはっきり見える明るさに */
  --border-strong: #4e7259;

  --text: #e3ebe5;      /* 本文（真っ白より少し落とす） */
  --text-2: #b8c8bd;    /* 補足の文章 */
  --muted: #96a89c;     /* 日時など控えめな文字（小さいので読める明るさを確保） */

  --primary: #a3adf5;      /* 強調の色（彩度をおさえた藤色） */
  --primary-dark: #b3bbf8; /* 触れたときに少し明るく */
  --primary-solid: #5058b8;/* ボタンの塗り */
  --primary-weak: #313a5c; /* 淡い下地 */

  --success: #6dbd93;
  --success-weak: #263d33;
  --warn: #d9a763;
  --warn-weak: #453723;
  --danger: #e08d95;
  --danger-weak: #4a3138;
  --info: #7fb2d4;
  --info-weak: #263a47;

  --radius: 14px;
  --radius-sm: 9px;

  /* 背景が暗いぶん、影は濃いめにしてカードを浮かせる */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN",
               "Yu Gothic UI", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  -webkit-font-smoothing: antialiased;

  /* 緑調のグラデーション
     ・上部にやわらかい緑の光を置き、下にいくほど沈ませる
     ・スクロールしても動かないよう固定し、目がちらつかないようにする */
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 50% -12%, rgba(58, 148, 100, .26), transparent 62%),
    radial-gradient(900px 520px at 88% 8%, rgba(40, 120, 110, .16), transparent 60%),
    linear-gradient(180deg, #0d1f15 0%, #0a1710 45%, #07110b 100%);
  background-attachment: fixed;
  background-color: var(--bg); /* グラデーションが描けない環境向けの下地 */
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px 72px;
}

/* ---------------------------------------------------------------------------
   ヘッダー
   --------------------------------------------------------------------------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 32px 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-size: 22px;
}

.brand-text h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .01em;
}

.subtitle {
  margin: 1px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.today {
  margin: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  box-shadow: var(--shadow-sm);
}

/* ---------------------------------------------------------------------------
   ダッシュボード
   --------------------------------------------------------------------------- */

.dashboard {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: box-shadow .18s ease, transform .18s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* カード上端の細いライン */
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--muted);
  opacity: .5;
}

.stat-card:nth-child(1)::before { background: var(--info); }
.stat-card:nth-child(2)::before { background: var(--primary); }
.stat-card.done::before { background: var(--success); }
.stat-card.accent::before { background: var(--warn); }
.stat-card.danger::before { background: var(--border-strong); opacity: 1; }
.stat-card.danger.alert::before { background: var(--danger); }

.stat-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .02em;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-memo { background: var(--info); }
.dot-task { background: var(--primary); }
.dot-done { background: var(--success); }
.dot-open { background: var(--warn); }
.dot-over { background: var(--border-strong); }
.alert .dot-over { background: var(--danger); }

.stat-figure {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.stat-value {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.stat-unit {
  font-size: 13px;
  color: var(--muted);
}

.stat-card.accent .stat-value { color: var(--warn); }
.stat-card.done .stat-value { color: var(--success); }
.stat-card.danger .stat-value { color: var(--muted); }

.stat-card.danger.alert {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  background: linear-gradient(180deg, var(--danger-weak), var(--surface) 70%);
}

.stat-card.danger.alert .stat-value { color: var(--danger); }

/* ---------------------------------------------------------------------------
   今日どうする？（朝のブリーフィング）
   --------------------------------------------------------------------------- */

.brief {
  position: relative;
  overflow: hidden;
  margin-bottom: 22px;
  padding: 20px 24px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background:
    linear-gradient(135deg, var(--primary-weak) 0%, var(--surface) 42%),
    var(--surface);
}

.brief::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--primary);
}

.brief-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.brief-head h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .01em;
}

.brief-icon { font-size: 17px; }

.brief-stamp {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.brief-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 14px;
}

.brief-line {
  margin: 0;
  font-size: 14px;
  color: var(--text-2);
}

.brief-line.lead {
  font-size: 14.5px;
  color: var(--text);
  font-weight: 600;
}

.brief-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
}

.brief-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.rank {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--surface-3);
  color: var(--text-2);
}

.rank.rank-over { background: var(--danger-weak); color: var(--danger); }
.rank.rank-today { background: var(--warn-weak); color: var(--warn); }

.brief-text {
  flex: 1;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
}

.brief-more {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.brief-empty {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-2);
}

/* ---------------------------------------------------------------------------
   お忘れではありませんか？
   --------------------------------------------------------------------------- */

.reminders {
  margin-bottom: 22px;
  padding: 18px 22px 20px;
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: linear-gradient(135deg, var(--warn-weak) 0%, var(--surface) 45%), var(--surface);
}

.reminders-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.reminders-head h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.reminder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reminder-item {
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 12px 14px;
}

.reminder-item.level-high { border-left-color: var(--danger); }

.reminder-message {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  word-break: break-word;
}

.reminder-question {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--primary);
  font-weight: 600;
}

.reminder-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.reminder-actions .spacer { flex: 1; }

.reminders-more {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* 気づきから開く送信メールの下書き */
.outgoing {
  margin-top: 11px;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.outgoing-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.outgoing input,
.outgoing textarea {
  width: 100%;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  resize: vertical;
}

.outgoing input::placeholder,
.outgoing textarea::placeholder { color: var(--muted); }

.outgoing textarea { line-height: 1.7; margin-top: 7px; }

.outgoing input:focus,
.outgoing textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.outgoing-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.outgoing-note {
  flex: 1;
  min-width: 200px;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------------------------------------------------------------------------
   パネル
   --------------------------------------------------------------------------- */

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
}

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

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px 22px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.panel-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .01em;
}

.panel-icon { font-size: 15px; }

.count {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  background: var(--surface-3);
  border-radius: 999px;
  padding: 2px 10px;
}

/* ---------------------------------------------------------------------------
   フォーム
   --------------------------------------------------------------------------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form input[type="text"],
.form textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  resize: vertical;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.form input::placeholder,
.form textarea::placeholder { color: var(--muted); }

.form input[type="text"]:focus,
.form textarea:focus,
.form input[type="date"]:focus,
.form input[type="time"]:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  font: inherit;
  font-weight: 600;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary-solid);
  color: #eceefb;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background .15s ease, transform .1s ease;
}

.btn-primary:hover { background: #5a62bd; }
.btn-primary:active { transform: translateY(1px); }

/* ---------------------------------------------------------------------------
   期限の入力
   --------------------------------------------------------------------------- */

.due-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.due-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.due-label {
  width: 44px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .04em;
}

input[type="date"],
input[type="time"] {
  font: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}

input[type="date"]:disabled,
input[type="time"]:disabled {
  background: var(--surface-3);
  color: var(--muted);
  cursor: not-allowed;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s ease;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-weak);
}

.chip.active {
  background: var(--primary-solid);
  border-color: var(--primary-solid);
  color: #eceefb;
  box-shadow: var(--shadow-sm);
}

/* 日付が未指定のあいだは時刻の行を触れないようにする */
.due-line.is-locked { opacity: .45; }
.due-line.is-locked .chip { pointer-events: none; }

.due-preview {
  margin: 2px 0 0;
  padding-left: 52px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

/* ---------------------------------------------------------------------------
   一覧
   --------------------------------------------------------------------------- */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-item {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 13px 15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.card-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

/* 期限切れのタスクは左端に赤い線を出す */
.card-item.is-overdue {
  border-left: 3px solid var(--danger);
  padding-left: 13px;
}

.item-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.item-title {
  flex: 1;
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.5;
  word-break: break-word;
}

.item-body {
  margin: 8px 0 0;
  font-size: 13.5px;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.task-check {
  width: 17px;
  height: 17px;
  margin: 3px 0 0;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.task-done .item-title {
  text-decoration: line-through;
  text-decoration-color: var(--muted);
  color: var(--muted);
  font-weight: 500;
}

.task-done { opacity: .8; }

/* 削除ボタン（×） */
.icon-btn {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.icon-btn:hover {
  background: var(--danger-weak);
  color: var(--danger);
}

/* バッジ */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  /* どの明るさの面に乗っても輪郭が分かるように、文字色を薄めた枠線を付ける */
  border: 1px solid color-mix(in srgb, currentColor 32%, transparent);
}

.badge.done { background: var(--success-weak); color: var(--success); }
.badge.open { background: var(--surface-3); color: var(--text-2); }

.badge.due-over { background: var(--danger-weak); color: var(--danger); }
.badge.due-today { background: var(--warn-weak); color: var(--warn); }
.badge.due-soon { background: var(--info-weak); color: var(--info); }
.badge.due-far { background: var(--surface-3); color: var(--muted); }

/* 下段（日時と期限の変更欄） */
.item-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
}

.stamp {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.due-editor {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.due-edit {
  font-size: 11.5px;
  padding: 3px 7px;
  border-radius: 6px;
  border-color: var(--border);
  background: var(--surface-3);
  color: var(--text-2);
}

.due-edit:hover:not(:disabled) { border-color: var(--primary); }

.empty {
  margin: 0;
  padding: 22px 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

/* ---------------------------------------------------------------------------
   メール
   --------------------------------------------------------------------------- */

.mail-panel { margin-top: 20px; }

.dot-mail { background: var(--info); }
.stat-card.mail::before { background: var(--info); }
.stat-card.mail .stat-value { color: var(--muted); }
.stat-card.mail.alert .stat-value { color: var(--info); }

/* 取り込み欄（折りたたみ） */
.importer {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.importer > summary {
  padding: 11px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  list-style: none;
}

.importer > summary::before {
  content: "＋";
  margin-right: 8px;
  color: var(--muted);
}

.importer[open] > summary::before { content: "−"; }
.importer > summary::-webkit-details-marker { display: none; }

.importer > .form,
.importer-bulk {
  padding: 0 14px 14px;
}

.importer-bulk {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}

.importer-bulk > label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
}

.hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.hint code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-3);
  font-size: 11.5px;
}

.importer-bulk textarea {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Courier New", monospace;
  font-size: 12.5px;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}

.btn-outline {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s ease;
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-weak);
}

/* 絞り込みボタン */
.mail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 分類ごとのまとまり */
.mail-group { margin-bottom: 18px; }

.mail-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}

.mail-group-title {
  font-size: 13.5px;
  font-weight: 700;
}

.mail-group-count {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.mail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.mail-item {
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 12px 14px;
}

.mail-item.cat-urgent { border-left-color: var(--danger); }
.mail-item.cat-today { border-left-color: var(--warn); }
.mail-item.cat-later { border-left-color: var(--success); }
.mail-item.cat-info { border-left-color: var(--border-strong); }

.mail-item.is-handled { opacity: .6; }

.mail-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.mail-subject {
  flex: 1;
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  word-break: break-word;
}

.is-handled .mail-subject {
  text-decoration: line-through;
  text-decoration-color: var(--muted);
  color: var(--muted);
}

.mail-from {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-2);
}

.mail-body {
  margin: 9px 0 0;
  padding: 9px 11px;
  border-radius: 7px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 7.5em;
  overflow: auto;
}

.mail-why {
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.mail-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
}

.mail-actions .stamp { margin-right: auto; }

.btn-mini {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s ease;
}

.btn-mini:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-weak);
}

.btn-mini.primary {
  background: var(--primary-solid);
  border-color: var(--primary-solid);
  color: #eceefb;
}

.btn-mini.primary:hover { background: #5a62bd; border-color: #5a62bd; color: #eceefb; }

.btn-mini.go {
  background: #3d7a5c;
  border-color: #3d7a5c;
  color: #e9f4ee;
}

.btn-mini.go:hover { background: #468a68; border-color: #468a68; color: #e9f4ee; }

.cat-select {
  font: inherit;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--text-2);
}

/* 返信案 */
.draft {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.draft-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.draft-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
}

.draft textarea {
  width: 100%;
  font: inherit;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  resize: vertical;
}

.draft textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.draft-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.draft-note {
  flex: 1;
  min-width: 180px;
  font-size: 11.5px;
  color: var(--muted);
}

.badge.st-draft { background: var(--surface-3); color: var(--text-2); }
.badge.st-approved { background: var(--warn-weak); color: var(--warn); }
.badge.st-sent { background: var(--success-weak); color: var(--success); }

/* ---------------------------------------------------------------------------
   トースト
   --------------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 10;
  transform: translateX(-50%) translateY(12px);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 40px);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  /* 暗い画面で急に明るいものが出ると目にまぶしいので、通知も暗い色にする */
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: #4a2a2f;
  border-color: var(--danger);
  color: #f2d5d8;
}

/* ---------------------------------------------------------------------------
   画面が狭いとき
   --------------------------------------------------------------------------- */

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

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

@media (max-width: 820px) {
  .page { padding: 0 16px 56px; }
  .columns { grid-template-columns: 1fr; }
  .site-header { padding: 24px 0 20px; }
  .due-label { width: 100%; }
  .due-preview { padding-left: 0; }
}

@media (max-width: 460px) {
  .dashboard { grid-template-columns: 1fr; }
  .stat-card { flex-direction: row; align-items: center; justify-content: space-between; }
}
