:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #697386;
  --line: #dfe5ee;
  --panel: #ffffff;
  --soft: #f5f7fb;
  --accent: #176b87;
  --accent-2: #d97745;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(31, 45, 61, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(23, 107, 135, .13), transparent 32rem),
    linear-gradient(315deg, rgba(217, 119, 69, .14), transparent 28rem),
    #f8fafc;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.shell { min-height: 100vh; }
.hidden { display: none !important; }

.auth-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
  gap: 32px;
  align-items: center;
  padding: clamp(20px, 5vw, 72px);
}

.brand-panel h1 {
  margin: 24px 0 16px;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 1;
  letter-spacing: 0;
}

.brand-panel p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.photo-strip {
  display: grid;
  grid-template-columns: 1.2fr .8fr 1fr;
  gap: 12px;
  height: 220px;
}

.photo-strip span {
  border-radius: 8px;
  box-shadow: var(--shadow);
  background-size: cover;
  background-position: center;
}

.photo-strip span:nth-child(1) {
  background-image: linear-gradient(rgba(15, 23, 42, .05), rgba(15, 23, 42, .12)), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 420'%3E%3Crect fill='%23d8ecf1' width='600' height='420'/%3E%3Cpath d='M0 300c120-80 210-70 310-20s180 35 290-45v185H0z' fill='%23176b87'/%3E%3Cpath d='M0 250c105-54 197-45 285 2s191 45 315-45v80c-126 89-217 82-315 35S105 285 0 340z' fill='%238ec7d2'/%3E%3Ccircle cx='480' cy='90' r='46' fill='%23f1b661'/%3E%3C/svg%3E");
}

.photo-strip span:nth-child(2) {
  margin-top: 36px;
  background-image: linear-gradient(rgba(15, 23, 42, .08), rgba(15, 23, 42, .2)), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 420 520'%3E%3Crect fill='%23f4efe4' width='420' height='520'/%3E%3Cpath d='M50 520V155h90v365zm135 0V70h92v450zm137 0V205h58v315z' fill='%23d97745'/%3E%3Cpath d='M0 390h420v130H0z' fill='%235d8b72'/%3E%3C/svg%3E");
}

.photo-strip span:nth-child(3) {
  background-image: linear-gradient(rgba(15, 23, 42, .05), rgba(15, 23, 42, .16)), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 520 420'%3E%3Crect fill='%23f9d9bb' width='520' height='420'/%3E%3Cpath d='M0 295l120-118 94 82 106-142 200 178v125H0z' fill='%2374a17d'/%3E%3Cpath d='M0 340c110-32 205-18 292 0 87 17 151 19 228-11v91H0z' fill='%23176b87'/%3E%3C/svg%3E");
}

.auth-card, .editor-panel, .sidebar, .share-hero {
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(223, 229, 238, .8);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card {
  padding: 24px;
  display: grid;
  gap: 16px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  background: var(--soft);
  border-radius: 8px;
}

.segmented button {
  border: 0;
  background: transparent;
  border-radius: 6px;
  padding: 10px;
  color: var(--muted);
}

.segmented button.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(15, 23, 42, .08);
}

label span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 135, .14);
}

.primary, .ghost, .danger, .text-button {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 14px;
  min-height: 40px;
}

.primary {
  background: var(--accent);
  color: white;
}

.ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.danger {
  background: #fff4f2;
  border-color: #ffd0c8;
  color: var(--danger);
}

.text-button {
  background: transparent;
  color: var(--muted);
  padding-left: 0;
  text-align: left;
}

.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 14px;
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
}

.app-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
}

.sidebar {
  position: sticky;
  top: 20px;
  height: calc(100vh - 40px);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.sidebar h2 {
  margin: 0;
  font-size: 22px;
}

.plan-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.plan-item {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 10px;
  text-align: left;
}

.plan-item.active {
  border-color: var(--accent);
  background: #eef8fb;
}

.plan-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-item span {
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.title-input {
  border: 0;
  padding: 0;
  background: transparent;
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 800;
}

.title-input:focus {
  box-shadow: none;
}

.plan-fields {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1.6fr .7fr .7fr;
  gap: 10px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.insights, .summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.insights div, .summary-grid div {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.insights span, .summary-grid strong {
  display: block;
  font-size: 26px;
  font-weight: 800;
}

.insights p, .summary-grid p {
  margin: 4px 0 0;
  color: var(--muted);
}

.editor-panel {
  padding: 16px;
}

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

h3 {
  margin: 0;
  font-size: 18px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  font-weight: 700;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
}

td input {
  min-width: 120px;
}

.day-cell {
  min-width: 72px;
  color: var(--accent);
  font-weight: 800;
  white-space: nowrap;
}

.icon-button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--danger);
  font-size: 20px;
  line-height: 1;
}

.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.task-list {
  display: grid;
  gap: 8px;
}

.task-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.task-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.task-item input.done {
  color: var(--muted);
  text-decoration: line-through;
}

.muted {
  color: var(--muted);
  line-height: 1.7;
}

.compact {
  margin: 6px 0 0;
  font-size: 13px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.upload-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
}

.upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.photo-gallery, .share-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.photo-card, .share-photo {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.photo-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding-bottom: 10px;
}

.photo-card img, .share-photo img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.photo-card input {
  width: calc(100% - 20px);
  margin: 0 10px;
}

.photo-card .icon-button {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, .92);
}

.share-gallery {
  margin-top: 16px;
}

.share-photo figcaption {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 14px;
}

.share-view {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.share-hero {
  min-height: 280px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  padding: 28px;
  margin-bottom: 16px;
  background:
    linear-gradient(110deg, rgba(24, 33, 47, .8), rgba(24, 33, 47, .2)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 500'%3E%3Crect fill='%23d8ecf1' width='1200' height='500'/%3E%3Cpath d='M0 350c150-110 284-130 430-62s275 72 430-36 244-108 340-59v307H0z' fill='%23176b87'/%3E%3Cpath d='M0 404c205-70 355-45 514-8 159 36 322 26 686-115v219H0z' fill='%2374a17d'/%3E%3Ccircle cx='1020' cy='110' r='60' fill='%23f1b661'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
  color: #fff;
}

.share-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(36px, 6vw, 72px);
  letter-spacing: 0;
}

.share-hero p {
  max-width: 720px;
  margin: 0;
}

.timeline {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.timeline-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.timeline-card time {
  color: var(--accent);
  font-weight: 800;
}

.timeline-card h3 {
  margin-bottom: 8px;
}

.timeline-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}

.timeline-card dt {
  color: var(--muted);
  font-size: 12px;
}

.timeline-card dd {
  margin: 2px 0 0;
}

@media (max-width: 860px) {
  body {
    background: #f8fafc;
  }

  .auth-view, .app-view, .toolbar, .bottom-grid {
    grid-template-columns: 1fr;
  }

  .auth-view {
    align-items: start;
    gap: 20px;
    padding: 16px;
  }

  .brand-panel h1 {
    margin-top: 18px;
    font-size: 42px;
  }

  .brand-panel p {
    font-size: 16px;
    line-height: 1.65;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .photo-strip {
    height: 128px;
  }

  .plan-fields, .insights, .summary-grid {
    grid-template-columns: 1fr;
  }

  .app-view {
    gap: 14px;
    padding: 12px;
  }

  .workspace {
    gap: 14px;
  }

  .title-input {
    font-size: 30px;
  }

  .actions {
    justify-content: stretch;
  }

  .actions button {
    flex: 1 1 120px;
  }

  .editor-panel {
    padding: 14px;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-head .primary,
  .panel-head .ghost,
  .upload-button {
    width: 100%;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  table {
    min-width: 0;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 12px;
  }

  th,
  td {
    border-bottom: 0;
    padding: 0;
  }

  td {
    display: grid;
    gap: 6px;
    margin-top: 10px;
  }

  td::before {
    color: var(--muted);
    content: "";
    font-size: 12px;
    font-weight: 700;
  }

  td:nth-child(1) {
    margin-top: 0;
  }

  td:nth-child(1)::before { content: "天数"; }
  td:nth-child(2)::before { content: "具体日期"; }
  td:nth-child(3)::before { content: "时间/时段"; }
  td:nth-child(4)::before { content: "所在城市"; }
  td:nth-child(5)::before { content: "出行方式"; }
  td:nth-child(6)::before { content: "旅店"; }
  td:nth-child(7)::before { content: "特色项目"; }
  td:nth-child(8)::before { content: "备注"; }
  td:nth-child(9)::before { content: "花费"; }

  td:last-child::before {
    content: "";
  }

  td input {
    min-width: 0;
  }

  .day-cell {
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
  }

  .day-cell::before {
    display: none;
  }

  td:last-child {
    display: flex;
    justify-content: flex-end;
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }

  .task-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .photo-gallery,
  .share-gallery {
    grid-template-columns: 1fr;
  }

  .share-view {
    padding: 12px 12px 32px;
  }

  .share-hero {
    min-height: 240px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
  }

  .timeline-card {
    grid-template-columns: 1fr;
  }

  .timeline-card dl {
    grid-template-columns: 1fr;
  }
}
