:root {
  --bg: #020712;
  --panel: rgba(8, 20, 36, 0.84);
  --panel-strong: rgba(10, 29, 51, 0.96);
  --line: rgba(89, 214, 255, 0.38);
  --line-strong: rgba(106, 237, 255, 0.72);
  --cyan: #2ee8ff;
  --cyan-deep: #0788ff;
  --mint: #47ffd1;
  --gold: #ffd166;
  --red: #ff6b8b;
  --text: #f4fbff;
  --muted: #9fb9cf;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-y: auto;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 12%, rgba(46, 232, 255, 0.18), transparent 24rem),
    radial-gradient(circle at 86% 4%, rgba(71, 255, 209, 0.12), transparent 26rem),
    linear-gradient(145deg, #061421 0%, #020712 52%, #071422 100%);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent 78%);
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 22rem;
  height: 22rem;
  border-radius: 999px;
  filter: blur(38px);
  opacity: 0.58;
  pointer-events: none;
}

.ambient-one {
  left: -8rem;
  top: 12rem;
  background: rgba(0, 136, 255, 0.32);
}

.ambient-two {
  right: -9rem;
  bottom: 2rem;
  background: rgba(71, 255, 209, 0.18);
}

.app {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  width: min(1680px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  padding: 22px;
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 16px;
  position: sticky;
  top: 18px;
}

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

.panel,
.topbar,
.summary-card,
.category-section,
.modal-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(11, 30, 52, 0.92), rgba(4, 13, 26, 0.88));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.panel::after,
.topbar::after,
.summary-card::after,
.category-section::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(46, 232, 255, 0.18), transparent 24%, transparent 72%, rgba(71, 255, 209, 0.12));
  opacity: 0.75;
}

.panel > *,
.topbar > *,
.summary-card > *,
.category-section > * {
  position: relative;
  z-index: 1;
}

.panel {
  padding: 20px;
}

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

.section-kicker {
  color: var(--mint);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.input-panel h1 {
  margin-top: 7px;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.input-panel p,
.topbar p,
.memory-text {
  color: var(--muted);
  margin-top: 10px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.65;
}

textarea {
  display: block;
  width: 100%;
  height: 176px;
  margin-top: 18px;
  resize: vertical;
  border: 1px solid rgba(126, 231, 255, 0.5);
  border-radius: 20px;
  background: rgba(2, 9, 18, 0.86);
  color: #eaffff;
  -webkit-text-fill-color: #eaffff;
  padding: 15px;
  font: 700 13px/1.55 "SF Mono", Menlo, Monaco, Consolas, monospace;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), inset 0 18px 42px rgba(0, 0, 0, 0.2);
}

textarea::placeholder {
  color: rgba(184, 220, 238, 0.62);
  -webkit-text-fill-color: rgba(184, 220, 238, 0.62);
}

textarea:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(46, 232, 255, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid rgba(141, 236, 255, 0.72);
  border-radius: 16px;
  padding: 0 16px;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  font-family: inherit;
  font-size: 15px;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.78);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 48%, rgba(46, 232, 255, 0.16));
  opacity: 0.9;
}

button span {
  position: relative;
  z-index: 1;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.primary-action {
  background: linear-gradient(135deg, #005eea 0%, #0099ff 44%, #00d7ff 100%);
  border-color: rgba(180, 247, 255, 0.9);
}

.secondary-action {
  background: linear-gradient(135deg, #12345b 0%, #0b6e96 54%, #13b9c8 100%);
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  color: rgba(255, 255, 255, 0.72) !important;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.72) !important;
  cursor: not-allowed;
  filter: grayscale(0.35);
  opacity: 0.65;
}

.memory-panel h2 {
  margin-top: 8px;
  font-size: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
  padding: 22px 24px;
}

.topbar-side {
  display: grid;
  justify-items: end;
  gap: 12px;
}

.topbar h2 {
  margin-top: 5px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.logout-action {
  min-height: 42px;
  border-radius: 14px;
  padding: 0 18px;
  font-size: 13px;
  background: linear-gradient(135deg, #4b1033 0%, #9f184f 48%, #ff6b8b 100%);
  border-color: rgba(255, 174, 196, 0.88);
}

.progress-shell {
  width: min(360px, 42vw);
  color: #dffaff;
  font-weight: 900;
  text-align: right;
}

@media (max-width: 900px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-side {
    justify-items: stretch;
  }

  .progress-shell {
    width: 100%;
  }
}

.progress-track {
  height: 16px;
  margin-top: 10px;
  border: 1px solid rgba(126, 231, 255, 0.42);
  border-radius: 999px;
  background: rgba(1, 8, 18, 0.82);
  overflow: hidden;
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.45);
}

#progressBar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan-deep), var(--cyan), var(--mint));
  box-shadow: 0 0 18px rgba(46, 232, 255, 0.7);
  transition: width 240ms ease;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
  gap: 14px;
}

.summary-card {
  min-height: 132px;
  padding: 17px;
  cursor: pointer;
}

.summary-card.changed {
  border-color: rgba(255, 209, 102, 0.9);
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 209, 102, 0.28), 0 0 30px rgba(255, 209, 102, 0.08);
}

.summary-title {
  color: #dffaff;
  font-size: 15px;
  font-weight: 950;
  line-height: 1.3;
}

.summary-value {
  margin-top: 10px;
  color: #ffffff;
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 950;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.summary-diff {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.45;
}

.summary-diff.plus {
  color: var(--mint);
}

.summary-diff.minus {
  color: var(--red);
}

.summary-hint {
  margin-top: 8px;
  color: rgba(255, 209, 102, 0.96);
  font-size: 12px;
  font-weight: 900;
}

.results-board {
  display: grid;
  gap: 16px;
  padding-bottom: 70px;
}

.category-section {
  scroll-margin-top: 20px;
}

.category-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 17px 18px;
  border-bottom: 1px solid rgba(89, 214, 255, 0.22);
  background: linear-gradient(90deg, rgba(13, 50, 82, 0.68), rgba(5, 17, 31, 0.4));
}

.category-head strong {
  font-size: 21px;
  line-height: 1.2;
}

.category-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--muted);
  font-weight: 900;
}

.category-actions button {
  min-height: 38px;
  border-radius: 13px;
  padding: 0 14px;
  font-size: 13px;
  background: linear-gradient(135deg, #11446f, #0f95b8);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 12px;
  padding: 14px;
}

.result-card {
  border: 1px solid rgba(89, 214, 255, 0.28);
  border-radius: 18px;
  background: rgba(2, 9, 18, 0.72);
  padding: 14px;
  min-width: 0;
}

.result-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.result-number {
  color: #ffffff;
  font-size: 16px;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.result-top button {
  min-height: 34px;
  border-radius: 12px;
  padding: 0 12px;
  font-size: 12px;
  background: linear-gradient(135deg, #0f3760, #087eaa);
}

.result-status {
  color: #cfefff;
  margin-top: 10px;
  line-height: 1.58;
  overflow-wrap: anywhere;
}

.delivery-time {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-top: 12px;
  padding: 9px 11px;
  border: 1px solid rgba(71, 255, 209, 0.42);
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(18, 91, 93, 0.36), rgba(7, 37, 54, 0.62));
  color: #eafff9;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.4;
}

.delivery-time-label {
  color: var(--mint);
  font-weight: 950;
  white-space: nowrap;
}

.delivery-time time {
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.empty {
  color: var(--muted);
  padding: 18px;
  font-weight: 800;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(1, 7, 14, 0.76);
  backdrop-filter: blur(16px);
}

.hidden {
  display: none;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(46, 232, 255, 0.14), transparent 28rem),
    rgba(1, 7, 14, 0.92);
  backdrop-filter: blur(18px);
}

.auth-overlay.hidden {
  display: none;
}

.auth-card {
  width: min(460px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  padding: 28px;
  background: linear-gradient(145deg, rgba(10, 29, 51, 0.98), rgba(3, 11, 22, 0.96));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
}

.auth-card h2 {
  margin-top: 8px;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.auth-intro {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.7;
  font-weight: 700;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.auth-field {
  display: grid;
  gap: 8px;
}

.auth-field span {
  color: #dffaff;
  font-size: 13px;
  font-weight: 900;
}

.auth-field input {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(126, 231, 255, 0.5);
  border-radius: 16px;
  background: rgba(2, 9, 18, 0.86);
  color: #eaffff;
  padding: 0 14px;
  font: 700 15px/1.2 "Avenir Next", "PingFang SC", sans-serif;
  outline: none;
}

.auth-field input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(46, 232, 255, 0.14);
}

.login-message {
  color: var(--muted);
  min-height: 22px;
  font-size: 13px;
  font-weight: 800;
}

.modal-card {
  width: min(1040px, 94vw);
  max-height: 86vh;
  overflow: auto;
  background: linear-gradient(145deg, rgba(8, 22, 39, 0.98), rgba(3, 11, 22, 0.98));
  border-color: var(--line-strong);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid rgba(89, 214, 255, 0.26);
  background: rgba(4, 14, 27, 0.96);
}

.modal-head h3 {
  font-size: 22px;
}

.modal-head button {
  min-height: 38px;
  border-radius: 12px;
  padding: 0 16px;
  font-size: 13px;
  background: linear-gradient(135deg, #113b66, #0c86ab);
}

.modal-body {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.modal-body > button {
  justify-self: start;
  min-height: 42px;
  background: linear-gradient(135deg, #0069f2, #00b9e8);
}

.modal-row {
  border: 1px solid rgba(89, 214, 255, 0.28);
  border-radius: 16px;
  background: rgba(6, 18, 33, 0.88);
  padding: 13px;
}

.modal-row label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.modal-row-content {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}

.modal-delivery-time {
  max-width: 430px;
}

.modal-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--cyan);
}

.sf-number {
  color: var(--mint);
  font-size: 12px;
  font-weight: 900;
}

.timeline {
  white-space: pre-wrap;
  color: #d8efff;
  line-height: 1.6;
}

@media (max-width: 1180px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
    align-items: stretch;
  }

  .memory-panel {
    min-height: 100%;
  }
}

@media (max-width: 760px) {
  .app {
    padding: 14px;
  }

  .sidebar {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .progress-shell {
    width: 100%;
    text-align: left;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .category-head {
    display: grid;
  }
}

.modal-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.copy-preview-wrap {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(126, 231, 255, 0.28);
  border-radius: 16px;
  background: rgba(2, 9, 18, 0.62);
}

.copy-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.copy-preview {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid rgba(126, 231, 255, 0.32);
  border-radius: 14px;
  background: rgba(1, 8, 18, 0.92);
  color: #eaffff;
  padding: 12px;
  font: 700 12px/1.55 "SF Mono", Menlo, Monaco, Consolas, monospace;
}
