/* ========== 店铺记账 — 公共样式 ========== */
:root {
    --primary: #2f6fed;
    --primary-dark: #1f56c8;
    --primary-light: #e8effd;
    --green: #22c55e;
    --red: #ef4444;
    --text: #1f2937;
    --text-gray: #6b7280;
    --text-light: #9ca3af;
    --bg: #f5f7fb;
    --card: #ffffff;
    --border: #e5e7eb;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; }

/* ========== 介绍页 ========== */
.nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 32px; background: #fff; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.nav .logo { font-size: 20px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.nav .logo .dot { width: 28px; height: 28px; border-radius: 8px; background: var(--primary); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; }
.nav .links { display: flex; gap: 20px; align-items: center; }
.nav .links a { color: var(--text-gray); font-size: 14px; }
.nav .links a:hover { color: var(--primary); }

.hero {
    text-align: center; padding: 80px 24px 60px;
    background: linear-gradient(180deg, #eef4ff 0%, #f5f7fb 100%);
}
.hero h1 { font-size: 40px; font-weight: 800; color: var(--text); margin-bottom: 16px; }
.hero h1 .accent { color: var(--primary); }
.hero p { font-size: 18px; color: var(--text-gray); max-width: 620px; margin: 0 auto 32px; }
.hero .cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 28px; border-radius: 10px; font-size: 15px; font-weight: 600;
    transition: all .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-ghost:hover { background: var(--primary-light); }

.features { max-width: 1080px; margin: 0 auto; padding: 60px 24px; }
.features h2 { text-align: center; font-size: 28px; margin-bottom: 40px; }
.features .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.feature-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 28px 24px; box-shadow: var(--shadow);
}
.feature-card .icon { width: 44px; height: 44px; border-radius: 10px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 16px; }
.feature-card h3 { font-size: 17px; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text-gray); }

.footer { text-align: center; padding: 40px 24px; color: var(--text-light); font-size: 13px; border-top: 1px solid var(--border); background: #fff; }

/* ========== 后台 ========== */
.admin-body { display: flex; min-height: 100vh; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #eef4ff, #f5f7fb); }
.login-card { background: #fff; border-radius: 16px; padding: 40px 36px; width: 380px; box-shadow: 0 8px 30px rgba(0,0,0,.08); }
.login-card h2 { font-size: 22px; text-align: center; margin-bottom: 6px; }
.login-card .sub { text-align: center; color: var(--text-gray); font-size: 14px; margin-bottom: 28px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--text-gray); margin-bottom: 6px; }
.field input, .field select, .field textarea {
    width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 14px; font-family: inherit; transition: border .2s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; }
.login-error { color: var(--red); font-size: 13px; text-align: center; margin-bottom: 12px; min-height: 18px; }

.sidebar { width: 220px; background: #1f2937; color: #d1d5db; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar .brand { padding: 20px; font-size: 18px; font-weight: 700; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar nav { flex: 1; padding: 12px 0; }
.sidebar nav a {
    display: block; padding: 12px 20px; font-size: 14px; color: #d1d5db;
    border-left: 3px solid transparent; transition: all .15s;
}
.sidebar nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar nav a.active { background: rgba(47,111,237,.15); color: #fff; border-left-color: var(--primary); }
.sidebar .logout { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar .logout a { color: #9ca3af; font-size: 14px; }
.sidebar .logout a:hover { color: var(--red); }

.main { flex: 1; padding: 28px 32px; overflow-x: auto; }
.main .page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.main .page-head h1 { font-size: 24px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-card .label { font-size: 13px; color: var(--text-gray); }
.stat-card .value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.stat-card .value.pos { color: var(--green); }
.stat-card .value.neg { color: var(--red); }
.stat-card .value.income { color: var(--green); }
.stat-card .value.expense { color: var(--red); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card h3 { font-size: 16px; margin-bottom: 16px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--text-gray); font-weight: 600; font-size: 13px; background: #fafbfc; }
tr:hover td { background: #fafbfc; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; }
.tag.income { background: #e8f9ef; color: var(--green); }
.tag.expense { background: #fdeaea; color: var(--red); }
.tag.admin { background: #e8effd; color: var(--primary); }
.tag.editor { background: #fff4e5; color: #f59e0b; }
.tag.viewer { background: #f1f5f9; color: var(--text-gray); }

.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input, .toolbar select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }

.btn-sm { padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.btn-sm.primary { background: var(--primary); color: #fff; }
.btn-sm.danger { background: var(--red); color: #fff; }
.btn-sm.ghost { background: #fff; color: var(--text-gray); border: 1px solid var(--border); }
.btn-sm:hover { opacity: .88; }

.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 14px; padding: 28px; width: 480px; max-width: 92vw; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin-bottom: 20px; }
.modal .actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }

.tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.tabs button { padding: 8px 16px; border-radius: 8px; background: #fff; border: 1px solid var(--border); font-size: 13px; color: var(--text-gray); }
.tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.empty { text-align: center; color: var(--text-light); padding: 40px; font-size: 14px; }
.muted { color: var(--text-gray); font-size: 13px; }
.money-income { color: var(--green); font-weight: 600; }
.money-expense { color: var(--red); font-weight: 600; }
.hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
