:root {
  color-scheme: light;
  --background: #f5f7f6;
  --surface: #ffffff;
  --ink: #192420;
  --muted: #64716b;
  --line: #dce3df;
  --green: #16744f;
  --green-dark: #105a3d;
  --orange: #a96120;
  --red: #b04444;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--background); color: var(--ink); font: 14px/1.5 Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif; letter-spacing: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(22,116,79,.23); outline-offset: 2px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 62px; padding: 0 28px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand strong { color: var(--green); font-size: 20px; font-weight: 800; }
.brand span { color: var(--muted); font-size: 13px; }
.account { display: flex; align-items: center; gap: 16px; color: var(--muted); }
.account button { padding: 5px 10px; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--ink); }
.account button:hover { border-color: var(--green); }
.login-shell { display: grid; min-height: calc(100vh - 62px); place-items: center; padding: 24px; }
.login-form { display: grid; width: min(100%, 380px); gap: 8px; padding: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 12px 32px rgba(24,45,34,.07); }
.login-form h1 { margin: 0 0 16px; font-size: 22px; }
.login-form label { margin-top: 8px; font-weight: 600; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid #cbd5d0; border-radius: 5px; background: white; color: var(--ink); }
input, select { min-height: 40px; padding: 0 10px; }
textarea { padding: 12px; resize: vertical; }
textarea[readonly] { background: #f1f4f2; color: #3d4a43; }
.primary { min-height: 40px; padding: 0 18px; border: 1px solid var(--green); border-radius: 5px; background: var(--green); color: white; font-weight: 700; }
.primary:hover { background: var(--green-dark); }
.login-form .primary { margin-top: 6px; }
.password-form { display: grid; width: min(100%, 420px); gap: 8px; }
.password-form label { margin-top: 8px; font-weight: 600; }
.password-form .primary { width: fit-content; margin-top: 12px; }
.message { min-height: 20px; margin: 0; color: var(--green); font-size: 13px; }
.message.error { color: var(--red); }
.app-layout { display: grid; min-height: calc(100vh - 62px); grid-template-columns: 210px minmax(0, 1fr); }
.side-nav { display: flex; flex-direction: column; gap: 4px; padding: 22px 12px; border-right: 1px solid var(--line); background: var(--surface); }
.side-nav button { min-height: 42px; padding: 0 14px; border: 0; border-radius: 5px; background: transparent; color: #3f5148; text-align: left; font-weight: 600; }
.side-nav button:hover { background: #eff4f0; }
.side-nav button.active { background: #e8f3eb; color: var(--green-dark); }
.main-content { width: min(100%, 1100px); margin: 0 auto; padding: 34px 42px 72px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.section-head h1, #emptyPanel h1 { margin: 0; font-size: 25px; line-height: 1.25; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 12px; }
.permission-label { min-width: 58px; padding: 4px 8px; border: 1px solid #bed7c6; border-radius: 4px; background: #eaf4ed; color: var(--green-dark); text-align: center; font-size: 12px; }
.permission-label.readonly { border-color: #e7d5bc; background: #fff6e9; color: var(--orange); }
.field-title { display: block; margin-bottom: 8px; font-weight: 600; }
#moduleContent { min-height: 200px; }
.actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.create-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) 150px 150px auto; align-items: end; gap: 12px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field label, .user-grant label, .user-password label { font-weight: 600; font-size: 12px; color: #405047; }
.create-button { white-space: nowrap; }
#createMessage { margin-top: 10px; }
.list-heading { display: flex; align-items: baseline; gap: 10px; margin-top: 32px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.list-heading h2 { margin: 0; font-size: 16px; }
.list-heading span { color: var(--muted); font-size: 12px; }
.user-row { display: grid; grid-template-columns: minmax(110px, 1.2fr) minmax(120px, 1fr) minmax(120px, 1fr) 120px 170px 75px; align-items: end; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.user-name { align-self: center; min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
.user-grant, .user-password { display: grid; gap: 6px; min-width: 0; }
.user-active { display: flex; min-height: 40px; align-items: center; gap: 8px; white-space: nowrap; }
.user-active input { width: 16px; min-height: 16px; accent-color: var(--green); }
.save-user { min-height: 40px; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--ink); }
.save-user:hover { border-color: var(--green); color: var(--green); }
.row-message { grid-column: 1 / -1; color: var(--green); font-size: 12px; }
.row-message.error { color: var(--red); }
@media (max-width: 1050px) {
  .create-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-name { grid-column: 1 / -1; }
  .row-message { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .topbar { padding: 0 16px; }
  .brand { gap: 6px; }
  .brand span { font-size: 11px; }
  .account { gap: 8px; }
  .account button { padding: 5px 7px; }
  .app-layout { display: block; }
  .side-nav { flex-direction: row; gap: 4px; overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-nav button { flex: 0 0 auto; }
  .main-content { padding: 24px 16px 56px; }
  .section-head h1 { font-size: 21px; }
  .create-form { grid-template-columns: 1fr; }
  .user-row { gap: 10px; }
}
