:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --ink: #17201c;
  --muted: #66716b;
  --line: #dfe5e1;
  --accent: #087a55;
  --accent-dark: #065d42;
  --accent-soft: #e8f4ef;
  --warning: #a35f05;
  --warning-soft: #fff5e3;
  --danger: #b42318;
  --danger-soft: #fef0ee;
  --info: #2864a7;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-size: 14px; letter-spacing: 0; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 224px; background: #17251f; color: #fff; padding: 20px 14px; display: flex; flex-direction: column; }
.brand { display: flex; gap: 11px; align-items: center; padding: 2px 7px 24px; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 7px; background: #d7f26f; color: #1d3329; font-weight: 800; }
.brand strong, .brand small, .identity strong, .identity small { display: block; }
.brand strong { font-size: 15px; }
.brand small, .identity small { color: #a8b7b0; margin-top: 3px; font-size: 11px; }
nav { display: grid; gap: 4px; }
nav button { height: 42px; border: 0; border-radius: 6px; background: transparent; color: #b8c5bf; text-align: left; padding: 0 12px; display: flex; align-items: center; gap: 12px; }
nav button span { width: 18px; text-align: center; font-size: 18px; }
nav button:hover { background: #22372e; color: #fff; }
nav button.active { background: #2b4439; color: #fff; box-shadow: inset 3px 0 #d7f26f; }
.identity { margin-top: auto; padding: 16px 8px 2px; border-top: 1px solid #31483e; display: flex; gap: 10px; align-items: center; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #456357; }
.identity div { min-width: 0; flex: 1; }
.identity strong, .identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-icon { width: 30px; height: 30px; border: 0; border-radius: 5px; background: transparent; color: #b8c5bf; font-size: 18px; }
.sidebar-icon:hover { background: #2b4439; color: #fff; }
main { margin-left: 224px; min-height: 100vh; padding: 28px 34px 44px; }
header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
h1 { margin: 0; font-size: 24px; line-height: 1.3; }
header p { color: var(--muted); margin: 5px 0 0; }
.header-actions { display: flex; gap: 9px; }
.primary, .secondary, .danger-btn { min-height: 38px; border-radius: 6px; padding: 0 15px; border: 1px solid transparent; }
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-dark); }
.secondary { border-color: var(--line); background: #fff; color: var(--ink); }
.danger-btn { border-color: #f2c5c0; background: #fff; color: var(--danger); }
.icon-btn { width: 38px; height: 38px; border: 1px solid var(--line); background: #fff; border-radius: 6px; font-size: 20px; color: #42504a; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 17px 18px; min-height: 98px; }
.stat span { color: var(--muted); font-size: 12px; }
.stat strong { display: block; font-size: 25px; margin-top: 10px; line-height: 1; }
.stat small { color: var(--muted); margin-left: 6px; font-weight: 400; }
.toolbar { height: 58px; background: #fff; border: 1px solid var(--line); border-bottom: 0; border-radius: 7px 7px 0 0; padding: 10px 12px; display: flex; gap: 8px; }
.bulkbar { min-height: 46px; padding: 7px 14px; border: 1px solid #b8d8ca; border-bottom: 0; background: var(--accent-soft); display: flex; align-items: center; gap: 8px; }
.bulkbar button { border: 1px solid #a8cabb; background: #fff; border-radius: 5px; min-height: 30px; padding: 0 10px; }
.bulkbar span { margin-right: 8px; color: var(--accent-dark); }
.danger-text { color: var(--danger); }
.search { min-width: 300px; flex: 1; max-width: 520px; position: relative; }
.search span { position: absolute; left: 12px; top: 8px; color: var(--muted); font-size: 18px; }
input, select { height: 36px; border: 1px solid #ced7d2; border-radius: 5px; background: #fff; color: var(--ink); padding: 0 11px; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px #d9eee6; }
.search input { width: 100%; padding-left: 36px; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 0 0 7px 7px; min-height: 420px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th { height: 43px; padding: 0 14px; color: #67726d; background: #f9faf9; font-size: 11px; text-align: left; font-weight: 650; white-space: nowrap; }
th.check-cell, td.check-cell { width: 38px; padding-left: 14px; padding-right: 4px; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }
td { height: 58px; padding: 8px 14px; border-top: 1px solid #edf0ee; vertical-align: middle; }
tbody tr:hover { background: #fafcfb; }
.file-cell { display: flex; gap: 10px; align-items: center; min-width: 230px; }
.file-icon { width: 32px; height: 36px; flex: 0 0 auto; border: 1px solid #ccd8d2; background: #f2f6f4; border-radius: 4px; display: grid; place-items: center; color: var(--accent); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.file-cell strong, .file-cell small { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-cell small, .subtle { color: var(--muted); font-size: 11px; margin-top: 4px; }
.subtle button { border: 0; background: transparent; color: var(--accent); padding: 0 3px; font-size: 11px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: #53615a; }
.badge { display: inline-flex; min-height: 23px; align-items: center; padding: 0 8px; border-radius: 999px; font-size: 11px; white-space: nowrap; background: #eef2f0; color: #4f5d56; }
.badge.active, .badge.verified, .badge.healthy { background: var(--accent-soft); color: var(--accent-dark); }
.badge.archived, .badge.pending, .badge.unknown, .badge.not_configured { background: var(--warning-soft); color: var(--warning); }
.badge.deleted, .badge.missing, .badge.hash_mismatch, .badge.mismatch, .badge.infected, .badge.error, .badge.quarantined, .badge.unhealthy { background: var(--danger-soft); color: var(--danger); }
.row-actions { display: flex; gap: 5px; }
.row-actions button { border: 0; background: transparent; color: var(--accent); padding: 5px; }
.empty { min-height: 330px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.empty strong { color: var(--ink); margin-bottom: 5px; }
.pagination { min-height: 51px; border-top: 1px solid var(--line); padding: 8px 14px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.pagination button { width: 34px; height: 32px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.pagination button:first-child { border-radius: 5px 0 0 5px; }.pagination button:last-child { border-radius: 0 5px 5px 0; border-left: 0; }
.pagination button:disabled { color: #aeb7b2; cursor: default; }
dialog { border: 0; border-radius: 8px; padding: 0; box-shadow: 0 24px 70px #13261d33; color: var(--ink); }
dialog::backdrop { background: #0d18136b; }
.detail-dialog { width: min(760px, calc(100vw - 30px)); max-height: 86vh; }
.upload-dialog { width: min(560px, calc(100vw - 30px)); }
.adapter-dialog { width: min(650px, calc(100vw - 30px)); }
.password-dialog { width: min(480px, calc(100vw - 30px)); }
.user-dialog { width: min(620px, calc(100vw - 30px)); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 3px 0 0; font-size: 20px; overflow-wrap: anywhere; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 700; }
#detail-content { padding: 22px 24px 26px; overflow-y: auto; max-height: calc(86vh - 85px); }
.detail-section { margin-bottom: 25px; }
.detail-section h3 { font-size: 13px; margin: 0 0 12px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.detail-item { padding: 12px 14px; min-height: 61px; border-bottom: 1px solid var(--line); }
.detail-item:nth-child(odd) { border-right: 1px solid var(--line); }
.detail-item span, .detail-item strong { display: block; }
.detail-item span { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.detail-item strong { font-size: 13px; overflow-wrap: anywhere; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dropzone { margin: 22px 24px 16px; border: 1px dashed #9eb4aa; background: #f7faf8; min-height: 150px; border-radius: 7px; display: grid; place-items: center; align-content: center; cursor: pointer; }
.dropzone input { display: none; }
.dropzone strong, .dropzone small { display: block; text-align: center; }
.dropzone small { margin-top: 6px; color: var(--muted); }
.upload-icon { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 23px; margin-bottom: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 24px 14px; }
#upload-form > label:not(.dropzone) { margin: 0 24px; }
#upload-form label { color: var(--muted); font-size: 12px; }
#upload-form label input, #upload-form label select { display: block; width: 100%; margin-top: 6px; color: var(--ink); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 20px 24px 24px; }
.adapter-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 22px 24px 0; }
.adapter-form-grid label { color: var(--muted); font-size: 12px; }
.adapter-form-grid input:not([type="checkbox"]), .adapter-form-grid select { display: block; width: 100%; margin-top: 6px; color: var(--ink); }
.adapter-form-grid .wide { grid-column: 1 / -1; }
.adapter-form-grid .toggle-line { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.adapter-form-grid .toggle-line input { margin: 0; }
.account-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 22px 24px 0; }
.account-form-grid label { color: var(--muted); font-size: 12px; }
.account-form-grid input:not([type="checkbox"]) { display: block; width: 100%; margin-top: 6px; color: var(--ink); }
.account-form-grid label small { display: block; margin-top: 5px; }
.account-form-grid .wide { grid-column: 1 / -1; }
.account-form-grid .toggle-line { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.account-form-grid .toggle-line input { margin: 0; }
.role-fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-fieldset legend { color: var(--muted); font-size: 12px; padding: 0 5px; }
.role-fieldset label { display: flex; align-items: center; gap: 7px; color: var(--ink); }
.role-fieldset input { margin: 0; }
.form-notice { margin: 16px 24px 0; padding: 10px 12px; border-left: 3px solid var(--warning); background: var(--warning-soft); color: #714305; }
.form-error { margin: 0; color: var(--danger); min-height: 19px; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eef2f0; }
.login-panel { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 18px 50px #17251f1a; padding: 30px; }
.login-brand { display: flex; gap: 11px; align-items: center; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.login-brand strong, .login-brand small { display: block; }
.login-brand small { color: var(--muted); margin-top: 3px; font-size: 11px; }
.login-heading { margin: 26px 0 20px; }
.login-heading h1 { font-size: 22px; }
.login-heading p { color: var(--muted); margin: 6px 0 0; }
#login-form { display: grid; gap: 15px; }
#login-form label { color: var(--muted); font-size: 12px; }
#login-form input { display: block; width: 100%; height: 42px; margin-top: 6px; color: var(--ink); }
.login-submit { width: 100%; height: 42px; margin-top: 2px; }
.toast { position: fixed; right: 24px; bottom: 24px; min-width: 250px; max-width: 420px; background: #17251f; color: #fff; padding: 12px 15px; border-radius: 6px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #791f19; }
.exception-list { display: grid; gap: 9px; }
.exception-row { border: 1px solid var(--line); border-left: 3px solid var(--warning); padding: 11px 12px; border-radius: 5px; }
@media (max-width: 900px) {
  .sidebar { width: 66px; padding: 16px 8px; }
  .brand div, nav button:not(.active)::after, nav button { font-size: 0; }
  .brand { padding-left: 7px; }.brand-mark { width: 36px; }
  nav button { padding: 0; justify-content: center; } nav button span { font-size: 19px; }
  .identity div { display: none; }.identity { justify-content: center; }
  main { margin-left: 66px; padding: 22px 18px 36px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  main { padding: 17px 12px 30px; }
  header { align-items: flex-start; } header p { display: none; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }.stat { padding: 13px; min-height: 80px; }.stat strong { font-size: 21px; }
  .toolbar { height: auto; flex-wrap: wrap; }.search { min-width: 100%; }
  .header-actions .icon-btn { display: none; }
  .detail-grid, .form-grid, .adapter-form-grid, .account-form-grid { grid-template-columns: 1fr; }.adapter-form-grid .wide, .adapter-form-grid .toggle-line, .account-form-grid .wide { grid-column: 1; }.detail-item:nth-child(odd) { border-right: 0; }
  .role-fieldset { grid-template-columns: 1fr; }
  .login-panel { padding: 24px 20px; }
}
