:root {
    --ink: #17202d;
    --muted: #6f7b89;
    --line: #e4e8ed;
    --paper: #fbfcfd;
    --white: #fff;
    --blue: #2967d9;
    --blue-deep: #17499e;
    --green: #198754;
    --amber: #b76e00;
    --red: #b23a48;
    --shadow: 0 18px 60px rgba(27, 42, 61, .08);
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif; }
body { margin: 0; min-width: 320px; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar { background: rgba(255, 255, 255, .92); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(18px); }
.topbar-inner { align-items: center; display: flex; justify-content: space-between; margin: auto; max-width: 1180px; padding: 18px 28px; }
.brand { align-items: center; display: inline-flex; gap: 11px; }
.brand-mark { align-items: center; background: var(--ink); color: #fff; display: inline-flex; font-size: 18px; font-weight: 800; height: 34px; justify-content: center; width: 34px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .02em; }
.brand small { color: var(--muted); font-size: 10px; letter-spacing: .14em; margin-top: 2px; text-transform: uppercase; }
.top-actions { align-items: center; display: flex; gap: 13px; }
.status-pill { align-items: center; color: var(--muted); display: inline-flex; font-size: 12px; gap: 7px; }
.status-pill i, .admin-state i { background: #d5dbe2; border-radius: 50%; display: inline-block; height: 7px; width: 7px; }
.status-pill i { background: var(--green); }

.shell { margin: auto; max-width: 1180px; padding: 52px 28px 76px; }
.hero { align-items: end; display: flex; justify-content: space-between; margin-bottom: 28px; }
.eyebrow { color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .18em; margin: 0 0 14px; }
h1, h2, p { margin-top: 0; }
.hero h1, .page-heading h1 { font-size: 36px; letter-spacing: 0; line-height: 1.12; margin-bottom: 13px; }
.hero-copy, .page-heading > div > p:last-child { color: var(--muted); font-size: 15px; line-height: 1.8; margin-bottom: 0; max-width: 560px; }
.hero-stats { display: flex; gap: 36px; padding-bottom: 5px; }
.hero-stats strong, .hero-stats span { display: block; }
.hero-stats strong { font-size: 30px; letter-spacing: 0; }
.hero-stats span { color: var(--muted); font-size: 12px; margin-top: 4px; }

.search-panel { background: var(--white); border: 1px solid var(--line); box-shadow: 0 10px 34px rgba(27, 42, 61, .06); margin-bottom: 22px; padding: 16px; }
.search-form { display: flex; gap: 10px; }
.search-input { align-items: center; border: 1px solid var(--line); display: flex; flex: 1; min-width: 0; }
.search-icon { color: var(--blue); font-size: 27px; line-height: 0; padding: 0 14px 3px; }
.search-input input { background: transparent; border: 0; color: var(--ink); min-width: 0; outline: 0; padding: 13px 0; width: 100%; }
.search-input input::placeholder { color: #9ba4af; }
.clear-search { color: var(--muted); font-size: 23px; line-height: 1; padding: 0 14px; }
.search-form select { background: #fff; border: 1px solid var(--line); color: var(--ink); min-width: 220px; outline: 0; padding: 0 14px; }
.search-meta { color: var(--muted); display: flex; font-size: 12px; justify-content: space-between; padding: 13px 2px 0; }
.meta-note { color: #a1aab4; }

.button { border: 1px solid transparent; display: inline-flex; font-size: 13px; font-weight: 700; justify-content: center; padding: 12px 17px; transition: .2s ease; }
.button-primary { background: var(--blue); color: #fff; }
.button-primary:hover { background: var(--blue-deep); }
.button-quiet { background: #fff; border-color: var(--line); color: var(--ink); }
.button-quiet:hover { border-color: #b8c2cc; background: #f7f9fb; }

.results-list { background: #fff; border: 1px solid var(--line); }
.command-row { align-items: center; background: #fff; border-bottom: 1px solid var(--line); display: flex; gap: 17px; padding: 17px 18px; transition: background .2s ease; }
.command-row:last-child { border-bottom: 0; }
.command-row:hover { background: #f8fafc; }
.command-icon { align-items: center; background: #eef3fb; color: var(--blue); display: flex; flex: 0 0 50px; height: 50px; justify-content: center; overflow: hidden; }
.command-icon img { height: 100%; object-fit: cover; width: 100%; }
.command-icon span { font-size: 17px; font-weight: 800; }
.command-main { min-width: 0; }
.command-heading { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; }
.command-heading h2 { font-size: 17px; letter-spacing: 0; margin: 0; }
.tag, .version-chip { background: #f0f4f8; color: #667281; font-size: 11px; padding: 4px 7px; }
.command-description { color: #65717d; font-size: 13px; line-height: 1.7; margin: 8px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-foot { align-items: center; color: #99a3ae; display: flex; flex-wrap: wrap; font-size: 11px; gap: 12px; }
code { background: #f3f5f7; color: #425466; font-family: "Cascadia Code", Consolas, monospace; padding: 3px 6px; }
.icon-button { background: transparent; border: 0; color: var(--blue); font-size: 26px; padding: 12px; }
.result-limit { color: var(--muted); font-size: 11px; text-align: center; }
.pagination { align-items: center; color: var(--muted); display: flex; font-size: 12px; gap: 14px; justify-content: center; margin-top: 20px; }
.page-button { background: #fff; border: 1px solid var(--line); color: var(--ink); padding: 9px 14px; }
.page-button:not(.disabled):hover { border-color: #9aa8b7; }
.page-button.disabled { color: #b5bec8; pointer-events: none; }
.notice { font-size: 12px; line-height: 1.7; margin: -8px 0 22px; padding: 12px 14px; }
.notice-warn { background: #fff8e8; border-left: 3px solid #d8992b; color: #78500f; }

.empty-state { background: #fff; border: 1px solid var(--line); padding: 64px 20px; text-align: center; }
.empty-icon { align-items: center; background: #edf3fc; color: var(--blue); display: inline-flex; font-size: 25px; height: 56px; justify-content: center; margin-bottom: 18px; width: 56px; }
.empty-state h2 { font-size: 20px; margin-bottom: 9px; }
.empty-state p { color: var(--muted); font-size: 13px; margin-bottom: 22px; }

.detail-section { border-top: 1px solid var(--line); padding: 19px 0; }
.detail-section h3 { font-size: 12px; letter-spacing: .08em; margin: 0 0 13px; text-transform: uppercase; }
.detail-section p { color: #536170; font-size: 13px; line-height: 1.8; white-space: pre-wrap; }
.detail-grid { display: grid; gap: 9px 17px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-item { background: #f7f9fb; padding: 11px; }
.detail-item strong, .detail-item span { display: block; }
.detail-item strong { font-size: 12px; margin-bottom: 5px; }
.detail-item span { color: #687585; font-size: 11px; line-height: 1.5; }
.detail-link { color: var(--blue); font-size: 13px; }
@keyframes pulse { to { opacity: .4; } }

.admin-app { display: grid; gap: 0; grid-template-columns: 240px minmax(0, 1fr); margin: 0 auto; max-width: 1440px; min-height: calc(100vh - 72px); }
.admin-sidebar { background: #101927; color: #d9e2ef; padding: 24px 18px; }
.admin-profile { align-items: center; border-bottom: 1px solid rgba(255, 255, 255, .12); display: flex; gap: 11px; margin-bottom: 18px; padding-bottom: 20px; }
.admin-profile .brand-mark { background: #2f7dd8; }
.admin-profile strong, .admin-profile small { display: block; }
.admin-profile small { color: #8ea0b5; font-size: 11px; margin-top: 3px; }
.admin-sidebar a { color: #b8c7d9; display: block; font-size: 13px; padding: 11px 12px; }
.admin-sidebar a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.admin-content { min-width: 0; padding: 28px; }
.admin-header { align-items: end; display: flex; justify-content: space-between; margin-bottom: 22px; }
.admin-header h1 { font-size: 30px; letter-spacing: 0; margin: 0 0 8px; }
.admin-header p:last-child { color: var(--muted); font-size: 13px; margin: 0; }
.admin-kpis { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(110px, 1fr)); }
.admin-kpis div { background: #fff; border: 1px solid var(--line); padding: 14px 16px; }
.admin-kpis strong, .admin-kpis span { display: block; }
.admin-kpis strong { font-size: 22px; letter-spacing: 0; }
.admin-kpis span { color: var(--muted); font-size: 11px; margin-top: 5px; }
.admin-main-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); margin-bottom: 18px; }
.target-panel { margin-bottom: 18px; }
.lookup-form { align-items: end; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) auto; }
.package-results { display: grid; gap: 10px; margin-top: 16px; }
.package-item { align-items: center; border: 1px solid var(--line); display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) auto; padding: 14px; }
.package-item strong, .package-item small { display: block; }
.package-item strong { font-size: 13px; margin-bottom: 4px; }
.package-item small { color: #667281; font-size: 11px; }
.package-item p { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 8px 0 0; }
.admin-shell { padding-top: 55px; }
.page-heading { align-items: end; display: flex; justify-content: space-between; margin-bottom: 34px; }
.page-heading h1 { font-size: 38px; margin-bottom: 10px; }
.admin-state { align-items: center; display: flex; font-size: 12px; gap: 8px; padding-bottom: 6px; }
.state-good { color: var(--green); }
.state-good i { background: var(--green); }
.state-warn { color: var(--amber); }
.state-warn i { background: var(--amber); }
.setup-panel, .panel { background: #fff; border: 1px solid var(--line); padding: 26px; }
.setup-panel { margin-bottom: 22px; max-width: 740px; }
.panel-title { align-items: center; display: flex; justify-content: space-between; margin-bottom: 18px; }
.panel-title > div { align-items: center; display: flex; gap: 12px; }
.panel-title h2 { font-size: 16px; margin: 0; }
.panel-title > span { color: var(--muted); font-size: 11px; }
.section-number { color: var(--blue); font-family: Consolas, monospace; font-size: 12px; }
.panel-copy { color: var(--muted); font-size: 12px; line-height: 1.75; margin-bottom: 21px; max-width: 540px; }
.form-grid { align-items: end; display: grid; gap: 13px; grid-template-columns: 1fr 1fr auto; }
.stack-form, .form-grid { font-size: 12px; }
label { color: #566473; display: block; }
label input { background: #fff; border: 1px solid var(--line); color: var(--ink); display: block; margin-top: 7px; outline: 0; padding: 11px 12px; width: 100%; }
label input:focus, .search-input:focus-within, .search-form select:focus { border-color: #7fa4e7; box-shadow: 0 0 0 3px #eaf1fe; }
.dashboard-grid { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); margin-bottom: 22px; }
.stack-form { display: grid; gap: 13px; }
.form-status { color: var(--green); font-size: 12px; min-height: 18px; margin: 14px 0 0; }
.form-status.error { color: var(--red); }
.action-list { border-top: 1px solid var(--line); }
.action-row { align-items: center; background: #fff; border: 0; border-bottom: 1px solid var(--line); display: grid; gap: 13px; grid-template-columns: 32px 1fr auto; padding: 15px 0; text-align: left; width: 100%; }
.action-row:hover strong { color: var(--blue); }
.action-row:disabled, .text-button:disabled { cursor: wait; opacity: .55; }
.action-icon { align-items: center; background: #edf3fc; color: var(--blue); display: flex; font-size: 20px; height: 32px; justify-content: center; width: 32px; }
.action-row strong, .action-row small { display: block; }
.action-row strong { font-size: 13px; transition: color .2s ease; }
.action-row small { color: var(--muted); font-size: 11px; margin-top: 4px; }
.action-row b { color: var(--blue); font-size: 20px; font-weight: 400; }
.progress-box { background: #f6f8fa; margin-top: 17px; padding: 13px; }
.progress-head { color: var(--muted); display: flex; font-size: 11px; justify-content: space-between; }
.progress-track { background: #e2e7ed; height: 5px; margin: 9px 0; overflow: hidden; }
.progress-track i { background: var(--blue); display: block; height: 100%; transition: width .25s ease; width: 0; }
.progress-current { color: #536171; display: flex; font-size: 11px; gap: 8px; justify-content: space-between; min-height: 18px; }
.progress-current span:last-child { color: var(--blue); text-align: right; }
.progress-box pre { color: #6d7885; font-family: Consolas, monospace; font-size: 10px; line-height: 1.6; max-height: 90px; overflow: auto; white-space: pre-wrap; }
.cache-panel { padding-bottom: 0; }
.table-wrap { margin: 0 -26px; overflow-x: auto; }
table { border-collapse: collapse; min-width: 760px; width: 100%; }
th, td { border-top: 1px solid var(--line); padding: 14px 26px; text-align: left; }
th { color: #8a96a2; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
td { color: #465464; font-size: 12px; vertical-align: middle; }
td strong, td small { display: block; }
td strong { color: var(--ink); font-size: 12px; margin-bottom: 4px; }
td small { color: #a0a9b3; font-size: 10px; }
.row-actions { white-space: nowrap; }
.text-button { background: transparent; border: 0; color: var(--blue); font-size: 11px; padding: 5px; }
.text-button.danger { color: var(--red); }
.table-empty { color: var(--muted); font-size: 12px; padding: 30px; text-align: center; }
.toast { background: var(--ink); bottom: 25px; color: #fff; font-size: 12px; opacity: 0; padding: 12px 16px; pointer-events: none; position: fixed; right: 25px; transform: translateY(10px); transition: .25s ease; z-index: 30; }
.toast.show { opacity: 1; transform: translateY(0); }

.login-page { align-items: center; background: #f6f8fa; display: flex; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 38px; width: min(100%, 390px); }
.login-card .brand { margin-bottom: 56px; }
.login-card h1 { font-size: 30px; letter-spacing: 0; margin-bottom: 8px; }
.login-card > p:not(.eyebrow):not(.form-status) { color: var(--muted); font-size: 13px; margin-bottom: 25px; }

.catalog-page, .admin-page { background: #f5f7fb; }
.catalog-header { position: sticky; top: 0; z-index: 20; }
.display-title { color: #101828; font-size: 42px; font-weight: 750; letter-spacing: 0; line-height: 1.12; }
.metric-box { background: #fff; border: 1px solid #e7ebf1; border-radius: 8px; padding: 18px 20px; }
.metric-box strong { color: #101828; display: block; font-size: 28px; line-height: 1; }
.metric-box span { color: #667085; display: block; font-size: 12px; margin-top: 8px; }
.command-list { display: grid; gap: 10px; }
.command-item { background: #fff; border: 1px solid #e7ebf1; border-radius: 8px; box-shadow: 0 8px 26px rgba(16, 24, 40, .04); overflow: hidden; }
.command-item summary { align-items: center; cursor: pointer; display: grid; gap: 16px; grid-template-columns: 50px minmax(0, 1fr) auto; list-style: none; padding: 18px; }
.command-item summary::-webkit-details-marker { display: none; }
.command-item[open] summary { background: #f9fbff; border-bottom: 1px solid #e7ebf1; }
.command-item h2 { font-size: 16px; letter-spacing: 0; margin: 0; }
.command-item p { color: #667085; font-size: 13px; line-height: 1.65; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-meta { align-items: center; color: #8a94a6; display: flex; flex-wrap: wrap; font-size: 12px; gap: 10px; margin-top: 8px; }
.expand-hint { color: #2f6fd6; font-size: 12px; white-space: nowrap; }
.command-item[open] .expand-hint { color: #667085; }
.command-detail { padding: 18px; }
.command-detail h3 { color: #344054; font-size: 13px; font-weight: 700; margin-bottom: 12px; }
.detail-chip, .param-card { background: #f8fafc; border: 1px solid #edf1f5; border-radius: 8px; padding: 12px; }
.detail-chip span, .param-card span { color: #667085; display: block; font-size: 12px; line-height: 1.5; margin-top: 4px; }
.detail-chip strong, .param-card strong { color: #101828; display: block; font-size: 13px; overflow-wrap: anywhere; }
.admin-tabs .nav-link { color: #526070; font-weight: 600; }
.admin-tabs .nav-link.active { color: #1f5fbf; }
.admin-metric { min-height: 112px; }
.quick-card { background: #fff; border: 1px solid #e7ebf1; border-radius: 8px; display: block; height: 100%; padding: 18px; }
.quick-card:hover { border-color: #9bb8ed; box-shadow: 0 10px 30px rgba(47, 111, 214, .08); }
.quick-card strong, .quick-card span { display: block; }
.quick-card strong { color: #101828; font-size: 15px; }
.quick-card span { color: #667085; font-size: 12px; line-height: 1.6; margin-top: 8px; }
.package-item { background: #fff; border: 1px solid #e7ebf1; border-radius: 8px; }
.update-list .list-group-item { border-color: #e7ebf1; }
.table td, .table th { padding: 14px 18px; }
.table th { color: #667085; font-size: 12px; letter-spacing: 0; text-transform: none; }
.table td { color: #344054; font-size: 13px; }

@media (max-width: 760px) {
    .topbar-inner, .shell { padding-left: 18px; padding-right: 18px; }
    .top-actions .status-pill { display: none; }
    .shell { padding-top: 45px; }
    .hero, .page-heading { align-items: start; flex-direction: column; gap: 25px; }
    .hero h1 { font-size: 36px; }
    .display-title { font-size: 30px; }
    .hero-stats { gap: 27px; }
    .search-form { flex-wrap: wrap; }
    .search-input, .search-form select { flex-basis: 100%; min-height: 46px; }
    .search-form .button { flex: 1; }
    .search-meta { gap: 10px; }
    .meta-note { text-align: right; }
    .command-row { align-items: start; }
    .command-icon { flex-basis: 42px; height: 42px; }
    .command-description { white-space: normal; }
    .icon-button { margin-left: auto; padding-right: 0; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .setup-panel, .panel { padding: 20px; }
    .table-wrap { margin: 0 -20px; }
    th, td { padding-left: 20px; padding-right: 20px; }
    .detail-grid { grid-template-columns: 1fr; }
    .admin-app { display: block; }
    .admin-sidebar { padding: 16px; }
    .admin-sidebar a { display: inline-block; padding: 9px 10px; }
    .admin-profile { margin-bottom: 10px; padding-bottom: 14px; }
    .admin-content { padding: 18px; }
    .admin-header { align-items: start; flex-direction: column; gap: 16px; }
    .admin-kpis, .admin-main-grid, .lookup-form, .package-item { grid-template-columns: 1fr; }
    .package-item .button { width: 100%; }
    .command-item summary { align-items: start; grid-template-columns: 42px minmax(0, 1fr); }
    .expand-hint { grid-column: 2; }
    .command-item p { white-space: normal; }
}
