:root {
  --ink: #14231e;
  --muted: #6d7b75;
  --line: #dfe7e2;
  --panel: #ffffff;
  --canvas: #f4f7f5;
  --green: #146b4a;
  --green-2: #0e543a;
  --green-soft: #e7f3ed;
  --amber: #a86313;
  --red: #a23d38;
  --shadow: 0 18px 54px rgba(26, 53, 43, .09);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 9px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.muted { color: var(--muted); line-height: 1.75; }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; color: white; background: var(--green); font-family: Georgia, serif; font-size: 28px; font-weight: 700; box-shadow: 0 12px 26px rgba(20,107,74,.22); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 12px; font-size: 21px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #37a874; box-shadow: 0 0 0 4px rgba(55,168,116,.13); }

/* Login */
.login-body { min-height: 100vh; background: #eef3f0; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1.05fr) minmax(480px, .95fr); }
.login-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: 9vw; color: white; background: #153f31; }
.login-brand::before { content: ""; position: absolute; inset: auto -12vw -30vw 10vw; height: 50vw; border-radius: 50%; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 0 0 7vw rgba(255,255,255,.025), 0 0 0 14vw rgba(255,255,255,.018); }
.login-brand > * { position: relative; z-index: 1; max-width: 600px; }
.login-brand .brand-mark { margin-bottom: 72px; background: #eaf4ef; color: #153f31; }
.login-brand .eyebrow { color: #98c9b3; }
.login-brand h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(48px, 5.2vw, 78px); font-weight: 500; line-height: 1.08; letter-spacing: -.045em; }
.login-brand .lead { margin: 30px 0 42px; color: #c7d9d1; font-size: 17px; line-height: 1.85; }
.boundary-card { display: flex; gap: 15px; align-items: center; width: max-content; max-width: 100%; padding: 16px 20px; border: 1px solid rgba(255,255,255,.13); border-radius: 14px; background: rgba(255,255,255,.055); }
.boundary-card strong, .boundary-card small { display: block; }
.boundary-card small { margin-top: 5px; color: #a9c4b8; }
.login-panel { display: grid; place-items: center; padding: 48px; }
.login-card { width: min(470px, 100%); padding: 48px; border: 1px solid rgba(20,107,74,.08); border-radius: 24px; background: white; box-shadow: var(--shadow); }
.login-card h2 { margin: 0 0 14px; font-size: 34px; letter-spacing: -.035em; }
.mobile-logo { display: none; }
.login-button { width: 100%; margin: 30px 0 26px; justify-content: space-between; text-decoration: none; }
.ding-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--green); background: white; font-size: 12px; font-weight: 900; }
.login-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.login-meta div { padding: 16px; border-radius: 12px; background: var(--canvas); }
.login-meta span, .login-meta strong { display: block; }
.login-meta span { margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.login-meta strong { font-size: 14px; }
.fineprint { margin: 26px 0 0; color: #829089; font-size: 12px; line-height: 1.7; }
.notice { margin: 18px 0 -12px; padding: 13px 15px; border-radius: 10px; font-size: 13px; }
.notice.error { color: var(--red); background: #fbebea; }
.notice.warning { color: var(--amber); background: #fff5e5; }

/* Authorization console */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 235px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 18px 18px; color: #d5e3dc; background: #173b30; }
.wordmark { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.wordmark strong, .wordmark small { display: block; }
.wordmark strong { color: white; font-size: 17px; }
.wordmark small { margin-top: 3px; color: #8eb1a1; font-size: 11px; }
.main-nav { display: grid; gap: 5px; }
.main-nav a { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 10px; color: #b9cec4; text-decoration: none; font-size: 14px; }
.main-nav a:hover, .main-nav a.active { color: white; background: rgba(255,255,255,.095); }
.main-nav a span { width: 18px; color: #7fb59d; text-align: center; }
.sidebar-footer { margin-top: auto; }
.environment { display: flex; align-items: center; gap: 10px; padding: 13px 11px; border-bottom: 1px solid rgba(255,255,255,.1); color: #a9c2b7; font-size: 11px; }
.user-mini { padding: 14px 10px 2px; font-size: 12px; }
.user-mini strong, .user-mini small { display: block; }
.user-mini small { margin-top: 4px; color: #82a596; }
.main-content { min-width: 0; padding: 40px 4vw 70px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; max-width: 1280px; margin: 0 auto 30px; }
.page-header h1 { margin: 0 0 8px; font-size: 34px; letter-spacing: -.04em; }
.page-header p:last-child { margin: 0; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.isolation-pill { padding: 8px 12px; border: 1px solid #c9ddd3; border-radius: 999px; color: var(--green); background: #eef7f2; font-size: 12px; font-weight: 700; }
.tabs { display: flex; gap: 5px; max-width: 1280px; margin: 0 auto 22px; overflow: auto; padding-bottom: 1px; border-bottom: 1px solid var(--line); }
.tabs button { flex: 0 0 auto; padding: 12px 14px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; cursor: pointer; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--green); border-color: var(--green); font-weight: 700; }
.content-area { max-width: 1280px; margin: 0 auto; }
.panel, .loading-card { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 10px 34px rgba(38,59,50,.045); }
.loading-card { padding: 44px; color: var(--muted); text-align: center; }
.panel { padding: 24px; }
.panel + .panel { margin-top: 16px; }
.panel-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 20px; }
.panel-title h2 { margin: 0 0 6px; font-size: 19px; }
.panel-title p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.stat-card { padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin: 12px 0 4px; font-family: Georgia, serif; font-size: 34px; font-weight: 500; }
.stat-card small { color: #8b9791; }
.workflow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.workflow-step { position: relative; padding: 18px; border-radius: 12px; background: var(--canvas); }
.workflow-step b { display: grid; place-items: center; width: 28px; height: 28px; margin-bottom: 18px; border-radius: 9px; color: white; background: var(--green); font-size: 12px; }
.workflow-step strong, .workflow-step span { display: block; }
.workflow-step span { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.rule-list { display: grid; gap: 12px; }
.rule-item { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 13px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.rule-item:last-child { border-bottom: 0; }
.rule-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 900; }
.rule-item strong, .rule-item small { display: block; }
.rule-item small { margin-top: 4px; color: var(--muted); }
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; color: #4b5a54; background: #eef2f0; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge.approved { color: var(--green); background: var(--green-soft); }
.badge.pending { color: var(--amber); background: #fff3df; }
.badge.rejected, .badge.inactive { color: var(--red); background: #fae9e8; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.toolbar input, .field input, .field textarea, .field select { width: 100%; padding: 11px 12px; border: 1px solid #cdd9d3; border-radius: 9px; color: var(--ink); background: white; outline: none; }
.toolbar input { width: min(340px, 100%); }
.toolbar input:focus, .field input:focus, .field textarea:focus, .field select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20,107,74,.09); }
.member-layout, .role-layout { display: grid; grid-template-columns: minmax(300px, .88fr) minmax(420px, 1.12fr); gap: 16px; }
.list-card, .detail-card { min-height: 520px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.list-row { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 12px; border: 0; border-bottom: 1px solid #edf1ef; color: var(--ink); background: transparent; text-align: left; cursor: pointer; }
.list-row:hover, .list-row.selected { border-radius: 10px; background: #f1f6f3; }
.list-row strong, .list-row small { display: block; }
.list-row small { margin-top: 5px; color: var(--muted); }
.avatar { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; color: var(--green); background: var(--green-soft); font-weight: 800; }
.list-main { display: flex; flex: 1; align-items: center; gap: 11px; min-width: 0; }
.detail-heading { display: flex; justify-content: space-between; gap: 15px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.detail-heading h3 { margin: 0 0 6px; }
.detail-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.field { display: block; margin-top: 20px; }
.field > span { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 700; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.check-card { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.check-card:has(input:checked) { border-color: #93bea9; background: #f0f7f3; }
.check-card input { accent-color: var(--green); }
.check-card strong, .check-card small { display: block; }
.check-card small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.detail-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.primary-button, .secondary-button, .danger-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 40px; padding: 10px 16px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-weight: 700; }
.primary-button { color: white; background: var(--green); }
.primary-button:hover { background: var(--green-2); }
.secondary-button { color: var(--ink); border-color: #cbd7d1; background: white; }
.secondary-button:hover { background: #f5f8f6; }
.danger-button { color: var(--red); border-color: #e6c3c1; background: #fffafa; }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-size: 24px; }
.empty-state { display: grid; place-items: center; min-height: 260px; color: var(--muted); text-align: center; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; vertical-align: top; }
th { color: var(--muted); font-size: 11px; letter-spacing: .04em; }
td strong, td small { display: block; }
td small { margin-top: 4px; color: var(--muted); }
.role-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.permission-summary { display: grid; gap: 7px; margin-top: 20px; }
.permission-line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 9px; background: var(--canvas); font-size: 12px; }
.dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 28px 90px rgba(12,31,24,.28); }
.dialog::backdrop { background: rgba(10,31,24,.42); backdrop-filter: blur(3px); }
.dialog form { padding: 26px; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; }
.dialog-header h2 { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.permission-matrix { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; }
.permission-group { padding: 13px; border-bottom: 1px solid var(--line); }
.permission-group:last-child { border-bottom: 0; }
.permission-group > strong { display: block; margin-bottom: 9px; font-size: 13px; }
.permission-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.permission-actions label { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.permission-actions select { padding: 5px; border: 1px solid var(--line); border-radius: 6px; font-size: 11px; }
.toast { position: fixed; z-index: 10; top: 22px; right: 24px; max-width: 420px; padding: 13px 16px; border-radius: 10px; color: white; background: #244e3f; box-shadow: var(--shadow); font-size: 13px; }

@media (max-width: 950px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; padding: 24px; }
  .mobile-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 42px; font-weight: 800; }
  .mobile-logo span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: white; background: var(--green); }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 14px 18px; flex-direction: row; align-items: center; }
  .wordmark { padding: 0; margin-right: auto; }
  .wordmark small, .sidebar-footer, .main-nav a:not(.active) { display: none; }
  .main-nav a { padding: 9px 12px; }
  .main-content { padding: 28px 22px 60px; }
  .member-layout, .role-layout { grid-template-columns: 1fr; }
  .list-card, .detail-card { min-height: auto; }
}
@media (max-width: 650px) {
  .login-card { padding: 30px 24px; }
  .login-meta, .stat-grid, .workflow, .check-grid { grid-template-columns: 1fr; }
  .page-header { align-items: flex-start; }
  .header-actions { display: none; }
  .page-header h1 { font-size: 29px; }
  .panel { padding: 18px; }
  .toolbar { flex-direction: column; }
  .toolbar input { width: 100%; }
  .tabs button { padding-inline: 10px; }
}
