:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #d8e2ef;
  --text: #172033;
  --muted: #637083;
  --accent: #2d6cdf;
  --accent-dark: #1e4fa8;
  --ok: #0f8f5f;
  --danger: #c2413a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  text-decoration: none;
}

.button-link:hover {
  background: var(--accent-dark);
}

button:hover {
  background: var(--accent-dark);
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.sidebar {
  min-height: 100vh;
  background: #101827;
  color: #fff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #71d5a1;
  color: #102018;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand p {
  color: #aab5c6;
  font-size: 13px;
}

nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  text-align: left;
  background: transparent;
  color: #d7deeb;
}

.nav-button.active,
.nav-button:hover {
  background: #26364f;
}

.status {
  margin-top: auto;
  color: #b6c4d8;
  font-size: 13px;
  line-height: 1.5;
}

.app-shell {
  padding: 28px;
  display: grid;
  gap: 20px;
  align-content: start;
}

.topbar,
.panel,
.view {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.eyebrow,
.topbar h2 {
  margin: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
}

.user-chip {
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
}

.panel,
.view {
  padding: 22px;
}

.auth-panel {
  display: grid;
  gap: 18px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

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

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

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

.section-head h3,
.section-head p {
  margin: 0;
}

.section-head p {
  color: var(--muted);
  margin-top: 4px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.work-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.work-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #edf2f7;
}

.work-card div {
  padding: 12px;
}

.work-card h4,
.work-card p {
  margin: 0;
}

.work-card p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 0;
}

.card-actions button {
  padding: 8px 10px;
  font-size: 13px;
}

.card-actions .ghost {
  background: #edf3fb;
  color: var(--accent-dark);
}

.card-actions .danger {
  background: var(--danger);
}

.detail-panel {
  display: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 16px;
}

.detail-panel.active {
  display: grid;
  gap: 12px;
}

.detail-panel img {
  width: min(520px, 100%);
  border-radius: 8px;
  border: 1px solid var(--line);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.upload-box {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  align-items: end;
  gap: 14px;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f7f9fc;
  border: 1px solid var(--line);
  padding: 14px;
  border-radius: 6px;
}

.admin-tools {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 8px;
  padding: 16px;
}

.admin-tools h4,
.admin-tools p {
  margin: 0;
}

.admin-tools p {
  margin-top: 4px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  min-width: 240px;
  max-width: 420px;
  padding: 12px 14px;
  background: #101827;
  color: #fff;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 860px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .auth-grid,
  .upload-box {
    grid-template-columns: 1fr;
  }
}

.share-body {
  display: block;
  background: var(--bg);
}

.share-page {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.share-header {
  margin-bottom: 20px;
}

.share-header .brand {
  color: var(--text);
}

.share-header .brand p {
  color: var(--muted);
}

.share-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 20px;
  align-items: start;
}

.share-image {
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f7;
}

.share-info h2 {
  margin: 4px 0 14px;
}

@media (max-width: 860px) {
  .share-card {
    grid-template-columns: 1fr;
  }
}
