:root {
  --brown: #8A6D3B;
  --brown-dark: #5a4628;
  --bg: #f5f3ef;
  --card: #fff;
  --line: #e6e1d6;
  --text: #2c2620;
  --muted: #8a8174;
  --danger: #c0392b;
  --ok: #2e7d32;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--brown-dark); }

/* ===== 登录 ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--brown) 0%, var(--brown-dark) 100%); padding: 20px; }
.login-card { width: 360px; max-width: 100%; background: #fff; border-radius: 14px; padding: 36px 32px; box-shadow: 0 20px 60px rgba(0,0,0,.3); display: flex; flex-direction: column; gap: 14px; }
.login-logo { text-align: center; font-size: 24px; font-weight: 700; letter-spacing: 2px; color: var(--brown-dark); }
.login-sub { text-align: center; color: var(--muted); margin-bottom: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 12px; color: var(--muted); }
.field input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; outline: none; }
.field input:focus { border-color: var(--brown); }
.login-error { color: var(--danger); font-size: 12px; }
.login-foot { text-align: center; font-size: 11px; color: var(--muted); }

/* ===== 按钮 ===== */
.btn { border: 1px solid transparent; background: var(--brown-dark); color: #fff; border-radius: 8px; padding: 8px 16px; font-size: 13px; cursor: pointer; transition: opacity .15s; }
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--brown-dark); }
.btn-ghost { background: transparent; color: var(--brown-dark); border-color: var(--line); }
/* 顶栏深色背景上的醒目按钮（导出等） */
.btn-export { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.42); }
.btn-export:hover { background: rgba(255,255,255,.26); }
.btn-danger { background: var(--danger); }
.btn-block { width: 100%; padding: 11px; }
/* 登录页主按钮：渐变 + 上浮阴影 */
.btn-login { width: 100%; padding: 13px; font-size: 15px; font-weight: 600; letter-spacing: 4px; background: linear-gradient(135deg, var(--brown) 0%, var(--brown-dark) 100%); color: #fff; border: none; box-shadow: 0 4px 14px rgba(139,109,59,.4); transition: all .15s; }
.btn-login:hover { opacity: .92; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(139,109,59,.5); }
.btn-login:active { transform: translateY(0); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ===== 主应用 ===== */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 56px; background: var(--brown-dark); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; box-shadow: 0 2px 6px rgba(0,0,0,.1); }
.brand { font-weight: 600; letter-spacing: 1px; }
.top-right { display: flex; align-items: center; gap: 14px; }
.me { font-size: 13px; opacity: .9; }
.link { color: rgba(255,255,255,.85); text-decoration: none; font-size: 13px; }
.link:hover { color: #fff; }

.body { flex: 1; display: flex; min-height: 0; }
.sidebar { width: 180px; background: #fff; border-right: 1px solid var(--line); padding: 12px 0; flex-shrink: 0; }
.nav-item { display: block; padding: 11px 20px; cursor: pointer; color: var(--text); border-left: 3px solid transparent; }
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--bg); border-left-color: var(--brown); color: var(--brown-dark); font-weight: 600; }

.main { flex: 1; padding: 16px 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.search-box { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-box input, .search-box select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; outline: none; }
.search-box input:focus { border-color: var(--brown); }
.toolbar-right { display: flex; gap: 8px; }

.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table th { background: #faf8f3; font-weight: 600; color: var(--brown-dark); position: sticky; top: 0; }
.data-table tbody tr:hover { background: #faf8f3; }
.data-table td.wrap { white-space: normal; word-break: break-all; max-width: 320px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; background: var(--line); color: var(--brown-dark); }
.tag-ok { background: #e7f3e8; color: var(--ok); }
.tag-off { background: #fbe9e7; color: var(--danger); }
.row-actions { display: flex; gap: 6px; }
.empty-hint { padding: 40px; text-align: center; color: var(--muted); }

.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; }
.page-info { font-size: 13px; color: var(--muted); }
.select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }

/* ===== 模态框 ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-card { width: 520px; max-width: 100%; max-height: 90vh; background: #fff; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head span { font-weight: 600; }
.modal-x { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal-body .field input, .modal-body .field select, .modal-body .field textarea { padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; font-family: inherit; outline: none; }
.modal-body .field textarea { min-height: 70px; resize: vertical; }
.modal-body .field input:focus, .modal-body .field select:focus, .modal-body .field textarea:focus { border-color: var(--brown); }
.modal-body .field .hint { font-size: 11px; color: var(--muted); }

/* ===== toast ===== */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: var(--brown-dark); color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 200; box-shadow: 0 6px 20px rgba(0,0,0,.2); font-size: 13px; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
