:root {
  color-scheme: light;
  --bg: #f5f6fa;
  --panel: #ffffff;
  --text: #171923;
  --muted: #737887;
  --line: #e7e9f0;
  --accent: #6d5dfb;
  --accent-soft: #efedff;
  --pink: #ff5c9a;
  --danger: #d73753;
  --success: #15835b;
  --shadow: 0 18px 50px rgba(36, 32, 72, .10);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 16px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 12%, #fff 0, #f6f3ff 35%, var(--bg) 70%); }
.login-card { width: min(400px, 100%); padding: 40px; border: 1px solid rgba(255,255,255,.8); border-radius: 28px; background: rgba(255,255,255,.9); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.brand-mark { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 24px; border-radius: 17px; color: white; font-size: 26px; background: linear-gradient(135deg, var(--accent), var(--pink)); box-shadow: 0 10px 28px rgba(109,93,251,.28); }
.brand-mark.small { width: 36px; height: 36px; margin: 0; border-radius: 11px; font-size: 18px; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 12px; font-weight: 750; letter-spacing: .14em; }
h1, h2, p { margin-top: 0; }
.login-card h1 { margin-bottom: 10px; font-size: 32px; }
.muted { color: var(--muted); }
label { display: block; margin: 22px 0 8px; font-size: 14px; font-weight: 650; }
input, select { width: 100%; min-height: 44px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: #fff; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
button { border: 0; border-radius: 11px; }
.primary { padding: 11px 18px; color: white; font-weight: 700; background: linear-gradient(135deg, var(--accent), #8b65f6 55%, var(--pink)); box-shadow: 0 7px 20px rgba(109,93,251,.2); }
.secondary { padding: 10px 16px; color: var(--text); background: #f0f1f5; }
.danger { color: var(--danger); background: #fff0f2; }
.wide { width: 100%; margin-top: 18px; }
.form-error { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-size: 14px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 16px; border-right: 1px solid var(--line); background: rgba(255,255,255,.94); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 30px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 12px; }
nav { display: grid; gap: 5px; }
nav button, .logout { width: 100%; padding: 11px 12px; text-align: left; color: #5c6170; background: transparent; display: flex; align-items: center; gap: 11px; font-size: 14px; font-weight: 620; }
nav button span { width: 20px; text-align: center; font-size: 17px; }
nav button:hover, nav button.active { color: var(--accent); background: var(--accent-soft); }
nav button b { min-width: 20px; margin-left: auto; padding: 2px 6px; border-radius: 99px; color: #fff; text-align: center; font-size: 11px; background: var(--pink); }
.logout { margin-top: auto; }
.main { min-width: 0; }
.topbar { min-height: 94px; padding: 24px 34px 18px; display: flex; align-items: center; gap: 18px; }
.topbar h1 { margin: 0; font-size: 26px; }
.page-actions { margin-left: auto; display: flex; gap: 10px; }
.content { padding: 0 34px 40px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.stat, .panel { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 5px 18px rgba(36,32,72,.035); }
.stat { padding: 20px; }
.stat .value { display: block; margin: 9px 0 2px; font-size: 31px; font-weight: 760; letter-spacing: -.04em; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .dot { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; background: var(--accent); }
.panel { margin-top: 18px; overflow: hidden; }
.panel-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head .search { width: min(320px, 100%); margin-left: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 18px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; background: #fafbfc; }
td { font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcff; }
.person { display: flex; align-items: center; gap: 10px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: var(--accent); font-weight: 750; background: var(--accent-soft); }
.person small { display: block; margin-top: 2px; color: var(--muted); }
.status, .tag { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; background: #eef1f5; }
.status.active { color: var(--success); background: #e8f8f1; }
.status.pending { color: #9a6411; background: #fff5db; }
.status.inactive { color: var(--muted); }
.tag { margin: 2px 4px 2px 0; border: 1px solid color-mix(in srgb, var(--tag-color) 35%, white); color: var(--tag-color); background: color-mix(in srgb, var(--tag-color) 10%, white); }
.actions { display: flex; gap: 7px; justify-content: flex-end; }
.text-button { padding: 7px 10px; color: var(--accent); background: var(--accent-soft); font-size: 13px; }
.text-button.danger { color: var(--danger); background: #fff0f2; }
.empty { padding: 60px 24px; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 7px; color: var(--text); }
.loading { padding: 60px; text-align: center; color: var(--muted); }
.icon-button { width: 38px; height: 38px; color: var(--muted); background: #f0f1f5; font-size: 20px; }
.mobile-only { display: none; }
dialog { width: min(560px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 22px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(21,22,31,.35); backdrop-filter: blur(4px); }
dialog header, dialog footer { padding: 20px 22px; display: flex; align-items: center; gap: 12px; }
dialog header { border-bottom: 1px solid var(--line); }
dialog header h2 { margin: 0; font-size: 21px; }
dialog header .icon-button { margin-left: auto; }
dialog footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.dialog-body { padding: 6px 22px 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check-row { display: flex; align-items: center; gap: 9px; margin-top: 20px; font-size: 14px; }
.check-row input { width: 18px; min-height: 18px; }
.tag-picker { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; }
.tag-option { display: flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.tag-option input { width: 16px; min-height: 16px; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 360px; padding: 13px 16px; border-radius: 12px; color: white; background: #20222b; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 10; width: 230px; transform: translateX(-100%); transition: .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: inline-grid; place-items: center; }
}
@media (max-width: 620px) {
  .topbar { padding: 18px 18px 14px; }
  .content { padding: 0 14px 30px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat { padding: 15px; }
  .stat .value { font-size: 25px; }
  .panel-head { align-items: stretch; flex-direction: column; }
  .panel-head .search { width: 100%; margin: 0; }
  .form-grid { grid-template-columns: 1fr; }
}
