/* 玉花园 管理后台 · 油画复古风 */
:root {
  --ink:      #2c2620;
  --ink-2:    #5b5147;
  --ink-3:    #8b8073;
  --line:     #e3dbcd;
  --line-2:   #d3c7b3;
  --paper:    #f7f3ea;
  --paper-2:  #fffdf8;
  --cream:    #efe7d7;
  --olive:    #6f7a52;
  --olive-d:  #58613f;
  --rose:     #a8574f;
  --gold:     #ac8b52;
  --shadow:   0 8px 30px rgba(64, 52, 38, .10);
  --shadow-lg:0 20px 60px rgba(64, 52, 38, .18);
  --r:        14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ================= 登录 ================= */
.login-wrap { display: flex; min-height: 100vh; }

.login-art {
  flex: 1.35;
  background:
    linear-gradient(to bottom, rgba(44,38,32,.28), rgba(44,38,32,.55)),
    url("https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=classical%20oil%20painting%20romantic%20european%20garden%20roses%20arch%20golden%20hour%20light%20vintage%20botanical%20rich%20brush%20texture%20museum%20quality&image_size=portrait_4_3") center/cover no-repeat;
  position: relative;
}
.login-art::after {
  content: "把一年四季，收进一座花园";
  position: absolute; left: 56px; bottom: 60px;
  color: #f4ece0; font-size: 26px; letter-spacing: 6px;
  text-shadow: 0 2px 16px rgba(0,0,0,.5);
}

.login-panel {
  flex: 1; min-width: 420px;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper-2);
  padding: 40px;
}
.login-box { width: 100%; max-width: 340px; }

.brand { text-align: center; margin-bottom: 36px; }
.brand-mark {
  width: 62px; height: 62px; margin: 0 auto 16px;
  border: 1px solid var(--line-2); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: var(--olive);
  background: var(--cream);
}
.brand h1 { font-size: 28px; letter-spacing: 8px; font-weight: 500; }
.brand-sub { color: var(--ink-3); font-size: 12px; letter-spacing: 2px; margin-top: 8px; }

.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: 12px; color: var(--ink-3);
  letter-spacing: 2px; margin-bottom: 7px;
}
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper-2); color: var(--ink);
  font-family: inherit; font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--olive);
  box-shadow: 0 0 0 3px rgba(111,122,82,.12);
}
.field textarea { resize: vertical; min-height: 92px; line-height: 1.8; }
.field-hint { font-size: 11px; color: var(--ink-3); margin-top: 5px; }
.login-tip { text-align: center; font-size: 11px; color: var(--ink-3); margin-top: 18px; }

/* ================= 按钮 ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border: 1px solid var(--line-2); border-radius: 9px;
  background: var(--paper-2); color: var(--ink);
  font-family: inherit; font-size: 13px; cursor: pointer;
  transition: all .18s;
}
.btn:hover { border-color: var(--olive); color: var(--olive-d); transform: translateY(-1px); }
.btn-primary { background: var(--olive); border-color: var(--olive); color: #fff; }
.btn-primary:hover { background: var(--olive-d); border-color: var(--olive-d); color: #fff; }
.btn-danger { color: var(--rose); border-color: #e2c8c4; }
.btn-danger:hover { background: var(--rose); border-color: var(--rose); color: #fff; }
.btn-lg { width: 100%; padding: 13px; font-size: 15px; letter-spacing: 4px; }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 7px; }
.btn-text {
  background: none; border: none; color: var(--ink-3);
  font-family: inherit; font-size: 12px; cursor: pointer;
  padding: 4px 0; text-align: left; transition: color .18s;
}
.btn-text:hover { color: var(--olive); }
.btn-text.danger:hover { color: var(--rose); }

/* ================= 布局 ================= */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 226px; flex-shrink: 0;
  background: linear-gradient(180deg, #322b23, #241f1a);
  color: #cfc6b8;
  display: flex; flex-direction: column;
  padding: 26px 0 20px;
  position: sticky; top: 0; height: 100vh;
}
.logo { display: flex; align-items: center; gap: 12px; padding: 0 24px 28px; }
.logo-mark {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(207,198,184,.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #e6dccb;
}
.logo-text { display: flex; flex-direction: column; line-height: 1.4; }
.logo-text strong { font-size: 17px; letter-spacing: 4px; color: #f0e8da; font-weight: 500; }
.logo-text span { font-size: 11px; letter-spacing: 2px; color: #8d8477; }

.menu { flex: 1; padding: 0 12px; }
.menu-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; margin-bottom: 3px; border-radius: 9px;
  color: #b8afa1; font-size: 14px; letter-spacing: 1px;
  cursor: pointer; user-select: none;
  transition: all .18s;
}
.menu-item i { font-style: normal; font-size: 14px; opacity: .75; width: 16px; text-align: center; }
.menu-item:hover { background: rgba(255,255,255,.05); color: #e8e0d2; }
.menu-item.active {
  background: rgba(163,178,124,.16); color: #dbe4c2;
  box-shadow: inset 2px 0 0 #a3b27c;
}

.sidebar-foot {
  padding: 18px 24px 0; border-top: 1px solid rgba(255,255,255,.07);
  display: flex; flex-direction: column; gap: 7px;
}
.admin-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #d5ccbe; margin-bottom: 6px; }
.admin-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: #9db065; }
.sidebar-foot .btn-text { color: #8d8477; }
.sidebar-foot .btn-text:hover { color: #cfc6b8; }

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

.topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; padding: 26px 34px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 22px; font-weight: 500; letter-spacing: 3px; }
.page-desc { font-size: 12px; color: var(--ink-3); letter-spacing: 1px; margin-top: 4px; }
.topbar-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

.content { flex: 1; padding: 26px 34px 50px; }

/* ================= 卡片 / 表格 ================= */
.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 22px;
}
.card-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h3 { font-size: 15px; font-weight: 500; letter-spacing: 2px; }
.card-body { padding: 18px 20px; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat {
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 20px 22px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::before {
  content: ''; position: absolute; right: -18px; top: -18px;
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--cream); opacity: .55;
}
.stat b { display: block; font-size: 30px; font-weight: 500; color: var(--olive-d); position: relative; }
.stat span { font-size: 12px; color: var(--ink-3); letter-spacing: 2px; position: relative; }

table { width: 100%; border-collapse: collapse; table-layout: auto; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { color: var(--ink-3); font-weight: 400; font-size: 12px; letter-spacing: 2px; background: #faf7f0; white-space: nowrap; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #fbf8f1; }
td.actions { white-space: nowrap; }
td.actions .btn { margin-right: 5px; }
/* 表格排版：避免窄列导致文字竖排 */
.card { overflow-x: auto; }
td.c-name { min-width: 130px; }
td.c-meta { min-width: 120px; }
td.c-tags { min-width: 150px; }
td.c-nowrap { white-space: nowrap; }

.thumb {
  width: 56px; height: 42px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--line); background: var(--cream); display: block;
}

.tag {
  display: inline-block; padding: 2px 9px; margin: 0 4px 4px 0;
  border: 1px solid var(--line-2); border-radius: 20px;
  font-size: 11px; color: var(--ink-2); background: #fbf8f1;
  white-space: nowrap;
}
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; letter-spacing: 1px; white-space: nowrap; }
.badge.on { background: #edf1e0; color: var(--olive-d); }
.badge.off { background: #f4ecea; color: var(--rose); }

.empty { padding: 60px 20px; text-align: center; color: var(--ink-3); font-size: 13px; letter-spacing: 2px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar input, .toolbar select {
  padding: 8px 13px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--paper-2); font-family: inherit; font-size: 13px; color: var(--ink);
}
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--olive); }
.toolbar input[type=search] { min-width: 220px; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 18px 0 0; font-size: 13px; color: var(--ink-3); }

/* ================= 图鉴卡片 / 小程序码 ================= */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }
.qr-card {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; text-align: center; box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.qr-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.qr-card img.qr { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.qr-card .qr-ph {
  width: 100%; aspect-ratio: 1; border: 1px dashed var(--line-2); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); font-size: 12px; background: #fbf8f1;
}
.qr-card h4 { font-size: 14px; font-weight: 500; margin: 11px 0 2px; letter-spacing: 1px; }
.qr-card p { font-size: 11px; color: var(--ink-3); margin-bottom: 11px; }
.qr-card .btn { width: 100%; }
.qr-card .btn + .btn { margin-top: 6px; }

/* ================= 弹窗 ================= */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-mask { position: absolute; inset: 0; background: rgba(44,38,32,.5); backdrop-filter: blur(3px); }
.modal-box {
  position: relative; width: 100%; max-width: 760px; max-height: 88vh;
  background: var(--paper-2); border-radius: var(--r);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: pop .22s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-head {
  padding: 18px 24px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { font-size: 17px; font-weight: 500; letter-spacing: 3px; }
.modal-close { background: none; border: none; font-size: 17px; color: var(--ink-3); cursor: pointer; }
.modal-close:hover { color: var(--rose); }
.modal-body { padding: 22px 24px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 15px 24px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }

/* 图片上传 */
.uploader { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.up-item { position: relative; width: 92px; height: 92px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); }
.up-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.up-item .del {
  position: absolute; top: 3px; right: 3px; width: 19px; height: 19px;
  border-radius: 50%; border: none; background: rgba(44,38,32,.72); color: #fff;
  font-size: 11px; cursor: pointer; line-height: 19px; text-align: center; padding: 0;
}
.up-add {
  width: 92px; height: 92px; border: 1px dashed var(--line-2); border-radius: 9px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--ink-3); font-size: 11px; cursor: pointer;
  background: #fbf8f1; transition: all .18s;
}
.up-add:hover { border-color: var(--olive); color: var(--olive); }
.up-add span { font-size: 19px; line-height: 1; }

/* Toast / Loading */
.toast {
  position: fixed; left: 50%; top: 34px; transform: translateX(-50%) translateY(-24px);
  padding: 11px 24px; border-radius: 10px;
  background: rgba(44,38,32,.93); color: #f4ece0;
  font-size: 13px; letter-spacing: 1px; z-index: 300;
  opacity: 0; pointer-events: none; transition: all .26s;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #8f4640; }

.loading { position: fixed; inset: 0; z-index: 250; display: flex; align-items: center; justify-content: center; background: rgba(247,243,234,.55); }
.spinner {
  width: 30px; height: 30px; border: 2px solid var(--line-2);
  border-top-color: var(--olive); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 花季月份选择 */
.bloom-row { display: flex; align-items: center; gap: 10px; }
.bloom-row select {
  flex: 1; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--paper-2); font-family: inherit;
  font-size: 14px; color: var(--ink);
}
.bloom-row select:focus { outline: none; border-color: var(--olive); }
.bloom-dash { color: var(--ink-3); font-size: 14px; }

/* 响应式 */
@media (max-width: 1000px) {
  .login-art { display: none; }
  .sidebar { width: 66px; }
  .logo-text, .menu-item span, .sidebar-foot .btn-text, .admin-chip span { display: none; }
  .logo { justify-content: center; padding: 0 0 22px; }
  .menu-item { justify-content: center; padding: 12px 0; }
  .menu-item i { width: auto; }
  .sidebar-foot { align-items: center; padding: 14px 0 0; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar, .content { padding-left: 18px; padding-right: 18px; }
}
