/* 零活小工管理后台 —— 自包含样式，无外部依赖 */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
:root { --footer-height: 40px; }
body {
    font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f6f2ea; color: #2f2a22; font-size: 14px; line-height: 1.6;
}
a { color: #8a6a3b; text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
.small { font-size: 12px; }
.muted { color: #9a9186; }

/* ---- 布局 ---- */
.shell { display: flex; min-height: calc(100vh - var(--footer-height)); }
.sidebar {
    width: 210px; flex-shrink: 0; background: #2f2a22; color: #d8d2c6;
    display: flex; flex-direction: column; position: sticky; top: 0; height: calc(100vh - var(--footer-height));
}
.brand { padding: 22px 18px 14px; font-size: 18px; font-weight: 700; color: #f7f3ec; letter-spacing: 2px; }
.brand span { display: block; font-size: 12px; font-weight: 400; color: #9a9186; letter-spacing: 4px; margin-top: 2px; }
.menu { flex: 1; padding: 8px; }
.menu a {
    display: block; padding: 9px 14px; border-radius: 8px; color: #cfc8ba; margin-bottom: 2px;
}
.menu a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
.menu a.active { background: #8a6a3b; color: #fffdf8; font-weight: 600; }
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.sidebar-footer .who { color: #f7f3ec; font-weight: 600; }
.sidebar-footer .who-sub { color: #9a9186; margin-bottom: 8px; }
.sidebar-footer button {
    width: 100%; padding: 6px; background: transparent; color: #9a9186;
    border: 1px solid rgba(255,255,255,.15); border-radius: 6px; cursor: pointer;
}
.sidebar-footer button:hover { color: #f7f3ec; border-color: #8a6a3b; }

.main { flex: 1; padding: 24px 28px; min-width: 0; }
h1 { font-size: 20px; margin-bottom: 18px; color: #241f18; }
h2 { font-size: 15px; margin-bottom: 12px; color: #4a4034; }

/* ---- 登录页 ---- */
.login-wrap { min-height: calc(100vh - var(--footer-height)); display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #f2e7d2, #d9c9a8); }
.login-card {
    width: 360px; background: #fffdf8; border-radius: 14px; padding: 36px 32px;
    box-shadow: 0 18px 50px rgba(63, 48, 26, .18);
}
.brand-lg { font-size: 26px; font-weight: 800; letter-spacing: 4px; text-align: center; color: #241f18; }
.login-sub { text-align: center; color: #8a6a3b; letter-spacing: 6px; font-size: 13px; margin: 4px 0 26px; }
.login-card label { display: block; margin-bottom: 14px; font-size: 13px; color: #4a4034; }
.login-card input {
    display: block; width: 100%; margin-top: 4px; padding: 9px 12px; border: 1px solid #e4dcc8;
    border-radius: 8px; font-size: 14px; background: #faf7f0;
}
.login-card input:focus { outline: none; border-color: #8a6a3b; }

/* ---- 页脚备案信息（所有后台页 + 登录页共用）---- */
.site-footer {
    height: var(--footer-height); line-height: var(--footer-height);
    text-align: center; font-size: 12px; color: #9a9186;
    background: #f6f2ea; border-top: 1px solid #e8e0d0;
}
.site-footer a { color: #8d8578; }
.site-footer a:hover { color: #8a6a3b; }
.site-footer .sep { margin: 0 8px; color: #c6bda9; }

/* ---- 通用组件 ---- */
.btn {
    display: inline-block; padding: 7px 14px; border-radius: 8px; border: 1px solid #d8cdb6;
    background: #fffdf8; color: #4a4034; cursor: pointer; font-size: 13px; line-height: 1.4;
}
.btn:hover { border-color: #8a6a3b; text-decoration: none; }
.btn.primary { background: #8a6a3b; border-color: #8a6a3b; color: #fffdf8; }
.btn.primary:hover { background: #75592f; }
.btn.tiny { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.btn.danger { color: #b23a2e; border-color: #dcb4ae; }
.btn.danger:hover { border-color: #b23a2e; }
.btn.block { width: 100%; padding: 10px; font-size: 15px; }
button.btn { appearance: none; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.flash.success { background: #eaf3e6; color: #3f6c3a; border: 1px solid #cbe0c3; }
.flash.error { background: #faeae8; color: #b23a2e; border: 1px solid #f0d2cd; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar input, .toolbar select {
    padding: 7px 10px; border: 1px solid #d8cdb6; border-radius: 8px; background: #fffdf8; font-size: 13px;
}
.toolbar-stat { color: #9a9186; font-size: 12px; margin-left: auto; }

table { width: 100%; border-collapse: collapse; background: #fffdf8; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(63,48,26,.06); }
th { text-align: left; font-size: 12px; color: #8d8578; font-weight: 600; padding: 10px 12px; background: #f5efe3; white-space: nowrap; }
td { padding: 10px 12px; border-top: 1px solid #f0e9db; vertical-align: middle; }
tr:hover td { background: #fbf7ef; }
td.empty, .empty { text-align: center; color: #9a9186; padding: 30px; }
td.actions { display: flex; gap: 6px; flex-wrap: wrap; }
td.actions form { display: inline; }

.pagination { display: flex; gap: 6px; list-style: none; margin: 16px 0; flex-wrap: wrap; }
.pagination li a, .pagination li span {
    display: inline-block; padding: 5px 11px; border-radius: 6px; border: 1px solid #d8cdb6;
    background: #fffdf8; font-size: 13px; color: #4a4034;
}
.pagination li.active span { background: #8a6a3b; border-color: #8a6a3b; color: #fffdf8; }
.pagination li.disabled span { color: #c6bda9; border-color: #ece4d2; }

/* ---- 统计卡片 ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: #fffdf8; border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(63,48,26,.06); }
.stat-label { font-size: 12px; color: #8d8578; }
.stat-value { font-size: 24px; font-weight: 700; color: #241f18; margin: 4px 0 2px; }
.stat-sub { font-size: 12px; color: #9a9186; }

.panel { background: #fffdf8; border-radius: 12px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(63,48,26,.06); margin-bottom: 16px; min-width: 0; }
.panel.narrow { max-width: 640px; }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.panel-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { padding: 6px 10px; border: 1px solid #d8cdb6; border-radius: 8px; font-size: 13px; }

/* ---- 表单 ---- */
.panel form label { display: block; margin-bottom: 14px; font-size: 13px; color: #4a4034; }
.panel form input:not([type=checkbox]):not([type=submit]), .panel form select, .panel form textarea {
    display: block; width: 100%; margin-top: 4px; padding: 8px 11px; border: 1px solid #e4dcc8;
    border-radius: 8px; font-size: 14px; background: #faf7f0;
}
.panel form textarea { font-size: 12px; }
.panel form input:focus, .panel form select:focus, .panel form textarea:focus { outline: none; border-color: #8a6a3b; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12px; color: #9a9186; margin: -6px 0 14px; }
.row-form { display: inline; }

/* ---- 详情 ---- */
.detail-grid { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.kv { display: grid; grid-template-columns: 88px 1fr; gap: 6px 10px; font-size: 13px; }
.kv dt { color: #8d8578; }
.kv dd { color: #241f18; word-break: break-all; }

/* ---- 素材/作品媒体墙 ---- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.media-card { background: #fffdf8; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(63,48,26,.08); }
.media-thumb { aspect-ratio: 4/3; background: #f0e9db; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-meta { padding: 10px 12px; }
.media-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-sub { font-size: 11px; color: #9a9186; margin-top: 2px; }
.media-delete { margin-top: 8px; }

/* ---- RBAC ---- */
.tag { display: inline-block; background: #f5efe3; border: 1px solid #e4dcc8; color: #6b6154; font-size: 12px; border-radius: 999px; padding: 1px 10px; margin: 2px 4px 2px 0; }
.tag code { font-size: 11px; color: #9a9186; }
.perm-cloud { margin: 8px 0; }
.perm-group { margin-bottom: 10px; }
.perm-group > strong { display: inline-block; min-width: 64px; color: #4a4034; font-size: 13px; }
.perm-matrix { border: 1px solid #e4dcc8; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.perm-matrix legend { padding: 0 6px; font-size: 13px; color: #8a6a3b; }
.perm-matrix label.check { display: inline-flex; align-items: center; gap: 5px; margin: 3px 14px 3px 0; font-size: 13px; }

@media (max-width: 900px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .detail-grid { grid-template-columns: 1fr; }
}
