/* Project Tracker (js/projects.js). Uses the tokens from css/style.css. */
#page-projects svg { width: 16px; height: 16px; flex-shrink: 0; }
.pt-loading, .pt-muted { color: var(--text-muted); font-size: 14px; }
.pt-loading { padding: 40px 0; text-align: center; }
.pt-text-danger { color: var(--danger) !important; }
.pt-link-btn { appearance: none; border: 0; background: none; padding: 0; color: var(--primary); font-weight: 600; cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 3px; }
.pt-help { display: block; margin-top: 4px; color: var(--text-muted); font-size: 12px; }

.pt-page-header .btn-primary { white-space: nowrap; }
.pt-plan-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 16px; margin: -12px 0 20px; background: var(--primary-light); border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; color: var(--text-2); }

.pt-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.pt-tab { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: var(--radius-full); padding: 7px 14px; font-weight: 600; font-size: 13px; cursor: pointer; }
.pt-tab span { color: var(--text-muted); margin-left: 4px; font-weight: 500; }
.pt-tab.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.pt-tab.active span { color: inherit; opacity: .75; }

.pt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pt-card { appearance: none; text-align: left; font: inherit; color: inherit; display: flex; flex-direction: column; gap: 10px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); cursor: pointer; transition: var(--transition); min-width: 0; }
.pt-card:hover { border-color: var(--primary-mid); box-shadow: var(--shadow); transform: translateY(-1px); }
.pt-card:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--primary); }
.pt-card h3 { font-family: 'Fraunces', Georgia, serif; font-size: 19px; font-weight: 600; line-height: 1.25; color: var(--text); overflow-wrap: anywhere; }
.pt-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pt-card-desc { font-size: 13.5px; color: var(--text-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.pt-card-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; font-size: 13px; color: var(--text-muted); }
.pt-card-meta span, .pt-card-next, .pt-hero-meta > * { display: inline-flex; align-items: center; gap: 6px; }
.pt-card-meta strong { color: var(--text); }
.pt-card-next { font-size: 13px; color: var(--text-2); border-top: 1px solid var(--border-light); padding-top: 10px; min-width: 0; }
.pt-card-next span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pt-status, .pt-status-select { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; letter-spacing: .02em; border-radius: var(--radius-full); padding: 4px 10px; border: 1px solid transparent; }
.pt-status-planning { background: var(--info-light); color: var(--info); }
.pt-status-active   { background: var(--primary-light); color: var(--primary); }
.pt-status-paused   { background: var(--warning-light); color: var(--warning); }
.pt-status-done     { background: var(--success-light); color: var(--success); }
[data-theme="dark"] .pt-status-planning { color: #93c5fd; }
[data-theme="dark"] .pt-status-active   { color: #f0c2ae; }
[data-theme="dark"] .pt-status-paused   { color: #fcd34d; }
[data-theme="dark"] .pt-status-done     { color: #6ee7b7; }
.pt-status-select { cursor: pointer; padding-right: 8px; font-family: inherit; }
.pt-overdue-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--danger); background: var(--danger-light); border-radius: var(--radius-full); padding: 3px 9px; }
[data-theme="dark"] .pt-overdue-badge, [data-theme="dark"] .pt-text-danger { color: #fca5a5 !important; }
#page-projects .pt-overdue-badge svg { width: 13px; height: 13px; }

.pt-progress { height: 8px; background: var(--surface-2); border: 1px solid var(--border-light); border-radius: var(--radius-full); overflow: hidden; }
.pt-progress-bar { height: 100%; background: var(--primary); border-radius: inherit; transition: width .3s ease; }

.pt-empty { max-width: 520px; margin: 24px auto; padding: 40px 28px; text-align: center; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-lg); }
.pt-empty h3 { font-family: 'Fraunces', Georgia, serif; font-size: 24px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.pt-empty p { color: var(--text-muted); line-height: 1.6; margin-bottom: 18px; }
.pt-empty small { display: block; margin-top: 12px; color: var(--text-muted); font-size: 12.5px; }
.pt-empty-icon { width: 56px; height: 56px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; background: var(--primary-light); color: var(--primary); }
#page-projects .pt-empty-icon svg { width: 28px; height: 28px; }
.pt-empty-list { list-style: none; padding: 0; margin: 0 auto 22px; display: grid; gap: 8px; text-align: left; max-width: 360px; font-size: 14px; color: var(--text-2); }
.pt-empty-list li { display: flex; gap: 8px; align-items: flex-start; }
.pt-empty-list svg { color: var(--primary); margin-top: 2px; }
.pt-empty-small { margin: 8px 0; padding: 18px; max-width: none; }
.pt-empty-small p { margin: 0; font-size: 13.5px; }
.pt-error { padding: 24px; border: 1px solid var(--danger-light); background: var(--surface); border-radius: var(--radius-lg); }
.pt-error p { color: var(--text-muted); margin: 6px 0 14px; }

/* Detail */
.pt-back { appearance: none; border: 0; background: none; display: inline-flex; align-items: center; gap: 4px; padding: 4px 0; margin-bottom: 14px; color: var(--text-muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.pt-back:hover { color: var(--primary); }
.pt-archived-banner { padding: 10px 14px; margin-bottom: 14px; border-radius: var(--radius); background: var(--warning-light); color: var(--text-2); font-size: 14px; }
.pt-hero { display: flex; gap: 24px; align-items: center; justify-content: space-between; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.pt-hero-main { min-width: 0; flex: 1; }
.pt-hero-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.pt-title { font-family: 'Fraunces', Georgia, serif; font-size: clamp(24px, 4vw, 32px); font-weight: 600; line-height: 1.15; color: var(--text); overflow-wrap: anywhere; }
.pt-desc { margin-top: 8px; color: var(--text-2); line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere; }
.pt-hero-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; font-size: 13.5px; color: var(--text-muted); }
.pt-idea-link { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: var(--primary); font-weight: 600; cursor: pointer; text-align: left; overflow-wrap: anywhere; }
.pt-idea-link:hover { text-decoration: underline; }
.pt-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pt-hero-actions .btn-secondary { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 13.5px; }
.pt-btn-danger:hover { color: var(--danger) !important; border-color: var(--danger) !important; }
.pt-ring { --pt-pct: 0; flex-shrink: 0; width: 128px; height: 128px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--primary) calc(var(--pt-pct) * 1%), var(--surface-2) 0); }
.pt-ring > div { width: 100px; height: 100px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pt-ring strong { font-family: 'Fraunces', Georgia, serif; font-size: 28px; font-weight: 600; color: var(--text); line-height: 1; }
.pt-ring span { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.pt-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0; }
.pt-stats > div { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.pt-stats strong { display: block; font-size: 22px; font-weight: 700; color: var(--text); }
.pt-stats span { font-size: 12.5px; color: var(--text-muted); }
.pt-stats .pt-stat-danger strong { color: var(--danger); }

.pt-columns { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.pt-panel { padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.pt-panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.pt-panel-head h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.pt-filter { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-full); padding: 2px; }
.pt-filter button { appearance: none; border: 0; background: none; padding: 5px 12px; border-radius: var(--radius-full); font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.pt-filter button.active { background: var(--primary-light); color: var(--primary); }

.pt-task-form { display: grid; gap: 8px; padding-bottom: 14px; margin-bottom: 6px; border-bottom: 1px solid var(--border-light); }
.pt-task-form-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; }
.pt-task-form-row .form-select, .pt-task-form-row .form-input { min-width: 0; padding-top: 8px; padding-bottom: 8px; font-size: 13.5px; }
.pt-task-list { list-style: none; padding: 0; margin: 0; }
.pt-task { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border-light); }
.pt-task:last-child { border-bottom: 0; }
.pt-check { appearance: none; flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--border); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: #fff; padding: 0; }
.pt-check:hover { border-color: var(--primary); }
.pt-check:focus-visible { outline: none; box-shadow: var(--ring); }
.pt-task.is-done .pt-check { background: var(--success); border-color: var(--success); }
#page-projects .pt-check svg { width: 14px; height: 14px; }
.pt-task-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pt-task-title { font-size: 14.5px; color: var(--text); overflow-wrap: anywhere; }
.pt-task.is-done .pt-task-title { color: var(--text-muted); text-decoration: line-through; }
.pt-task.is-milestone .pt-task-title { font-weight: 600; }
.pt-milestone-tag { display: inline-flex; align-items: center; gap: 3px; margin-right: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); vertical-align: 1px; }
#page-projects .pt-milestone-tag svg { width: 12px; height: 12px; }
.pt-task-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--text-muted); }
.pt-prio { font-weight: 700; }
.pt-prio-high { color: var(--danger); }
.pt-prio-medium { color: var(--warning); }
.pt-prio-low { color: var(--text-light); }
[data-theme="dark"] .pt-prio-high { color: #fca5a5; }
[data-theme="dark"] .pt-prio-medium { color: #fcd34d; }
.pt-task-status { flex-shrink: 0; font: inherit; font-size: 12.5px; padding: 5px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); cursor: pointer; }
.pt-icon-btn { appearance: none; flex-shrink: 0; border: 0; background: none; padding: 6px; border-radius: var(--radius-sm); color: var(--text-light); cursor: pointer; display: grid; place-items: center; }
.pt-icon-btn:hover { color: var(--primary); background: var(--surface-2); }
.pt-icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }

.pt-log-form { display: grid; gap: 8px; margin-bottom: 14px; }
.pt-log-form .btn-secondary { justify-self: start; }
.pt-log { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.pt-log li { position: relative; padding: 0 0 14px 16px; border-left: 2px solid var(--border-light); }
.pt-log li::before { content: ''; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.pt-log-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pt-log time { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.pt-log p { font-size: 14px; color: var(--text-2); line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }

/* Modal */
.pt-modal h2 { font-family: 'Fraunces', Georgia, serif; font-size: 24px; font-weight: 600; margin-bottom: 6px; }
.pt-modal form { display: grid; gap: 14px; margin-top: 14px; }
.pt-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }

@media (max-width: 900px) {
  .pt-columns { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .pt-page-header { flex-direction: column; align-items: stretch; }
  .pt-hero { flex-direction: column-reverse; align-items: flex-start; padding: 18px; }
  .pt-ring { width: 96px; height: 96px; }
  .pt-ring > div { width: 74px; height: 74px; }
  .pt-ring strong { font-size: 22px; }
  .pt-stats { grid-template-columns: repeat(2, 1fr); }
  .pt-task-form-row { grid-template-columns: 1fr 1fr; }
  .pt-task { flex-wrap: wrap; }
  .pt-task-body { flex-basis: calc(100% - 32px); }
  .pt-task-status { margin-left: 32px; }
  .pt-grid { grid-template-columns: 1fr; }
}
