:root {
  /* Catppuccin Mocha色パレット */
  --bg-primary: #1e1e2e;
  --bg-secondary: #313244;
  --bg-tertiary: #45475a;
  --surface: #585b70;
  --text-primary: #cdd6f4;
  --text-secondary: #bac2de;
  --text-muted: #9399b2;
  --accent: #89b4fa;
  --accent-hover: #74c7ec;
  --success: #a6e3a1;
  --warning: #f9e2af;
  --error: #f38ba8;
  --purple: #cba6f7;
  --pink: #f5c2e7;
  --border: #6c7086;
  
  /* シャドウ */
  --shadow-small: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-large: 0 8px 32px rgba(0, 0, 0, 0.5);
  
  /* 境界線の丸み */
  --radius-small: 6px;
  --radius-medium: 12px;
  --radius-large: 16px;

  /* レイアウト */
  --titlebar-height: 40px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  user-select: none;
  pointer-events: auto !important;
}

input,
select,
textarea {
  user-select: text;
}

/* タイトルバー */
.titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--titlebar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  -webkit-app-region: drag;
}

.titlebar-drag {
  flex: 1;
  display: flex;
  align-items: center;
  padding-left: 10px;
  gap: 8px;
}

.app-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.titlebar-controls {
  display: flex;
  -webkit-app-region: no-drag;
}

.titlebar-button {
  width: 46px;
  height: var(--titlebar-height);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.titlebar-button:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.titlebar-button.close:hover {
  background: var(--error);
  color: white;
}

.titlebar-button .material-icons {
  font-size: 16px;
}

/* アプリコンテナ */
.app-container {
  display: flex;
  height: calc(100vh - var(--titlebar-height));
}

/* Web版ログインUI（ヘッダー内） */
.mobile-menu-btn {
  display: none;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-small);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.mobile-menu-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.mobile-menu-btn .material-icons {
  font-size: 18px;
}

.mobile-overlay {
  display: none;
  position: fixed;
  top: var(--titlebar-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.35);
}

.web-auth-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
  -webkit-app-region: no-drag;
}

.web-auth-left {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.web-auth-right {
  display: flex;
  align-items: center;
  gap: 8px;
  -webkit-app-region: no-drag;
}

/* 既存ボタンをヘッダー用にコンパクト化 */
.titlebar .web-auth-right .btn-secondary {
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1;
  width: auto;
  min-width: 0;
  gap: 0;
}

.titlebar .web-auth-right .btn-secondary .material-icons {
  font-size: 18px;
}

/* サイドバー */
.sidebar {
  width: 340px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.task-counter {
  font-size: 14px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 4px 12px;
  border-radius: var(--radius-small);
  display: inline-block;
}

/* 要望: サイドバー見出しと件数・下線を非表示 */
.sidebar-header {
  display: none !important;
}

.sidebar-content {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* タスク入力 */
.task-input-section {
  background: var(--bg-primary);
  padding: 16px;
  border-radius: var(--radius-medium);
  border: 1px solid var(--border);
}

.task-add-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.task-add-tab {
  flex: 1;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.task-add-tab:hover {
  background: var(--surface);
  border-color: var(--accent);
}

.task-add-tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.tag-select-group {
  display: block;
  margin-bottom: 12px;
}

.tag-select-label {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  min-width: 40px;
}

.tag-select {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
}

.tag-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.1);
}

.tag-select option {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.input-group {
  display: flex;
  gap: 8px;
}

.task-name-row {
  display: flex;
  margin-bottom: 10px;
}

.btn-add-task {
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  gap: 8px;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  min-height: 32px;
}

.btn-add-task .material-icons {
  font-size: 18px;
}

.btn-add-task:hover:not(:disabled) {
  transform: none;
}

.reserve-time-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.reserve-time-row[hidden] {
  display: none !important;
}

.reserve-time-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
  appearance: auto;
}

.reserve-time-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.1);
}

.task-input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
}

.task-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.1);
}

.task-input::placeholder {
  color: var(--text-muted);
}

/* ボタン */
.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px;
  border-radius: var(--radius-small);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  min-width: 48px;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-small);
}

.btn-primary:disabled,
.btn-primary.disabled {
  background: var(--surface);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
  pointer-events: none;
}

.btn-primary.active {
  background: var(--accent);
  color: white;
  cursor: pointer;
  opacity: 1;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.8; }
  100% { opacity: 1; }
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius-small);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  font-size: 14px;
  width: 100%;
  justify-content: center;
}

.btn-secondary:hover:not(:disabled):not(.disabled) {
  background: var(--surface);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.btn-secondary:disabled,
.btn-secondary.disabled {
  background: var(--bg-secondary);
  color: var(--text-muted);
  border-color: var(--surface);
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.btn-danger {
  background: var(--bg-tertiary);
  color: var(--error);
  border: 1px solid var(--error);
  padding: 12px 16px;
  border-radius: var(--radius-small);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  font-size: 14px;
  width: 100%;
  justify-content: center;
}

.btn-danger:hover {
  background: var(--error);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-small);
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* メインコンテンツ */
.main-content {
  flex: 1;
  /* 上側の余白はヘッダー内で持つため、topだけ0にする */
  padding: 0 24px 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  min-height: 0; /* 子要素のスクロールを効かせる */
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  /* 上部固定（タイムラインをスクロールしても見えるように） */
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  /* main-content から移設した上余白 */
  padding-top: calc(12px + 24px);
  padding-bottom: 12px;
  /* 背景を左右端まで伸ばす（main-contentの左右パディング24pxと一致） */
  margin-left: -24px;
  margin-right: -24px;
  padding-left: 24px;
  padding-right: 24px;
}

/* ヘッダーの下だけスクロールにするラッパー */
.main-body {
  flex: 1;
  overflow-y: auto;
  /* スクロールバーを右端に寄せる（main-content の右paddingを相殺） */
  margin-right: -24px;
  padding-right: 24px;
  /* スクロールバーの上下の余白も解消する（ヘッダーの下余白・main-content の下余白を相殺） */
  margin-top: -32px;   /* .main-header の margin-bottom と一致 */
  padding-top: 32px;
  margin-bottom: -24px; /* main-content の下余白分 */
  padding-bottom: 24px;
}

/* 履歴モードでは日付入力をヘッダー中央に配置 */
.main-header.history-mode {
  position: sticky; /* 明示しておく */
}

.main-header.history-mode .date-selector {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.date-display h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.date-display p {
  font-size: 16px;
  color: var(--text-muted);
  visibility: visible; /* モード切替時にvisibilityで制御する前提 */
}

.status-indicators {
  display: flex;
  gap: 16px;
}

/* ヘッダーの実行中タスク（ステータスインジケータ）を非表示 */
.main-header .status-indicators {
  display: none !important;
}

.status-card {
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: var(--radius-medium);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
}

/* フレックス子要素でellipsisを有効にするための最小幅リセット */
.status-card > div {
  min-width: 0;
}

.status-card .material-icons {
  font-size: 24px;
  color: var(--accent);
}

.status-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.status-card p:last-child {
  /* 実行中タスク名は1行で省略表示（最大サイズ上限） */
  font-size: 16px; /* 最大値 */
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 念のためidセレクタでも省略を強制 */
#current-task {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* タイムライン */
.timeline-section {
  margin-bottom: 32px;
}

.timeline-section h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.timeline-container {
  background: var(--bg-secondary);
  border-radius: var(--radius-medium);
  padding: 24px;
  min-height: 300px;
}

.timeline-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 250px;
  color: var(--text-muted);
  text-align: center;
}

.timeline-empty .material-icons {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.timeline-empty p {
  margin-bottom: 4px;
}

.sub-text {
  font-size: 14px;
  opacity: 0.7;
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  animation: slideIn 0.3s ease;
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
  position: relative;
}

.timeline-item.running {
  background: rgba(137, 180, 250, 0.1);
  border-left: 4px solid var(--accent);
  padding-left: 12px;
}

.timeline-item.reserved {
  background: var(--bg-secondary);
  border-left: 4px solid var(--purple);
  padding-left: 12px;
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-item:hover .timeline-edit {
  opacity: 1;
}

.timeline-edit {
  opacity: 0;
  transition: opacity 0.2s ease;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  align-self: center;
  margin-right: 12px;
}

.timeline-edit:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.timeline-edit .material-icons {
  font-size: 16px;
}

.timeline-time {
  min-width: 80px;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.timeline-time.range {
  position: relative;
  align-self: stretch;
  padding-top: 2px;
  padding-bottom: 2px;
}

.timeline-time.range .time-start,
.timeline-time.range .time-end {
  position: absolute;
  left: 0;
  white-space: nowrap;
}

.timeline-time.range .time-start {
  top: 0;
}

.timeline-time.range .time-end {
  bottom: 0;
}

.timeline-time.range .time-line {
  position: absolute;
  left: 18px;
  top: 18px;
  bottom: 18px;
  width: 1px;
  background: var(--border);
  opacity: 0.7;
}

.timeline-content {
  flex: 1;
}

.timeline-task {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 4px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.timeline-task:hover {
  color: var(--accent);
}

.timeline-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.task-tag {
  font-size: 11px;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: var(--radius-small);
  display: inline-block;
  font-weight: 500;
}

.timeline-duration {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: var(--radius-small);
  display: inline-block;
}

.timeline-tag {
  font-size: 12px;
  color: var(--text-primary);
  background: var(--purple);
  background: linear-gradient(135deg, var(--purple), var(--pink));
  padding: 2px 8px;
  border-radius: var(--radius-small);
  display: inline-block;
  margin-left: 4px;
  font-weight: 500;
}

/* タグ別作業時間のタブスタイル */
.tag-tabs-container {
  display: flex;
  align-items: center;
  position: relative;
  margin-bottom: 16px;
}

.tag-tabs-navigation {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg-tertiary);
  flex: 1;
}

.tag-tabs-navigation::-webkit-scrollbar {
  height: 6px;
}

.tag-tabs-navigation::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.tag-tabs-navigation::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

.tag-tabs-navigation::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

.tag-scroll-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  width: 32px;
  height: 32px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
  z-index: 1;
}

.tag-scroll-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.tag-scroll-left {
  margin-right: 8px;
}

.tag-scroll-right {
  margin-left: 8px;
}

.tag-scroll-btn .material-icons {
  font-size: 18px;
}

.tag-tab {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small) var(--radius-small) 0 0;
  padding: 8px 16px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.tag-tab:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.tag-tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.tag-tabs-content {
  position: relative;
}

.tag-tab-panel {
  display: none;
}

.tag-tab-panel.active {
  display: block;
}

.tag-tasks {
  margin-bottom: 12px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg-tertiary);
}

.tag-tasks::-webkit-scrollbar {
  width: 6px;
}

.tag-tasks::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.tag-tasks::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

.tag-tasks::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

.tag-total {
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-small);
  font-weight: 600;
  color: var(--accent);
  text-align: right;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tag-total-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.tag-total-actions .tag-copy-btn {
  padding: 6px 10px;
}

.tag-total-actions .tag-csv-btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.tag-total-actions .tag-csv-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.tag-copy-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-small);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: auto;
}

.tag-copy-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-small);
}

.tag-copy-btn .material-icons {
  font-size: 16px;
}

/* 日付セパレーター */
.date-header {
  margin: 16px 0 8px 0;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-small);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent);
}

.date-header:first-child {
  margin-top: 0;
}

/* 日付ヘッダーと統計の組み合わせ */
.date-header-with-stats {
  margin: 16px 0 8px 0;
  background: var(--bg-tertiary);
  border-radius: var(--radius-small);
  border-left: 3px solid var(--accent);
  overflow: hidden;
}

.date-header-with-stats:first-child {
  margin-top: 0;
}

.date-header-with-stats .date-header {
  margin: 0;
  padding: 8px 12px 4px 12px;
  background: transparent;
  border: none;
  border-radius: 0;
}

.date-total {
  padding: 0 12px 8px 12px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.date-separator {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
  opacity: 0.5;
}

.tag-date-group {
  margin-bottom: 16px;
}

.tag-date-header {
  margin: 0 0 8px 0;
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-small);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: inline-block;
}

.tag-copy-section {
  margin-top: 20px;
  text-align: center;
}

.tag-copy-section .btn-secondary {
  padding: 10px 16px;
  font-size: 14px;
  gap: 6px;
}

.tag-copy-section .material-icons {
  font-size: 18px;
}

/* 統計セクション */
.stats-section h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

/* 要望により統計セクションは非表示 */
.stats-section {
  display: none !important;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.stat-card {
  background: var(--bg-secondary);
  padding: 24px;
  border-radius: var(--radius-medium);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
  border-color: var(--accent);
}

.stat-icon {
  width: 48px;
  height: 48px;
  background: var(--accent);
  border-radius: var(--radius-small);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon .material-icons {
  font-size: 24px;
  color: white;
}

.stat-content h4 {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-number {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

/* トースト通知 */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--success);
  color: var(--bg-primary);
  padding: 16px 20px;
  border-radius: var(--radius-medium);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-large);
  transform: translateX(500px);
  transition: transform 0.3s ease, visibility 0.3s ease;
  font-weight: 500;
  z-index: 9999;
  max-width: 400px;
  word-wrap: break-word;
  visibility: hidden;
}

.toast.show {
  transform: translateX(0);
  visibility: visible;
}

.toast .material-icons {
  font-size: 20px;
  flex-shrink: 0;
}

.toast #toast-message {
  line-height: 1.4;
  font-size: 14px;
}

/* 確認ダイアログ */
.confirm-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.confirm-dialog.show {
  opacity: 1;
  visibility: visible;
}

.confirm-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  padding: 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.confirm-dialog.show .confirm-content {
  transform: scale(1);
}

.confirm-content h3 {
  color: var(--text-primary);
  margin-bottom: 16px;
  font-size: 20px;
  font-weight: 600;
}

.confirm-content p {
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.confirm-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.confirm-buttons button {
  padding: 0;
  border-radius: var(--radius-small);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 44px;
  width: 44px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.confirm-buttons button .material-icons {
  font-size: 20px;
}

.confirm-buttons .btn-confirm {
  background: var(--error);
  color: white;
}

.confirm-buttons .btn-confirm:hover {
  background: #e74c3c;
  transform: translateY(-1px);
}

.confirm-buttons .btn-cancel {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.confirm-buttons .btn-cancel:hover {
  background: var(--surface);
  transform: translateY(-1px);
}

/* 編集ダイアログ */
.edit-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.edit-dialog.show {
  opacity: 1;
  visibility: visible;
}

.edit-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  width: 90%;
  max-width: 550px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.edit-dialog.show .edit-content {
  transform: scale(1);
}

.edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.edit-header h3 {
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.edit-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
}

.edit-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.edit-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}

.edit-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-field label {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.edit-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
}

.edit-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.1);
}

.edit-input::placeholder {
  color: var(--text-muted);
}

.edit-footer {
  padding: 10px 16px 12px;
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .edit-content {
    width: calc(100% - 24px);
    max-height: 92vh;
  }

  .edit-header,
  .edit-body,
  .edit-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .edit-footer {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

.edit-footer button {
  padding: 0;
  border-radius: var(--radius-small);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 44px;
  width: 44px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.edit-footer button .material-icons {
  font-size: 20px;
}

.edit-footer .btn-primary {
  background: var(--accent);
  color: white;
}

.edit-footer .btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.edit-footer .btn-cancel {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.edit-footer .btn-cancel:hover {
  background: var(--surface);
  transform: translateY(-1px);
}

.edit-footer .btn-danger {
  background: var(--error);
  color: white;
}

.edit-footer .btn-danger:hover {
  background: #e74c3c;
  transform: translateY(-1px);
}

/* 報告書ダイアログ */
.report-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.report-dialog.show {
  opacity: 1;
  visibility: visible;
}

.report-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.report-dialog.show .report-content {
  transform: scale(1);
}

.report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.report-header h3 {
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.report-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
}

.report-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.report-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  flex: 1;
}

.report-section h4 {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.task-summary,
.goal-summary {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 16px;
  margin-bottom: 8px;
}

.task-summary-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.tag-summary {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 16px;
  margin-bottom: 8px;
}

.tag-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.tag-item:last-child {
  border-bottom: none;
}

.tag-item-name {
  color: var(--text-primary);
  font-weight: 500;
}

.tag-item-duration {
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-small);
  font-size: 12px;
  font-weight: 500;
}

.task-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.task-item:last-child {
  border-bottom: none;
}

.task-item-name {
  color: var(--text-primary);
  font-weight: 500;
}

.task-item-time {
  color: var(--text-muted);
  font-size: 14px;
}

.task-item-duration {
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-small);
  font-size: 12px;
  font-weight: 500;
}

.report-textarea {
  width: 100%;
  min-height: 300px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 16px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  resize: vertical;
  transition: all 0.2s ease;
}

.report-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.1);
}

.report-textarea::placeholder {
  color: var(--text-muted);
}

.report-footer {
  padding: 10px 16px 12px;
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.report-footer button {
  padding: 0;
  border-radius: var(--radius-small);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 44px;
  width: 44px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.report-footer button .material-icons {
  font-size: 20px;
}

.report-footer .btn-primary {
  background: var(--accent);
  color: white;
}

.report-footer .btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.report-footer .btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.report-footer .btn-secondary:hover {
  background: var(--surface);
  transform: translateY(-1px);
}

.report-footer .btn-cancel {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.report-footer .btn-cancel:hover {
  background: var(--surface);
  transform: translateY(-1px);
}

.report-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.report-link-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-small);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
}

.report-link-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-small);
}

.report-link-btn .material-icons {
  font-size: 16px;
}

/* 報告書タブ */
.report-tabs {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tab-navigation {
  display: flex;
  border-bottom: 2px solid var(--border);
  gap: 4px;
}

.tab-button {
  background: transparent;
  border: none;
  padding: 12px 20px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-small) var(--radius-small) 0 0;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  position: relative;
}

.tab-button:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.tab-button.active {
  background: var(--accent);
  color: white;
  border-bottom: 2px solid var(--accent);
}

.tab-button.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-textarea {
  width: 100%;
  min-height: 300px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 16px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  resize: vertical;
  transition: all 0.2s ease;
}

.tab-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.1);
}

.tab-textarea::placeholder {
  color: var(--text-muted);
}

/* 設定ダイアログ */
.settings-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.settings-dialog.show {
  opacity: 1;
  visibility: visible;
}

.settings-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.settings-dialog.show .settings-content {
  transform: scale(1);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.settings-header h3 {
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.settings-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
}

.settings-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.settings-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

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

.settings-section h4 {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.url-list {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 16px;
  margin-bottom: 16px;
  min-height: 120px;
  max-height: 300px;
  overflow-y: auto;
}

.url-item {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  padding: 0;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-small);
  margin-bottom: 8px;
  background: var(--bg-secondary);
  transition: all 0.2s ease;
  overflow: hidden;
}

.url-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.url-item:hover {
  background: var(--bg-tertiary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-small);
}

.url-info {
  flex: 1;
  min-width: 0; /* flexboxでの文字切り詰めを有効にする */
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.url-name {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.url-name::before {
  content: "🔗";
  font-size: 14px;
}

.url-address {
  color: var(--text-muted);
  font-size: 13px;
  word-break: break-all;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  background: var(--bg-primary);
  padding: 4px 8px;
  border-radius: var(--radius-small);
  border: 1px solid var(--border);
}

.url-actions {
  display: flex;
  gap: 0;
  flex-shrink: 0;
  align-items: stretch;
}

.url-actions button {
  background: var(--bg-tertiary);
  border: none;
  border-left: 1px solid var(--border);
  width: 48px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.url-actions button:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.url-actions button.delete:hover {
  background: var(--error);
  color: white;
}

.url-actions .material-icons {
  font-size: 18px;
}

.add-url-form {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-small);
  border: 1px solid var(--border);
}

.add-url-form h5 {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.add-url-form h5::before {
  content: "➕";
  font-size: 14px;
}

.input-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.input-row input {
  flex: 1;
  min-height: 48px;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
}

.input-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.1);
}

.input-row input::placeholder {
  color: var(--text-muted);
  font-size: 13px;
}

.input-row button {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-small);
  cursor: pointer;
  transition: all 0.2s ease;
}

.input-row button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-small);
}

.settings-footer {
  padding: 10px 16px 12px;
  display: flex;
  justify-content: flex-start;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}

.settings-footer button {
  padding: 0;
  border-radius: var(--radius-small);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 44px;
  width: 44px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.settings-footer button .material-icons {
  font-size: 20px;
}

.settings-footer .btn-cancel {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.settings-footer .btn-cancel:hover {
  background: var(--surface);
  transform: translateY(-1px);
}

.settings-footer .btn-primary {
  background: var(--accent);
  color: white;
}

.settings-footer .btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.url-list-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.url-list-empty .material-icons {
  font-size: 48px;
  opacity: 0.5;
}

/* アニメーション */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* スクロールバー */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--surface);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border);
}

/* レスポンシブ */
@media (max-width: 768px) {
  /* iOS Safari: inputフォーカス時の自動ズームを防ぐ（font-size < 16px だとズームする） */
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .edit-input,
  .task-input,
  .tag-select,
  .reserve-time-input,
  .report-textarea,
  .tab-textarea {
    font-size: 16px;
  }

  .mobile-menu-btn {
    display: inline-flex;
    width: 36px;
    height: 36px;
  }

  .mobile-menu-btn .material-icons {
    font-size: 22px;
  }

  /* サイドバーをオフキャンバスに */
  .sidebar {
    position: fixed;
    top: var(--titlebar-height);
    left: 0;
    bottom: 0;
    width: min(340px, 86vw);
    height: auto;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    z-index: 50;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .mobile-overlay {
    display: block;
    z-index: 40;
  }
  
  .main-header {
    flex-direction: column;
    gap: 16px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* 共通のストック管理アイテムスタイル */
.stock-item,
.goal-stock-item,
.task-stock-item {
  display: flex;
  align-items: center;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  margin-bottom: 8px;
  transition: all 0.2s ease;
  gap: 12px;
}

.stock-item:hover,
.goal-stock-item:hover,
.task-stock-item:hover {
  background: var(--surface);
  border-color: var(--accent-light);
}

.stock-item:last-child,
.goal-stock-item:last-child,
.task-stock-item:last-child {
  margin-bottom: 0;
}

.stock-item-content,
.goal-stock-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.stock-item-input,
.goal-stock-item input,
.task-stock-item input,
.task-stock-item-name {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
}

.stock-item-input:focus,
.goal-stock-item input:focus,
.task-stock-item input:focus,
.task-stock-item-name:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.stock-item-remove,
.goal-stock-item button,
.task-stock-item button,
.task-stock-item-delete,
.stock-item button {
  padding: 6px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius-small);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
}

.stock-item-remove:hover,
.goal-stock-item button:hover,
.task-stock-item button:hover,
.task-stock-item-delete:hover,
.stock-item button:hover {
  background: var(--danger-dark);
  transform: scale(1.05);
}

.stock-item-remove .material-icons,
.goal-stock-item button .material-icons,
.task-stock-item button .material-icons,
.task-stock-item-delete .material-icons,
.stock-item button .material-icons {
  font-size: 18px;
}

/* タスクストックダイアログ */
.task-stock-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}

.task-stock-dialog.show {
  opacity: 1;
  visibility: visible;
}

.task-stock-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-large);
  max-width: 600px;
  width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.task-stock-dialog.show .task-stock-content {
  transform: scale(1);
}

.task-stock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.task-stock-header h3 {
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.task-stock-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
}

.task-stock-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.task-stock-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  flex: 1;
}

.task-stock-section h4 {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.task-stock-list {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  min-height: 200px;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
}

/* task-stock-item のスタイルは共通スタイルで定義済み */

.task-stock-item-drag-handle {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  cursor: grab;
  padding: 4px;
  margin-right: 8px;
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
}

.task-stock-item-drag-handle:hover {
  background: var(--bg-tertiary);
  color: var(--accent);
}

.task-stock-item-drag-handle:active {
  cursor: grabbing;
}

/* 目標ストック用ドラッグハンドル */
.goal-stock-item-drag-handle {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  cursor: grab;
  padding: 4px;
  margin-right: 8px;
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
}

.goal-stock-item-drag-handle:hover {
  background: var(--bg-tertiary);
  color: var(--accent);
}

.goal-stock-item-drag-handle:active {
  cursor: grabbing;
}

/* タグストック用ドラッグハンドル */
.tag-stock-item-drag-handle {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  cursor: grab;
  padding: 4px;
  margin-right: 8px;
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
}

.tag-stock-item-drag-handle:hover {
  background: var(--bg-tertiary);
  color: var(--accent);
}

.tag-stock-item-drag-handle:active {
  cursor: grabbing;
}

.task-stock-item-name {
  color: var(--text-primary);
  font-weight: 500;
  flex: 1;
}

.task-stock-item-actions {
  display: flex;
  gap: 8px;
}

/* task-stock-item-delete のスタイルは共通スタイルで定義済み */

.task-stock-input {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* 古いスタイルを無効化 - 共通スタイルが優先されるようにする */
.task-stock-input input {
  flex: 1;
  margin-bottom: 0;
}

/* タスクストックアイテム内のinputに対してより具体的に共通スタイルを適用 */
.task-stock-item .stock-item-content input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
  margin-bottom: 0;
}

.task-stock-item .stock-item-content input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.task-stock-item .stock-item-content button {
  padding: 6px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius-small);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
}

.task-stock-item .stock-item-content button:hover {
  background: var(--danger-dark);
  transform: scale(1.05);
}

.task-stock-item .stock-item-content button .material-icons {
  font-size: 18px;
}

/* タスクストック編集ボタンスタイル */
.task-stock-edit-btn {
  background: var(--accent) !important;
  color: white !important;
}

.task-stock-edit-btn:hover {
  background: var(--accent-dark) !important;
}

/* タスクストック名表示エリア */
.task-stock-item-name {
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
  flex: 1;
  color: var(--text-primary);
  font-weight: 500;
  background: transparent;
  border: none;
  user-select: none; /* テキスト選択を無効化 */
}

.task-stock-item-name:hover {
  color: var(--accent);
}

.task-stock-item-name.clickable {
  display: flex;
  align-items: center;
  background: transparent;
  border: none;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: var(--radius-small);
  transition: all 0.15s ease;
}

.task-stock-item-name.clickable:hover {
  color: var(--accent);
  transform: none;
}

/* タスクストックのヘルプテキスト */
.task-stock-help-text {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 12px;
  padding: 0 4px;
}

/* 編集中の入力フィールド */
.task-stock-edit-input {
  display: none;
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
}

.task-stock-edit-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

/* 目標管理とタグ管理の名前表示エリア */
.goal-stock-item-name,
.tag-stock-item-name {
  padding: 8px 12px;
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
  flex: 1;
  color: var(--text-primary);
  font-weight: 500;
  background: transparent;
  border: 1px solid transparent;
  user-select: none;
}

/* 目標管理とタグ管理の編集入力フィールド */
.goal-stock-edit-input,
.tag-stock-edit-input {
  display: none;
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
}

.goal-stock-edit-input:focus,
.tag-stock-edit-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

/* 目標管理とタグ管理の編集ボタン */
.goal-stock-edit-btn,
.tag-stock-edit-btn,
.stock-item .tag-stock-edit-btn {
  background: var(--accent) !important;
  color: white !important;
}

.goal-stock-edit-btn:hover,
.tag-stock-edit-btn:hover,
.stock-item .tag-stock-edit-btn:hover {
  background: var(--accent-dark) !important;
}

.task-stock-input button {
  height: fit-content;
  align-self: stretch;
}

.task-stock-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-muted);
  text-align: center;
}

.task-stock-empty .material-icons {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.task-stock-empty p {
  margin: 0 0 4px 0;
  font-size: 16px;
}

.task-stock-empty .sub-text {
  font-size: 14px;
  opacity: 0.8;
}

.task-stock-footer {
  display: flex;
  justify-content: flex-start;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.task-stock-footer-buttons {
  display: flex;
  gap: 8px;
}

/* 目標作成画面の項目は選択不可 */
#goal-stock-dialog .task-stock-item {
  cursor: default;
  pointer-events: none;
}

#goal-stock-dialog .task-stock-item .task-stock-item-drag-handle,
#goal-stock-dialog .task-stock-item .task-stock-item-delete {
  pointer-events: all;
}

.task-stock-footer button {
  padding: 0;
  border-radius: var(--radius-small);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 44px;
  width: 44px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.task-stock-footer button .material-icons {
  font-size: 20px;
}

.task-stock-footer .btn-cancel {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.task-stock-footer .btn-cancel:hover {
  background: var(--surface);
  transform: translateY(-1px);
}

.task-stock-footer .btn-danger {
  background: var(--error);
  color: white;
}

.task-stock-footer .btn-danger:hover {
  background: #e74c3c;
  transform: translateY(-1px);
}

/* 履歴コントロール */
.history-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.view-mode-toggle {
  display: flex;
  gap: 0;
  background: var(--bg-tertiary);
  border-radius: var(--radius-small);
  padding: 4px;
  border: 1px solid var(--border);
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-small);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 500;
}

.mode-btn:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.mode-btn.active {
  background: var(--accent);
  color: var(--bg-primary);
}

.date-selector {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.date-selector input[type="date"] {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.date-selector input[type="date"]:hover {
  border-color: var(--accent);
}

.date-selector input[type="date"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.date-selector button {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-small);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid var(--border);
}

.date-selector .btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.date-selector .btn-secondary:hover {
  background: var(--surface);
  border-color: var(--accent);
}

.date-selector .material-icons {
  font-size: 16px;
}

/* タイムライン表示モード */
.timeline-section.history-mode {
  opacity: 0.9;
}

.timeline-section.history-mode h3 {
  color: var(--purple);
}

.timeline-section.history-mode .timeline-item {
  border-left-color: var(--purple);
}

/* ドラッグ&ドロップの視覚的フィードバック */
.goal-stock-item.drag-over,
.task-stock-item.drag-over,
.stock-item.drag-over {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
  transition: all 0.2s ease;
}

/* ドラッグ中のアイテム */
.goal-stock-item[draggable="true"]:active,
.task-stock-item[draggable="true"]:active,
.stock-item[draggable="true"]:active {
  cursor: grabbing;
}

/* ドラッグハンドルのホバー効果を強化 */
.goal-stock-item-drag-handle:hover,
.task-stock-item-drag-handle:hover,
.stock-item-drag-handle:hover {
  background: var(--bg-tertiary);
  border-radius: var(--radius-small);
}

/* 入力フィールドとボタンの組み合わせ */
.input-with-button {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-with-button .edit-input {
  flex: 1;
}

.icon-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 8px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-small);
}

.icon-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* 設定: 丸めUI改善 */
.settings-hint {
  color: var(--text-muted);
  font-size: 13px;
  margin: 6px 0 10px;
}

.settings-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.settings-field .settings-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.rounding-preview {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px dashed var(--border);
  border-radius: var(--radius-small);
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* iOS Safari は画面幅により max-width:768px を外れることがあるため、iOS では常に16px以上にする */
@supports (-webkit-touch-callout: none) {
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  .tab-textarea {
    font-size: 16px !important;
  }

  /* iOS Safari: transform配下の入力はズーム/スクロールが不安定になることがあるため無効化 */
  .confirm-content,
  .edit-content,
  .report-content,
  .settings-content,
  .task-stock-content {
    transform: none !important;
    transition: none !important;
  }
}