:root {
  color-scheme: light;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: #f6f3fb;
  color: #25222b;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(103, 80, 164, 0.16), transparent 30rem),
    #f6f3fb;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding:
    max(24px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(40px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(145deg, #765db8, #4f378b);
  color: white;
  font-size: 27px;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(79, 55, 139, 0.24);
}

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

h1 {
  margin-bottom: 4px;
  font-size: clamp(1.55rem, 4vw, 2rem);
}

h2 {
  margin-bottom: 0;
  font-size: 1.16rem;
}

.subtitle,
.muted,
.field-help,
footer {
  color: #716b78;
}

.subtitle {
  margin-bottom: 0;
  line-height: 1.55;
}

.eyebrow {
  margin-bottom: 4px;
  color: #6750a4;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.network-badge,
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eee8f8;
  color: #56417f;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.network-badge.offline {
  background: #fce8e6;
  color: #9c332b;
}

.card {
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid rgba(103, 80, 164, 0.13);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 40px rgba(55, 43, 83, 0.07);
  backdrop-filter: blur(12px);
}

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

label {
  display: block;
  margin: 16px 0 8px;
  font-size: 0.9rem;
  font-weight: 700;
}

textarea,
input {
  width: 100%;
  border: 1px solid #d6d0dc;
  border-radius: 15px;
  outline: none;
  background: #fcfbfe;
  color: #25222b;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea {
  min-height: 138px;
  padding: 14px;
  line-height: 1.6;
  resize: vertical;
}

input {
  min-height: 48px;
  padding: 0 13px;
}

textarea:focus,
input:focus {
  border-color: #6750a4;
  box-shadow: 0 0 0 3px rgba(103, 80, 164, 0.13);
}

.field-help {
  margin: 7px 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
}

.primary-button,
.secondary-button,
.text-button {
  border: 0;
  border-radius: 14px;
  font-weight: 750;
}

.primary-button {
  width: 100%;
  min-height: 50px;
  margin-top: 18px;
  background: #6750a4;
  color: white;
  box-shadow: 0 8px 18px rgba(103, 80, 164, 0.22);
}

.secondary-button {
  min-height: 44px;
  padding: 0 16px;
  background: #ede7f6;
  color: #4f378b;
}

.text-button {
  padding: 8px 10px;
  background: transparent;
  color: #6750a4;
}

.text-button.danger {
  color: #a83b32;
}

.button-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

.status-message {
  min-height: 1.35em;
  margin: 12px 0 0;
  color: #5f5866;
  font-size: 0.86rem;
  text-align: center;
}

.status-message.error {
  color: #a83b32;
}

details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

details summary::-webkit-details-marker {
  display: none;
}

.details-content {
  padding-top: 4px;
}

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

.recent-item {
  display: grid;
  gap: 7px;
  padding: 14px;
  border-radius: 16px;
  background: #f7f4fa;
}

.recent-item p {
  margin: 0;
  line-height: 1.5;
}

.recent-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 7px 12px;
  color: #716b78;
  font-size: 0.78rem;
}

.sync-state {
  color: #8a6400;
  font-weight: 750;
}

.sync-state.acked {
  color: #28744e;
}

.empty-state {
  margin: 8px 0;
  color: #817986;
  text-align: center;
}

footer {
  padding: 6px 10px;
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
}

footer p {
  margin-bottom: 5px;
}

@media (max-width: 620px) {
  .hero {
    grid-template-columns: auto 1fr;
  }

  .network-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .card {
    padding: 18px;
    border-radius: 21px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
