:root {
  --bg: #0f1115;
  --panel: #171a21;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f3f5f8;
  --muted: #939aab;
  --accent: #2dd4bf;
  --danger: #fb7185;
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.login-card, .panel, .modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.login-card {
  width: min(400px, 100%);
  padding: 1.25rem;
  display: grid;
  gap: 0.85rem;
}

.login-brand, .side-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.login-brand h1 { margin: 0; font-size: 1.2rem; }
.login-brand p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.86rem; }

.mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #5eead4, #0f766e);
  color: #042f2e;
}
.mark.sm { width: 34px; height: 34px; }

.mark i, .btn i, .nav i, .side-foot i, .muted-link i, .file-btn i {
  width: 1em;
  height: 1em;
  stroke-width: 2.2;
}

label { display: grid; gap: 0.35rem; }
label > span { font-size: 0.82rem; color: var(--muted); font-weight: 600; }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #10131a;
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: rgba(45, 212, 191, 0.5);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.7rem 0.95rem;
  cursor: pointer;
  font-weight: 700;
}
.btn.primary { background: linear-gradient(135deg, #5eead4, #2dd4bf); color: #042f2e; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }

.error { margin: 0; color: var(--danger); font-size: 0.88rem; }
.muted-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.side {
  border-right: 1px solid var(--line);
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: rgba(23, 26, 33, 0.9);
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-nav { display: grid; gap: 0.3rem; }
.nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 650;
  text-align: left;
}
.nav.active, .nav:hover {
  background: rgba(45, 212, 191, 0.12);
  color: var(--accent);
}

.side-foot {
  margin-top: auto;
  display: grid;
  gap: 0.3rem;
}
.side-foot a, .side-foot button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  cursor: pointer;
}

.main { padding: 1.1rem 1rem 2rem; }
.head h2 { margin: 0; letter-spacing: -0.03em; }
.head p { margin: 0.25rem 0 1rem; color: var(--muted); }

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
}
.stat span { color: var(--muted); font-size: 0.82rem; }
.stat strong { display: block; margin-top: 0.3rem; font-size: 1.55rem; letter-spacing: -0.03em; }

.dash { display: grid; gap: 1rem; }
.dash-hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    radial-gradient(900px 280px at 12% -20%, rgba(45, 212, 191, 0.22), transparent 55%),
    radial-gradient(700px 240px at 90% 0%, rgba(56, 189, 248, 0.12), transparent 50%),
    linear-gradient(160deg, #1a1f2a 0%, #12151c 100%);
  padding: 1.6rem 1.4rem 1.5rem;
  min-height: 140px;
}
.dash-hero-text { position: relative; z-index: 1; max-width: 36rem; }
.dash-eyebrow {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.dash-hero h3 {
  margin: 0;
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  letter-spacing: -0.04em;
  line-height: 1.15;
}
.dash-lead {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}
.dash-hero-glow {
  position: absolute;
  right: -40px;
  bottom: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.28), transparent 68%);
  pointer-events: none;
}
.dash-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.dash-card {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 1.05rem 1rem 1rem;
  min-height: 118px;
}
.dash-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.12), transparent 70%);
  pointer-events: none;
}
.dash-card-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.dash-card-value {
  display: block;
  margin-top: 0.45rem;
  font-size: clamp(1.55rem, 2.2vw, 1.9rem);
  letter-spacing: -0.04em;
  line-height: 1;
}
.dash-card-tip {
  display: block;
  margin-top: 0.65rem;
  color: #6f7688;
  font-size: 0.78rem;
}
.dash-foot {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0 0.15rem;
}

.icons-panel { padding: 1rem; }
.icons-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.icons-search { flex: 1; }
.icons-meta {
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 0.55rem;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding-right: 0.2rem;
}
.icon-tile {
  display: grid;
  gap: 0.45rem;
  justify-items: center;
  padding: 0.85rem 0.5rem 0.7rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #10131a;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.icon-tile:hover {
  border-color: rgba(45, 212, 191, 0.4);
  background: rgba(45, 212, 191, 0.08);
  transform: translateY(-1px);
}
.icon-tile-preview {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--accent);
}
.icon-tile-preview i {
  width: 1.45rem;
  height: 1.45rem;
  stroke-width: 1.8;
}
.icon-tile-name {
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  word-break: break-all;
  line-height: 1.25;
}

.panel { padding: 1rem; margin-bottom: 0.85rem; }
.panel.tip { color: var(--muted); font-size: 0.9rem; }
.panel.tip p { margin: 0; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.panel-head h3 { margin: 0; }

.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.form .full, .actions.full { grid-column: 1 / -1; }
.actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

.qiniu-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.list { display: grid; gap: 0.65rem; }
.item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem;
  border-radius: 14px;
  background: #10131a;
  border: 1px solid var(--line);
}
.item.cat { grid-template-columns: 40px 1fr auto; }
.thumb {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  background: #0b0d12;
}
.icon-box {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(45, 212, 191, 0.12);
  color: var(--accent);
}
.item h4 { margin: 0; font-size: 0.95rem; }
.item p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.8rem; }
.item-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn.on {
  color: #ff7a59;
  border-color: rgba(255, 122, 89, 0.35);
  background: rgba(255, 122, 89, 0.1);
}

.prompt-toolbar {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr)) auto;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #10131a;
  color: var(--muted);
}

.search-field input {
  border: 0;
  background: transparent;
  padding: 0.7rem 0;
}

.search-field i {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
}

.prompt-toolbar select {
  min-width: 0;
}

.prompt-meta {
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 0.65rem;
}

.item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.mini-tag {
  font-size: 0.72rem;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.mini-tag.warn {
  background: rgba(251, 113, 133, 0.12);
  color: #fb7185;
}

.mini-tag.ok {
  background: rgba(45, 212, 191, 0.12);
  color: var(--accent);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.pager span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  min-width: 4.5rem;
  text-align: center;
}

.thumb.user-avatar.placeholder {
  display: grid;
  place-items: center;
  background: rgba(45, 212, 191, 0.12);
  color: var(--accent);
}

.thumb.user-avatar.placeholder i {
  width: 1.25rem;
  height: 1.25rem;
}

.field-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.contact-editor-wrap {
  display: grid;
  gap: 0.45rem;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.contact-editor {
  min-height: 180px;
  max-height: 420px;
  overflow: auto;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #10131a;
  color: var(--text);
  line-height: 1.65;
  outline: none;
}

.contact-editor:empty:before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.contact-editor img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin: 0.5rem 0;
}

.contact-editor:focus {
  border-color: rgba(45, 212, 191, 0.45);
}

.empty-list {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
  font-size: 0.92rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: end center;
  padding: 0;
}
.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.modal-card {
  position: relative;
  width: min(640px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 1.1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  border-radius: 18px 18px 0 0;
  animation: up 0.25s ease;
}
.modal-card.wide { width: min(720px, 100%); }
.modal-card h3 { grid-column: 1 / -1; margin: 0; }
.modal-card .full, .modal-card .actions, .modal-card .check, .modal-card .media-block {
  grid-column: 1 / -1;
}

.media-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem;
  background: #10131a;
}
.media-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  font-size: 0.86rem;
}
.media-head span { color: var(--muted); }
.upload-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}
.file-btn { cursor: pointer; }
.preview {
  margin-top: 0.65rem;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 10px;
  background: #0b0d12;
  display: none;
}
.preview.show { display: block; }

.check {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  grid-template-columns: none;
}
.check input { width: auto; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  z-index: 60;
  background: #f3f5f8;
  color: #0f1115;
  padding: 0.65rem 0.95rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
}

@keyframes up {
  from { transform: translateY(18px); opacity: 0.7; }
  to { transform: none; opacity: 1; }
}

.form.narrow {
  max-width: 420px;
  grid-template-columns: 1fr;
}

#view-password {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 9rem);
}

#view-password .panel {
  width: min(420px, 100%);
  margin: 0;
}

.section-title {
  margin: 0;
  font-size: 1rem;
}

.hint {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.carousel-preview {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  background: #0b0d12;
  display: none;
}
.carousel-preview.show { display: block; }

.nav-card .upload-inline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nav-card .upload-inline input[name="image_url"],
.nav-card .upload-inline input[id^="carouselImg"] {
  flex: 1;
}

.nav-editor {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.nav-editor-labels {
  grid-template-columns: 1fr;
}

.nav-card-label {
  grid-template-columns: 1fr !important;
}

.nav-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem;
  background: #10131a;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.nav-card .full { grid-column: 1 / -1; }

.nav-card .check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.nav-card .check input { width: auto; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .side-nav {
    display: flex;
    overflow-x: auto;
    gap: 0.35rem;
  }
  .nav { white-space: nowrap; }
  .form, .qiniu-fields, .modal-card, .nav-card, .prompt-toolbar {
    grid-template-columns: 1fr;
  }
  .item { grid-template-columns: 56px 1fr; }
  .item-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .dash-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .icons-toolbar { flex-direction: column; align-items: stretch; }
  .icon-grid { max-height: none; }
}

@media (min-width: 861px) {
  .modal { place-items: center; padding: 1rem; }
  .modal-card, .modal-card.wide { border-radius: 18px; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
