/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #1e1e2e;
  --surface:     #2a2a3d;
  --surface-2:   #33334a;
  --border:      #44445a;
  --accent:      #7c6bff;
  --accent-glow: rgba(124,107,255,0.3);
  --text:        #f0f0fa;
  --text-muted:  #8f8fa8;
  --success:     #4ade80;
  --danger:      #f87171;
  --warning:     #fbbf24;
  --col-todo:    #6b8cff;
  --col-doing:   #fbbf24;
  --col-done:    #4ade80;
  --radius:      14px;
}

body {
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 16px 60px;
  background-image: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(124,107,255,0.12) 0%, transparent 60%);
}

.app { width: 100%; max-width: 1100px; display: flex; flex-direction: column; gap: 20px; }

/* ===== Header ===== */
.header { display: flex; flex-direction: column; gap: 12px; }
.header-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.title {
  font-size: 1.9rem; font-weight: 700; letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 30%, var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; white-space: nowrap;
}

.stats { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 120px; }
#stats-text { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.progress-bar { flex: 1; height: 4px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #a78bfa); border-radius: 99px; width: 0%; transition: width 0.4s cubic-bezier(0.4,0,0.2,1); }

/* ===== Search Area ===== */
.search-area { display: flex; flex-direction: column; gap: 6px; }

.search-box {
  position: relative; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 10px; display: flex; align-items: center; transition: 0.2s;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.search-icon { position: absolute; left: 12px; color: var(--text-muted); flex-shrink: 0; }
.search-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 0.92rem; padding: 10px 40px 10px 36px;
  caret-color: var(--accent);
}
.search-input::placeholder { color: var(--text-muted); }
.search-clear-btn {
  position: absolute; right: 10px; background: none; border: none; color: var(--text-muted);
  font-size: 0.9rem; cursor: pointer; padding: 4px; border-radius: 50%; transition: 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.search-clear-btn:hover { color: var(--danger); background: rgba(248,113,113,0.12); }

.search-status { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.ss-badge {
  font-size: 0.72rem; font-weight: 700; padding: 2px 9px; border-radius: 99px;
  display: inline-flex; align-items: center; gap: 4px;
}
.ss-badge.local { background: rgba(74,222,128,0.1); color: var(--success); border: 1px solid rgba(74,222,128,0.25); }
.ss-badge.ai    { background: rgba(124,107,255,0.15); color: #a78bfa; border: 1px solid rgba(124,107,255,0.3); }
.ss-count { font-size: 0.78rem; color: var(--text-muted); }
.ss-text  { font-size: 0.78rem; color: #a78bfa; }
.ss-spinner {
  display: inline-block; width: 12px; height: 12px;
  border: 2px solid rgba(167,139,250,0.3); border-top-color: #a78bfa;
  border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Input Area ===== */
.input-area { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px; }
.input-wrapper { display: flex; gap: 4px; align-items: center; }
.task-input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-size: 0.95rem; padding: 12px 14px; caret-color: var(--accent); }
.task-input::placeholder { color: var(--text-muted); }

.priority-select { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); font-size: 0.8rem; padding: 8px 10px; border-radius: 9px; cursor: pointer; outline: none; transition: 0.2s; }
.priority-select:hover { border-color: var(--accent); color: var(--text); }

.add-btn { background: var(--accent); border: none; color: #fff; width: 42px; height: 42px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: 0.2s; }
.add-btn:hover { background: #9580ff; box-shadow: 0 0 20px var(--accent-glow); transform: scale(1.05); }
.add-btn:active { transform: scale(0.96); }

/* ===== Hamburger / Mobile Menu ===== */
.desktop-nav { display: flex; align-items: center; gap: 8px; }

.hamburger-btn {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 36px; height: 36px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; padding: 6px; flex-shrink: 0;
}
.hamburger-btn span {
  display: block; width: 18px; height: 2px;
  background: var(--text-muted); border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  display: none;
  flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px;
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 220px; z-index: 1000;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: menuFadeIn 0.15s ease;
}
.mobile-menu.open { display: flex; }
@keyframes menuFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.mobile-menu-btn {
  width: 100%; padding: 10px 14px; text-align: left;
  background: none; border: none; border-radius: 8px;
  color: var(--text-muted); font-size: 0.88rem; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.mobile-menu-btn:hover { background: var(--surface-2); color: var(--text); }
.mobile-menu-logout { color: var(--danger) !important; }
.mobile-menu-logout:hover { background: rgba(248,113,113,0.1) !important; }

/* ヘッダーのトップ行をrelativeにしてドロップダウンの基準点にする */
.header-top { position: relative; }

@media (max-width: 640px) {
  .desktop-nav { display: none; }
  .hamburger-btn { display: flex; }
}

/* ===== Board ===== */
.board { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; align-items: start; }
@media (max-width: 700px) { .board { grid-template-columns: 1fr; } }

/* ===== Column ===== */
.column { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 200px; transition: border-color 0.2s, box-shadow 0.2s; }
.column.drag-over { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow), inset 0 0 20px rgba(124,107,255,0.05); }

.col-header { display: flex; align-items: center; gap: 8px; padding: 14px 16px 12px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 0.9rem; }
.col-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.col-header.todo  .col-dot { background: var(--col-todo);  box-shadow: 0 0 8px rgba(107,140,255,0.6); }
.col-header.doing .col-dot { background: var(--col-doing); box-shadow: 0 0 8px rgba(251,191,36,0.6); }
.col-header.done  .col-dot { background: var(--col-done);  box-shadow: 0 0 8px rgba(74,222,128,0.6); }
.col-title { flex: 1; }
.col-count { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; }

.task-list { list-style: none; display: flex; flex-direction: column; gap: 6px; padding: 12px; flex: 1; min-height: 60px; }

/* ===== Task Item ===== */
.task-item {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 10px 10px 8px;
  cursor: grab; position: relative;
  transition: border-color 0.2s, transform 0.2s, opacity 0.2s, box-shadow 0.2s;
  animation: slide-in 0.22s ease;
}
.task-item:hover { border-color: var(--accent); }
.task-item.dragging { opacity: 0.45; cursor: grabbing; transform: scale(0.97); box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.task-ghost { opacity: 0.35; background: var(--surface-2); border: 2px dashed var(--accent); border-radius: var(--radius); }

@keyframes slide-in { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }

.task-item.priority-high   { border-left: 3px solid var(--danger); }
.task-item.priority-medium { border-left: 3px solid var(--warning); }
.task-item.priority-low    { border-left: 3px solid var(--success); }

/* ===== Search Highlight ===== */
.task-item.search-dim {
  opacity: 0.22;
  filter: grayscale(0.6);
  transform: scale(0.98);
}
.task-item.search-match-high {
  border-color: #4ade80 !important;
  box-shadow: 0 0 0 2px rgba(74,222,128,0.25), 0 0 16px rgba(74,222,128,0.12);
  background: rgba(74,222,128,0.05);
}
.task-item.search-match-med {
  border-color: #a78bfa !important;
  box-shadow: 0 0 0 2px rgba(167,139,250,0.25), 0 0 16px rgba(167,139,250,0.12);
  background: rgba(124,107,255,0.06);
}
.task-item.search-match-low {
  border-color: var(--warning) !important;
  box-shadow: 0 0 0 2px rgba(251,191,36,0.2), 0 0 12px rgba(251,191,36,0.08);
  background: rgba(251,191,36,0.04);
}

/* ===== Confidence Badge ===== */
.conf-badge {
  font-size: 0.62rem; font-weight: 800; padding: 1px 6px; border-radius: 99px;
  white-space: nowrap; flex-shrink: 0; letter-spacing: 0.2px;
}
.conf-badge.conf-high { background: rgba(74,222,128,0.15); color: #4ade80; border: 1px solid rgba(74,222,128,0.3); }
.conf-badge.conf-med  { background: rgba(167,139,250,0.15); color: #a78bfa; border: 1px solid rgba(167,139,250,0.3); }
.conf-badge.conf-low  { background: rgba(251,191,36,0.15); color: var(--warning); border: 1px solid rgba(251,191,36,0.3); }

.search-reason { font-size: 0.72rem; color: var(--text-muted); background: var(--surface); border-radius: 6px; padding: 4px 8px; line-height: 1.4; }

/* ===== Task Body ===== */
.task-drag-handle { color: var(--border); padding-top: 2px; flex-shrink: 0; cursor: grab; transition: color 0.2s; }
.task-item:hover .task-drag-handle { color: var(--text-muted); }
.task-body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.task-text { font-size: 0.88rem; line-height: 1.45; word-break: break-word; cursor: text; }

.task-meta { display: flex; align-items: center; gap: 6px; justify-content: space-between; flex-wrap: wrap; }

.priority-badge { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.3px; padding: 2px 7px; border-radius: 99px; text-transform: uppercase; flex-shrink: 0; }
.priority-badge.high   { background: rgba(248,113,113,0.15); color: var(--danger); }
.priority-badge.medium { background: rgba(251,191,36,0.15);  color: var(--warning); }
.priority-badge.low    { background: rgba(74,222,128,0.15);  color: var(--success); }

.task-actions { display: flex; gap: 3px; opacity: 0; transition: opacity 0.2s; align-items: center; }
.task-item:hover .task-actions { opacity: 1; }

.action-btn { background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); font-size: 0.65rem; padding: 2px 6px; border-radius: 5px; cursor: pointer; transition: 0.2s; line-height: 1.4; }
.action-btn.next:hover { border-color: var(--accent); color: var(--accent); }
.action-btn.prev:hover { border-color: var(--text-muted); color: var(--text); }
.action-btn.img-btn    { display: flex; align-items: center; justify-content: center; padding: 2px 5px; }
.label-toggle-btn:hover { border-color: #ec4899; color: #ec4899; }

.delete-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px 4px; border-radius: 5px; display: flex; align-items: center; transition: 0.2s; }
.delete-btn:hover { color: var(--danger); background: rgba(248,113,113,0.1); }

/* ===== Labels ===== */
.task-labels { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.task-label-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.label-picker {
  display: flex; gap: 5px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; margin-top: 4px;
}
.label-picker.hidden { display: none; }

.label-swatch {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; transition: transform 0.15s, border-color 0.15s;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; color: #fff; font-weight: 900;
}
.label-swatch:hover { transform: scale(1.2); }
.label-swatch.active { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.3); }

/* ===== Timer Badge ===== */
.timer-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; cursor: pointer; transition: 0.2s; border: 1px solid transparent; user-select: none; }
.timer-badge.running { background: rgba(74,222,128,0.12); color: #4ade80; border-color: rgba(74,222,128,0.3); }
.timer-badge.warning { background: rgba(251,191,36,0.12);  color: #fbbf24; border-color: rgba(251,191,36,0.3); }
.timer-badge.danger  { background: rgba(248,113,113,0.15); color: #f87171; border-color: rgba(248,113,113,0.4); animation: danger-blink 0.9s ease-in-out infinite; }
@keyframes danger-blink { 0%,100%{opacity:1} 50%{opacity:0.45} }
.timer-set-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Images ===== */
.task-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px,1fr)); gap: 5px; }
.task-img-wrap { position: relative; display: inline-block; border-radius: 8px; overflow: hidden; line-height: 0; }
.task-thumb { display: block; width: 100%; max-height: 90px; object-fit: cover; border-radius: 8px; cursor: zoom-in; transition: opacity 0.2s; border: 1px solid var(--border); }
.task-thumb:hover { opacity: 0.85; }
.img-remove-btn { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.65); border: none; color: #fff; font-size: 9px; width: 18px; height: 18px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s; }
.task-img-wrap:hover .img-remove-btn { opacity: 1; }
.img-remove-btn:hover { background: rgba(248,113,113,0.85); }
.task-item.img-drag-over { border-color: var(--accent); background: rgba(124,107,255,0.08); box-shadow: 0 0 0 2px var(--accent-glow); }

/* ===== Column Footer ===== */
.col-empty { display: none; text-align: center; font-size: 0.8rem; color: var(--text-muted); padding: 28px 16px; opacity: 0.5; }
.col-empty.show { display: block; }
.col-footer { padding: 8px 12px 12px; border-top: 1px solid var(--border); }
.clear-btn { background: none; border: 1px solid var(--border); color: var(--text-muted); font-size: 0.75rem; padding: 5px 12px; border-radius: 99px; cursor: pointer; transition: 0.2s; width: 100%; }
.clear-btn:hover { border-color: var(--danger); color: var(--danger); }

/* ===== Inline Edit ===== */
.task-edit-input { width: 100%; background: var(--bg); border: 1px solid var(--accent); border-radius: 6px; color: var(--text); font-size: 0.88rem; font-family: inherit; padding: 3px 7px; outline: none; box-shadow: 0 0 0 2px var(--accent-glow); }

/* ===== Removing animation ===== */
.task-item.removing { animation: slide-out 0.2s ease forwards; }
@keyframes slide-out { to { opacity:0; transform:translateX(16px); height:0; padding:0; margin:0; border:none; overflow:hidden; } }

/* ===== Lightbox ===== */
.lightbox { display: none; position: fixed; inset: 0; z-index: 9999; align-items: center; justify-content: center; }
.lightbox.open { display: flex; }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.88); backdrop-filter: blur(6px); }
.lightbox-content { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 12px; max-width: 96vw; }
.lightbox-img { max-width: calc(90vw - 80px); max-height: 88vh; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.6); object-fit: contain; animation: lb-in 0.2s ease; }
@keyframes lb-in { from{opacity:0;transform:scale(0.94)} to{opacity:1;transform:scale(1)} }
.lightbox-close { position: absolute; top: -14px; right: -14px; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; z-index: 2; }
.lightbox-close:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.lb-nav-btn { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: #fff; font-size: 2rem; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s; flex-shrink: 0; z-index: 2; }
.lb-nav-btn:hover { background: rgba(255,255,255,0.22); }
.lb-counter { position: absolute; bottom: -28px; left: 50%; transform: translateX(-50%); font-size: 0.78rem; color: rgba(255,255,255,0.6); white-space: nowrap; }

/* ===== Timer Modal ===== */
.timer-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.65); display: flex; align-items: center; justify-content: center; z-index: 10000; backdrop-filter: blur(4px); }
.timer-modal-overlay.hidden { display: none; }
.timer-modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 30px 34px; width: 340px; box-shadow: 0 24px 64px rgba(0,0,0,0.55); display: flex; flex-direction: column; gap: 18px; }
.timer-modal-title { font-size: 1.1rem; font-weight: 700; color: var(--accent); text-align: center; }
.timer-modal-task { font-size: 0.82rem; color: var(--text-muted); text-align: center; background: var(--surface-2); border-radius: 8px; padding: 6px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-modal-inputs { display: flex; align-items: center; justify-content: center; gap: 10px; }
.timer-field { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.timer-field input { width: 80px; text-align: center; padding: 10px 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 1.6rem; font-weight: 700; outline: none; transition: border-color 0.2s; }
.timer-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.timer-field label { font-size: 0.72rem; color: var(--text-muted); }
.timer-colon { font-size: 1.8rem; font-weight: 700; color: var(--text-muted); padding-bottom: 16px; }
.timer-presets { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.preset-btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); font-size: 0.75rem; padding: 4px 10px; border-radius: 99px; cursor: pointer; transition: 0.18s; }
.preset-btn:hover { border-color: var(--accent); color: var(--accent); }
.timer-modal-actions { display: flex; gap: 10px; }
.timer-cancel-btn { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: none; color: var(--text-muted); font-size: 0.88rem; cursor: pointer; transition: 0.18s; }
.timer-cancel-btn:hover { border-color: var(--danger); color: var(--danger); }
.timer-start-btn { flex: 2; padding: 10px; border-radius: 10px; border: none; background: var(--accent); color: #fff; font-size: 0.95rem; font-weight: 700; cursor: pointer; transition: 0.18s; }
.timer-start-btn:hover { background: #9580ff; box-shadow: 0 0 16px var(--accent-glow); }

/* ===== Timer Alert ===== */
.timer-alert { display: none; position: fixed; inset: 0; z-index: 99999; align-items: center; justify-content: center; animation: alert-flash 0.55s ease-in-out infinite; }
.timer-alert.active { display: flex; }
@keyframes alert-flash { 0%,100%{background:rgba(160,0,28,0.96)} 50%{background:rgba(230,80,0,0.96)} }
.timer-alert-inner { background: #180010; border: 3px solid #ff2244; border-radius: 22px; padding: 52px 64px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; animation: alert-pulse 0.55s ease-in-out infinite; max-width: 90vw; }
@keyframes alert-pulse { 0%,100%{transform:scale(1);box-shadow:0 0 50px rgba(255,34,68,0.7)} 50%{transform:scale(1.04);box-shadow:0 0 90px rgba(255,120,0,0.9)} }
.timer-alert-emoji { font-size: 5.5rem; line-height: 1; animation: emoji-blink 0.5s ease-in-out infinite; }
@keyframes emoji-blink { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.15;transform:scale(0.92)} }
.timer-alert-title { font-size: 2.4rem; font-weight: 900; color: #fff; animation: text-blink 0.5s ease-in-out infinite; }
@keyframes text-blink { 0%,100%{opacity:1} 50%{opacity:0.1} }
.timer-alert-msg { font-size: 1.15rem; color: #ffbbbb; max-width: 380px; line-height: 1.5; word-break: break-word; background: rgba(255,255,255,0.07); border-radius: 10px; padding: 10px 20px; }
.timer-alert-close-btn { margin-top: 8px; background: #ff2244; color: #fff; border: none; font-size: 1.1rem; font-weight: 700; letter-spacing: 2px; padding: 14px 52px; border-radius: 99px; cursor: pointer; transition: background 0.2s, transform 0.1s; box-shadow: 0 4px 20px rgba(255,34,68,0.5); }
.timer-alert-close-btn:hover { background: #ff4466; transform: scale(1.06); }

/* ===== Textarea Input ===== */
.task-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 0.95rem; padding: 12px 14px;
  caret-color: var(--accent); resize: none; font-family: inherit;
  line-height: 1.5; min-height: 44px; max-height: 200px; overflow-y: auto;
}
.task-input::placeholder { color: var(--text-muted); }
.input-right { display: flex; gap: 4px; align-items: center; flex-shrink: 0; padding: 4px; }
.file-attach-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 1rem; transition: 0.2s; flex-shrink: 0;
}
.file-attach-btn:hover { border-color: var(--accent); }

/* Pending files preview */
.pending-files-preview { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 8px 8px; }
.pending-file-chip {
  display: flex; align-items: center; gap: 6px; font-size: 0.76rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 99px; padding: 3px 10px; color: var(--text-muted);
}
.pending-file-chip button {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 0.7rem; line-height: 1; padding: 0;
}
.pending-file-chip button:hover { color: var(--danger); }

/* ===== Task Files ===== */
.task-files { display: flex; flex-wrap: wrap; gap: 5px; }
.task-file-chip {
  display: flex; align-items: center; gap: 5px; font-size: 0.72rem;
  background: rgba(124,107,255,0.1); border: 1px solid rgba(124,107,255,0.3);
  border-radius: 99px; padding: 3px 10px 3px 8px; cursor: pointer;
  color: #a78bfa; transition: 0.15s; max-width: 180px;
}
.task-file-chip:hover { background: rgba(124,107,255,0.2); }
.file-chip-icon { flex-shrink: 0; }
.file-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip-remove {
  background: none; border: none; color: #a78bfa; cursor: pointer;
  font-size: 0.65rem; flex-shrink: 0; padding: 0; opacity: 0.6; line-height: 1;
}
.file-chip-remove:hover { color: var(--danger); opacity: 1; }

/* ===== Reminder Badge ===== */
.reminder-badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 0.68rem;
  font-weight: 600; padding: 2px 8px; border-radius: 99px; cursor: pointer;
  background: rgba(251,191,36,0.1); border: 1px solid rgba(251,191,36,0.3);
  color: var(--warning); transition: 0.15s;
}
.reminder-badge:hover { background: rgba(251,191,36,0.2); }
.reminder-badge.sent { background: rgba(74,222,128,0.08); border-color: rgba(74,222,128,0.25); color: var(--success); }

/* ===== File Hit Info ===== */
.file-hit-info {
  font-size: 0.7rem; color: #a78bfa;
  background: rgba(124,107,255,0.08); border-radius: 6px;
  padding: 3px 8px; cursor: pointer;
}

/* ===== Task Edit Textarea ===== */
.task-edit-textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--accent);
  border-radius: 6px; color: var(--text); font-size: 0.88rem;
  font-family: inherit; padding: 4px 7px; outline: none;
  box-shadow: 0 0 0 2px var(--accent-glow); resize: none;
  line-height: 1.5; min-height: 40px;
}

/* ===== Modal (共通) ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 28px 32px; width: 380px; max-width: 95vw;
  box-shadow: 0 24px 64px rgba(0,0,0,0.55); display: flex;
  flex-direction: column; gap: 16px;
}
.modal-title { font-size: 1.05rem; font-weight: 700; color: var(--accent); }
.modal-task-name { font-size: 0.82rem; color: var(--text-muted); background: var(--surface-2); border-radius: 8px; padding: 6px 12px; }
.modal-field { display: flex; flex-direction: column; gap: 6px; }
.modal-field label { font-size: 0.78rem; color: var(--text-muted); }
.modal-field input {
  width: 100%; padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 0.9rem; outline: none; transition: 0.2s;
}
.modal-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.modal-actions { display: flex; gap: 10px; }
.modal-cancel-btn {
  flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--border);
  background: none; color: var(--text-muted); font-size: 0.88rem; cursor: pointer; transition: 0.18s;
}
.modal-cancel-btn:hover { border-color: var(--danger); color: var(--danger); }
.modal-ok-btn {
  flex: 2; padding: 10px; border-radius: 10px; border: none;
  background: var(--accent); color: #fff; font-size: 0.95rem;
  font-weight: 700; cursor: pointer; transition: 0.18s;
}
.modal-ok-btn:hover { background: #9580ff; box-shadow: 0 0 16px var(--accent-glow); }

/* ===== File Viewer Modal ===== */
.file-viewer-box {
  width: 92vw; max-width: 1100px; max-height: 88vh;
  padding: 20px 24px; gap: 12px;
}
.file-viewer-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sheet-select {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-size: 0.82rem; padding: 5px 10px;
  border-radius: 8px; outline: none; cursor: pointer;
}
.file-viewer-highlight {
  font-size: 0.78rem; color: #4ade80; background: rgba(74,222,128,0.08);
  border: 1px solid rgba(74,222,128,0.25); border-radius: 8px;
  padding: 6px 12px; font-weight: 600;
}
.file-viewer-content {
  overflow: auto; flex: 1; max-height: calc(88vh - 140px);
  border: 1px solid var(--border); border-radius: 10px;
}
.file-table { border-collapse: collapse; font-size: 0.8rem; width: 100%; min-width: max-content; }
.file-table th, .file-table td {
  border: 1px solid var(--border); padding: 5px 10px;
  white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis;
}
.file-table th { background: var(--surface-2); color: var(--text-muted); font-weight: 700; position: sticky; top: 0; z-index: 1; }
.file-table td { background: var(--surface); }
.file-table tr:hover td { background: var(--surface-2); }
.file-table .cell-hit { background: rgba(124,107,255,0.25) !important; outline: 2px solid var(--accent); outline-offset: -2px; }
.file-table mark { background: rgba(251,191,36,0.35); color: var(--warning); border-radius: 2px; font-style: normal; }
.file-text-content {
  white-space: pre-wrap; word-break: break-word;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 0.85rem; line-height: 1.7;
  color: var(--text); padding: 4px 0;
}
.file-text-content mark { background: rgba(251,191,36,0.35); color: var(--warning); border-radius: 2px; font-style: normal; }

/* ===== Card Size Bar ===== */
.card-size-bar {
  height: 2px; background: var(--border); border-radius: 99px;
  overflow: hidden; margin-top: 2px;
}
.card-size-fill { height: 100%; border-radius: 99px; transition: width 0.3s; }

/* ===== Subscribe Button ===== */
#subscribe-btn:hover {
  background: linear-gradient(135deg, #9580ff, #a78bfa) !important;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(124,107,255,0.4);
}
#subscribe-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
