:root {
    --ink: #15302f;
    --muted: #6a7d7b;
    --paper: #f5f2e9;
    --panel: #fffdf7;
    --line: #d9ded8;
    --deep: #123c3a;
    --mint: #bce3d4;
    --mint-strong: #5eb89b;
    --orange: #e4864a;
    --red: #b84b4b;
    --shadow: 0 12px 34px rgba(27, 58, 55, .09);
    --radius: 18px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(rgba(18,60,58,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(18,60,58,.035) 1px, transparent 1px),
        var(--paper);
    background-size: 28px 28px;
    font-family: "Noto Sans SC", "Microsoft YaHei UI", sans-serif;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
    min-height: 74px;
    padding: 12px clamp(18px, 4vw, 56px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #f7fbf8;
    background: var(--deep);
    border-bottom: 4px solid var(--mint-strong);
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 42px; height: 42px; display: grid; place-items: center;
    border-radius: 14px 6px 14px 6px; background: var(--mint); color: var(--deep);
    font-family: "STKaiti", "KaiTi", serif; font-size: 24px; font-weight: 700;
}
.brand strong { display: block; font-size: 18px; letter-spacing: .04em; }
.brand small, .user-chip small { display: block; opacity: .68; margin-top: 2px; }
.user-chip { text-align: right; font-size: 14px; }

.desktop-nav {
    height: 52px; padding: 0 clamp(18px, 4vw, 56px); display: flex; align-items: stretch;
    gap: 6px; background: rgba(255,253,247,.96); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px);
}
.desktop-nav a { display: flex; align-items: center; padding: 0 15px; color: var(--muted); font-weight: 700; font-size: 14px; }
.desktop-nav a.active { color: var(--deep); box-shadow: inset 0 -3px var(--mint-strong); }
.desktop-nav a:last-child { margin-left: auto; }

.shell { width: min(1180px, calc(100% - 32px)); margin: 28px auto 94px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: clamp(27px, 4vw, 42px); line-height: 1; font-family: "STKaiti", "KaiTi", serif; }
.page-head p { margin: 8px 0 0; color: var(--muted); }

.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid.two { grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.stat { min-height: 132px; position: relative; overflow: hidden; }
.stat::after { content: attr(data-mark); position: absolute; right: 10px; bottom: -22px; font: 700 88px/1 "STKaiti", serif; color: rgba(18,60,58,.07); }
.stat small { color: var(--muted); font-weight: 700; }
.stat strong { display: block; margin-top: 10px; font-size: 34px; }
.stat.warn strong { color: var(--orange); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 0 0 14px; }
.section-title h2 { margin: 0; font-size: 18px; }

.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; color: var(--muted); font-weight: 800; }
.input, select, textarea {
    width: 100%; border: 1px solid #c8d2cd; border-radius: 12px; background: #fff;
    min-height: 48px; padding: 10px 13px; color: var(--ink); outline: none;
}
.input:focus, select:focus, textarea:focus { border-color: var(--mint-strong); box-shadow: 0 0 0 4px rgba(94,184,155,.16); }
.btn { border: 0; border-radius: 12px; min-height: 46px; padding: 10px 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--deep); color: #fff; font-weight: 800; }
.btn:hover { transform: translateY(-1px); }
.btn.mint { background: var(--mint); color: var(--deep); }
.btn.orange { background: var(--orange); color: #fff; }
.btn.ghost { background: transparent; color: var(--deep); border: 1px solid var(--line); }
.btn.danger { background: var(--red); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.quick-links { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin: 18px 0; }
.quick-link { padding: 20px; min-height: 112px; border-radius: var(--radius); background: var(--deep); color: white; display: flex; flex-direction: column; justify-content: space-between; }
.quick-link:nth-child(2) { background: var(--mint); color: var(--deep); }
.quick-link:nth-child(3) { background: #dce4c2; color: var(--deep); }
.quick-link:nth-child(4) { background: #ead3bf; color: var(--deep); }
.quick-link b { font-size: 18px; }
.quick-link span { font-size: 28px; align-self: flex-end; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; background: #fff; min-width: 720px; }
th, td { text-align: left; padding: 13px 14px; border-bottom: 1px solid #edf0ed; font-size: 14px; }
th { position: sticky; top: 0; background: #eef5f0; color: var(--muted); font-size: 12px; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.qty { font-variant-numeric: tabular-nums; font-weight: 900; }
.qty.low { color: var(--red); }
.pill { display: inline-flex; align-items: center; border-radius: 99px; padding: 5px 9px; background: #e8f2ed; font-size: 12px; font-weight: 800; }
.pill.out { background: #f8e5d8; color: #8b421f; }
.pill.in { background: #ddf2e9; color: #17654f; }
.muted { color: var(--muted); }
.empty { padding: 42px 20px; text-align: center; color: var(--muted); }
.notice { margin-bottom: 18px; padding: 13px 16px; border-radius: 12px; background: #dff2e9; border-left: 4px solid var(--mint-strong); }
.notice.error { background: #f8e2e2; border-left-color: var(--red); }
.notice.warning { background: #faeadc; border-left-color: var(--orange); }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: var(--deep); }
.login-shell { width: min(920px,100%); display: grid; grid-template-columns: 1.05fr .95fr; overflow: hidden; border-radius: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.login-story { padding: clamp(28px,6vw,64px); color: white; background: var(--deep); border: 1px solid rgba(255,255,255,.14); }
.login-story .eyebrow { color: var(--mint); letter-spacing: .18em; font-size: 12px; font-weight: 900; }
.login-story h1 { font: 700 clamp(38px,6vw,66px)/1.02 "STKaiti",serif; margin: 25px 0; }
.login-story p { color: rgba(255,255,255,.68); max-width: 440px; line-height: 1.8; }
.login-card { background: var(--panel); padding: clamp(28px,6vw,64px); display: flex; flex-direction: column; justify-content: center; }
.login-card h2 { margin: 0 0 8px; font-size: 28px; }
.login-card form { display: grid; gap: 16px; margin-top: 28px; }

.mobile-nav { display: none; }
@media (max-width: 820px) {
    .desktop-nav { display: none; }
    .shell { width: min(100% - 22px, 720px); margin-top: 20px; }
    .grid.stats { grid-template-columns: repeat(2,1fr); }
    .grid.two { grid-template-columns: 1fr; }
    .quick-links { grid-template-columns: repeat(2,1fr); }
    .login-shell { grid-template-columns: 1fr; }
    .login-story { display: none; }
    .mobile-nav { display: grid; grid-template-columns: repeat(4,1fr); position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: rgba(255,253,247,.96); border-top: 1px solid var(--line); backdrop-filter: blur(14px); }
    .mobile-nav a { display: grid; justify-items: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 800; }
    .mobile-nav a span { font-size: 22px; line-height: 1; }
    .mobile-nav a.active { color: var(--deep); }
}
@media (max-width: 560px) {
    .topbar { min-height: 66px; padding: 10px 14px; }
    .brand-mark { width: 38px; height: 38px; }
    .brand strong { font-size: 16px; }
    .brand small { display: none; }
    .user-chip span { font-size: 13px; }
    .page-head { align-items: start; }
    .page-head h1 { font-size: 31px; }
    .grid.stats { gap: 10px; }
    .card { padding: 15px; border-radius: 15px; }
    .stat { min-height: 112px; }
    .stat strong { font-size: 28px; }
    .quick-link { min-height: 96px; padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .field.full { grid-column: auto; }
    .btn { width: 100%; }
    .actions { display: grid; grid-template-columns: 1fr; }
}

