:root {
  --bg: #f1f1f1;
  --surface: #ffffff;
  --surface-subdued: #f7f7f7;
  --text: #303030;
  --text-subdued: #616161;
  --text-disabled: #8a8a8a;
  --border: #d4d4d4;
  --border-subdued: #e3e3e3;
  --primary: #303030;
  --primary-hover: #1a1a1a;
  --green: #29845a;
  --green-bg: #eaf4ef;
  --blue: #005bd3;
  --blue-bg: #eaf4ff;
  --yellow: #8a6116;
  --yellow-bg: #fff5d6;
  --red: #c70a24;
  --red-bg: #feecef;
  --shadow: 0 1px 0 rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.12);
  --radius: 12px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); font-size: 14px; line-height: 1.45; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; color: var(--text-subdued); }
.spinner { width: 24px; height: 24px; border: 2px solid #ddd; border-top-color: #555; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0,1fr) minmax(420px,560px); background: #fff; }
.auth-hero { background: #08251c; color: #fff; padding: clamp(40px,7vw,100px); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-hero::before, .auth-hero::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; }
.auth-hero::before { width: 480px; height: 480px; right: -180px; bottom: -160px; }
.auth-hero::after { width: 280px; height: 280px; right: -40px; bottom: -60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; font-size: 19px; position: relative; z-index: 1; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: #95bf47; color: #163d2c; font-weight: 800; box-shadow: inset 0 -1px 0 rgba(0,0,0,.15); }
.auth-copy { max-width: 600px; position: relative; z-index: 1; }
.auth-copy h1 { font-size: clamp(38px,5vw,64px); line-height: 1.02; letter-spacing: -.05em; margin: 0 0 24px; font-weight: 650; }
.auth-copy p { color: #c8d8d1; font-size: 17px; max-width: 520px; }
.platform-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 26px; }
.platform-list span { padding: 6px 10px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; color: #e2ebe7; font-size: 12px; }
.auth-foot { color: #94a99f; font-size: 12px; position: relative; z-index: 1; }
.auth-panel { display: grid; place-items: center; padding: 40px; }
.auth-card { width: min(100%,400px); }
.auth-card h2 { margin: 0 0 8px; font-size: 26px; letter-spacing: -.025em; }
.auth-card > p { color: var(--text-subdued); margin: 0 0 28px; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 13px; }
.field .help { color: var(--text-subdued); font-size: 12px; margin-top: 1px; }
.password-control { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 8px; align-items: center; }
.password-control .button { min-height: 38px; }
.password-control input[readonly] { background: var(--surface-subdued); color: var(--text); }
input, textarea, select { width: 100%; border: 1px solid #8a8a8a; border-radius: 8px; background: #fff; padding: 9px 12px; outline: none; min-height: 38px; box-shadow: inset 0 1px 1px rgba(0,0,0,.05); }
textarea { resize: vertical; min-height: 130px; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: #005bd3; box-shadow: 0 0 0 1px #005bd3; }
input:disabled, textarea:disabled, select:disabled { background: #f1f1f1; color: var(--text-disabled); cursor: not-allowed; }
.checkbox { display: flex; align-items: flex-start; gap: 9px; color: var(--text-subdued); font-size: 13px; }
.checkbox input { width: 18px; min-height: 18px; height: 18px; flex: 0 0 auto; margin: 1px 0 0; accent-color: var(--primary); }
.button { border: 1px solid #bababa; border-radius: 8px; background: #fff; padding: 7px 13px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 600; box-shadow: 0 1px 0 rgba(0,0,0,.08); text-decoration: none; white-space: nowrap; }
.button:hover { background: #f7f7f7; text-decoration: none; }
.button.primary { color: #fff; background: var(--primary); border-color: var(--primary); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 1px 0 rgba(0,0,0,.18); }
.button.primary:hover { background: var(--primary-hover); }
.button.critical { color: #fff; background: #c70a24; border-color: #9e071b; }
.button.plain { border-color: transparent; box-shadow: none; background: transparent; }
.button.small { min-height: 30px; padding: 4px 9px; font-size: 12px; }
.button.full { width: 100%; }
.button:disabled { opacity: .55; cursor: not-allowed; }

.app-shell { min-height: 100vh; display: grid; grid-template-rows: 56px 1fr; }
.topbar { height: 56px; background: #1a1a1a; color: #fff; display: flex; align-items: center; padding: 0 16px; gap: 18px; position: sticky; top: 0; z-index: 30; }
.topbar .brand { min-width: 208px; }
.topbar-search { flex: 1; max-width: 620px; margin: 0 auto; position: relative; }
.topbar-search input { min-height: 34px; height: 34px; border-color: #616161; background: #303030; color: #fff; box-shadow: none; padding-left: 34px; }
.topbar-search::before { content: "⌕"; position: absolute; left: 11px; top: 5px; color: #b5b5b5; font-size: 18px; z-index: 1; }
.topbar-user { display: flex; align-items: center; gap: 9px; min-width: 190px; justify-content: flex-end; }
.avatar { width: 30px; height: 30px; border-radius: 8px; background: #aee9d1; color: #0c5132; display: grid; place-items: center; font-weight: 750; text-transform: uppercase; }
.topbar-user button { color: #fff; border: 0; background: transparent; padding: 5px; }
.shell-body { display: grid; grid-template-columns: 240px minmax(0,1fr); min-height: 0; }
.sidebar { background: #ebebeb; border-right: 1px solid #ddd; padding: 12px 10px; position: sticky; top: 56px; height: calc(100vh - 56px); }
.nav-label { color: var(--text-disabled); text-transform: uppercase; font-size: 10px; letter-spacing: .08em; padding: 13px 10px 5px; }
.nav-item { border: 0; width: 100%; background: transparent; text-align: left; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; margin: 2px 0; font-weight: 560; }
.nav-item:hover { background: #ddd; }
.nav-item.active { background: #d8d8d8; color: #1a1a1a; }
.nav-icon { width: 20px; text-align: center; color: #616161; font-weight: 700; }
.main { min-width: 0; padding: 28px 32px 80px; }
.page { width: min(100%,1120px); margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; min-height: 44px; }
.page-head h1 { margin: 0; font-size: 22px; line-height: 1.3; letter-spacing: -.02em; }
.page-head p { margin: 5px 0 0; color: var(--text-subdued); }
.head-actions { display: flex; gap: 8px; align-items: center; }

.card { background: var(--surface); border: 1px solid var(--border-subdued); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 16px; }
.card-header { padding: 16px 18px; border-bottom: 1px solid var(--border-subdued); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-header h2, .card-section h2 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.card-section { padding: 18px; }
.card-section + .card-section { border-top: 1px solid var(--border-subdued); }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: minmax(0,2fr) minmax(280px,1fr); }
.grid.four { grid-template-columns: repeat(4,minmax(0,1fr)); }
.metric { padding: 17px 18px; }
.metric-label { color: var(--text-subdued); font-size: 12px; display: flex; justify-content: space-between; }
.metric-value { font-size: 26px; font-weight: 650; letter-spacing: -.035em; margin-top: 5px; }
.metric-note { color: var(--text-disabled); font-size: 12px; margin-top: 4px; }
.segmented { display: inline-grid; grid-template-columns: 1fr 1fr; background: #e3e3e3; padding: 2px; border-radius: 9px; margin-bottom: 18px; }
.segmented button { border: 0; background: transparent; padding: 7px 14px; border-radius: 7px; font-weight: 600; }
.segmented button.active { background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.callout { display: flex; gap: 10px; padding: 12px; border-radius: 9px; background: var(--blue-bg); color: #003a8c; font-size: 13px; margin-bottom: 16px; }
.callout.warning { background: var(--yellow-bg); color: #5e420c; }
.callout.critical { background: var(--red-bg); color: #8e061a; }
.callout.success { background: var(--green-bg); color: #145c3d; }
.quota { display: grid; gap: 14px; }
.quota-row { display: grid; gap: 6px; }
.quota-head { display: flex; justify-content: space-between; font-size: 12px; }
.progress { height: 7px; border-radius: 99px; background: #e3e3e3; overflow: hidden; }
.progress > span { display: block; height: 100%; min-width: 2px; max-width: 100%; background: var(--green); border-radius: inherit; transition: width .25s ease; }

.toolbar { padding: 12px; display: flex; gap: 8px; border-bottom: 1px solid var(--border-subdued); }
.toolbar input { min-height: 34px; height: 34px; border-color: var(--border); flex: 1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 13px; background: #fafafa; color: var(--text-subdued); font-size: 11px; font-weight: 650; text-align: left; border-bottom: 1px solid var(--border-subdued); white-space: nowrap; }
td { padding: 12px 13px; border-bottom: 1px solid var(--border-subdued); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafafa; }
.cell-main { font-weight: 600; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { color: var(--text-subdued); font-size: 12px; margin-top: 3px; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 8px; background: #e3e3e3; font-size: 11px; font-weight: 650; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #616161; }
.badge.success { background: var(--green-bg); color: #145c3d; }.badge.success::before { background: var(--green); }
.badge.info { background: var(--blue-bg); color: #003a8c; }.badge.info::before { background: var(--blue); }
.badge.warning { background: var(--yellow-bg); color: #5e420c; }.badge.warning::before { background: #b98900; }
.badge.critical { background: var(--red-bg); color: #8e061a; }.badge.critical::before { background: var(--red); }
.badge.neutral::before { background: #616161; }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.empty { padding: 54px 24px; text-align: center; color: var(--text-subdued); }
.empty-mark { width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 14px; background: #e9f3ee; color: #267656; display: grid; place-items: center; font-size: 25px; font-weight: 750; }
.empty h3 { color: var(--text); margin: 0 0 7px; font-size: 15px; }
.empty p { margin: 0 auto 16px; max-width: 430px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.38); display: grid; place-items: center; padding: 20px; z-index: 100; animation: fade .12s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; width: min(100%,620px); max-height: min(88vh,820px); overflow: auto; border-radius: 14px; box-shadow: 0 16px 48px rgba(0,0,0,.22); }
.modal.wide { width: min(100%,920px); }
.modal-head { padding: 17px 20px; border-bottom: 1px solid var(--border-subdued); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-close { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; font-size: 20px; }
.modal-close:hover { background: #eee; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border-subdued); display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: #fff; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.detail-list { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; font-size: 13px; }
.detail-list dt { color: var(--text-subdued); }.detail-list dd { margin: 0; word-break: break-word; }
.item-list { margin-top: 18px; border: 1px solid var(--border-subdued); border-radius: 9px; overflow: hidden; }
.item-row { padding: 10px 12px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; border-bottom: 1px solid var(--border-subdued); }
.item-row:last-child { border-bottom: 0; }
.item-error { color: var(--red); font-size: 12px; margin-top: 4px; white-space: normal; }
.toast-region { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 280px; max-width: min(560px,90vw); color: #fff; background: #303030; padding: 11px 14px; border-radius: 9px; box-shadow: 0 8px 28px rgba(0,0,0,.25); animation: toast-in .18s ease-out; }
.toast.error { background: #8e061a; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 980px) {
  .grid.four { grid-template-columns: repeat(2,1fr); }
  .grid.two { grid-template-columns: 1fr; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { min-height: 280px; padding: 34px; }
  .auth-copy h1 { font-size: 38px; margin-top: 50px; }
  .auth-foot { display: none; }
  .topbar-search { display: none; }
}
@media (max-width: 720px) {
  .app-shell { grid-template-rows: 52px 1fr; }
  .topbar { height: 52px; }.topbar .brand { min-width: 0; flex: 1; }.topbar-user { min-width: 0; }
  .topbar-user .username { display: none; }
  .shell-body { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: auto 0 0; height: 58px; z-index: 40; border: 0; border-top: 1px solid #d4d4d4; display: flex; padding: 5px; overflow-x: auto; }
  .sidebar .nav-label { display: none; }.nav-item { justify-content: center; min-width: 90px; flex: 1; margin: 0; padding: 6px; flex-direction: column; gap: 1px; font-size: 10px; }
  .nav-icon { line-height: 15px; }.main { padding: 20px 13px 80px; }
  .page-head { align-items: center; }.page-head p { display: none; }
  .grid.four { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric { padding: 13px; }.metric-value { font-size: 22px; }
  .auth-panel { padding: 32px 22px; }.auth-hero { display: none; }
  .auth-page { min-height: 100vh; }.form-grid { grid-template-columns: 1fr; }
  .password-control { grid-template-columns: 1fr 1fr; }
  .password-control input { grid-column: 1 / -1; }
  .hide-mobile { display: none; }.modal-backdrop { padding: 0; align-items: end; }.modal { border-radius: 14px 14px 0 0; max-height: 92vh; }
}
