/* ==========================================================================
   野果子官网后台 · 样式
   配色取自品牌：深咖底 + 暖棕主色 + 奶油白
   ========================================================================== */
:root {
  --brown-900: #2E2117;
  --brown-800: #3E2C1D;
  --brown-700: #55402C;
  --brand: #B4552A;
  --brand-dark: #95441F;
  --brand-soft: #F3E3D8;
  --cream: #FAF6F1;
  --paper: #FFFFFF;
  --line: #E8DDD2;
  --text: #2E2419;
  --text-2: #6B5B4B;
  --text-3: #9C8B7A;
  --ok: #2E7D4F;
  --ok-soft: #E6F2EA;
  --warn: #9A6A12;
  --warn-soft: #FBF1DC;
  --err: #B02A20;
  --err-soft: #FBE7E4;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(46, 36, 25, .06), 0 6px 18px rgba(46, 36, 25, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--cream); color: var(--text);
  font: 14px/1.65 "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--brand); }

/* ---------------------------------------------------------------- 登录页 */
#login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--brown-900) 0%, var(--brown-700) 60%, #6B4A2E 100%);
  padding: 24px;
}
#login .card {
  width: 100%; max-width: 380px; background: var(--paper);
  border-radius: 16px; padding: 34px 30px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
#login .brandmark { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
#login .brandmark small { display: block; font-weight: 400; font-size: 12px; color: var(--text-3); margin-top: 4px; letter-spacing: 1px; }
#login .field { margin-top: 18px; }
#login button.primary { width: 100%; margin-top: 24px; }
#login .hint { margin-top: 16px; font-size: 12px; color: var(--text-3); line-height: 1.7; }

/* ---------------------------------------------------------------- 布局 */
#app { display: none; min-height: 100vh; grid-template-columns: 226px 1fr; }
#app.on { display: grid; }

aside {
  background: var(--brown-900); color: #EADFD5; padding: 20px 0 28px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
aside .logo { padding: 0 20px 18px; border-bottom: 1px solid rgba(255,255,255,.09); margin-bottom: 14px; }
aside .logo b { display: block; font-size: 15px; color: #fff; letter-spacing: .3px; }
aside .logo span { font-size: 11px; color: #A8968A; letter-spacing: 1.2px; }
aside nav a {
  display: flex; align-items: center; gap: 9px; padding: 9px 20px; cursor: pointer;
  color: #D8CBBF; text-decoration: none; font-size: 13.5px; border-left: 3px solid transparent;
}
aside nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
aside nav a.active { background: rgba(180,85,42,.22); color: #fff; border-left-color: var(--brand); font-weight: 600; }
aside nav a .ic { width: 17px; text-align: center; opacity: .9; }
aside .foot { margin-top: auto; padding: 16px 20px 0; border-top: 1px solid rgba(255,255,255,.09); font-size: 12px; color: #A8968A; }
aside .foot a { color: #D8CBBF; }

main { min-width: 0; display: flex; flex-direction: column; }

header.bar {
  position: sticky; top: 0; z-index: 20; background: rgba(250,246,241,.94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); padding: 11px 22px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
header.bar h1 { font-size: 15px; margin: 0; font-weight: 700; }
header.bar .spacer { flex: 1; }
header.bar .who { font-size: 12.5px; color: var(--text-3); }

.content { padding: 22px; max-width: 1120px; width: 100%; }

/* ---------------------------------------------------------------- 组件 */
.btn {
  border: 1px solid var(--line); background: var(--paper); color: var(--text);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; white-space: nowrap;
  transition: .15s;
}
.btn:hover { border-color: #D6C6B8; background: #FDFBF9; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: rgba(0,0,0,.04); }
.btn.danger { color: var(--err); border-color: #E9C8C3; }
.btn.danger:hover { background: var(--err-soft); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn .ic { margin-right: 5px; }

.card2 {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card2 > h2 {
  font-size: 14.5px; margin: 0 0 4px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.card2 > .sub { font-size: 12.5px; color: var(--text-3); margin-bottom: 14px; line-height: 1.7; }

.grid { display: grid; gap: 12px; }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 23px; font-weight: 700; color: var(--brand); line-height: 1.25; }
.stat span { font-size: 12.5px; color: var(--text-3); }

label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; font-weight: 500; }
label.f > span em { font-style: normal; color: var(--text-3); font-weight: 400; margin-left: 6px; font-size: 11.5px; }
input[type=text], input[type=password], input[type=date], textarea, select {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: #FDFCFB; outline: none; transition: .15s; font-size: 13.5px;
}
input[type=text]:focus, input[type=password]:focus, input[type=date]:focus, textarea:focus, select:focus {
  border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(180,85,42,.10);
}
textarea { min-height: 76px; resize: vertical; line-height: 1.7; }
input:disabled, textarea:disabled { background: #F4F1ED; color: var(--text-3); }
.counter { font-size: 11.5px; color: var(--text-3); text-align: right; margin-top: 3px; }
.counter.over { color: var(--err); }

.hintbox {
  background: var(--brand-soft); border-left: 3px solid var(--brand); border-radius: 6px;
  padding: 10px 13px; font-size: 12.5px; color: var(--brown-700); line-height: 1.75; margin-bottom: 14px;
}
.hintbox.warn { background: var(--warn-soft); border-left-color: var(--warn); color: #6B4A0C; }
.hintbox.ok { background: var(--ok-soft); border-left-color: var(--ok); color: #1E5A38; }

.pill {
  display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11.5px;
  background: var(--brand-soft); color: var(--brand-dark); font-weight: 600;
}
.pill.gray { background: #EFEAE4; color: var(--text-2); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.err { background: var(--err-soft); color: var(--err); }

/* 折叠分组 */
.group { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; background: var(--paper); }
.group > .gh {
  padding: 11px 15px; cursor: pointer; display: flex; align-items: center; gap: 9px;
  background: #FCFAF8; user-select: none;
}
.group > .gh:hover { background: #F7F3EE; }
.group > .gh b { font-size: 13.5px; }
.group > .gh .chev { color: var(--text-3); transition: .18s; font-size: 11px; }
.group.open > .gh .chev { transform: rotate(90deg); }
.group > .gb { display: none; padding: 15px; border-top: 1px solid var(--line); }
.group.open > .gb { display: block; }

/* 卡片编辑器 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.pcard { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.pcard > .ph {
  padding: 9px 13px; background: #FCFAF8; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--brown-700);
}
.pcard > .pb { padding: 14px; }
.pcard .thumb {
  width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 7px; background: #F2EDE7;
  border: 1px solid var(--line); display: block;
}
.pcard .pickerow { display: flex; gap: 7px; margin-top: 7px; }

/* 图片库 */
.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
.imgc { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--paper); }
.imgc img { width: 100%; height: 108px; object-fit: cover; display: block; background: #F2EDE7; }
.imgc .m { padding: 7px 9px; font-size: 11.5px; color: var(--text-3); }
.imgc .m b { display: block; color: var(--text-2); font-weight: 500; font-size: 12px; word-break: break-all; }

/* 动态列表 */
.newsrow {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--paper); margin-bottom: 8px;
}
.newsrow .t { flex: 1; min-width: 0; }
.newsrow .t b { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.newsrow .t span { font-size: 12px; color: var(--text-3); }

/* 终端日志 */
.term {
  background: #221A13; color: #D9CEC2; border-radius: 9px; padding: 13px 15px;
  font: 12px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  max-height: 340px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}
.term .ok { color: #7FD3A0; }
.term .err { color: #FF9A8E; }

table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th { text-align: left; padding: 9px 10px; border-bottom: 2px solid var(--line); color: var(--text-2); font-size: 12.5px; font-weight: 600; }
table.tb td { padding: 9px 10px; border-bottom: 1px solid #F0EAE3; }
table.tb tr:last-child td { border-bottom: none; }

/* 提示条 */
#toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px;
}
#toast .t {
  background: var(--brown-900); color: #fff; padding: 10px 16px; border-radius: 9px; font-size: 13px;
  box-shadow: 0 8px 26px rgba(0,0,0,.28); animation: pop .22s ease; max-width: 380px;
}
#toast .t.ok { background: #1E5A38; }
#toast .t.err { background: #8E211A; }
#toast .t.warn { background: #8A5E10; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

.modal-mask {
  position: fixed; inset: 0; background: rgba(46,36,25,.55); z-index: 150;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-mask .modal {
  background: var(--paper); border-radius: 13px; max-width: 720px; width: 100%;
  max-height: 82vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal-mask .modal > .mh { padding: 15px 20px; border-bottom: 1px solid var(--line); font-weight: 700; display: flex; align-items: center; }
.modal-mask .modal > .mh .spacer { flex: 1; }
.modal-mask .modal > .mb { padding: 18px 20px; overflow: auto; }
.modal-mask .modal > .mf { padding: 13px 20px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-end; }

.muted { color: var(--text-3); font-size: 12.5px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }
hr.sep { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
code.k { background: #F3EEE8; padding: 1px 6px; border-radius: 5px; font-size: 12px; word-break: break-all; }

input[type=checkbox] { width: auto; }

@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  aside { position: static; height: auto; }
  .content { padding: 14px; }
}
