:root {
  --bg: #f4f2ed;
  --panel: #fffdf9;
  --ink: #23211d;
  --muted: #78736a;
  --line: #e2ddd3;
  --accent: #9a5b3c;
  --accent-dark: #7d452b;
  --ok: #2d6a4f;
  --warn: #a15c00;
  --danger: #9b2c2c;
  --radius: 14px;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.55; }
code { font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; background: #f1ede5; padding: 1px 5px; border-radius: 4px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 7px 14px; color: var(--ink); }
button:hover { border-color: #c9c0b2; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-dark); }
button.ghost { background: transparent; }
button.small { padding: 4px 9px; font-size: 12px; }
button.danger { color: var(--danger); border-color: #e5c7c7; }
button:disabled { opacity: .55; cursor: not-allowed; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 8px 10px; color: var(--ink); }
textarea { resize: vertical; }
label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; display: grid; gap: 12px; }
legend { padding: 0 6px; color: var(--ink); font-weight: 600; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 26px; border-bottom: 1px solid var(--line); background: rgba(255,253,249,.92); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 700; font-size: 18px; }
.brand div { display: grid; line-height: 1.25; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.topbar-right { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; }
.app { max-width: 1240px; margin: 0 auto; padding: 26px; }
.auth-card { max-width: 430px; margin: 7vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: 0 18px 50px rgba(60,45,30,.08); }
.auth-card h1 { margin: 0 0 8px; font-size: 24px; }
.auth-card form { display: grid; gap: 14px; margin-top: 20px; }
.auth-card button { margin-top: 6px; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; margin: 0; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.console { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; }
.sidebar { display: flex; flex-direction: column; gap: 4px; align-self: start; position: sticky; top: 86px; }
.nav { text-align: left; border: 0; background: transparent; padding: 10px 12px; color: var(--muted); border-radius: 10px; display: flex; align-items: center; justify-content: space-between; }
.nav:hover { background: #efeae1; }
.nav.active { background: var(--panel); color: var(--ink); box-shadow: 0 2px 10px rgba(60,45,30,.06); font-weight: 600; }
.badge { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 26px; min-height: 60vh; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-head h1 { margin: 0 0 2px; font-size: 22px; }
.page-head p { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px; background: #fff; }
.card span { color: var(--muted); font-size: 12px; }
.card strong { font-size: 26px; line-height: 1.2; }
.card strong.warn { color: var(--warn); }
.card small { color: var(--muted); font-size: 11px; }
.section { border-top: 1px solid var(--line); padding-top: 18px; }
.section h2 { font-size: 16px; margin: 0 0 8px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 18px; background: #fff; }
.inline-form label { min-width: 130px; flex: 1; }
.inline-form label:has(textarea) { flex-basis: 100%; }
.inline-form button { flex: none; margin-bottom: 2px; }
.settings-form { max-width: 760px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.table .hash { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: Consolas, monospace; font-size: 11px; }
.table .detail { max-width: 280px; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; border: 1px solid transparent; }
.pill.ok { background: #e4f1e9; color: var(--ok); }
.pill.off { background: #f0ece5; color: var(--muted); }
.pill.admin { background: #f4e6dd; color: var(--accent-dark); }
.empty { color: var(--muted); padding: 26px 0; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.wardrobe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin: 16px 0; }
.wardrobe-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; display: grid; }
.wardrobe-card img { width: 100%; height: 150px; object-fit: cover; background: #eee; }
.wardrobe-card div { padding: 10px 12px 4px; }
.wardrobe-card p { margin: 3px 0 4px; font-size: 12px; }
.wardrobe-card small { color: var(--muted); font-size: 11px; }
.wardrobe-card button { margin: 0 12px 12px; justify-self: start; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.split { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; }
.list { display: grid; gap: 6px; align-content: start; max-height: 620px; overflow: auto; }
.list-item { text-align: left; display: grid; gap: 2px; background: #fff; }
.list-item.active { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.list-item small { color: var(--muted); font-size: 11px; }
.detail { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: #fff; }
.detail h2 { margin: 0 0 4px; font-size: 17px; }
.detail textarea { margin: 12px 0; font-family: Consolas, monospace; font-size: 12px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #2b2823; color: #fff; padding: 9px 18px; border-radius: 999px; box-shadow: 0 12px 30px rgba(0,0,0,.18); z-index: 20; font-size: 13px; }
.toast.error { background: var(--danger); }
@media (max-width: 860px) {
  .console { grid-template-columns: 1fr; }
  .sidebar { position: static; flex-direction: row; overflow: auto; padding-bottom: 4px; }
  .nav { white-space: nowrap; }
  .split { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  .app { padding: 16px; }
}
