/* DecorFlow - 裝潢資金與文件導航儀表板 */
:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-hover: #243044;
  --border: #2d3a4d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-dim: #388bfd66;
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  --radius: 12px;
  --font: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* 導航 */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  transition: background 0.2s;
}

nav a:hover {
  background: var(--surface-hover);
}

nav a.active {
  background: var(--accent-dim);
  color: var(--text);
}

/* 主內容區 */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

h1 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

h2 {
  font-size: 1.25rem;
  margin: 1.5rem 0 0.75rem;
  font-weight: 600;
}

/* 卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

/* 圓餅圖容器 */
.chart-wrap {
  max-width: 320px;
  margin: 0 auto 1.5rem;
  aspect-ratio: 1;
}

/* 超支清單 */
.overbudget-list {
  list-style: none;
}

.overbudget-list li {
  padding: 0.75rem 1rem;
  background: rgba(248, 81, 73, 0.12);
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.overbudget-list li span.overflow {
  color: var(--danger);
  font-weight: 600;
}

/* 時間軸 */
.timeline {
  position: relative;
  padding-left: 1.5rem;
  border-left: 2px solid var(--border);
  margin-left: 0.5rem;
}

.timeline-item {
  position: relative;
  padding-bottom: 1.25rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.65rem;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-item.paid::before {
  background: var(--success);
}

.timeline-item.urgent::before {
  background: var(--warning);
  box-shadow: 0 0 0 2px var(--warning);
}

.timeline-item .meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.timeline-item .amount {
  font-weight: 600;
  font-size: 1.1rem;
}

.timeline-item .doc-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.timeline-item .doc-link:hover {
  text-decoration: underline;
}

/* 表單 */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group .hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.form-group .remaining {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.form-group .remaining.negative {
  color: var(--danger);
}

.form-group .remaining.positive {
  color: var(--success);
}

/* 按鈕 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-decoration: none;
  font-family: inherit;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  background: #79b8ff;
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: rgba(248, 81, 73, 0.2);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-danger:hover {
  background: rgba(248, 81, 73, 0.35);
}

/* 狀態標籤 */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge-paid {
  background: rgba(63, 185, 80, 0.2);
  color: var(--success);
}

.badge-pending {
  background: rgba(210, 153, 34, 0.2);
  color: var(--warning);
}

.badge-unpaid {
  background: rgba(139, 148, 158, 0.18);
  color: var(--text-muted);
}

.badge-urgent {
  background: rgba(248, 81, 73, 0.2);
  color: var(--danger);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* 超支警示 */
.budget-warning {
  padding: 0.75rem 1rem;
  background: rgba(248, 81, 73, 0.15);
  border: 1px solid rgba(248, 81, 73, 0.4);
  border-radius: 8px;
  color: var(--danger);
  font-weight: 500;
  margin-top: 0.5rem;
}

/* 空狀態 */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.empty-state p {
  margin-bottom: 1rem;
}

/* 項目卡片（Project View 列表） */
.project-card {
  display: block;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s;
}

.project-card:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.project-card .category {
  font-weight: 600;
  font-size: 1.05rem;
}

.project-card .summary {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.project-card .overflow-badge {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--danger);
}

/* Token 提示 */
.token-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  word-break: break-all;
}

/* 響應式 */
@media (max-width: 600px) {
  main {
    padding: 1rem;
  }

  nav {
    padding: 0.75rem 1rem;
  }

  .chart-wrap {
    max-width: 260px;
  }
}
