:root {
  color-scheme: light;
  --ink: #17221d;
  --muted: #68756e;
  --paper: #f4f1e8;
  --surface: #fffdf7;
  --line: #ded9ca;
  --green: #1f6649;
  --green-dark: #164735;
  --green-pale: #e7f0e9;
  --gold: #c49339;
  --red: #a84235;
  --shadow: 0 18px 48px rgba(31, 47, 39, 0.11);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 1100px; min-height: 100vh; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 15% 12%, rgba(196, 147, 57, .2), transparent 27%),
    linear-gradient(132deg, #173f31 0 44%, #efe8d7 44% 100%);
}
.login-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .14;
  background-image: linear-gradient(90deg, transparent 49%, #fff 50%, transparent 51%);
  background-size: 62px 62px;
}
.login-card { width: 420px; padding: 46px; background: rgba(255, 253, 247, .98); border: 1px solid rgba(255,255,255,.7); box-shadow: var(--shadow); position: relative; }
.brand-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px 5px 18px 5px; color: #fff; background: var(--green); border: 3px solid #d2b06c; font: 700 28px Georgia, serif; box-shadow: 7px 7px 0 #d8c49d; }
.brand-mark-small { width: 40px; height: 40px; border-width: 2px; border-radius: 12px 4px; font-size: 19px; box-shadow: 4px 4px 0 #d8c49d; }
.eyebrow { margin: 24px 0 7px; color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.login-card h1 { margin: 0; font: 700 31px/1.2 Georgia, "Microsoft YaHei", serif; }
.login-subtitle { color: var(--muted); margin: 9px 0 30px; }
.login-form { display: grid; gap: 17px; }
label { display: grid; gap: 8px; font-size: 13px; font-weight: 700; color: #34433b; }
input, select { width: 100%; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 12px 13px; border-radius: 6px; outline: 0; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31, 102, 73, .12); }
.primary-button, .secondary-button { border: 0; border-radius: 6px; padding: 11px 18px; font-weight: 750; }
.primary-button { background: var(--green); color: white; box-shadow: 0 4px 0 var(--green-dark); }
.primary-button:hover { background: #277657; }
.secondary-button { color: var(--green); background: var(--green-pale); }
.text-button { border: 0; color: #c9d8cf; background: transparent; padding: 6px 0; }
.security-note { margin: 23px 0 0; font-size: 12px; color: var(--muted); }
.form-error { min-height: 18px; margin: 0; color: var(--red); font-size: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 242px 1fr; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 242px; display: flex; flex-direction: column; color: white; background: #173d30; padding: 24px 16px 18px; }
.sidebar-brand { display: flex; gap: 13px; align-items: center; padding: 2px 8px 27px; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand strong { font-size: 14px; }
.sidebar-brand span { margin-top: 3px; color: #b5c8bd; font-size: 12px; }
nav { display: grid; gap: 5px; padding: 25px 0; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 7px; color: #c9d8cf; background: transparent; text-align: left; }
.nav-item:hover { color: white; background: rgba(255,255,255,.07); }
.nav-item.active { color: #173d30; background: #f5ebd6; font-weight: 750; }
.nav-icon { width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-size: 11px; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 17px 8px 0; }
.admin-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.admin-chip > span { width: 33px; height: 33px; display: grid; place-items: center; color: #173d30; background: #d8c49d; border-radius: 50%; font-weight: 800; }
.admin-chip strong, .admin-chip small { display: block; }
.admin-chip strong { font-size: 13px; }
.admin-chip small { margin-top: 2px; color: #aebfb5; font-size: 11px; }

.workspace { grid-column: 2; min-width: 0; padding: 0 35px 50px; }
.topbar { height: 105px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.topbar .eyebrow { margin: 0 0 5px; }
.topbar h2 { margin: 0; font: 700 26px Georgia, "Microsoft YaHei", serif; }
.topbar-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.topbar-status span { width: 8px; height: 8px; border-radius: 50%; background: #4b9a69; box-shadow: 0 0 0 4px rgba(75,154,105,.15); }
.view-content { padding-top: 28px; }
.notice { position: fixed; z-index: 20; top: 20px; right: 28px; max-width: 440px; padding: 12px 18px; color: white; background: var(--green); border-radius: 6px; box-shadow: var(--shadow); }
.notice.error { background: var(--red); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 16px; }
.stat-card, .panel { background: var(--surface); border: 1px solid var(--line); box-shadow: 0 5px 18px rgba(45,55,49,.045); }
.stat-card { padding: 20px 21px; position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; top: 0; right: 0; width: 48px; height: 5px; background: var(--gold); }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin-top: 10px; font: 700 31px Georgia, serif; }
.panel { margin-top: 18px; padding: 22px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.panel-header h3 { margin: 0; font: 700 19px Georgia, "Microsoft YaHei", serif; }
.panel-header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.toolbar { display: flex; gap: 9px; align-items: center; }
.toolbar input { width: 260px; }
.toolbar select { width: 130px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 10px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 11px; letter-spacing: .04em; text-align: left; }
td { padding: 13px 10px; border-bottom: 1px solid #ebe7dc; vertical-align: middle; }
tbody tr:hover { background: #faf7ef; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 20px; background: var(--green-pale); color: var(--green); font-size: 11px; font-weight: 700; }
.status-pill.banned { color: var(--red); background: #f5e6e2; }
.status-pill.offline { color: var(--muted); background: #edeae2; }
.row-actions { display: flex; gap: 6px; }
.small-button { border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: white; padding: 6px 9px; font-size: 11px; }
.small-button.danger { color: var(--red); border-color: #dfbdb6; }
.small-button:hover { border-color: var(--green); }
.muted { color: var(--muted); }
.pre-line { white-space: pre-line; }
.empty-state { padding: 50px 20px; text-align: center; color: var(--muted); }
.role-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.role-card { padding: 19px; background: #fff; border: 1px solid var(--line); }
.role-card h3 { margin: 0; font-size: 16px; }
.role-card ul { margin: 14px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.85; }
.coming-soon { min-height: 360px; display: grid; place-items: center; text-align: center; }
.coming-soon strong { display: block; color: var(--green); font: 700 24px Georgia, "Microsoft YaHei", serif; }
.coming-soon p { max-width: 500px; color: var(--muted); line-height: 1.7; }

dialog { width: 500px; border: 0; border-radius: 9px; padding: 0; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(19, 35, 27, .58); backdrop-filter: blur(2px); }
#dialogForm { padding: 24px; }
.dialog-heading { display: flex; justify-content: space-between; }
.dialog-heading .eyebrow { margin: 0 0 5px; }
.dialog-heading h3 { margin: 0; font: 700 22px Georgia, "Microsoft YaHei", serif; }
.icon-button { width: 32px; height: 32px; border: 0; border-radius: 50%; color: var(--muted); background: #eeeae0; font-size: 22px; }
.dialog-body { display: grid; gap: 14px; padding: 22px 0 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }
#dialogSubmit.danger { background: var(--red); box-shadow: 0 4px 0 #7d3028; }
.one-time-secret { padding: 14px; border: 1px dashed var(--gold); background: #faf2df; font-family: Consolas, monospace; font-size: 17px; word-break: break-all; }

@media (max-width: 1250px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar input { width: 210px; }
}
