:root {
    --navy: #0b1220;
    --navy-soft: #111c31;
    --teal: #14b8a6;
    --teal-dark: #0f9488;
    --blue: #2563eb;
    --amber: #d97706;
    --red: #dc2626;
    --green: #16a34a;
    --ink: #162033;
    --muted: #65708a;
    --line: #e5e9f2;
    --bg: #f4f6fb;
    --card: #ffffff;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
    font-size: 14px;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    flex: 0 0 232px;
    background: radial-gradient(circle at 20% -10%, #1d3557 0%, transparent 45%), var(--navy);
    color: #dbe4f3;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 16px 18px;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; }
.brand-logo {
    width: 42px; height: 42px; border-radius: 12px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #2dd4bf, #0ea5e9);
    color: #06283d; font-weight: 800; font-size: 20px;
    box-shadow: 0 8px 18px rgba(45, 212, 191, .28);
}
.brand-text { display: flex; flex-direction: column; gap: 3px; }
.brand-text strong { color: #fff; font-size: 16px; letter-spacing: .5px; }
.brand-text span { color: #8ea1c2; font-size: 11px; }

.main-nav { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.main-nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 14px; border-radius: 10px;
    color: #b9c5da; font-size: 13.5px; text-decoration: none;
    transition: all .15s ease;
}
.main-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.main-nav a.active {
    background: linear-gradient(90deg, rgba(20, 184, 166, .22), rgba(20, 184, 166, .04));
    color: #fff;
    box-shadow: inset 2px 0 0 var(--teal);
}
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }

.sidebar-foot {
    margin-top: auto; padding: 16px 10px 0;
    border-top: 1px solid rgba(255, 255, 255, .08);
    display: flex; flex-direction: column; gap: 6px;
    color: #7284a4; font-size: 11.5px;
}
.sidebar-foot a { color: #9fb2d1; }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 22px 34px 14px;
}
.topbar-kicker { color: var(--muted); font-size: 11.5px; letter-spacing: 1px; text-transform: uppercase; }
.topbar h1 { margin: 3px 0 0; font-size: 25px; font-weight: 700; letter-spacing: .3px; }
.topbar-user { display: flex; align-items: center; gap: 11px; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #dbeafe, #ccfbf1);
    color: #0f766e; font-weight: 700;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.35; }
.user-meta strong { font-size: 13px; }
.user-meta span { color: var(--muted); font-size: 11.5px; }

.content { padding: 8px 34px 42px; max-width: 1500px; width: 100%; }

.card {
    background: var(--card);
    border: 1px solid rgba(229, 233, 242, .9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-head h2 { margin: 0; font-size: 16px; }
.card-head .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.metric::after {
    content: ""; position: absolute; right: -20px; top: -24px;
    width: 84px; height: 84px; border-radius: 50%;
    background: radial-gradient(circle, rgba(20, 184, 166, .13), transparent 68%);
}
.metric .label { color: var(--muted); font-size: 12px; }
.metric .value { font-size: 28px; font-weight: 700; margin-top: 8px; letter-spacing: .5px; }
.metric .hint { margin-top: 6px; color: #8a94a8; font-size: 11.5px; }
.metric.accent .value { color: var(--teal-dark); }
.metric.warn .value { color: var(--amber); }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
    text-align: left; padding: 11px 12px; color: var(--muted);
    font-weight: 600; font-size: 11.5px; letter-spacing: .4px;
    background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 13px 12px; border-bottom: 1px solid #eef1f7; vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fbfcff; }
.cell-title { font-weight: 600; color: var(--ink); }
.cell-sub { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions form { display: inline-flex; gap: 6px; align-items: center; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid transparent; border-radius: 9px;
    padding: 9px 16px; font-size: 13px; font-family: inherit;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: all .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--teal), var(--teal-dark)); color: #fff; box-shadow: 0 6px 16px rgba(20, 184, 166, .22); }
.btn-primary:hover { color: #fff; box-shadow: 0 8px 20px rgba(20, 184, 166, .3); }
.btn-dark { background: var(--navy-soft); color: #fff; }
.btn-dark:hover { color: #fff; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #c9d2e3; }
.btn-danger { background: #fef2f2; color: var(--red); border-color: #fecaca; }
.btn-danger:hover { color: #b91c1c; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
    background: #f1f5f9; color: #475569; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-green { background: #ecfdf5; color: #15803d; }
.badge-teal { background: #f0fdfa; color: #0f766e; }
.badge-amber { background: #fffbeb; color: #b45309; }
.badge-red { background: #fef2f2; color: #b91c1c; }
.badge-blue { background: #eff6ff; color: #1d4ed8; }
.badge-gray { background: #f1f5f9; color: #64748b; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 13px; }
.alert-success { background: #ecfdf5; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 12.5px; color: #44506a; font-weight: 600; }
.field input, .field select, .field textarea {
    width: 100%; border: 1px solid #d9dfeb; border-radius: 9px;
    padding: 10px 12px; font-size: 13px; font-family: inherit; color: var(--ink);
    background: #fff; outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--teal); box-shadow: 0 0 0 3px rgba(20, 184, 166, .12);
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.field .hint { color: var(--muted); font-size: 11.5px; }
.field .error { color: var(--red); font-size: 11.5px; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }

.filter-bar {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    margin-bottom: 16px;
}
.filter-bar input, .filter-bar select {
    border: 1px solid #d9dfeb; border-radius: 9px; padding: 9px 12px;
    font-size: 13px; font-family: inherit; background: #fff; min-width: 170px;
}
.filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: var(--teal); }
.filter-bar .spacer { flex: 1; }

.inline-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.inline-form .field { min-width: 130px; }
.inline-form .field.grow { flex: 1; min-width: 220px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.page-head h2 { margin: 0 0 5px; font-size: 18px; }
.page-head p { margin: 0; color: var(--muted); font-size: 12.5px; }

.detail-hero {
    display: flex; justify-content: space-between; align-items: center; gap: 20px;
    background: radial-gradient(circle at 100% 0, rgba(20, 184, 166, .1), transparent 35%), var(--card);
    border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.detail-hero h2 { margin: 0 0 8px; font-size: 22px; }
.detail-hero .meta { display: flex; gap: 16px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.detail-hero .expiry { text-align: right; }
.detail-hero .expiry strong { display: block; font-size: 22px; margin-top: 4px; }
.detail-hero .expiry span { color: var(--muted); font-size: 12px; }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 12px; }
.section-title h3 { margin: 0; font-size: 15px; }
.section-title span { color: var(--muted); font-size: 12px; }

.empty { text-align: center; padding: 44px 16px; color: var(--muted); font-size: 13px; }
.empty strong { display: block; color: #475569; font-size: 14px; margin-bottom: 6px; }

.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.code-chip {
    font-family: Consolas, "Courier New", monospace; font-size: 12px;
    background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 7px;
    padding: 4px 8px; color: #0f172a;
}

/* Login */
.login-page {
    min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr;
    background: #eef3f9;
}
.login-art {
    position: relative; overflow: hidden;
    background: radial-gradient(circle at 15% 20%, #1e3a5f 0, transparent 40%),
                radial-gradient(circle at 90% 80%, #0f766e 0, transparent 45%),
                #0b1220;
    color: #fff; padding: 64px; display: flex; flex-direction: column; justify-content: space-between;
}
.login-art::before, .login-art::after {
    content: ""; position: absolute; border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .08);
}
.login-art::before { width: 420px; height: 420px; right: -140px; top: -100px; }
.login-art::after { width: 280px; height: 280px; right: 40px; bottom: -100px; }
.login-brand { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.login-brand .brand-logo { width: 52px; height: 52px; font-size: 24px; }
.login-brand strong { font-size: 20px; display: block; }
.login-brand span { color: #9fb2d1; font-size: 12px; }
.login-copy { position: relative; z-index: 1; max-width: 460px; }
.login-copy h2 { font-size: 38px; line-height: 1.3; margin: 0 0 18px; letter-spacing: .5px; }
.login-copy h2 em { font-style: normal; color: #2dd4bf; }
.login-copy p { color: #a9b8d1; line-height: 1.9; font-size: 14px; margin: 0; }
.login-points { display: flex; gap: 22px; margin-top: 30px; position: relative; z-index: 1; }
.login-point { border-left: 2px solid rgba(45, 212, 191, .55); padding-left: 12px; }
.login-point strong { display: block; font-size: 16px; }
.login-point span { color: #8ea1c2; font-size: 11.5px; }
.login-panel { display: grid; place-items: center; padding: 40px; }
.login-card { width: min(420px, 100%); background: #fff; border-radius: 20px; padding: 38px; box-shadow: 0 24px 60px rgba(15, 23, 42, .12); }
.login-card h3 { margin: 0 0 6px; font-size: 22px; }
.login-card .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 26px; }
.login-card .field { margin-bottom: 16px; }
.login-card .field input { padding: 12px 13px; }
.captcha-row { display: flex; gap: 10px; align-items: stretch; }
.captcha-row input { flex: 1; }
.captcha-row img { height: 44px; width: 132px; border-radius: 9px; border: 1px solid var(--line); cursor: pointer; object-fit: cover; }
.login-footer { text-align: center; color: #94a3b8; font-size: 11.5px; margin-top: 20px; }
.login-error { background: #fef2f2; color: #b91c1c; padding: 10px 12px; border-radius: 9px; font-size: 12.5px; margin-bottom: 16px; }

@media (max-width: 1180px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .sidebar { width: 76px; flex: 0 0 76px; padding: 20px 10px; }
    .brand-text, .main-nav a:not(.active)::after, .sidebar-foot { display: none; }
    .brand { justify-content: center; padding-left: 0; padding-right: 0; }
    .main-nav a { justify-content: center; font-size: 0; }
    .nav-dot { width: 9px; height: 9px; }
    .topbar, .content { padding-left: 20px; padding-right: 20px; }
    .login-page { grid-template-columns: 1fr; }
    .login-art { display: none; }
    .form-grid { grid-template-columns: 1fr; }
}
