:root {
  color-scheme: light;
  --bg: #faf7ff;
  --bg-band: #f0ecfb;
  --card: #fffdfd;
  --ink: #252133;
  --muted: #6c647d;
  --line: #ded6ef;
  --accent: #8b6fd6;
  --accent-strong: #6f56be;
  --accent-soft: #efe8ff;
  --pink: #d783a8;
  --ok: #517b68;
  --warn: #946b2f;
  --risk: #9a564f;
  --shadow: 0 18px 45px rgba(61, 47, 92, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  background:
    linear-gradient(180deg, #faf7ff 0%, #f9f3fb 46%, #fbf7f2 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 16px;
  align-items: center;
  padding: 28px 18px 18px;
  max-width: 980px;
  margin: 0 auto;
}

.moon-mark {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #f8ecbd;
  box-shadow: inset -16px 4px 0 #b8a6ea, 0 12px 28px rgba(111, 86, 190, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.eyebrow,
.tagline,
footer p {
  margin: 0;
  color: var(--muted);
}

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

h1 {
  margin-bottom: 4px;
  font-size: 2.35rem;
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.45rem;
}

h3 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 14px;
  background: rgba(250, 247, 255, 0.92);
  backdrop-filter: blur(16px);
  border-block: 1px solid rgba(222, 214, 239, 0.75);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  min-height: 42px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
}

.tab.active {
  color: var(--accent-strong);
  border-color: var(--line);
  background: var(--card);
  box-shadow: 0 8px 22px rgba(61, 47, 92, 0.08);
}

main {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 18px 14px 34px;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.section-heading {
  margin: 12px 4px 16px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.card {
  padding: 16px;
  border: 1px solid rgba(222, 214, 239, 0.85);
  border-radius: 8px;
  background: rgba(255, 253, 253, 0.9);
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
}

.label-text {
  color: var(--muted);
  font-size: 0.9rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #ffffff;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(139, 111, 214, 0.22);
  outline-offset: 2px;
}

.date-field {
  grid-template-columns: max-content max-content;
  align-items: center;
  justify-content: start;
  gap: 8px 10px;
}

.date-field label {
  grid-column: 1 / -1;
}

.compact-date {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.date-pill,
.secondary-action,
.file-action,
.danger-action,
.primary-action {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  font-weight: 700;
}

.date-pill {
  min-width: 92px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.primary-action {
  color: #fff;
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.secondary-action,
.file-action {
  display: inline-grid;
  place-items: center;
  color: var(--accent-strong);
  background: #fff;
}

.danger-action {
  color: #8a3e48;
  background: #fff6f7;
}

.wide {
  grid-column: 1 / -1;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.chip input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

.size-table-shell {
  margin: 18px 0;
}

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

.table-topline h3 {
  margin-bottom: 0;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  background: #faf8ff;
}

td input,
td select {
  min-width: 88px;
  min-height: 38px;
  padding: 7px 8px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #8a3e48;
  background: #fff;
}

.list-block {
  margin-top: 22px;
}

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

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
}

.record-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

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

.record-title {
  margin: 0;
  font-weight: 800;
}

.record-meta,
.small-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-action {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--accent-strong);
  background: #fff;
}

.mini-action.delete {
  color: #8a3e48;
}

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

.route-summary {
  border-left: 5px solid var(--accent);
}

.route-grid {
  display: grid;
  gap: 10px;
}

.route-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.route-card.recommended {
  border-left: 5px solid var(--ok);
}

.route-card.caution {
  border-left: 5px solid var(--warn);
}

.route-card.risky,
.route-card.notRecommended {
  border-left: 5px solid var(--risk);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 800;
}

.route-card ul {
  margin: 8px 0 0;
  padding-left: 1.15rem;
}

.data-card p:last-child,
.route-card p:last-child {
  margin-bottom: 0;
}

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

.file-action input {
  display: none;
}

.status-text {
  margin: 14px 0 0;
  color: var(--accent-strong);
  font-weight: 700;
}

footer {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 0 18px 28px;
}

@media (max-width: 640px) {
  .table-topline {
    align-items: stretch;
  }

  .table-scroll {
    overflow-x: visible;
    border: 0;
    background: transparent;
  }

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

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

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

  tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  td {
    min-width: 0;
    border-bottom: 0;
    padding: 0;
  }

  td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
  }

  td input,
  td select {
    min-width: 0;
    width: 100%;
  }

  .size-row-action {
    display: flex;
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .size-row-action::before {
    content: "";
    display: none;
  }

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

@media (min-width: 720px) {
  .app-header {
    padding-top: 42px;
    grid-template-columns: 84px 1fr;
  }

  .moon-mark {
    width: 74px;
    height: 74px;
    box-shadow: inset -22px 5px 0 #b8a6ea, 0 16px 34px rgba(111, 86, 190, 0.22);
  }

  h1 {
    font-size: 4.2rem;
  }

  .tabs {
    justify-content: center;
  }

  main {
    padding-inline: 18px;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .route-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
