:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #d9e0ec;
  --text: #172033;
  --muted: #64748b;
  --blue: #1668dc;
  --blue-dark: #0958d9;
  --green: #0f9f6e;
  --gold: #b7791f;
  --red: #d4380d;
  --shadow: 0 14px 32px rgba(20, 35, 70, .16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 212px;
  flex: 0 0 212px;
  background: #111827;
  color: #f8fafc;
  padding: 22px 14px;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  padding: 0 10px 20px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  height: 40px;
  border: 0;
  border-radius: 6px;
  color: #dbeafe;
  background: transparent;
  text-align: left;
  padding: 0 12px;
}

.nav-item.active,
.nav-item:hover {
  color: #ffffff;
  background: #1d4ed8;
}

.main {
  width: calc(100% - 212px);
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

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

h1 {
  font-size: 26px;
  line-height: 1.3;
}

.topbar p,
.drawer-head p,
.empty-state p,
.modal-panel p {
  color: var(--muted);
  margin-top: 6px;
}

.primary-btn,
.ghost-btn,
.danger-btn,
.icon-btn {
  border-radius: 6px;
  border: 1px solid transparent;
  min-height: 34px;
  padding: 0 14px;
  background: #fff;
}

.primary-btn {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.primary-btn:hover {
  background: var(--blue-dark);
}

.ghost-btn {
  color: var(--text);
  border-color: var(--line);
}

.danger-btn {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.icon-btn {
  min-width: 34px;
  padding: 0;
  font-size: 24px;
  color: var(--muted);
  border-color: var(--line);
}

.notice-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.notice {
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
}

.notice.info {
  color: #123c69;
  background: #e8f1ff;
}

.notice.warning {
  color: #7c4a03;
  background: #fff7d6;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

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

.stat-card {
  padding: 16px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
}

.panel {
  overflow: hidden;
}

.filters {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr auto;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  min-height: 34px;
  padding: 7px 10px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(22, 104, 220, .12);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: var(--muted);
  background: #f8fafc;
  font-weight: 600;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
}

.actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid;
}

.tag.online {
  color: var(--green);
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.tag.draft {
  color: var(--gold);
  background: #fff7ed;
  border-color: #fed7aa;
}

.tag.offline {
  color: #6b7280;
  background: #f3f4f6;
  border-color: #d1d5db;
}

.tag.privacy {
  color: var(--red);
  background: #fff1f0;
  border-color: #ffccc7;
}

.empty-state {
  padding: 46px 16px;
  text-align: center;
}

.drawer,
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.drawer-mask,
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .42);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(720px, 100%);
  height: 100%;
  background: #fff;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.drawer-head,
.drawer-foot {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.drawer-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.drawer-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}

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

.detail-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fbfdff;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 22px 0 12px;
}

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

.field-row {
  display: grid;
  grid-template-columns: 1fr .85fr .55fr .7fr 1.2fr auto;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  color: var(--text);
}

.check-label input {
  width: auto;
  min-height: auto;
}

.field-table {
  margin-top: 12px;
}

.field-table table {
  min-width: 620px;
}

.form-error {
  color: var(--red);
  background: #fff1f0;
  border: 1px solid #ffccc7;
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 12px;
}

.modal-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(460px, calc(100% - 32px));
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.modal-panel label {
  margin-top: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  color: #0f5132;
  background: #d1fae5;
  border: 1px solid #86efac;
  border-radius: 6px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

@media (max-width: 920px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    width: 100%;
    padding: 12px;
  }

  .brand {
    padding-bottom: 10px;
  }

  .nav {
    grid-template-columns: repeat(4, minmax(88px, 1fr));
    overflow-x: auto;
  }

  .main {
    width: 100%;
    padding: 16px;
  }

  .topbar,
  .notice-row {
    align-items: stretch;
  }

  .topbar {
    flex-direction: column;
  }

  .stats,
  .filters,
  .detail-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .field-row {
    grid-template-columns: 1fr;
  }
}
