:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --border: #dfe4ea;
  --border-strong: #ccd4dd;
  --text: #17212b;
  --muted: #6b7785;
  --blue: #2481cc;
  --blue-hover: #1d6fae;
  --blue-soft: #e8f3fc;
  --red: #c73d4d;
  --red-soft: #fdecef;
  --green: #23815a;
  --green-soft: #e8f7f0;
  --amber: #9c6915;
  --amber-soft: #fff5dc;
  --sidebar: #1f2c38;
  --sidebar-text: #dce7ef;
  --radius: 7px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--sidebar); color: var(--sidebar-text); padding: 20px 14px 14px; z-index: 20; }
.brand { display: flex; gap: 11px; align-items: center; padding: 0 8px 21px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: white; font-size: 18px; font-weight: 700; }
.brand strong, .brand small { display: block; }
.brand strong { color: white; font-size: 15px; }
.brand small { margin-top: 2px; color: #91a5b5; font-size: 12px; }
.main-nav { display: grid; gap: 4px; }
.main-nav a { padding: 10px 12px; border-radius: 6px; color: #b9cad7; font-weight: 600; }
.main-nav a:hover { color: white; background: #2a3b49; }
.main-nav a.active { color: white; background: var(--blue); }
.sidebar-footer { margin-top: auto; border-top: 1px solid #354551; padding: 14px 4px 0; }
.admin-identity { padding: 0 8px 12px; }
.admin-identity strong, .admin-identity span { display: block; }
.admin-identity span { color: #91a5b5; margin-top: 3px; font-size: 12px; }
.main-area { min-width: 0; }
.topbar { min-height: 86px; padding: 17px 30px; display: flex; align-items: center; gap: 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar h1 { margin: 0; font-size: 21px; line-height: 1.3; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.service-state { margin-left: auto; color: var(--green); font-weight: 600; white-space: nowrap; }
.service-state i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #2ca36f; margin-right: 7px; }
.content { padding: 26px 30px 44px; max-width: 1500px; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { min-height: 104px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.stat span { display: block; color: var(--muted); }
.stat strong { display: block; margin-top: 12px; font-size: 27px; line-height: 1; }
.section-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 18px; padding: 20px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 17px; }
.section-heading h2 { margin: 0; font-size: 16px; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.heading-line { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.text-link, .row-link { color: var(--blue); font-weight: 600; }
.row-link:hover, .text-link:hover { text-decoration: underline; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 13px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: var(--surface-subtle); color: #4d5966; font-size: 12px; font-weight: 700; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfdff; }
.empty { padding: 34px; color: var(--muted); text-align: center; }
.empty-inline, .empty-state { color: var(--muted); padding: 20px; text-align: center; }
.empty-state { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { display: block; margin-top: 4px; color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 700; white-space: nowrap; background: #eef1f4; color: #59636d; }
.badge-active, .badge-published, .badge-resolved { color: var(--green); background: var(--green-soft); }
.badge-disabled, .badge-staged, .badge-processing { color: var(--amber); background: var(--amber-soft); }
.badge-revoked, .badge-danger, .badge-closed { color: var(--red); background: var(--red-soft); }
.badge-new, .badge-draft { color: var(--blue); background: var(--blue-soft); }
.button { min-height: 36px; display: inline-flex; justify-content: center; align-items: center; padding: 7px 13px; border: 1px solid #b9c9d6; border-radius: 6px; background: #edf5fb; color: #24648f; font-weight: 650; cursor: pointer; white-space: nowrap; }
.button:hover { background: #dfedf8; border-color: #93b4cb; }
.button-primary { color: white; background: var(--blue); border-color: var(--blue); }
.button-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.button-danger { color: white; background: var(--red); border-color: var(--red); }
.button-danger:hover { background: #a93240; border-color: #a93240; }
.button-quiet { background: transparent; color: #cbd9e3; border-color: #496071; }
.button-small { min-height: 31px; padding: 5px 9px; font-size: 12px; }
.button-large { min-height: 44px; }
.button-full { width: 100%; }
.action-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.action-row form { margin: 0; }
label { display: grid; gap: 7px; color: #45515d; font-size: 13px; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: 6px; background: white; color: var(--text); padding: 9px 10px; outline: none; }
input, select { min-height: 39px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36, 129, 204, .12); }
.form-stack { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(140px, 1fr)); gap: 15px; align-items: end; }
.field-wide { grid-column: 1 / -1; }
.form-action { display: flex; justify-content: flex-end; grid-column: 1 / -1; }
.checkbox-field { display: flex; flex-direction: row; align-items: center; gap: 9px; min-height: 39px; }
.checkbox-field input { width: 17px; min-height: 17px; accent-color: var(--blue); }
.filter-bar, .upload-row, .inline-form { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; }
.filter-bar input { max-width: 360px; }
.filter-bar select { width: 150px; }
.inline-form { margin: 0; }
.inline-form select { width: 112px; }
.upload-row { padding-top: 16px; margin: 16px 0 0; border-top: 1px solid var(--border); }
.upload-row select { width: 130px; }
.upload-row input[type=file] { flex: 1; min-width: 210px; }
.platform-upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--border); }
.platform-upload-bundle { min-width: 0; }
.bundle-upload-hint { margin: 16px 0 -4px; color: var(--muted); font-size: 13px; }
.platform-upload { min-width: 0; display: grid; gap: 13px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-subtle); }
.platform-upload-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.platform-upload-heading strong, .platform-upload-heading span { display: block; }
.platform-upload-heading strong { font-size: 15px; }
.platform-upload-heading div > span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.upload-state { flex: 0 0 auto; padding: 4px 8px; border-radius: 4px; background: #eef1f4; color: var(--muted); font-size: 12px; font-weight: 700; }
.upload-state-ready { color: var(--green); background: var(--green-soft); }
.package-file-field { min-width: 0; }
.package-file-field input[type=file] { min-width: 0; background: var(--surface); cursor: pointer; }
.upload-progress { margin: -4px 0 0; color: var(--blue); text-align: center; font-size: 12px; font-weight: 650; }
.bundle-upload-actions { display: grid; justify-items: end; gap: 10px; padding-top: 14px; }
.platform-upload-bundle.is-uploading { opacity: .72; }
.platform-upload-bundle.is-uploading .button { cursor: wait; }
.package-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 9px; }
.package-item { display: grid; gap: 5px; padding: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-subtle); }
.package-item span, .package-item small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; }
.alert-error { color: var(--red); background: var(--red-soft); border-color: #f2c4ca; }
.alert-warning { color: #79500e; background: var(--amber-soft); border-color: #ecd69a; }
.key-output { min-height: 330px; line-height: 1.8; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; }
.feedback-body h2 { margin: 0; font-size: 19px; }
.meta-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 20px 0; }
.meta-list div { border-bottom: 1px solid var(--border); padding-bottom: 9px; }
.meta-list dt { color: var(--muted); font-size: 12px; }
.meta-list dd { margin: 5px 0 0; }
.message-content { white-space: pre-wrap; line-height: 1.75; margin: 0 0 20px; padding: 16px; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: 6px; }
.feedback-form { padding-left: 24px; border-left: 1px solid var(--border); }
.mobile-menu { display: none; }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eef3f7; }
.login-panel { width: min(420px, 100%); padding: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 18px 50px rgba(25, 49, 68, .09); }
.login-brand { display: flex; justify-content: center; }
.login-panel h1 { margin: 16px 0 5px; text-align: center; font-size: 23px; }
.login-panel > p { margin: 0 0 25px; text-align: center; color: var(--muted); }
@media (max-width: 1080px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .package-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: -240px; width: 224px; transition: left .18s ease; box-shadow: 12px 0 30px rgba(10, 25, 36, .2); }
  .sidebar.open { left: 0; }
  .mobile-menu { display: inline-flex; min-height: 36px; align-items: center; border: 1px solid var(--border); border-radius: 6px; background: white; color: var(--text); }
  .topbar { padding: 14px 16px; min-height: 76px; }
  .topbar h1 { font-size: 18px; }
  .topbar p, .service-state { display: none; }
  .content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .section-block { padding: 15px; }
  .section-heading { align-items: flex-start; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .feedback-form { padding: 20px 0 0; border: 0; border-top: 1px solid var(--border); }
  .filter-bar, .upload-row { align-items: stretch; flex-direction: column; }
  .filter-bar input, .filter-bar select, .upload-row select { max-width: none; width: 100%; }
  .platform-upload-grid { grid-template-columns: 1fr; }
  .package-grid { grid-template-columns: 1fr; }
  .meta-list { grid-template-columns: 1fr; }
}
