:root {
  --bg: #f3f6fa;
  --card: #ffffff;
  --navy: #0f2942;
  --navy-2: #1c4e78;
  --accent: #1d6fa5;
  --text: #1c2733;
  --muted: #607080;
  --border: #e2e8f0;
  --green-bg: #e7f7ef;
  --green-fg: #137347;
  --amber-bg: #fff5e1;
  --amber-fg: #a15c00;
  --blue-bg: #e6f2fc;
  --blue-fg: #155d94;
  --red-bg: #fdecec;
  --red-fg: #b42318;
  --gray-bg: #f1f5f9;
  --gray-fg: #64748b;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(15, 41, 66, 0.06);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 14px;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(15, 41, 66, 0.18);
}

.header-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 16px 10px;
}

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

.app-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.subtitle {
  margin: 3px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
}

.updated-badge {
  flex-shrink: 0;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.92);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.main-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.12);
  padding: 4px;
  border-radius: 10px;
}

.tab-btn {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.tab-btn.active {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* Main Layout */
.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 14px 32px;
}

.tab-panel {
  display: none;
}

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

/* Date Bar */
.date-bar-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 -14px 12px;
  padding: 0 14px;
}

.date-bar-wrap::-webkit-scrollbar {
  display: none;
}

.date-bar {
  display: flex;
  gap: 8px;
  padding-bottom: 2px;
}

.date-pill {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 12px;
  padding: 7px 13px;
  cursor: pointer;
  text-align: center;
  min-width: 78px;
  transition: all 0.15s ease;
}

.date-pill .d-md {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.date-pill .d-wk {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.date-pill.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.date-pill.active .d-wk {
  color: rgba(255, 255, 255, 0.78);
}

/* Toolbar & Chips */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-copy {
  border: 1px solid var(--accent);
  background: var(--blue-bg);
  color: var(--blue-fg);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.btn-copy:active {
  transform: scale(0.97);
}

/* Summary & Safety Cards */
.summary-card {
  background: linear-gradient(135deg, #ffffff 0%, #eef5fc 100%);
  border: 1px solid #d5e6f7;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.summary-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

.summary-text {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

.safety-card {
  background: var(--green-bg);
  border: 1px solid #bce8d1;
  color: var(--green-fg);
  border-radius: var(--radius);
  padding: 11px 14px;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 500;
}

/* Project Daily Cards */
.cards-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: var(--shadow);
}

.proj-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.proj-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
}

.proj-contractor {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.station-pill {
  flex-shrink: 0;
  background: var(--blue-bg);
  color: var(--blue-fg);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
}

.sub-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy-2);
  margin: 12px 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.done-list {
  margin: 0;
  padding-left: 18px;
}

.done-list li {
  margin-bottom: 5px;
  font-size: 13.5px;
}

.tomorrow-box {
  margin-top: 10px;
  background: #f8fafc;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  color: #334155;
}

/* Photo Grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}

@media (min-width: 680px) {
  .photo-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
}

.photo-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #e2e8f0;
  aspect-ratio: 4 / 3;
  cursor: pointer;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}

.photo-item:hover img {
  transform: scale(1.03);
}

.photo-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(15, 41, 66, 0.78);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
}

.photo-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.76));
  color: #fff;
  font-size: 11px;
  padding: 16px 7px 5px;
  line-height: 1.3;
}

/* Progress Tab */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

@media (min-width: 680px) {
  .kpi-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  box-shadow: var(--shadow);
}

.kpi-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
}

.kpi-lbl {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.section-block {
  margin-bottom: 20px;
}

.section-head {
  margin-bottom: 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
  color: var(--navy);
}

.contractor-tag {
  display: inline-block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.ls-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 720px) {
  .ls-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.ls-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
  box-shadow: var(--shadow);
}

.ls-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.ls-card-head h3 {
  margin: 0;
  font-size: 15px;
  color: var(--navy);
}

.prog-track {
  height: 7px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}

.prog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #2b9348);
  border-radius: 999px;
}

.ls-items {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ls-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  gap: 6px;
}

/* Jing-Guang Station Cards */
.filter-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.jg-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 720px) {
  .jg-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.jg-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
  box-shadow: var(--shadow);
}

.jg-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.jg-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}

.jg-sub {
  font-size: 11px;
  color: var(--muted);
  margin-left: 6px;
}

.jg-qty {
  font-size: 11px;
  color: var(--muted);
  background: var(--gray-bg);
  padding: 3px 7px;
  border-radius: 6px;
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.task-cell {
  background: #f8fafc;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  padding: 5px 6px;
  text-align: center;
}

.task-k {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 3px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 5px;
  line-height: 1.4;
}

.b-green { background: var(--green-bg); color: var(--green-fg); }
.b-amber { background: var(--amber-bg); color: var(--amber-fg); }
.b-blue  { background: var(--blue-bg);  color: var(--blue-fg); }
.b-red   { background: var(--red-bg);   color: var(--red-fg); }
.b-gray  { background: var(--gray-bg);  color: var(--gray-fg); }

.jg-note {
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8, 15, 24, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
}

.lightbox.open {
  display: flex;
}

.lb-stage {
  max-width: 94vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lb-stage img {
  max-width: 92vw;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 8px;
}

.lb-meta {
  margin-top: 10px;
  text-align: center;
  color: #fff;
  max-width: 90vw;
}

.lb-counter {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
}

.lb-caption {
  margin: 4px 0 0;
  font-size: 13.5px;
}

.lb-close,
.lb-nav {
  position: fixed;
  border: 0;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-close {
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  font-size: 24px;
}

.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  font-size: 26px;
}

.lb-prev { left: 10px; }
.lb-next { right: 10px; }

/* Toast & Footer */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 41, 66, 0.92);
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 120;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.app-footer {
  text-align: center;
  padding: 12px 16px 28px;
  font-size: 11.5px;
  color: var(--muted);
}
