:root {
  --ink: #14181f;
  --primary: #0f5c56;
  --primary-light: #167a72;
  --accent: #c4a35a;
  --bg: #e9e7e2;
  --bg-glow: #dfe8e6;
  --card-bg: #f7f6f2;
  --text: #1a1d24;
  --text-muted: #5c6470;
  --border: rgba(20, 24, 31, 0.12);
  --success: #0f766e;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(20, 24, 31, 0.06);
  --radius: 14px;
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --display: "Fraunces", "Noto Serif TC", serif;
}

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

body {
  font-family: var(--font);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(15, 92, 86, 0.12), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(196, 163, 90, 0.14), transparent 50%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding: 20px 16px 40px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.container { max-width: 1180px; margin: 0 auto; }

header {
  background: var(--ink);
  color: white;
  padding: 22px 24px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
header h1 {
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
header p { font-size: 14px; opacity: 0.78; }

.badge-contest {
  background: rgba(196, 163, 90, 0.2);
  color: #e8d5a3;
  border: 1px solid rgba(196, 163, 90, 0.35);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 8px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.progress-bar-container {
  background: rgba(255,255,255,0.2);
  border-radius: 999px;
  height: 10px;
  margin-top: 20px;
  overflow: hidden;
}
.progress-bar {
  background: #fbbf24;
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-top: 6px;
  opacity: 0.95;
  gap: 12px;
  flex-wrap: wrap;
}
#syncStatus.sync-cloud { color: #bbf7d0; }
#syncStatus.sync-local { color: #fde68a; }

.nav-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: #e2e8f0;
  padding: 6px;
  border-radius: 12px;
  overflow-x: auto;
}
.tab-btn {
  flex: 1;
  min-width: 140px;
  padding: 12px 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
}
.tab-btn.active { background: var(--card-bg); color: var(--primary); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

.stats-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-item {
  background: var(--card-bg);
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.stat-label { font-size: 13px; color: var(--text-muted); }
.stat-value { font-size: 22px; font-weight: 800; color: var(--primary); margin-top: 4px; }

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.toolbar input[type="search"] {
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}
.filter-chip {
  border: 1px solid var(--border);
  background: white;
  color: var(--text-muted);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.filter-chip.active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.timeline {
  display: flex;
  gap: 3px;
  margin-bottom: 18px;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
}
.timeline-seg {
  min-width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: white;
  cursor: pointer;
  background: #94a3b8;
  border: none;
}
.timeline-seg.done { background: #10b981; }
.timeline-seg:hover { filter: brightness(1.08); }

.shot-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 18px;
}
.shot-thumb {
  flex: 0 0 160px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #f1f5f9;
  cursor: pointer;
  padding: 0;
  position: relative;
}
.shot-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot-thumb span {
  position: absolute;
  left: 6px;
  bottom: 6px;
  background: rgba(15, 23, 42, 0.8);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.shot-list { display: flex; flex-direction: column; gap: 20px; }
.shot-card {
  background: var(--card-bg);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 22px;
}
.shot-card.completed {
  border-left: 6px solid var(--success);
  background: #f0fdf4;
}
.shot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.shot-title-left { display: flex; align-items: center; gap: 12px; }
.shot-checkbox { width: 22px; height: 22px; cursor: pointer; accent-color: var(--success); }
.shot-badge {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 6px;
}
.time-badge {
  background: #fef3c7;
  color: #b45309;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
}
.shot-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 22px;
  align-items: start;
}
@media (max-width: 880px) { .shot-grid { grid-template-columns: 1fr; } }

.section-block { margin-bottom: 10px; }
.section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.section-content { font-size: 14px; }

.vo-box {
  background: #f1f5f9;
  padding: 10px 14px;
  border-radius: 8px;
  border-left: 3px solid var(--primary-light);
  font-style: italic;
  font-weight: 500;
}
.vo-row { display: flex; gap: 8px; align-items: flex-start; }
.vo-row .vo-box { flex: 1; }

.subtitle-badge {
  display: inline-block;
  background: #e0e7ff;
  color: #3730a3;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.shot-note {
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}

.storyboard-preview-wrap { display: flex; flex-direction: column; gap: 8px; }
.storyboard-container {
  position: relative;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
}
.storyboard-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f8fafc;
}
.storyboard-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(20, 24, 31, 0.72);
  color: #e8d5a3;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 4;
}
.upload-btn-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.link-svg-btn {
  font-size: 11px;
  color: #1d4ed8;
  background: #eff6ff;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #bfdbfe;
  text-decoration: none;
  font-weight: 600;
}
.custom-upload-btn, .ghost-btn {
  font-size: 11px;
  color: #64748b;
  background: #f1f5f9;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px dashed #cbd5e1;
  cursor: pointer;
}

.vo-teleprompter-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: white;
  padding: 24px;
  border-radius: 14px;
  margin-bottom: 24px;
}
.vo-timer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  padding-bottom: 16px;
  margin-bottom: 16px;
}
.timer-display {
  font-size: 32px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 800;
  color: #38bdf8;
}
.timer-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-timer {
  background: #334155;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.btn-timer.primary { background: var(--primary); }
.btn-timer.danger { background: #dc2626; }
.size-ctrl { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #94a3b8; }
.teleprompter-box { background: rgba(255,255,255,0.05); padding: 18px; border-radius: 10px; }
.teleprompter-line {
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.tp-tc {
  font-size: 12px;
  font-weight: 700;
  color: #fbbf24;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(251,191,36,0.15);
  padding: 2px 6px;
  border-radius: 4px;
}
.tp-content { font-size: var(--tp-size, 17px); font-weight: 600; }
.tp-note { font-size: 13px; color: #94a3b8; }

.vo-teleprompter-card {
  background: var(--card-bg);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 22px;
  margin-bottom: 16px;
}
.vo-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.vo-card-left { display: flex; align-items: center; gap: 10px; }
.btn-jump-shot {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.vo-words-badge {
  background: #ecfdf5;
  color: #047857;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}
.vo-main-text {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 12px;
  background: #f8fafc;
  padding: 14px 18px;
  border-radius: 10px;
  border-left: 4px solid var(--primary);
}
.vo-guide-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13.5px;
}
.vo-guide-label { font-weight: 700; color: #b45309; }
.vo-guide-content { color: #78350f; }
.vo-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
@media (max-width: 600px) { .vo-meta-grid { grid-template-columns: 1fr; } }

.table-card {
  background: var(--card-bg);
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; text-align: left; }
th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table-svg-link {
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 700;
  padding: 3px 8px;
  background: #eff6ff;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 13px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}
.overview-card {
  background: var(--card-bg);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 22px;
}
.overview-card h3 { font-size: 17px; color: var(--primary); margin-bottom: 14px; }
.checklist-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-item {
  background: #eff6ff;
  color: #1e40af;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #bfdbfe;
}

.btn-actions {
  display: flex;
  gap: 10px;
  margin-top: 28px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.btn {
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-print { background: #0f172a; color: white; }
.btn-copy { background: var(--primary); color: white; }
.btn-reset { background: #e2e8f0; color: #334155; }
.btn-download { background: #059669; color: white; }
.btn-back {
  background: rgba(255,255,255,0.18);
  color: white;
  border: 1px solid rgba(255,255,255,0.35);
}
.btn-tiny {
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: white;
  cursor: pointer;
  font-weight: 700;
  color: #334155;
}

.home-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 24px; }
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.project-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.project-card:hover { border-color: #93c5fd; }
.project-card h2 { font-size: 18px; margin-bottom: 6px; }
.muted { color: var(--text-muted); font-size: 13px; }
.empty-board { color: #94a3b8; font-size: 14px; padding: 24px; text-align: center; }
.hidden { display: none !important; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px 24px;
}
.lightbox.hidden { display: none !important; }
.lightbox img {
  max-width: min(96vw, 1100px);
  max-height: 78vh;
  object-fit: contain;
  background: #0f172a;
  border-radius: 8px;
  cursor: zoom-out;
}
.lightbox-caption {
  color: #e2e8f0;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
.lightbox-close,
.lightbox-nav {
  position: absolute;
  border: none;
  background: rgba(255,255,255,0.12);
  color: white;
  cursor: pointer;
  font-weight: 800;
}
.lightbox-close {
  top: 16px;
  right: 16px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
}
.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 24px;
}
.lightbox-nav.prev { left: 12px; }
.lightbox-nav.next { right: 12px; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  z-index: 90;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.app-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  background: var(--ink);
  color: #fff;
  padding: 18px 20px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.app-brand h1 {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 4px 0 0;
}
.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.app-nav-btn {
  border: 1px solid rgba(255,255,255,0.18);
  background: transparent;
  color: rgba(255,255,255,0.82);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s ease;
}
.app-nav-btn:hover { border-color: rgba(255,255,255,0.4); color: #fff; }
.app-nav-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.app-page { display: none; }
.app-page.active { display: block; }
.app-page[hidden] { display: none !important; }
.page-lead {
  color: var(--text-muted);
  margin-bottom: 14px;
  font-size: 14px;
}
.audio-hub-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.audio-hub-bar select {
  margin-left: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
#appShell.hidden { display: none !important; }

.home-header-compact {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.home-header-compact h1 { margin-bottom: 0; }
.home-actions-inline { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.home-calendar {
  margin-bottom: 16px;
}
.home-cal-layout {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 18px;
  align-items: start;
}
.home-cal-main,
.home-cal-board {
  background:
    linear-gradient(165deg, rgba(15, 92, 86, 0.04), transparent 42%),
    var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 18px 14px;
  box-shadow: var(--shadow);
}
.home-cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.home-cal-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.home-cal-month {
  font-family: var(--display);
  font-size: clamp(1.25rem, 2.4vw, 1.55rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  min-width: 9.5em;
  text-align: center;
}
.home-cal-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.home-cal-nav-btn:hover {
  border-color: var(--primary);
  background: rgba(15, 92, 86, 0.08);
}
.home-cal-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.home-cal-today-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.home-cal-today-btn:hover {
  color: var(--primary);
  border-color: rgba(15, 92, 86, 0.35);
}
.home-cal-weekdays {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #8a929c;
  margin-bottom: 8px;
}
.home-cal-grid {
  gap: 8px;
  margin-bottom: 12px;
}
.home-cal-grid .cal-cell {
  min-height: 96px;
  border-radius: 12px;
  padding: 8px;
  gap: 6px;
  background: rgba(255, 255, 255, 0.85);
  transition: box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.home-cal-grid .cal-cell:hover:not(.is-empty) {
  border-color: rgba(15, 92, 86, 0.28);
}
.home-cal-cell .cal-daynum {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.home-cal-cell.is-today {
  background: rgba(15, 92, 86, 0.1);
  border-color: rgba(15, 92, 86, 0.28);
  outline: none;
  box-shadow: none;
}
.home-cal-cell.is-today .cal-daynum {
  color: var(--primary);
  font-weight: 800;
}
.home-cal-cell.is-selected,
.home-cal-cell[data-selected="true"] {
  box-shadow: 0 0 0 2px rgba(15, 92, 86, 0.55);
  border-color: var(--primary);
  background: rgba(15, 92, 86, 0.08);
}
.home-cal-cell.is-today.is-selected {
  background: rgba(15, 92, 86, 0.14);
}
.cal-markers {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: auto;
}
.home-cal-grid .cal-dot {
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 6px;
  min-width: 1.4em;
  text-align: center;
  line-height: 1.45;
}
.home-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding-top: 4px;
  border-top: 1px solid rgba(20, 24, 31, 0.06);
  margin-top: 4px;
}
.home-cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.home-cal-legend-item i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: #94a3b8;
}
.home-cal-legend-item.type-shoot i { background: var(--primary); }
.home-cal-legend-item.type-reshoot i { background: #c2410c; }
.home-cal-legend-item.type-vo i { background: #a8842f; }
.home-cal-legend-item.type-deadline i { background: #b42318; }
.home-cal-side,
.home-cal-agenda {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: min(78vh, 820px);
  overflow: auto;
}
.home-cal-agenda-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
}
.home-cal-agenda-date {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin: -2px 0 12px;
}
.home-cal-empty {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 4px 0 0;
}
.home-cal-empty h2 {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.home-cal-empty p,
.home-cal-empty-line {
  color: var(--text-muted);
  font-size: 13px;
}
.home-cal-cell.is-today,
.today-card.is-today-card {
  outline: none;
}
.today-card.is-today-card {
  box-shadow: 0 0 0 1px rgba(15, 92, 86, 0.25);
}
.home-projects-drawer {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 8px;
}
.home-projects-drawer summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--primary);
}

@media (max-width: 900px) {
  .home-cal-layout { grid-template-columns: 1fr; }
  .home-cal-side,
  .home-cal-agenda { max-height: none; }
  .home-cal-grid .cal-cell { min-height: 72px; }
}
.today-kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-light);
  margin-bottom: 8px;
}
.today-empty, .today-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
}
.today-empty h2 { font-size: 20px; margin-bottom: 6px; }
.today-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.today-card h3 { font-size: 17px; margin: 8px 0 6px; }
.today-card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.today-type {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}
.today-proj, .today-meta, .today-shots, .muted { color: var(--text-muted); font-size: 13px; }
.today-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.asset-panel {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.asset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 8px 0;
}
.asset-item, .audio-chip {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.audio-chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.shot-date-row { margin-top: 8px; font-size: 13px; }
.shot-date-row input[type=date] {
  margin-left: 6px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 18px;
}
.cal-cell {
  min-height: 72px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 6px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cal-cell.is-empty { background: transparent; border-color: transparent; cursor: default; }
.cal-cell.is-today {
  border-color: rgba(15, 92, 86, 0.35);
  box-shadow: none;
  background: rgba(15, 92, 86, 0.08);
}
.cal-daynum { font-size: 12px; font-weight: 800; }
.cal-dot {
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 6px;
  background: #e2e8f0;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-dot.type-shoot { background: rgba(15, 92, 86, 0.14); color: var(--primary); }
.cal-dot.type-reshoot { background: #ffedd5; color: #9a3412; }
.cal-dot.type-vo { background: rgba(196, 163, 90, 0.22); color: #7a6428; }
.cal-dot.type-deadline { background: #fee2e2; color: #991b1b; }
.cal-more { font-size: 10px; color: var(--text-muted); }
.cal-list-head { font-weight: 800; margin-bottom: 8px; }
.cal-event-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
}
.cal-event-actions { display: flex; gap: 6px; align-items: flex-start; }
.cal-form-wrap, .audio-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
}
.cal-form-wrap.hidden { display: none; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.form-grid label, .ef-notes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
}
.form-grid input, .form-grid select, .ef-notes textarea {
  font-weight: 400;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.shot-pick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
}
.audio-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.audio-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.audio-card audio { width: 100%; margin-top: 10px; }
.audio-card-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }

.call-sheet-print { display: none; }
.callsheet h1 { font-size: 22px; margin-bottom: 8px; }
.callsheet h2 { font-size: 16px; margin: 16px 0 8px; }
.callsheet table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 12px; }
.callsheet th, .callsheet td { border: 1px solid #cbd5e1; padding: 6px 8px; vertical-align: top; }
.callsheet th { background: #f1f5f9; }

@media (max-width: 720px) {
  .cal-cell { min-height: 56px; }
  .cal-dot { font-size: 9px; }
  body { padding: 12px; }
}

@media print {
  body { padding: 0; background: white; }
  .home-view, .btn-actions, .progress-bar-container, .nav-tabs, .upload-btn-bar,
  .vo-timer-bar, .btn-jump-shot, .link-svg-btn, .btn-back, .toolbar, .shot-strip,
  .timeline, .lightbox, .toast, .today-assistant { display: none !important; }
  .tab-pane { display: block !important; }

  body.printing-callsheet .container { display: none !important; }
  body.printing-callsheet .call-sheet-print {
    display: block !important;
    padding: 16px;
  }
}

/* —— 視覺優化層 + 分鏡畫筆 —— */
.btn-copy, .btn-download { background: var(--primary); }
.btn-print { background: var(--ink); color: white; }
.btn-reset { background: #e4e2dc; }
.btn:hover { filter: brightness(1.05); }

.shot-card {
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.shot-card.completed { border-color: rgba(15, 92, 86, 0.4); }
.subtitle-badge {
  background: rgba(15, 92, 86, 0.1) !important;
  color: var(--primary) !important;
}
.today-type {
  background: rgba(15, 92, 86, 0.12) !important;
  color: var(--primary) !important;
}
.stat-value { color: var(--primary) !important; }
.progress-bar { background: var(--accent) !important; }
.tab-btn.active { color: var(--primary) !important; }

.project-card {
  text-align: left;
  width: 100%;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: 0.2s ease;
}
.project-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.project-card h2 {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 6px 0;
}

.home-cal-main,
.today-empty,
.today-card,
.cal-form-wrap,
.audio-card,
.audio-hub-bar {
  box-shadow: var(--shadow);
}

.draw-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--ink);
}
.draw-tool {
  border: 1px solid rgba(255,255,255,0.22);
  background: transparent;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.draw-tool.active {
  background: var(--primary);
  border-color: var(--primary);
}
.draw-tool[data-draw-size].active {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.45);
}
.draw-tool.danger { color: #fecaca; border-color: rgba(254,202,202,0.35); }
.draw-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  background: var(--sw, #fff);
  cursor: pointer;
  padding: 0;
}
.draw-swatch.active {
  outline: 2px solid #fff;
  outline-offset: 1px;
}
.storyboard-preview-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  gap: 0 !important;
}
.storyboard-container {
  border: none !important;
  border-radius: 0 !important;
  background: #f3f1ec !important;
  touch-action: none;
}
.storyboard-container .board-layer,
.storyboard-container .empty-board {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--text-muted);
  font-size: 13px;
}
.storyboard-container .board-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.draw-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}
.storyboard-container.is-drawing .draw-canvas,
.storyboard-container.is-erasing .draw-canvas {
  pointer-events: auto;
  cursor: crosshair;
}
.storyboard-tag {
  z-index: 4;
  background: rgba(20, 24, 31, 0.72) !important;
}
.upload-btn-bar {
  padding: 8px 10px;
  background: #f7f6f2;
  border-top: 1px solid var(--border);
}

/* 統一舊藍色標記為港灣綠 */
.shot-badge,
.vo-words-badge,
.pill-item,
.cal-dot.type-shoot {
  background: rgba(15, 92, 86, 0.12) !important;
  color: var(--primary) !important;
}
.link-svg-btn,
.table-svg-link,
.btn-jump-shot {
  color: var(--primary) !important;
  background: rgba(15, 92, 86, 0.1) !important;
  border-color: rgba(15, 92, 86, 0.25) !important;
}
.cal-dot.type-vo {
  background: rgba(196, 163, 90, 0.22) !important;
  color: #7a6428 !important;
}
.timeline-seg { background: rgba(15, 92, 86, 0.25); }
.timeline-seg.done { background: var(--success); }

/* 可編輯標題／分鏡欄位 */
.hdr-editable {
  outline: none;
  border-radius: 6px;
  transition: box-shadow 0.15s ease, background 0.15s ease;
  cursor: text;
}
.hdr-editable:hover {
  background: rgba(255, 255, 255, 0.06);
}
.hdr-editable:focus {
  box-shadow: 0 0 0 2px rgba(196, 163, 90, 0.55);
  background: rgba(255, 255, 255, 0.08);
}
#hdrSub.hdr-editable {
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  min-height: 1.4em;
}
.shot-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 10px;
}
.shot-card-actions .btn-tiny.danger {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.35);
  background: rgba(180, 35, 24, 0.06);
}
.shot-edit .field-edit,
.field-edit {
  width: 100%;
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  resize: vertical;
  min-height: 2.8em;
}
.field-edit:focus {
  outline: none;
  border-color: rgba(15, 92, 86, 0.45);
  box-shadow: 0 0 0 3px rgba(15, 92, 86, 0.12);
}
.vo-row .field-edit,
.vo-row .vo-edit {
  flex: 1;
  min-width: 0;
}
.toolbar #btnAddShotEnd {
  margin-left: auto;
}
