:root {
    color-scheme: light;
    --bg: #f5f8fc;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #102235;
    --muted: #6d7f91;
    --border: #dde6ef;
    --primary: #0aa483;
    --primary-dark: #087761;
    --primary-soft: #e8f8f3;
    --danger: #d94d5c;
    --sidebar: #0d2a3a;
    font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 220px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; background: linear-gradient(180deg, #102e3f, #0b2332); color: #dceaf0; padding: 20px 14px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 22px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(145deg, #16c7a1, #079476); color: white; font-weight: 800; font-size: 21px; box-shadow: 0 8px 22px #001c2538; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 2px; color: #8eb0bf; text-transform: uppercase; font-size: 9px; letter-spacing: .12em; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 0 12px; border-radius: 11px; color: #a9c1cd; font-weight: 650; font-size: 13px; }
.sidebar nav a span { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: #173a4b; }
.sidebar nav a.active, .sidebar nav a:hover { background: #124659; color: white; }
.sidebar nav a.active { box-shadow: inset 3px 0 #1dd4ab; }
.side-note { margin-top: auto; display: flex; gap: 9px; align-items: center; padding: 12px; border-radius: 11px; background: #153849; }
.side-note .dot, .api-hint .dot { width: 8px; height: 8px; border-radius: 50%; background: #21c79d; box-shadow: 0 0 0 4px #21c79d1f; }
.side-note strong, .side-note small { display: block; }
.side-note strong { font-size: 11px; }
.side-note small { color: #85a7b7; font-size: 9px; margin-top: 2px; }

.workspace { min-width: 0; }
.topbar { height: 66px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 10; }
.topbar > div:first-child small, .topbar > div:first-child strong { display: block; }
.topbar > div:first-child small { color: var(--primary); font-weight: 800; letter-spacing: .12em; font-size: 9px; }
.topbar > div:first-child strong { font-size: 17px; margin-top: 3px; }
.account { display: flex; align-items: center; gap: 9px; border: 1px solid var(--border); border-radius: 12px; padding: 6px 12px 6px 7px; background: #fff; }
.account .avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--primary); color: white; font-weight: 800; }
.account strong, .account small { display: block; }
.account strong { font-size: 12px; }
.account small { color: var(--muted); font-size: 9px; margin-top: 2px; }
.topbar > form { display: inline-block; margin-left: 8px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 11px; background: white; color: var(--text); }
.topbar > .account, .topbar > form { vertical-align: middle; }
.topbar { gap: 8px; }

main { padding: 24px 28px 40px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-head small, .panel-head small, .panel > small, .create-card > small, .docs-grid article > small { color: var(--primary); font-weight: 800; letter-spacing: .12em; font-size: 9px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: 27px; }
h2 { margin: 4px 0 0; font-size: 17px; }
.page-head p, .panel p { color: var(--muted); font-size: 12px; margin-bottom: 0; }
.page-actions { display: flex; gap: 8px; }
.button { border: 1px solid var(--border); background: white; color: var(--text); border-radius: 10px; min-height: 38px; padding: 0 15px; font-weight: 700; }
.button.primary { background: var(--primary); border-color: var(--primary); color: white; }
.button.primary:hover { background: var(--primary-dark); }
.button.large { min-height: 46px; width: 100%; }
.month-input, input { min-height: 38px; border: 1px solid var(--border); border-radius: 9px; padding: 0 12px; color: var(--text); background: white; outline: none; }
input:focus { border-color: #63cdb6; box-shadow: 0 0 0 3px #1ebc9520; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.metric-card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: 15px; box-shadow: 0 8px 26px #0b27400d; }
.metric-card { padding: 17px; }
.metric-card small, .metric-card strong, .metric-card span { display: block; }
.metric-card small { color: var(--muted); font-size: 10px; }
.metric-card strong { margin: 9px 0 5px; font-size: 24px; }
.metric-card span { color: var(--muted); font-size: 10px; }
.two-column { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .8fr); gap: 14px; margin-bottom: 14px; }
.panel { padding: 17px; margin-bottom: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.panel-head > span, .panel-head > a { color: var(--muted); font-size: 10px; }
.quota-row { margin: 17px 0; }
.quota-row > div:first-child { display: flex; justify-content: space-between; gap: 16px; font-size: 11px; margin-bottom: 7px; }
.quota-row span { color: var(--muted); }
.progress { height: 8px; border-radius: 999px; background: #e9eef4; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #0aa483, #24cfa8); }
.detail-list { margin: 0; }
.detail-list div { display: grid; grid-template-columns: 110px 1fr; padding: 9px 0; border-bottom: 1px solid #edf1f5; }
.detail-list div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: 11px; }
.detail-list dd { margin: 0; font-size: 12px; font-weight: 700; }

.usage-bars { height: 180px; display: flex; align-items: flex-end; gap: 10px; padding-top: 12px; overflow-x: auto; }
.usage-bar-item { min-width: 36px; height: 100%; display: grid; grid-template-rows: 1fr auto; gap: 7px; text-align: center; }
.usage-bar { height: 100%; border-radius: 8px; background: #edf3f7; display: flex; align-items: flex-end; overflow: hidden; }
.usage-bar i { width: 100%; min-height: 4px; background: linear-gradient(180deg, #30d2ae, #07987a); border-radius: 8px 8px 0 0; }
.usage-bar-item small { font-size: 9px; color: var(--muted); }
.empty-small, .empty-cell { color: var(--muted); text-align: center; padding: 28px !important; }

.table-panel { padding: 0; overflow: hidden; }
.table-panel .panel-head { padding: 16px 17px 0; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { padding: 11px 13px; text-align: left; background: #f7f9fc; color: #718196; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
td { padding: 13px; border-top: 1px solid #edf1f5; }
code, pre { font-family: "Cascadia Code", Consolas, monospace; }
pre { white-space: pre-wrap; padding: 14px; border-radius: 10px; background: #0d2635; color: #dff8f1; overflow: auto; }
.text-danger { color: var(--danger); border: 0; background: transparent; font-weight: 700; }
.status { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: #eef2f6; font-size: 9px; font-weight: 750; }
.status.paid { background: #e6f8f1; color: #08785f; }
.status.confirmed { background: #e9f1ff; color: #2765b2; }
.status.void { background: #f5e8ea; color: #9e4450; }

.key-layout { grid-template-columns: minmax(0, 1fr) 330px; }
.create-card label { display: block; font-size: 11px; font-weight: 700; margin: 17px 0 7px; }
.create-card input, .create-card .button { width: 100%; }
.create-card .button { margin-top: 12px; }
.create-card p { margin-top: 14px; line-height: 1.65; }
.secret-banner { display: grid; grid-template-columns: 180px 1fr auto; align-items: center; gap: 14px; background: #e7f8f2; border: 1px solid #aee3d3; padding: 14px 16px; border-radius: 13px; margin-bottom: 14px; }
.secret-banner strong, .secret-banner span { display: block; }
.secret-banner span { color: var(--muted); font-size: 10px; margin-top: 3px; }
.secret-banner code { padding: 10px; border-radius: 8px; background: white; overflow-wrap: anywhere; }
.secret-banner button { border: 0; background: var(--primary); color: white; border-radius: 9px; padding: 10px 12px; }

.docs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.docs-grid .wide { grid-column: 1 / -1; }
.alert { display: flex; gap: 8px; padding: 13px 15px; border-radius: 11px; margin-bottom: 14px; }
.alert.error { background: #fff0f1; border: 1px solid #efc3c8; color: #9c3642; }
.alert span { display: block; }
.loading-panel { min-height: 80px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #dce6ed; border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; margin: 15vh auto; }
.empty-state > strong { font-size: 55px; color: var(--primary); }

.login-shell { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 5% 5%, #16766f 0 9%, transparent 9.5%), radial-gradient(circle at 94% 90%, #1f4f85 0 10%, transparent 10.5%), #0b2a3a; position: relative; overflow: hidden; }
.login-card { width: min(860px, calc(100vw - 36px)); display: grid; grid-template-columns: 1.05fr .95fr; border-radius: 22px; overflow: hidden; box-shadow: 0 30px 90px #001b2860; border: 1px solid #ffffff45; }
.login-copy { background: linear-gradient(150deg, #103f4c, #0b2e3c); color: white; padding: 42px; }
.login-logo { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: #18b996; font-size: 24px; font-weight: 800; }
.login-copy > small { display: block; margin: 14px 0; color: #27d4ad; font-weight: 800; letter-spacing: .14em; }
.login-copy h1 { max-width: 360px; font-size: 32px; line-height: 1.25; }
.login-copy p { color: #a7c5d1; line-height: 1.8; font-size: 12px; }
.feature-list { margin-top: 50px; display: grid; gap: 10px; }
.feature-list div { display: grid; grid-template-columns: 32px 90px 1fr; gap: 8px; align-items: center; padding: 11px; border-radius: 10px; background: #ffffff0c; border: 1px solid #ffffff12; }
.feature-list span { color: #2bd1ac; font-size: 10px; font-weight: 800; }
.feature-list strong { font-size: 11px; }
.feature-list small { color: #88a9b8; font-size: 9px; }
.login-form-panel { background: #fff; padding: 48px 42px; }
.login-form-panel .pill { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-size: 9px; font-weight: 800; }
.login-form-panel h2 { margin: 14px 0 6px; font-size: 24px; }
.login-form-panel > p { color: var(--muted); font-size: 11px; line-height: 1.7; }
.form-stack { display: grid; margin-top: 26px; }
.form-stack label { font-size: 10px; font-weight: 750; margin: 12px 0 7px; }
.form-stack input { min-height: 44px; }
.form-stack button { margin-top: 18px; }
.api-hint { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 9px; margin-top: 18px; }

@media (max-width: 1000px) {
    .shell { grid-template-columns: 76px 1fr; }
    .brand span:last-child, .sidebar nav a:not(.active) { font-size: 0; }
    .sidebar nav a { justify-content: center; padding: 0; }
    .sidebar nav a span { font-size: 13px; }
    .side-note { display: none; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .two-column, .key-layout { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .shell { display: block; }
    .sidebar { position: static; width: 100%; height: auto; padding: 10px; }
    .brand, .side-note { display: none; }
    .sidebar nav { grid-template-columns: repeat(5, 1fr); }
    .sidebar nav a { font-size: 0; min-height: 40px; }
    .topbar { padding: 0 14px; }
    main { padding: 18px 14px 30px; }
    .metric-grid { grid-template-columns: 1fr; }
    .page-head { align-items: flex-start; flex-direction: column; }
    .login-card { grid-template-columns: 1fr; }
    .login-copy { display: none; }
    .login-form-panel { padding: 34px 24px; }
    .docs-grid { grid-template-columns: 1fr; }
    .docs-grid .wide { grid-column: auto; }
}

/* Step10.49 - API Key 自助管理 */
.alert.success {
    background: #e8f8f2;
    border: 1px solid #a9dfcf;
    color: #08755e;
}

.secret-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.secret-banner .secret-actions button.secondary {
    background: white;
    color: var(--primary-dark);
    border: 1px solid #9fd7c7;
}

.key-security-note {
    display: grid;
    gap: 5px;
    margin-top: 16px;
    padding: 12px;
    border-radius: 10px;
    background: #f6f9fb;
    border: 1px solid #e5ebf0;
}

.key-security-note strong {
    font-size: 10px;
}

.key-security-note span {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.6;
}

@media (max-width: 900px) {
    .secret-banner {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .secret-actions {
        justify-content: flex-end;
    }
}
