/* 观象内容工坊 · base */
:root {
  --paper: #f4efe4;
  --paper-2: #fbf8f1;
  --paper-3: #efe7d8;
  --ink: #211f1b;
  --ink-2: #3a3731;
  --muted: #7a7266;
  --muted-2: #9a9183;
  --line: #d9d0bf;
  --line-strong: #c5b9a3;
  --red: #a83a2c;
  --red-soft: #f3ded8;
  --green: #3f6b52;
  --green-soft: #e1ece4;
  --amber: #a8752b;
  --amber-soft: #f4e8d2;
  --blue: #3f5f78;
  --blue-soft: #e0e9ee;
  --danger: #9d2f22;
  --title-font: "STSong", "SimSun", "Songti SC", "Noto Serif SC", serif;
  --body-font: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  --shadow: 0 1px 0 rgba(33, 31, 27, .04), 0 8px 24px rgba(33, 31, 27, .05);
  --radius: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, .8), transparent 34%),
    radial-gradient(circle at 100% 100%, rgba(168, 58, 44, .04), transparent 40%),
    var(--paper);
  color: var(--ink);
  font-family: var(--body-font);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--red); }
::selection { background: rgba(168, 58, 44, .18); }

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

/* ---------- sidebar ---------- */
.sidebar {
  width: 236px;
  flex: 0 0 236px;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, .05), transparent 34%),
    #1f1d1a;
  color: #efe7d8;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  overflow-y: auto;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 22px;
  border-bottom: 1px solid rgba(244, 239, 228, .12);
}

.brand-seal {
  width: 42px;
  height: 42px;
  border-radius: 4px;
  background: var(--red);
  color: #f8f2e6;
  display: grid;
  place-items: center;
  font-family: var(--title-font);
  font-size: 24px;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28);
  flex: 0 0 42px;
}

.brand-name {
  font-family: var(--title-font);
  font-size: 18px;
  letter-spacing: .08em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 9px;
  letter-spacing: .22em;
  color: rgba(244, 239, 228, .5);
  margin-top: 3px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(244, 239, 228, .68);
  text-align: left;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 13px;
  letter-spacing: .02em;
  transition: .18s ease;
}

.nav-item svg { width: 17px; height: 17px; opacity: .8; flex: 0 0 17px; }
.nav-item:hover { color: #fff8ee; background: rgba(244, 239, 228, .06); }
.nav-item.active {
  color: #fff8ee;
  background: rgba(244, 239, 228, .10);
  box-shadow: inset 2px 0 0 var(--red);
}
.nav-item.active svg { opacity: 1; color: #e8b7a4; }

.nav-label {
  font-size: 10px;
  letter-spacing: .18em;
  color: rgba(244, 239, 228, .35);
  padding: 10px 12px 4px;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(244, 239, 228, .12);
  padding: 14px 10px 2px;
  font-size: 11px;
  color: rgba(244, 239, 228, .42);
}

.sidebar-footer .link-btn { color: rgba(244, 239, 228, .7); }
.sidebar-footer .link-btn:hover { color: #fff8ee; }

/* ---------- main ---------- */
.main {
  flex: 1;
  min-width: 0;
  padding: 0 38px 70px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 0 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 4px;
}

.topbar h1 {
  margin: 0;
  font-family: var(--title-font);
  font-size: 30px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: .04em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.account-switcher {
  min-width: 148px;
  max-width: 220px;
  font-size: 12px;
}

.view { max-width: 1320px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff8ee;
  border-radius: 7px;
  padding: 8px 14px;
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: .02em;
  transition: .16s ease;
  white-space: nowrap;
}
.btn:hover { background: #35322c; border-color: #35322c; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: rgba(255, 255, 255, .5); border-color: var(--ink-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: rgba(33, 31, 27, .05); color: var(--ink); }
.btn.danger { background: transparent; border-color: #d9b3a9; color: var(--danger); }
.btn.danger:hover { background: var(--red-soft); }
.btn.small { padding: 5px 9px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.link-btn {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover { color: var(--red); }

.icon-btn {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}
.icon-btn:hover { background: rgba(255, 255, 255, .6); color: var(--ink); }

/* ---------- cards / layout ---------- */
.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-pad { padding: 20px 22px; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 30px 0 14px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--title-font);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .04em;
}
.section-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

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

.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.nowrap { white-space: nowrap; }

/* ---------- badges / chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.6;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.red { background: var(--red-soft); color: var(--danger); border-color: #e7c4ba; }
.badge.green { background: var(--green-soft); color: var(--green); border-color: #c8dbce; }
.badge.amber { background: var(--amber-soft); color: var(--amber); border-color: #e4d2b3; }
.badge.blue { background: var(--blue-soft); color: var(--blue); border-color: #c9dbe4; }
.badge.gray { background: #eee9df; color: var(--muted); border-color: var(--line); }
.badge.ink { background: var(--ink); color: #fff8ee; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .35);
  color: var(--muted);
  padding: 3px 9px;
  font-size: 11px;
  cursor: pointer;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff8ee; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label {
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--muted);
}
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .55);
  color: var(--ink);
  border-radius: 7px;
  padding: 8px 10px;
  outline: none;
  transition: .15s ease;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--red);
  background: #fffdf8;
  box-shadow: 0 0 0 3px rgba(168, 58, 44, .08);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.8; }
.input::placeholder, .textarea::placeholder { color: #aaa092; }

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

.search {
  position: relative;
}
.search .input { padding-left: 32px; }
.search::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 13px;
  height: 13px;
  transform: translateY(-50%);
  border: 1.5px solid var(--muted-2);
  border-radius: 50%;
  pointer-events: none;
}
.search::after {
  content: "";
  position: absolute;
  left: 22px;
  top: 50%;
  width: 6px;
  height: 1.5px;
  background: var(--muted-2);
  transform: translateY(4px) rotate(45deg);
  pointer-events: none;
}

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 22, 19, .48);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 20px 30px;
  overflow-y: auto;
  animation: fade .18s ease;
}
.modal {
  width: min(760px, 100%);
  background: var(--paper-2);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(20, 18, 15, .28);
  animation: rise .2s ease;
}
.modal.wide { width: min(1000px, 100%); }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 {
  margin: 0;
  font-family: var(--title-font);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .03em;
}
.modal-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.modal-body { padding: 20px 22px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- toast ---------- */
.toast-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.toast {
  background: var(--ink);
  color: #fff8ee;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 12px;
  box-shadow: 0 10px 30px rgba(20, 18, 15, .2);
  animation: rise .2s ease;
  max-width: 340px;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--green); }

/* ---------- error ---------- */
.error-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: #7d1f16;
  color: #fff;
  padding: 10px 16px;
  font-size: 12px;
  white-space: pre-wrap;
}

/* ---------- misc ---------- */
.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .28);
}
.empty strong { display: block; color: var(--ink); font-family: var(--title-font); font-size: 18px; margin-bottom: 4px; }

.divider { height: 1px; background: var(--line); margin: 16px 0; }

.kv { display: flex; justify-content: space-between; gap: 14px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 12px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }

.progress {
  height: 6px;
  background: #e6ddcd;
  border-radius: 99px;
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  background: var(--ink);
  border-radius: inherit;
}

.seal-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: var(--red);
  color: #fff8ee;
  border-radius: 3px;
  font-family: var(--title-font);
  font-size: 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, .35);
}

.stars { color: var(--amber); letter-spacing: .08em; }

.scroll-x { overflow-x: auto; }
.scroll-y { overflow-y: auto; }
