:root {
    --bg: #f7f6f2;
    --surface: #ffffff;
    --surface2: #f0efe9;
    --border: #e2e0d8;
    --border2: #cccab8;
    --text: #1a1916;
    --text2: #6b6a63;
    --text3: #9e9d94;
    --accent: #3b6d11;
    --accent-bg: #eaf3de;
    --accent-light: #c0dd97;
    --warn: #ba7517;
    --warn-bg: #faeeda;
    --danger: #a32d2d;
    --danger-bg: #fcebeb;
    --info: #185fa5;
    --info-bg: #e6f1fb;
    --purple: #534ab7;
    --purple-bg: #eeedfe;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #1a1916;
      --surface: #242320;
      --surface2: #2c2c29;
      --border: #3a3935;
      --border2: #4e4d47;
      --text: #f0efe9;
      --text2: #a8a79f;
      --text3: #6b6a63;
      --accent: #97c459;
      --accent-bg: #27500a;
      --accent-light: #3b6d11;
      --warn: #ef9f27;
      --warn-bg: #633806;
      --danger: #f09595;
      --danger-bg: #501313;
      --info: #85b7eb;
      --info-bg: #0c447c;
      --purple: #afa9ec;
      --purple-bg: #3c3489;
    }
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Yu Gothic UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; min-height: 100vh; }

  /* Layout */
  .app { display: flex; min-height: 100vh; }
  .sidebar { width: 220px; background: var(--surface); border-right: 1px solid var(--border); padding: 0; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; }
  .main { margin-left: 220px; flex: 1; padding: 28px 32px; max-width: 1000px; }

  /* Sidebar */
  .sidebar-logo { padding: 20px 20px 16px; border-bottom: 1px solid var(--border); }
  .sidebar-logo h1 { font-size: 17px; font-weight: 600; letter-spacing: -0.3px; color: var(--text); }
  .sidebar-logo span { font-size: 11px; color: var(--text3); letter-spacing: 0.5px; }
  .sidebar-nav { flex: 1; padding: 12px 0; }
  .nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 20px; cursor: pointer; color: var(--text2); font-size: 13px; font-weight: 500; border-left: 3px solid transparent; transition: all 0.15s; }
  .nav-item:hover { background: var(--surface2); color: var(--text); }
  .nav-item.active { background: var(--accent-bg); color: var(--accent); border-left-color: var(--accent); }
  .nav-icon { font-size: 16px; width: 20px; text-align: center; }
  .nav-section { padding: 16px 20px 6px; font-size: 10px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text3); font-weight: 600; }

  /* Views */
  .view { display: none; }
  .view.active { display: block; }
  .view-title { font-size: 22px; font-weight: 600; letter-spacing: -0.5px; margin-bottom: 4px; }
  .view-subtitle { color: var(--text2); font-size: 13px; margin-bottom: 24px; }

  /* Cards */
  .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
  .card + .card { margin-top: 16px; }

  /* Stats row */
  .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
  .stat-card { background: var(--surface2); border-radius: var(--radius-sm); padding: 14px 16px; }
  .stat-label { font-size: 11px; color: var(--text3); letter-spacing: 0.3px; margin-bottom: 4px; }
  .stat-value { font-size: 22px; font-weight: 600; color: var(--text); }
  .stat-unit { font-size: 12px; color: var(--text2); font-weight: 400; }

  /* Buttons */
  .btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border2); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
  .btn:hover { background: var(--surface2); border-color: var(--border2); }
  .btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
  .btn-primary:hover { opacity: 0.9; }
  .btn-sm { padding: 5px 10px; font-size: 12px; }
  .btn-danger { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
  .btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }

  /* Form */
  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .form-group { display: flex; flex-direction: column; gap: 5px; }
  .form-group label { font-size: 12px; font-weight: 500; color: var(--text2); }
  input, select, textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 13px; font-family: inherit; transition: border 0.15s; }
  input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
  textarea { resize: vertical; min-height: 70px; }
  .form-full { grid-column: 1 / -1; }

  /* Table */
  .table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
  table { width: 100%; border-collapse: collapse; }
  th { background: var(--surface2); font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text2); padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
  td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
  tr:last-child td { border-bottom: none; }
  tr:hover td { background: var(--surface2); }

  /* Badges */
  .badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
  .badge-done { background: var(--accent-bg); color: var(--accent); }
  .badge-miss { background: var(--danger-bg); color: var(--danger); }
  .badge-partial { background: var(--warn-bg); color: var(--warn); }
  .badge-pending { background: var(--surface2); color: var(--text3); }
  .badge-exam { background: var(--purple-bg); color: var(--purple); }
  .subject-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

  /* Weekly nav */
  .week-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
  .week-label { font-weight: 600; font-size: 15px; min-width: 160px; text-align: center; }

  /* Exam timetable */
  .exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
  .exam-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; transition: border-color 0.15s; }
  .exam-card:hover { border-color: var(--purple); }
  .exam-card .exam-date { font-size: 11px; color: var(--text3); margin-bottom: 3px; }
  .exam-card .exam-subj { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
  .exam-card .exam-time { font-size: 12px; color: var(--text2); }

  /* Subject color circles */
  .subject-colors { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
  .color-pick { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: border 0.1s; }
  .color-pick.selected { border-color: var(--text); }

  /* Hours bar */
  .hours-bar-wrap { margin-top: 6px; }
  .hours-bar-bg { background: var(--surface2); border-radius: 4px; height: 8px; overflow: hidden; }
  .hours-bar-fill { height: 100%; border-radius: 4px; transition: width 0.4s; }

  /* Empty state */
  .empty { text-align: center; padding: 48px 20px; color: var(--text3); }
  .empty-icon { font-size: 36px; margin-bottom: 12px; }
  .empty p { font-size: 14px; }

  /* Modal */
  .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200; display: none; align-items: center; justify-content: center; }
  .modal-backdrop.open { display: flex; }
  .modal { background: var(--surface); border-radius: var(--radius); padding: 24px; width: 480px; max-width: 95vw; max-height: 90vh; overflow-y: auto; border: 1px solid var(--border); }
  .modal-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
  .modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

  /* Section header */
  .section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
  .section-title { font-size: 15px; font-weight: 600; }

  /* Record status toggle */
  .status-toggle { display: flex; gap: 6px; }
  .status-btn { padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); color: var(--text2); font-size: 12px; cursor: pointer; font-weight: 500; }
  .status-btn.done { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
  .status-btn.miss { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
  .status-btn.partial { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }

  /* Subject list for hours */
  .subject-hours-list { display: flex; flex-direction: column; gap: 12px; }
  .subj-hour-row { display: flex; align-items: center; gap: 12px; }
  .subj-hour-name { min-width: 80px; font-weight: 500; font-size: 13px; }
  .subj-hour-val { min-width: 50px; text-align: right; font-size: 13px; color: var(--text2); }

  /* Data backup */
  .data-card .section-title { margin-bottom: 8px; }
  .data-desc { font-size: 13px; color: var(--text2); margin-bottom: 16px; line-height: 1.6; }
  .data-card + .data-card { margin-top: 16px; }
  .mobile-header-btn { flex-shrink: 0; }

  /* Mobile */
  .mobile-header { display: none; }
  .mobile-bottom-nav { display: none; }
  .mobile-day-list { display: none; }

  /* ── New additions ───────────────────────────────── */

/* Hours period bar */
.hours-period-bar { display: flex; flex-direction: column; gap: 0; }
.hours-toggle-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.hours-toggle-btn { opacity: 0.55; }
.hours-toggle-btn.active { opacity: 1; background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

/* Both-mode bar */
.hours-bar-pair { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.hours-bar-label-row { display: flex; justify-content: space-between; font-size: 10px; color: var(--text3); margin-bottom: 1px; }

/* Exam countdown */
.exam-countdown-banner { background: var(--purple-bg); border: 1px solid var(--purple); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.exam-countdown-banner .ecd-name { font-weight: 600; font-size: 15px; color: var(--purple); }
.exam-countdown-banner .ecd-days { font-size: 26px; font-weight: 700; color: var(--purple); }
.exam-countdown-banner .ecd-meta { font-size: 12px; color: var(--text2); }

/* Exam card with countdown */
.exam-card .exam-countdown { font-size: 13px; font-weight: 600; margin-top: 6px; }
.exam-card .exam-countdown.soon { color: var(--danger); }
.exam-card .exam-countdown.near { color: var(--warn); }
.exam-card .exam-countdown.ok { color: var(--accent); }

/* Drag handle for subjects */
.drag-handle { cursor: grab; color: var(--text3); font-size: 18px; padding: 0 6px; user-select: none; }
.drag-handle:active { cursor: grabbing; }
tr.dragging { opacity: 0.4; }
tr.drag-over td { background: var(--accent-bg) !important; }

/* Focus mode */
.focus-setup { padding: 8px 0; }
.focus-preset-btn { background: var(--surface2); border-color: var(--border); }
.focus-preset-btn.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

.focus-active { display: flex; flex-direction: column; align-items: center; padding: 32px 16px; gap: 12px; }
.focus-subject-label { font-size: 14px; font-weight: 600; color: var(--text2); }
.focus-timer-display { font-size: 64px; font-weight: 700; letter-spacing: -2px; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1; }
.focus-progress-ring { margin: -8px 0; }
.focus-elapsed { font-size: 13px; color: var(--text2); }
.focus-btn-row { display: flex; gap: 12px; margin-top: 8px; }

/* Fullscreen overlay */
.focus-fullscreen-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.focus-fs-content { text-align: center; padding: 32px; max-width: 400px; width: 100%; }
.focus-fs-subject { font-size: 18px; font-weight: 600; color: var(--text2); margin-bottom: 16px; }
.focus-fs-timer { font-size: 96px; font-weight: 700; letter-spacing: -4px; color: var(--text); line-height: 1; font-variant-numeric: tabular-nums; }
.focus-fs-elapsed { font-size: 16px; color: var(--text2); margin-top: 12px; }

/* Actual time input inline */
.actual-input-wrap { display: flex; align-items: center; gap: 6px; }
.actual-input-wrap input[type=number] { width: 64px; padding: 4px 8px; }

/* Dashboard two-col time */
.time-pair { display: flex; flex-direction: column; gap: 1px; line-height: 1.3; }
.time-pair .tp-planned { font-size: 12px; color: var(--text3); }
.time-pair .tp-actual { font-size: 13px; font-weight: 600; color: var(--accent); }
/* ダッシュボードの進捗バー用 */
.dash-progress-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; border-left: 4px solid var(--accent); }
.dash-progress-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 12px; }
.dash-progress-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px;}
.dash-progress-text { font-size: 13px; font-weight: 600; color: var(--accent); }
.dash-progress-bar-bg { background: var(--surface2); border-radius: 8px; height: 10px; overflow: hidden; }
.dash-progress-bar-fill { height: 100%; background: var(--accent); border-radius: 8px; transition: width 0.5s ease; }

/* ── Timetable view mode slide switch (mobile) ───────── */
.tt-slide-switch { margin-left: auto; }
.tt-switch-track {
  position: relative;
  display: flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  cursor: pointer;
  user-select: none;
  gap: 0;
  min-width: 172px;
}
.tt-switch-labels {
  display: flex;
  width: 100%;
  position: relative;
  z-index: 1;
}
.tt-switch-label {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 400;
  color: var(--text2);
  padding: 5px 8px;
  transition: font-weight 0.15s, color 0.15s;
  white-space: nowrap;
  line-height: 1.3;
}
.tt-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  bottom: 3px;
  background: var(--accent);
  border-radius: 999px;
  transition: transform 0.22s cubic-bezier(.4,0,.2,1);
  z-index: 0;
}

.tt2-wrap { display: flex; gap: 0; overflow-x: auto; overflow-y: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); }
.tt2-axis { flex-shrink: 0; width: 46px; background: var(--surface); border-right: 1px solid var(--border); }
.tt2-axis-inner { position: relative; }
.tt2-tick { position: absolute; right: 6px; font-size: 10px; color: var(--text3); transform: translateY(-50%); line-height: 1; white-space: nowrap; pointer-events: none; }
.tt2-cols { display: flex; flex: 1; gap: 1px; background: var(--border); min-width: 0; }
.tt2-col { flex: 1; min-width: 70px; display: flex; flex-direction: column; background: var(--surface2); }
.tt2-col-header { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--text2); background: var(--surface2); line-height: 1.3; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.tt2-col-header span { font-size: 11px; font-weight: 400; }
.tt2-col-header-today { background: var(--accent-bg); color: var(--accent); }
.tt2-col-body { position: relative; background: var(--surface); flex-shrink: 0; }
.tt2-today .tt2-col-body { background: var(--accent-bg); }
.tt2-hour-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--border); pointer-events: none; }
.tt2-block { position: absolute; left: 2px; right: 2px; border-radius: 4px; padding: 3px 5px; font-size: 10px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; gap: 1px; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.15); transition: opacity 0.15s; min-height: 18px; }
.tt2-block:hover { opacity: 0.85; }
.tt2-block-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt2-block-time { font-size: 9px; opacity: 0.85; white-space: nowrap; }
.tt2-block-content { font-size: 9px; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt2-exam-block { background: var(--surface) !important; border: 1.5px solid; }
.tt2-exam-block .tt2-block-name { font-weight: 700; }

/* ── Mobile schedule cards (timetable day list) ─────── */
.mobile-day-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.mobile-day-today { border-color: var(--accent-light); background: var(--accent-bg); }
.mobile-day-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mobile-day-header strong { font-size: 14px; font-weight: 600; }
.today-badge { background: var(--accent); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 600; margin-left: 6px; }
.mobile-day-count { font-size: 11px; color: var(--text3); }
.mobile-day-empty { padding: 8px 0; font-size: 13px; color: var(--text3); }
.mobile-schedule-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border-radius: var(--radius-sm); background: var(--surface2); border-left: 3px solid transparent; }
.mobile-schedule-item:last-child { margin-bottom: 0; }
.mobile-exam-item { background: var(--purple-bg); }
.msi-done { opacity: 0.6; }
.msi-miss { opacity: 0.5; }
.msi-time { font-size: 11px; font-weight: 600; color: var(--text2); min-width: 36px; line-height: 1.4; flex-shrink: 0; }
.msi-endtime { font-size: 10px; font-weight: 400; color: var(--text3); }
.msi-body { flex: 1; min-width: 0; }
.msi-subject { font-size: 13px; font-weight: 600; display: block; }
.msi-content { font-size: 12px; color: var(--text2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msi-actions { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.msi-actions .status-btn { padding: 3px 8px; font-size: 12px; }

.settings-section { margin-bottom: 8px; }

/* ── Timetable view toggle (mobile) ─────────────────── */
.tt-view-toggle { display: none; }
.mobile-only { display: none; }
@media (max-width: 700px) {
  .mobile-only { display: flex; }
  .tt-view-toggle {
    display: flex;
    background: var(--surface2);
    border-radius: 20px;
    padding: 3px;
    gap: 2px;
    border: 1px solid var(--border);
    margin-left: auto;
  }
  .tt-toggle-btn {
    padding: 5px 14px;
    border-radius: 16px;
    border: none;
    background: transparent;
    color: var(--text2);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
  }
  .tt-toggle-btn.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
  }
}

.notif-permission-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface2); border-radius: var(--radius-sm); margin-bottom: 16px; flex-wrap: wrap; }

/* 集中タイマー：再開ボタン */
.btn-resuming {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
  animation: pulse-resume 1.4s ease-in-out infinite;
}
@keyframes pulse-resume {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.75; }
}
.notif-settings-grid { display: flex; flex-direction: column; gap: 4px; transition: opacity 0.2s; }
.notif-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--surface2); border-radius: var(--radius-sm); cursor: pointer; transition: background 0.15s; }
.notif-toggle-row:hover { background: var(--surface3, var(--border)); }
.notif-toggle-info { display: flex; flex-direction: column; gap: 3px; }
.notif-toggle-title { font-size: 14px; font-weight: 600; }
.notif-toggle-desc { font-size: 12px; color: var(--text3); }
.notif-check { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.notif-sub-option { display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 32px; background: var(--surface); border-radius: var(--radius-sm); margin-top: -2px; }

/* ── Schedule mobile card list (hidden on desktop) ── */
.schedule-mobile-list { display: none; }

/* ── Schedule mobile card styles ─────────────────── */
.scm-group { margin-bottom: 20px; }
.scm-group-today .scm-date-header { color: var(--accent); }
.scm-date-header { display: flex; align-items: center; gap: 8px; padding: 6px 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.scm-date-str { font-size: 13px; font-weight: 600; color: var(--text); }
.scm-day-label { font-size: 11px; padding: 1px 8px; border-radius: 10px; background: var(--surface2); color: var(--text2); font-weight: 600; }
.scm-today-label { background: var(--accent-bg); color: var(--accent); }

.scm-card { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid transparent; border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
.scm-done { opacity: 0.65; background: var(--surface2); }
.scm-miss { opacity: 0.5; }
.scm-exam { background: var(--purple-bg); }

.scm-left { display: flex; flex-direction: column; align-items: flex-end; min-width: 38px; flex-shrink: 0; gap: 2px; padding-top: 1px; }
.scm-time { font-size: 12px; font-weight: 700; color: var(--text); }
.scm-endtime { font-size: 10px; color: var(--text3); }
.scm-dur { font-size: 10px; color: var(--text2); margin-top: 2px; }

.scm-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.scm-subject { font-size: 13px; font-weight: 600; }
.scm-content { font-size: 12px; color: var(--text2); }
.scm-note { font-size: 11px; color: var(--text3); font-style: italic; }
.scm-actual-row { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.scm-actual-input { width: 52px !important; padding: 3px 6px !important; font-size: 12px !important; }

.scm-right { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex-shrink: 0; }
.scm-status-btns { display: flex; gap: 3px; }
.scm-btn-status { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface2); color: var(--text3); font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: 600; transition: all 0.12s; }
.scm-btn-status.scm-s-done { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.scm-btn-status.scm-s-partial { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.scm-btn-status.scm-s-miss { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.scm-ops { display: flex; flex-direction: column; gap: 3px; }
.scm-ops .btn { padding: 3px 8px; font-size: 11px; }

@media (max-width: 700px) {
  .schedule-table-wrap { display: none; }
  .dash-table-wrap { display: none; }
  .schedule-mobile-list { display: block; }
}




  @media (max-width: 700px) {
    body { overflow-x: hidden; }

    .sidebar { display: none; }

    .mobile-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      position: sticky;
      top: 0;
      z-index: 50;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      padding: 12px 16px;
      padding-top: max(12px, env(safe-area-inset-top));
    }
    .mobile-header h1 { font-size: 17px; font-weight: 600; letter-spacing: -0.3px; }
    .mobile-header span { font-size: 11px; color: var(--text3); }

    .main {
      margin-left: 0;
      padding: 16px;
      padding-bottom: calc(72px + env(safe-area-inset-bottom));
      max-width: none;
      min-width: 0;
      width: 100%;
    }

    .view-title { font-size: 20px; }
    .view-subtitle { margin-bottom: 16px; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-value { font-size: 18px; }

    .form-grid { grid-template-columns: 1fr; }

    .btn-row { gap: 8px; }
    .btn-row select { flex: 1; min-width: 0; width: 100% !important; }
    .btn-row .btn-primary { width: 100%; }

    .week-nav {
      flex-wrap: wrap;
      gap: 8px;
      justify-content: center;
    }
    .week-label { min-width: 0; font-size: 14px; flex: 1 1 100%; }

    .section-header {
      flex-direction: column;
      align-items: flex-start;
      gap: 8px;
    }

    .exam-grid { grid-template-columns: 1fr; }

    .subj-hour-row { flex-wrap: wrap; gap: 8px; }
    .subj-hour-name { min-width: 0; }

    .modal {
      width: 100%;
      max-width: 100%;
      margin: 0 12px;
      max-height: calc(100vh - 24px - env(safe-area-inset-top));
    }
    .modal-footer { flex-wrap: wrap; }
    .modal-footer .btn { flex: 1; justify-content: center; }

    /* Card-style tables */
    .table-wrap { overflow: visible; border: none; background: transparent; }
    .card-table thead { display: none; }
    .card-table tbody tr {
      display: block;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      margin-bottom: 12px;
      background: var(--surface);
      overflow: hidden;
    }
    .card-table tbody tr:hover td { background: transparent; }
    .card-table tbody tr.empty-row {
      border: none;
      background: transparent;
    }
    .card-table td {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 10px 14px;
      border-bottom: 1px solid var(--border);
      text-align: right;
    }
    .card-table td::before {
      content: attr(data-label);
      font-size: 11px;
      font-weight: 600;
      color: var(--text2);
      text-transform: uppercase;
      letter-spacing: 0.3px;
      flex-shrink: 0;
      text-align: left;
    }
    .card-table td:last-child { border-bottom: none; }
    .card-table td.empty-cell {
      display: block;
      text-align: center;
    }
    .card-table td.empty-cell::before { display: none; }
    .card-table .status-toggle { flex-wrap: wrap; justify-content: flex-end; }
    .card-table td[data-label="操作"] {
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    .card-table td[data-label="操作"] .btn { margin-top: 4px; }

    /* Timetable → JS で表示切替 (applyTTMode) */
    .tt2-col { min-width: 46px; }
    .tt2-col-header { font-size: 10px; }
    .tt2-block-content { display: none; }
    .mobile-day-list { display: block; }

    /* Bottom navigation */
    .mobile-bottom-nav {
      display: flex;
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      background: var(--surface);
      border-top: 1px solid var(--border);
      z-index: 1000;
      padding-bottom: env(safe-area-inset-bottom);
    }
    .mobile-bottom-nav button {
      flex: 1;
      border: none;
      background: none;
      padding: 8px 4px;
      font-size: 10px;
      color: var(--text2);
      cursor: pointer;
      line-height: 1.3;
      transition: color 0.15s;
    }
    .mobile-bottom-nav button.active {
      color: var(--accent);
      font-weight: 600;
    }
    .focus-timer-display { font-size: 48px; }
    .focus-fs-timer { font-size: 72px; }
    .hours-toggle-row { gap: 6px; }
    .exam-countdown-banner { flex-direction: column; gap: 6px; align-items: flex-start; }
  }

/* ── Help ────────────────────────────────────────────── */

/* タブ */
.help-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
  flex-wrap: wrap;
}
.help-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text3);
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.help-tab:hover { color: var(--text); }
.help-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

/* パネル */
.help-panel { display: none; }
.help-panel.active { display: block; }

/* セクション見出し */
.help-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 24px 0 14px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
}
.help-section-title:first-child { margin-top: 0; }

/* 機能カードグリッド */
.help-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}
.help-feature-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.15s;
}
.help-feature-card:hover { border-color: var(--accent-light); }
.help-feature-icon { font-size: 28px; flex-shrink: 0; line-height: 1; margin-top: 2px; }
.help-feature-body { flex: 1; min-width: 0; }
.help-feature-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.help-feature-desc { font-size: 13px; color: var(--text2); line-height: 1.6; }
.help-feature-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.help-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

/* スクリーンショット */
.help-screenshots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.help-screenshot-placeholder {
  aspect-ratio: 9/16;
  max-height: 280px;
  background: var(--surface2);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  font-size: 36px;
  gap: 10px;
}
.help-screenshot-placeholder p { font-size: 12px; text-align: center; padding: 0 12px; }

/* 使い方ステップ */
.help-steps { display: flex; flex-direction: column; gap: 12px; }
.help-step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.help-step-num {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.help-step-body { flex: 1; }
.help-step-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.help-step-desc { font-size: 13px; color: var(--text2); line-height: 1.6; }

/* ヒント */
.help-tips { display: flex; flex-direction: column; gap: 8px; }
.help-tip {
  font-size: 13px;
  color: var(--text2);
  background: var(--surface2);
  border-left: 3px solid var(--accent-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  line-height: 1.6;
}

/* PWA OS タブ */
.pwa-os-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.pwa-os-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
}
.pwa-os-btn:hover { border-color: var(--accent-light); color: var(--text); }
.pwa-os-btn.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.pwa-steps { display: flex; flex-direction: column; gap: 10px; }

/* FAQ */
.help-faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}
.faq-item[open] { border-color: var(--accent-light); }
.faq-q {
  padding: 16px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  user-select: none;
}
.faq-q::-webkit-details-marker { display: none; }
.faq-q::after {
  content: '＋';
  font-size: 16px;
  color: var(--accent);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.faq-item[open] .faq-q::after { content: '－'; }
.faq-a {
  padding: 0 18px 16px;
  font-size: 13px;
  color: var(--text2);
  line-height: 1.7;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

@media (max-width: 700px) {
  .help-feature-grid { grid-template-columns: 1fr; }
  .help-tab { padding: 7px 12px; font-size: 13px; }
}