:root {
  --ink: #17251d;
  --muted: #68776e;
  --muted-light: #8a978f;
  --line: #dfe7e1;
  --line-strong: #cedbd2;
  --paper: #eef3ef;
  --surface: #ffffff;
  --green: #136b47;
  --green-dark: #0c4d33;
  --green-soft: #e6f3eb;
  --red: #b7463f;
  --red-soft: #fbeceb;
  --amber: #a56a16;
  --amber-soft: #fbf1dd;
  --blue: #34749f;
  --blue-soft: #eaf3f8;
  --shadow: 0 16px 44px rgba(31, 61, 43, .07);
  --radius: 16px;
  font-family: "Segoe UI Variable", Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at 85% 0%, #e4f1e9 0, transparent 32rem), var(--paper); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 18px 22px;
  color: #fff;
  background: linear-gradient(165deg, #102b1e 0%, #173c2a 58%, #123421 100%);
  box-shadow: 14px 0 42px rgba(17, 46, 31, .08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar::after { content: ""; position: absolute; right: -80px; bottom: 8%; width: 190px; height: 190px; border: 1px solid #ffffff0c; border-radius: 50%; box-shadow: 0 0 0 34px #ffffff05, 0 0 0 68px #ffffff03; pointer-events: none; }
.brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; padding: 2px 6px 25px; border-bottom: 1px solid #ffffff1a; }
.brand-mark { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid #83c7a5; border-radius: 12px; color: #effff6; background: linear-gradient(145deg, #ffffff1a, #ffffff06); box-shadow: inset 0 0 18px #9ee5bd12; font: 700 20px Georgia, serif; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; letter-spacing: .01em; }
.brand span { margin-top: 3px; color: #a8bdb0; font-size: 11px; }
.nav { position: relative; z-index: 1; display: grid; gap: 6px; margin-top: 24px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 12px 13px; border: 1px solid transparent; border-radius: 10px; color: #b8c9be; background: transparent; text-align: left; font-size: 13px; transition: background .16s ease, color .16s ease, border-color .16s ease; }
.nav-item:hover { color: #fff; background: #ffffff0b; }
.nav-item.active { color: #fff; background: #ffffff12; border-color: #ffffff12; box-shadow: inset 3px 0 #78d2a4; }
.dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #809188; box-shadow: 0 0 0 4px #ffffff0b; }
.dot.red { background: #ef8b84; }.dot.blue { background: #82bce0; }.dot.green { background: #7bdca5; }.dot.amber { background: #efbd6d; }
.privacy-note { position: relative; z-index: 1; margin-top: auto; padding: 15px; border: 1px solid #ffffff16; border-radius: 12px; color: #aebfb3; background: #ffffff06; font-size: 11px; line-height: 1.65; }
.privacy-note strong, .privacy-note span { display: block; }.privacy-note strong { margin-bottom: 4px; color: #edf7f0; }

.main { width: 100%; min-width: 0; max-width: 1600px; margin: 0 auto; padding: 28px clamp(24px, 3.2vw, 50px) 64px; }
.topbar { min-height: 68px; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 25px; }
.eyebrow { margin: 0 0 6px; color: var(--green); font-size: 10px; letter-spacing: .17em; font-weight: 800; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(27px, 2.6vw, 36px); line-height: 1.15; letter-spacing: -.025em; font-weight: 720; }
h2 { margin-bottom: 5px; font-size: 18px; letter-spacing: -.01em; }
.session-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #ffffffb8; box-shadow: 0 5px 18px #234b3410; font-size: 12px; }
.user-chip::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #47a778; box-shadow: 0 0 0 3px #47a77816; }

.button { border: 1px solid transparent; border-radius: 9px; padding: 9px 14px; font-size: 13px; font-weight: 620; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { width: 100%; padding: 12px; color: #fff; background: linear-gradient(135deg, #16774f, #0f5d3e); box-shadow: 0 8px 22px #176b4530; }
.button.primary:hover { box-shadow: 0 10px 26px #176b4540; }
.button.secondary { display: inline-flex; justify-content: center; align-items: center; color: var(--green-dark); border-color: var(--line-strong); background: #fff; }
.button.secondary:hover { border-color: #94bea6; box-shadow: 0 5px 16px #1f5d3c12; }
.button.ghost { color: var(--muted); border-color: var(--line); background: #ffffffa8; }

label { display: block; margin: 21px 0 8px; font-size: 12px; font-weight: 700; }
input, select { min-height: 39px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--ink); background: #fff; padding: 8px 11px; outline: none; transition: border-color .15s ease, box-shadow .15s ease; }
input:hover, select:hover { border-color: #aebfb3; }
input:focus, select:focus { border-color: #62a583; box-shadow: 0 0 0 3px #2f8b5d14; }

.login-wrap { min-height: calc(100vh - 130px); display: grid; place-items: center; }
.login-card { width: min(440px, 100%); padding: 38px; border: 1px solid #dce6df; border-radius: 20px; background: #ffffffed; box-shadow: 0 26px 70px #18382014; backdrop-filter: blur(12px); }
.login-card h2 { font-size: 28px; letter-spacing: -.025em; }
.login-card > p:not(.eyebrow):not(.error) { color: var(--muted); line-height: 1.75; font-size: 13px; }
.login-icon { float: right; width: 43px; height: 43px; display: grid; place-items: center; border-radius: 13px; color: var(--green); background: var(--green-soft); font-size: 21px; }
.login-card input { width: 100%; margin-bottom: 13px; }
.error { min-height: 20px; margin: 10px 0 0; color: var(--red); font-size: 12px; }

.summary-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric { position: relative; min-width: 0; padding: 18px 18px 17px; overflow: hidden; border: 1px solid #dfe7e1; border-radius: 14px; background: #ffffffef; box-shadow: 0 9px 30px #294b3610; }
.metric::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--green); }
.metric.warning::before { background: var(--red); }
.metric:nth-child(3)::before { background: #dda241; }
.metric:nth-child(4)::before { background: var(--blue); }
.metric span, .metric small { display: block; }
.metric span { color: var(--muted); font-size: 12px; font-weight: 620; }
.metric strong { display: block; margin: 9px 0 5px; font-size: 26px; line-height: 1.15; letter-spacing: -.035em; }
.metric small { overflow: hidden; color: var(--muted-light); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.panel { margin-bottom: 18px; padding: 22px; border: 1px solid #dce5de; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel.compact { padding: 27px 30px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 19px; }
.panel-head p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters input { min-width: 170px; }

.bulk-form { display: grid; grid-template-columns: minmax(210px, 1fr) repeat(3, minmax(108px, 145px)) 145px; gap: 11px; align-items: end; margin: 3px 0 20px; padding: 16px; border: 1px solid #d8e8dd; border-radius: 13px; background: linear-gradient(135deg, #f3f9f5, #f8faf8); }
.bulk-form > div strong, .bulk-form > div span { display: block; }
.bulk-form > div strong { margin-bottom: 4px; font-size: 13px; }
.bulk-form > div span { color: var(--muted); font-size: 10px; line-height: 1.55; }
.bulk-form label { margin: 0; color: #4d5e54; font-size: 10px; }
.bulk-form input { width: 100%; min-height: 37px; margin-top: 6px; background: #fff; }
.compact-button { width: auto; min-height: 37px; padding: 9px 12px; white-space: nowrap; font-size: 11px; }

.table-wrap { overflow: auto; border: 1px solid #e2e9e4; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 12px; color: #77857d; background: #f8faf8; font-size: 9px; font-weight: 800; letter-spacing: .055em; text-align: left; text-transform: uppercase; }
td { padding: 13px 12px; border-top: 1px solid #edf1ee; vertical-align: middle; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #fbfdfb; }
td strong, td span { display: block; }
td .sub { margin-top: 3px; color: var(--muted); font-size: 10px; }

.tag { display: inline-flex; align-items: center; gap: 5px; width: fit-content; padding: 5px 8px; border-radius: 999px; color: var(--red); background: var(--red-soft); font-size: 10px; font-weight: 750; white-space: nowrap; }
.tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tag.amber { color: var(--amber); background: var(--amber-soft); }
.tag.ok { color: var(--green); background: var(--green-soft); }
.tag.muted { color: var(--muted); background: #edf1ee; }
.action-set { display: flex; flex-wrap: wrap; gap: 6px; }
.mini { border: 1px solid var(--line-strong); border-radius: 7px; color: #45564c; background: #fff; padding: 6px 9px; font-size: 10px; font-weight: 650; transition: .15s ease; }
.mini:hover { color: var(--green); border-color: #8eb9a1; background: #f7fbf8; }

.quota-table-wrap { max-height: 610px; border: 1px solid #e0e8e2; border-radius: 12px; }
.quota-table { min-width: 1040px; table-layout: fixed; }
.quota-table thead { position: sticky; top: 0; z-index: 3; box-shadow: 0 1px 0 #e5ebe7; }
.quota-table th { padding: 12px 9px; background: #f7faf8; white-space: nowrap; }
.quota-table td { padding: 16px 9px; }
.quota-table th:nth-child(1) { width: 22%; }.quota-table th:nth-child(2) { width: 27%; }.quota-table th:nth-child(3) { width: 12%; }.quota-table th:nth-child(4) { width: 12%; }.quota-table th:nth-child(5) { width: 8%; }.quota-table th:nth-child(6) { width: 9%; }.quota-table th:nth-child(7) { width: 10%; }
.quota-table tbody tr:nth-child(even) { background: #fcfdfc; }
.quota-table tbody tr:hover { background: #f7fbf8; }
.quota-table input[type="number"] { width: 100%; min-width: 0; min-height: 36px; padding-inline: 8px; border-color: #d9e3dc; background: #fff; font-size: 11px; }
.quota-identity { display: flex; align-items: flex-start; gap: 11px; min-width: 0; }
.quota-avatar { flex: none; width: 37px; height: 37px; display: grid; place-items: center; border: 1px solid #cae0d2; border-radius: 11px; color: var(--green-dark); background: linear-gradient(145deg, #eef8f2, #dfeee5); font: 700 15px Georgia, "Microsoft YaHei", serif; }
.quota-user-cell { min-width: 0; }
.quota-user-cell > strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.quota-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.quota-meta .role, .quota-meta .key-state { display: inline-flex; width: fit-content; margin: 0; padding: 3px 6px; border-radius: 5px; font-size: 9px; line-height: 1.2; white-space: nowrap; }
.quota-meta .role { color: #5d6c63; background: #edf1ee; }
.quota-meta .key-state { color: #8b7760; background: #f5f1e9; }
.quota-meta .key-state.ready { color: var(--green); background: var(--green-soft); }

.quota-meter + .quota-meter { margin-top: 10px; }
.quota-meter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 10px; }
.quota-meter-head span { color: var(--muted); }
.quota-meter-head strong { color: var(--green-dark); font-size: 11px; font-variant-numeric: tabular-nums; }
.quota-track { height: 6px; margin-top: 5px; overflow: hidden; border-radius: 99px; background: #e9eee9; }
.quota-track > span { display: block; height: 100%; min-width: 0; border-radius: inherit; background: linear-gradient(90deg, #43a779, #19805a); transition: width .45s ease; }
.quota-meter small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted-light); font-size: 9px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.quota-meter.warning .quota-meter-head strong { color: var(--amber); }
.quota-meter.warning .quota-track > span { background: linear-gradient(90deg, #e8b65d, #c88722); }
.quota-meter.blocked .quota-meter-head strong { color: var(--red); }
.quota-meter.blocked .quota-track { background: #f4dfdd; }
.quota-meter.blocked .quota-track > span { background: repeating-linear-gradient(135deg, #cd625b 0 5px, #bd4b44 5px 10px); }
.quota-meter.unlimited .quota-meter-head strong { color: var(--blue); }
.quota-meter.unlimited .quota-track > span { background: #9bb8c8; }
.usage { min-width: 0; }

.status-note { margin-top: 6px; color: var(--muted-light); font-size: 9px; line-height: 1.35; }
.quota-save { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; white-space: nowrap; }
.quota-save label { display: inline-flex; align-items: center; gap: 5px; margin: 0; color: var(--muted); font-size: 10px; font-weight: 550; }
.quota-save input { width: 14px; min-height: 14px; accent-color: var(--green); }
.mini.save { color: #fff; border-color: var(--green); background: var(--green); }
.mini.save:hover { color: #fff; border-color: var(--green-dark); background: var(--green-dark); }

.empty { padding: 48px; text-align: center; color: var(--muted); }
.empty span { display: grid; place-items: center; width: 42px; height: 42px; margin: 0 auto 12px; border-radius: 50%; color: var(--green); background: var(--green-soft); }
.empty strong { display: block; color: var(--ink); }
.empty p { margin: 6px 0; font-size: 12px; }
.bars { display: grid; gap: 9px; margin: 12px 0 24px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 80px; gap: 10px; align-items: center; font-size: 11px; }
.bar-track { height: 8px; overflow: hidden; border-radius: 10px; background: #e8eee9; }
.bar-fill { height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, #5bb88a, #1a7a54); }
.system-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.system-card { padding: 17px; border: 1px solid #e0e8e2; border-radius: 11px; background: #f9fbf9; }
.system-card span { color: var(--muted); font-size: 11px; }
.system-card strong { display: block; margin-top: 8px; font-size: 15px; word-break: break-word; }
.status-ok { color: var(--green); }
.plain-list { margin: 14px 0 0; padding-left: 20px; color: var(--muted); line-height: 1.9; font-size: 12px; }
.toast { position: fixed; right: 28px; bottom: 28px; z-index: 20; max-width: 360px; padding: 12px 16px; border: 1px solid #ffffff18; border-radius: 10px; color: #fff; background: #183b2a; box-shadow: 0 14px 44px #0003; font-size: 12px; }

@media (max-width: 1280px) {
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bulk-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bulk-form > div { grid-column: 1 / -1; }
  .compact-button { width: 100%; }
}
@media (max-width: 1040px) {
  .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 23px 11px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand > div:last-child, .privacy-note, .nav-item { font-size: 0; }
  .nav-item { justify-content: center; padding-inline: 0; }
  .nav-item.active { box-shadow: inset 0 -2px #78d2a4; }
  .brand-mark { width: 39px; height: 39px; }
  .nav-item .dot { width: 10px; height: 10px; }
  .panel { padding: 18px; }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 13px 14px; flex-direction: row; align-items: center; }
  .sidebar::after { display: none; }
  .brand { border: 0; padding: 0; }
  .brand > div:last-child { display: none; }
  .nav { display: flex; gap: 4px; margin: 0 0 0 auto; }
  .nav-item { width: 38px; height: 38px; padding: 0; border-radius: 9px; }
  .main { padding: 20px 13px 42px; }
  .topbar { min-height: 58px; margin-bottom: 18px; }
  .summary-grid, .system-grid { grid-template-columns: 1fr; gap: 9px; }
  .metric { padding: 15px 16px; }
  .panel { padding: 15px; border-radius: 13px; }
  .panel-head { align-items: stretch; flex-direction: column; }
  .filters > * { flex: 1; min-width: 0; }
  .filters input { min-width: 0; }
  .bulk-form { grid-template-columns: 1fr; }
  .bulk-form > div, .compact-button { grid-column: auto; }
  .quota-table { min-width: 980px; }
  .session-actions { flex-direction: column; align-items: flex-end; gap: 3px; }
  .button.ghost { padding: 6px 10px; }
  .login-card { padding: 28px 21px; }
  .bar-row { grid-template-columns: 80px 1fr 62px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
