:root {
  --ink: #17211c;
  --muted: #66736b;
  --paper: #f7f3ea;
  --panel: #fffaf0;
  --line: rgba(23, 33, 28, 0.12);
  --green: #2f6b4f;
  --mint: #d8ead6;
  --clay: #c76943;
  --sun: #f2b84b;
  --blue: #477ca5;
  --shadow: 0 24px 70px rgba(38, 54, 44, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    linear-gradient(115deg, rgba(216, 234, 214, 0.92), rgba(247, 243, 234, 0.82) 46%, rgba(242, 184, 75, 0.24)),
    radial-gradient(circle at 15% 20%, rgba(199, 105, 67, 0.28), transparent 24%),
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.shell {
  display: grid;
  grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
  gap: 24px;
  height: 100dvh;
  padding: 28px;
  overflow: hidden;
}

.phone,
.workspace {
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.88);
  box-shadow: var(--shadow);
}

.phone {
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  min-height: 0;
  height: 100%;
  border-radius: 34px;
  overflow: hidden;
}

.phone-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.kicker {
  margin: 0 0 5px;
  color: var(--clay);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: var(--panel);
  background: var(--green);
}

.account-panel {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.34);
}

.account-summary {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.account-summary strong {
  color: var(--ink);
}

.account-role {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #244b39;
  background: var(--mint);
  font-size: 12px;
  font-weight: 800;
}

.account-role.admin {
  color: #fff;
  background: var(--clay);
}

.auth-form,
.key-form {
  display: grid;
  gap: 8px;
}

.auth-form input,
.key-form input,
.key-form select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-actions button {
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  color: white;
  background: var(--green);
  font-weight: 800;
}

.auth-actions button.secondary {
  color: var(--green);
  background: white;
  border: 1px solid var(--line);
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 22px 18px;
}

.message {
  max-width: 88%;
  padding: 13px 15px;
  border-radius: 18px;
  line-height: 1.55;
  font-size: 14px;
}

.message.agent {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--line);
}

.message.user {
  align-self: flex-end;
  color: white;
  background: var(--green);
}

.mini-plan {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.mini-plan span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--mint);
  color: #244b39;
  font-size: 12px;
  font-weight: 700;
}

.quick-prompts {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
}

.quick-prompts button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--green);
  background: #fff;
  font-size: 12px;
}

.composer {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 10px;
  padding: 16px;
}

.composer input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  background: #fff;
}

.composer button,
.action-row button,
.tabs button {
  border: 0;
  border-radius: 14px;
  padding: 11px 14px;
  color: white;
  background: var(--green);
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  border-radius: 28px;
  overflow: hidden;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
}

.tabs button {
  color: var(--muted);
  background: transparent;
}

.tabs button.active {
  color: #fff;
  background: var(--green);
}

.panel {
  display: none;
  min-height: 0;
  overflow: auto;
  padding: 22px;
}

.panel.active {
  display: block;
}

.empty-state {
  display: grid;
  align-content: center;
  min-height: 62vh;
  border: 1px dashed rgba(47, 107, 79, 0.28);
  border-radius: 20px;
  padding: 36px;
  background: rgba(255, 255, 255, 0.45);
}

.empty-state h2 {
  margin-bottom: 8px;
  font-size: 34px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: start;
}

.hero-card,
.day-card,
.weather-card,
.budget-card,
.save-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.hero-card {
  overflow: hidden;
}

.hero-visual {
  min-height: 210px;
  padding: 22px;
  color: white;
  background: linear-gradient(135deg, rgba(47, 107, 79, 0.52), rgba(71, 124, 165, 0.36)), var(--city-image);
  background-size: cover;
  background-position: center;
}

.hero-visual h2 {
  max-width: 560px;
  margin: 0;
  font-size: 38px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--mint);
  color: #244b39;
  font-size: 12px;
  font-weight: 800;
}

.day-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.day-card {
  padding: 16px;
}

.day-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.day-title h3 {
  margin: 0;
  font-size: 19px;
}

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

.timeline-item {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 11px;
  align-items: start;
  padding: 11px;
  border-radius: 8px;
  background: rgba(247, 243, 234, 0.78);
}

.time {
  color: var(--clay);
  font-size: 13px;
  font-weight: 900;
}

.poi-name {
  margin: 0 0 3px;
  font-weight: 900;
}

.poi-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.swap-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 9px;
  color: var(--green);
  background: white;
  font-size: 12px;
}

.side-stack {
  display: grid;
  gap: 14px;
}

.budget-card,
.weather-card,
.save-card {
  padding: 16px;
}

.metric {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.metric:last-child {
  border-bottom: 0;
}

.map-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 18px;
  height: 100%;
  min-height: 0;
}

.map-board {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(47, 107, 79, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(47, 107, 79, 0.08) 1px, transparent 1px),
    #fffdf6;
  background-size: 44px 44px;
}

.amap-board {
  background: #eef3ed;
}

.hidden {
  display: none !important;
}

.map-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--green);
  font-weight: 900;
  background: rgba(255, 250, 240, 0.78);
  z-index: 2;
}

.map-reset-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  border: 1px solid rgba(23, 33, 28, 0.14);
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--green);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 24px rgba(23, 33, 28, 0.14);
  font-size: 13px;
  font-weight: 900;
}

.route-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.marker {
  position: absolute;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border: 3px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: var(--clay);
  box-shadow: 0 10px 24px rgba(23, 33, 28, 0.2);
  display: grid;
  place-items: center;
  font-weight: 900;
}

.marker.active {
  z-index: 4;
  transform: translate(-50%, -50%) scale(1.22);
  outline: 4px solid rgba(47, 107, 79, 0.22);
}

.marker.food {
  background: var(--sun);
  color: var(--ink);
}

.marker.hotel {
  background: var(--blue);
}

.map-legend,
.map-day-list {
  display: grid;
  min-height: 0;
  gap: 12px;
}

.map-day-list {
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.map-legend {
  overflow: auto;
  padding-right: 4px;
}

.legend-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  width: 100%;
  text-align: left;
  align-items: start;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.legend-item:hover,
.legend-item.active {
  border-color: rgba(47, 107, 79, 0.45);
  background: rgba(216, 234, 214, 0.72);
  box-shadow: 0 8px 20px rgba(38, 54, 44, 0.1);
}

.weather-grid,
.share-grid,
.saved-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.weather-card strong {
  display: block;
  font-size: 18px;
  margin-bottom: 10px;
}

.weather-icon {
  font-size: 40px;
  line-height: 1;
}

.share-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.share-image {
  min-height: 160px;
  background: linear-gradient(135deg, rgba(47, 107, 79, 0.46), rgba(199, 105, 67, 0.32)), var(--city-image);
  background-size: cover;
  background-position: center;
}

.share-body {
  padding: 14px;
}

.share-body h3 {
  margin-bottom: 8px;
  font-size: 20px;
}

.share-body p {
  color: var(--muted);
  line-height: 1.55;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.action-row button.secondary {
  color: var(--green);
  background: white;
  border: 1px solid var(--line);
}

.share-output {
  width: 100%;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  resize: vertical;
  background: white;
  color: var(--ink);
}

.admin-dashboard {
  display: grid;
  gap: 18px;
}

.admin-header,
.admin-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px;
}

.admin-header h2,
.admin-section-header h3 {
  margin-bottom: 6px;
}

.admin-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.admin-header button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  color: white;
  background: var(--green);
  font-weight: 900;
}

.admin-alert {
  border: 1px solid rgba(199, 105, 67, 0.38);
  border-radius: 8px;
  padding: 12px 14px;
  color: #7a351e;
  background: rgba(199, 105, 67, 0.12);
  font-weight: 800;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(216, 234, 214, 0.5);
}

.admin-metric span,
.identity-cell span {
  color: var(--muted);
  font-size: 12px;
}

.admin-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  line-height: 1.2;
}

.admin-section {
  overflow: hidden;
}

.admin-section-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.admin-section-header span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.admin-table-wrap {
  width: 100%;
  overflow: auto;
}

.admin-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.42);
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.45;
  white-space: nowrap;
}

.admin-table th {
  color: var(--muted);
  background: rgba(247, 243, 234, 0.78);
  font-size: 12px;
  font-weight: 900;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.identity-cell {
  display: grid;
  gap: 4px;
  min-width: 190px;
}

.role-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  color: #244b39;
  background: var(--mint);
  font-size: 12px;
  font-weight: 900;
}

.role-badge.admin {
  color: #fff;
  background: var(--clay);
}

.status-badge.disabled,
.status-badge.failed {
  color: #7a351e;
  background: rgba(199, 105, 67, 0.16);
}

.admin-empty {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1040px) {
  body {
    overflow: auto;
  }

  .shell,
  .summary-grid,
  .map-wrap {
    grid-template-columns: 1fr;
    height: auto;
  }

  .shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .phone,
  .workspace {
    height: auto;
    min-height: auto;
  }

  .map-board {
    min-height: 560px;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 10px;
  }

  .phone,
  .workspace {
    border-radius: 18px;
  }

  .tabs,
  .quick-prompts {
    overflow-x: auto;
  }

  .weather-grid,
  .share-grid,
  .saved-grid,
  .admin-metrics {
    grid-template-columns: 1fr;
  }

  .admin-header,
  .admin-section-header {
    align-items: stretch;
    flex-direction: column;
  }

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

  .swap-btn {
    grid-column: 2;
    justify-self: start;
  }
}
