:root {
  --bg: #061128;
  --bg-deep: #030a19;
  --surface: rgba(14, 31, 61, 0.88);
  --surface-strong: #10264b;
  --surface-soft: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.11);
  --text: #f6f8ff;
  --muted: #9aaaca;
  --blue: #5b8cff;
  --cyan: #33d0d4;
  --violet: #8b6cff;
  --gold: #e6c36a;
  --green: #42d392;
  --red: #ff6978;
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg-deep);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 88% 4%, rgba(91, 140, 255, 0.2), transparent 28rem),
    linear-gradient(180deg, #07162f 0%, var(--bg-deep) 100%);
  -webkit-font-smoothing: antialiased;
}

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

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(91, 140, 255, 0.46);
  outline-offset: 2px;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(60px);
}

.ambient-one {
  top: 18%;
  left: -120px;
  width: 240px;
  height: 240px;
  background: rgba(105, 67, 255, 0.19);
}

.ambient-two {
  right: -100px;
  bottom: 10%;
  width: 220px;
  height: 220px;
  background: rgba(28, 190, 205, 0.13);
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100dvh;
  margin: 0 auto;
}

.view {
  display: none;
  min-height: 100dvh;
  animation: view-in 0.24s ease-out;
}

.view.is-active {
  display: block;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero {
  position: relative;
  min-height: clamp(350px, 49dvh, 470px);
  padding: max(24px, env(safe-area-inset-top)) 22px 22px;
  overflow: hidden;
  border-radius: 0 0 38px 38px;
  background:
    linear-gradient(142deg, rgba(9, 33, 72, 0.48), rgba(8, 15, 38, 0.92)),
    radial-gradient(circle at 78% 30%, rgba(116, 96, 255, 0.48), transparent 35%),
    radial-gradient(circle at 15% 85%, rgba(38, 170, 219, 0.22), transparent 42%),
    #0c1c3d;
  box-shadow: var(--shadow);
}

.hero::before {
  content: "";
  position: absolute;
  right: -46px;
  top: 78px;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(230, 195, 106, 0.24);
  border-radius: 50%;
  box-shadow:
    0 0 0 22px rgba(255, 255, 255, 0.018),
    0 0 0 46px rgba(255, 255, 255, 0.012);
}

.hero::after {
  content: "";
  position: absolute;
  right: 58px;
  top: 80px;
  width: 1px;
  height: 230px;
  opacity: 0.48;
  background: linear-gradient(transparent, var(--gold), transparent);
  transform: rotate(34deg);
}

.hero-topline,
.hero-copy,
.date-strip {
  position: relative;
  z-index: 1;
}

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

.brand-mark {
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.22em;
}

.install-button {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: #dfe8ff;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(12px);
  cursor: pointer;
}

.install-button svg {
  width: 17px;
  height: 17px;
}

.hero-copy {
  margin-top: clamp(68px, 11dvh, 110px);
}

.hero-copy .eyebrow {
  margin: 0 0 10px;
  color: rgba(230, 195, 106, 0.82);
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.hero-copy h1 {
  max-width: 7em;
  margin: 0;
  font-size: clamp(2.4rem, 12vw, 4.25rem);
  font-weight: 760;
  line-height: 1.03;
  letter-spacing: -0.05em;
  text-shadow: 0 12px 40px rgba(0, 0, 0, 0.24);
}

.hero-copy > p:last-child {
  margin: 15px 0 0;
  color: #aebddd;
  font-size: 1rem;
}

.date-strip {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-top: clamp(46px, 9dvh, 76px);
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 18px;
  background: rgba(3, 10, 26, 0.44);
  backdrop-filter: blur(14px);
}

.date-strip > div {
  display: grid;
  gap: 4px;
}

.date-label {
  color: var(--gold);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.date-strip strong {
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: 0.045em;
}

.weekday {
  color: #c5d1eb;
  font-size: 0.93rem;
}

.tools-section {
  padding: 28px 18px calc(34px + env(safe-area-inset-bottom));
}

.section-heading,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--blue);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: -0.025em;
}

.local-badge,
.save-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #9fafd0;
  font-size: 0.76rem;
}

.local-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(66, 211, 146, 0.12);
}

.tool-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.tool-card {
  position: relative;
  display: grid;
  grid-template-columns: 58px 1fr 32px;
  align-items: center;
  gap: 14px;
  min-height: 102px;
  padding: 18px;
  overflow: hidden;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, rgba(16, 38, 75, 0.96), rgba(10, 24, 50, 0.96));
  box-shadow: 0 15px 34px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.tool-card::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -24%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  opacity: 0.13;
  background: currentColor;
}

.tool-card:active {
  transform: scale(0.985);
}

@media (hover: hover) {
  .tool-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.22);
  }
}

.tool-schedule { color: #8aa6ff; }
.tool-map { color: #4ed8e1; }
.tool-material { color: #ab8bff; }

.tool-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.085);
}

.tool-icon svg {
  width: 29px;
  height: 29px;
}

.tool-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 7px;
}

.tool-content strong {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 650;
}

.tool-content small {
  color: var(--muted);
  font-size: 0.8rem;
}

.tool-arrow {
  position: relative;
  z-index: 1;
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  color: #dce6ff;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.045);
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 86px;
  padding: max(16px, env(safe-area-inset-top)) 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 14, 32, 0.88);
  backdrop-filter: blur(22px);
}

.back-button {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
}

.back-button svg {
  width: 23px;
  height: 23px;
}

.page-header > div {
  min-width: 0;
}

.page-header > div > span {
  display: block;
  margin-bottom: 2px;
  color: var(--gold);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.page-header h2 {
  margin: 0;
  overflow: hidden;
  font-size: 1.15rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-state {
  white-space: nowrap;
}

.page-content {
  display: grid;
  gap: 14px;
  padding: 18px 16px calc(40px + env(safe-area-inset-bottom));
}

.panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(18, 39, 74, 0.91), rgba(10, 23, 49, 0.93));
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
}

.date-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.date-panel label {
  font-size: 0.95rem;
  font-weight: 600;
}

.date-panel input {
  width: 160px;
}

.panel-heading {
  margin-bottom: 16px;
}

.panel-heading > div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.panel-heading h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
}

.panel-heading small {
  color: var(--muted);
  font-size: 0.72rem;
  text-align: right;
}

.step-number {
  display: inline-grid;
  min-width: 34px;
  height: 28px;
  padding: 0 7px;
  place-items: center;
  border-radius: 9px;
  color: #a9bdff;
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: rgba(91, 140, 255, 0.13);
}

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

.role-grid label,
.field {
  display: grid;
  gap: 8px;
  color: #bac7e0;
  font-size: 0.78rem;
  font-weight: 550;
}

.role-grid label:first-child,
.role-wide {
  grid-column: 1 / -1;
}

input,
textarea,
select {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 13px;
  color: var(--text);
  background: rgba(3, 12, 29, 0.65);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  transition: border-color 0.18s ease, background 0.18s ease;
}

input::placeholder,
textarea::placeholder {
  color: #66789b;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(91, 140, 255, 0.65);
  background: rgba(5, 17, 39, 0.86);
}

textarea {
  resize: vertical;
  line-height: 1.65;
}

select {
  color-scheme: dark;
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 50px;
  border: 0;
  border-radius: 15px;
  font-weight: 650;
  cursor: pointer;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 0 18px;
  color: white;
  background: linear-gradient(135deg, #4e7ef0, #7559e8);
  box-shadow: 0 14px 30px rgba(74, 91, 221, 0.26);
}

.primary-button svg {
  width: 20px;
  height: 20px;
}

.primary-button:active,
.secondary-button:active,
.text-button:active {
  transform: translateY(1px);
}

.primary-button.compact {
  min-height: 46px;
}

.secondary-button {
  padding: 0 18px;
  border: 1px solid var(--line);
  color: #b8c6e1;
  background: rgba(255, 255, 255, 0.055);
}

.secondary-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.text-button {
  min-height: 38px;
  padding: 0 10px;
  color: #9fb5ff;
  background: transparent;
}

.result-panel textarea {
  min-height: 360px;
  font-size: 0.88rem;
}

.map-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(86px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding: 4px 1px 7px;
  scrollbar-width: none;
}

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

.map-tabs button {
  min-height: 42px;
  padding: 0 12px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
}

.map-tabs button.is-active {
  border-color: rgba(51, 208, 212, 0.34);
  color: #d9fdff;
  background: rgba(51, 208, 212, 0.12);
}

.map-preview {
  display: grid;
  width: 100%;
  min-height: 340px;
  padding: 0;
  overflow: hidden;
  place-items: center;
  border: 1px dashed rgba(112, 160, 226, 0.28);
  border-radius: 18px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    rgba(3, 12, 29, 0.52);
  background-size: 24px 24px;
  cursor: pointer;
}

.map-preview img {
  display: block;
  width: 100%;
  max-height: 68dvh;
  object-fit: contain;
  background: #061027;
}

.map-empty {
  display: grid;
  justify-items: center;
  padding: 36px 20px;
  color: var(--muted);
}

.map-empty svg {
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
  color: #647da9;
}

.map-empty strong {
  color: #c2cde2;
  font-size: 0.94rem;
}

.map-empty small {
  margin-top: 6px;
  font-size: 0.78rem;
}

.map-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 14px;
}

.privacy-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0;
  color: #7385a7;
  font-size: 0.76rem;
}

.privacy-note svg {
  width: 15px;
  height: 15px;
}

.material-form {
  display: grid;
  gap: 14px;
}

.operation-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.operation-toggle legend {
  grid-column: 1 / -1;
  margin-bottom: 8px;
  color: #bac7e0;
  font-size: 0.78rem;
  font-weight: 550;
}

.operation-toggle label {
  position: relative;
}

.operation-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.operation-toggle span {
  display: grid;
  min-height: 46px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
}

.operation-toggle input:checked + span {
  border-color: rgba(91, 140, 255, 0.38);
  color: white;
  background: rgba(91, 140, 255, 0.17);
  box-shadow: inset 0 0 0 1px rgba(91, 140, 255, 0.12);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 10px;
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 105, 120, 0.2);
  border-radius: 12px;
  color: #ffabb3;
  font-size: 0.8rem;
  background: rgba(255, 105, 120, 0.09);
}

.stock-list,
.record-list {
  display: grid;
  gap: 9px;
}

.empty-list {
  margin: 0;
  padding: 22px 10px;
  color: #7182a3;
  font-size: 0.82rem;
  line-height: 1.6;
  text-align: center;
}

.stock-item,
.record-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 14px;
  background: rgba(3, 12, 29, 0.46);
}

.stock-item > div,
.record-main {
  min-width: 0;
}

.stock-item strong,
.record-main strong {
  display: block;
  overflow: hidden;
  color: #e7ecf7;
  font-size: 0.9rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-item small,
.record-main small {
  display: block;
  margin-top: 4px;
  color: #7889a9;
  font-size: 0.71rem;
}

.stock-value {
  color: #8fe0ba;
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
}

.stock-value.is-negative {
  color: #ff929d;
}

.record-side {
  display: grid;
  flex: 0 0 auto;
  justify-items: end;
  gap: 5px;
}

.record-type {
  padding: 4px 8px;
  border-radius: 999px;
  color: #95dfba;
  font-size: 0.67rem;
  font-weight: 700;
  background: rgba(66, 211, 146, 0.1);
}

.record-type.is-out {
  color: #ffb69a;
  background: rgba(255, 142, 99, 0.1);
}

.record-side strong {
  font-size: 0.84rem;
  font-weight: 650;
}

.modal-dialog,
.image-dialog {
  width: min(calc(100% - 32px), 440px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 24px;
  color: var(--text);
  background: #0d2042;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.55);
}

.modal-dialog::backdrop,
.image-dialog::backdrop {
  background: rgba(0, 5, 16, 0.78);
  backdrop-filter: blur(8px);
}

.modal-dialog form {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.dialog-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 15px;
  color: #b5c5ff;
  background: rgba(91, 140, 255, 0.15);
}

.dialog-icon svg {
  width: 24px;
  height: 24px;
}

.modal-dialog h2 {
  margin: 2px 0 -6px;
  font-size: 1.25rem;
}

.modal-dialog p:not(.form-error) {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.image-dialog {
  width: min(calc(100% - 20px), 1000px);
  max-width: 1000px;
  background: #020713;
}

.image-dialog button {
  position: fixed;
  z-index: 2;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: white;
  font-size: 1.7rem;
  background: rgba(0, 0, 0, 0.52);
}

.image-dialog img {
  display: block;
  width: 100%;
  max-height: 88dvh;
  object-fit: contain;
}

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  max-width: calc(100% - 36px);
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  opacity: 0;
  color: white;
  font-size: 0.82rem;
  text-align: center;
  background: rgba(15, 31, 61, 0.96);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
  transform: translate(-50%, 16px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

noscript {
  display: block;
  padding: 20px;
  color: white;
  text-align: center;
}

@media (min-width: 620px) {
  body {
    padding: 24px 0;
  }

  .app-shell {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 38px;
    background: rgba(4, 12, 28, 0.62);
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.34);
  }

  .hero {
    border-radius: 38px;
  }

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

  .tool-card {
    grid-template-columns: 1fr auto;
    align-items: start;
    min-height: 190px;
  }

  .tool-icon,
  .tool-content {
    grid-column: 1 / -1;
  }

  .tool-arrow {
    position: absolute;
    right: 16px;
    bottom: 16px;
  }

  .page-header {
    top: 24px;
    border-radius: 38px 38px 0 0;
  }

  .page-content {
    padding: 22px 22px 48px;
  }

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

  .role-grid label:first-child,
  .role-wide {
    grid-column: auto;
  }
}

@media (max-width: 380px) {
  .save-state {
    display: none;
  }

  .page-header {
    grid-template-columns: 42px 1fr;
  }

  .hero {
    padding-inline: 18px;
  }

  .tools-section {
    padding-inline: 14px;
  }

  .tool-card {
    grid-template-columns: 52px 1fr 30px;
    gap: 11px;
    padding: 15px;
  }

  .tool-icon {
    width: 52px;
    height: 52px;
  }

  .panel-heading small {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
