:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #64748b;
  --line: #c9d3df;
  --paper: #fffdf8;
  --bg: #eef3f6;
  --accent: #1f7a72;
  --accent-dark: #145a54;
  --gold: #b08a35;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background: linear-gradient(180deg, #e8f0f4 0%, #f7f8f6 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 620px);
  gap: 24px;
  align-items: start;
  justify-content: center;
}

.query-panel,
.schedule-sheet {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 40px rgba(31, 41, 51, 0.08);
}

.query-panel {
  position: sticky;
  top: 24px;
  padding: 24px;
}

.brand-line,
.eyebrow,
.logo-strip {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 6px;
  font-size: 28px;
  line-height: 1.18;
  letter-spacing: 0;
}

.subtitle {
  margin-top: 10px;
  color: var(--gold);
  font-size: 16px;
  font-weight: 700;
}

.search-form {
  margin-top: 28px;
}

.search-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.search-form label {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  font-weight: 700;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr;
  margin-top: 16px;
}

input[type="search"],
input[type="text"] {
  min-width: 0;
  height: 44px;
  border: 1px solid #a8b6c5;
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
}

input[type="search"]:focus,
input[type="text"]:focus {
  outline: 2px solid rgba(31, 122, 114, 0.28);
  border-color: var(--accent);
}

button {
  height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.status {
  min-height: 22px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

.status[data-tone="ok"] {
  color: var(--accent-dark);
}

.status[data-tone="warn"] {
  color: #986c12;
}

.status[data-tone="error"] {
  color: var(--danger);
}

.schedule-sheet {
  min-height: 680px;
  width: 100%;
  max-width: 620px;
  padding: 30px;
  background: var(--paper);
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 16px;
}

.sheet-header > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.sheet-header h2 {
  margin-top: 4px;
  font-size: clamp(28px, 4.8vw, 32px);
  line-height: 1.1;
  white-space: nowrap;
}

.logo-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 205px;
}

.logo-strip img {
  display: block;
  height: 32px;
  width: auto;
  object-fit: contain;
}

.project-title {
  margin: 22px 0;
  display: grid;
  gap: 6px;
  text-align: center;
}

.project-title strong {
  font-size: 24px;
}

.project-title span {
  color: var(--gold);
  font-weight: 700;
}

.schedule-sections {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.day-block,
.fixed-block,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.day-block h3,
.fixed-block h3 {
  margin-bottom: 12px;
  color: var(--accent-dark);
  font-size: 18px;
}

.sheet-footer {
  margin-top: 28px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  line-height: 1.55;
}

.sheet-footer p {
  margin: 0;
}

.capture-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
}

.capture-status {
  min-height: 22px;
  width: 100%;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.capture-status:empty {
  display: none;
}

.capture-status[data-tone="ok"] {
  color: var(--accent-dark);
}

.capture-status[data-tone="error"] {
  color: var(--danger);
}

.save-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  padding: 0 18px;
  background: #1d4f89;
}

.save-button:hover {
  background: #173f6e;
}

.qr-capture-block {
  display: none;
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: left;
}

.capture-mode .qr-capture-block {
  display: flex;
}

.qr-copy {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.qr-copy strong {
  color: var(--ink);
  font-size: 16px;
}

.qr-code {
  width: 118px;
  height: 118px;
  flex: 0 0 auto;
}

.qr-svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: var(--ink);
}

.capture-root {
  margin: 0;
  padding: 0;
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.capture-root .schedule-sheet {
  width: 100%;
  max-width: none;
  min-height: 0;
  box-shadow: none;
}

.fixed-block {
  margin-top: 16px;
}

.timeline-list {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  padding: 11px 12px;
  background: #fff;
}

.timeline-item-fixed {
  background: #fbfaf6;
  border-left: 4px solid var(--gold);
}

.timeline-item-class {
  border-left: 4px solid var(--accent);
}

.time-chip {
  color: var(--accent-dark);
  font-weight: 800;
  line-height: 1.35;
}

.timeline-main {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.timeline-main strong {
  color: var(--ink);
  line-height: 1.35;
}

.timeline-item-fixed .timeline-main strong {
  color: var(--gold);
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 6px;
  background: #edf6f4;
  color: var(--accent-dark);
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 700;
}

.timeline-item-fixed .meta-pill {
  background: #fbf2dc;
  color: #9a7728;
}

.fixed-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fixed-item {
  border-left: 3px solid var(--gold);
  background: #fbfaf6;
  padding: 10px 12px;
}

.fixed-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.fixed-item strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  line-height: 1.35;
}

.empty-state {
  margin-top: 24px;
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.muted {
  color: var(--muted);
}

.suggestions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.suggestions span {
  width: 100%;
  color: var(--muted);
  font-size: 13px;
}

.suggestions button {
  width: auto;
  height: 34px;
  padding: 0 12px;
  background: #e9f3f1;
  color: var(--accent-dark);
}

.image-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.72);
}

.image-overlay-panel {
  width: min(100%, 430px);
  max-height: min(90vh, 860px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}

.image-overlay-preview {
  min-height: 0;
  overflow: auto;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
}

.image-overlay-preview img {
  display: block;
  width: 100%;
  height: auto;
  user-select: auto;
  -webkit-user-select: auto;
  -webkit-touch-callout: default;
}

.image-overlay-guide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  color: #fff;
  font-size: 14px;
  line-height: 1.45;
}

.image-overlay-guide strong {
  display: block;
  font-size: 16px;
}

.image-overlay-download,
.image-overlay-close {
  width: auto;
  min-width: 70px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.image-overlay-download:hover,
.image-overlay-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

@media (max-width: 900px) {
  .page-shell {
    grid-template-columns: minmax(0, 620px);
    padding: 18px 0;
  }

  .query-panel {
    position: static;
  }

  .schedule-sections,
  .fixed-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 20px, 620px);
  }

  .query-panel,
  .schedule-sheet {
    padding: 18px;
  }

  h1 {
    font-size: 24px;
  }

  .sheet-header {
    align-items: center;
    gap: 10px;
  }

  .sheet-header h2 {
    min-width: 0;
    font-size: clamp(12px, 4vw, 26px);
  }

  .logo-strip {
    flex: 0 0 auto;
    justify-content: flex-end;
    min-width: 0;
    max-width: 34%;
    gap: 6px;
  }

  .logo-strip img {
    height: clamp(18px, 5vw, 24px);
    max-width: min(14vw, 66px);
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .capture-mode .qr-capture-block {
    align-items: center;
    text-align: center;
    flex-direction: column;
  }

  .image-overlay {
    padding: 10px;
  }

  .image-overlay-panel {
    max-height: 92vh;
  }

  .image-overlay-guide {
    grid-template-columns: 1fr;
  }

  .image-overlay-download,
  .image-overlay-close {
    width: 100%;
  }
}
