:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --page: #f5f6f8;
  --sidebar: #1f2937;
  --danger: #dc2626;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--page); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; }
a { color: var(--blue); text-decoration: none; }
button, input, textarea, select { font: inherit; }

.layout { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 14px; color: #e5e7eb; background: var(--sidebar); }
.system-name { display: flex; align-items: center; gap: 10px; padding: 2px 8px 22px; color: #fff; font-size: 17px; font-weight: 600; }
.system-logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 5px; color: #fff; background: var(--blue); font-weight: 700; }
.menu { display: grid; gap: 4px; }
.menu-item { display: block; padding: 10px 12px; border-radius: 5px; color: #cbd5e1; }
.menu-item:hover { color: #fff; background: #374151; }
.menu-item.active { color: #fff; background: var(--blue); }
.account-box { margin-top: auto; padding: 16px 8px 2px; border-top: 1px solid #374151; }
.account-name { color: #fff; font-weight: 600; }
.account-role { margin: 2px 0 8px; color: #9ca3af; font-size: 12px; }
.plain-button { padding: 0; border: 0; color: #cbd5e1; background: none; cursor: pointer; }

.content { min-width: 0; padding: 30px 34px 60px; }
.page-title-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 auto 20px; max-width: 1280px; }
.page-title-row h1 { margin: 0 0 4px; font-size: 24px; font-weight: 600; }
.page-title-row p { margin: 0; color: var(--muted); }
.panel { max-width: 1280px; margin: 0 auto; border: 1px solid var(--border); border-radius: 7px; background: #fff; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 15px; border: 1px solid #d1d5db; border-radius: 5px; color: #374151; background: #fff; cursor: pointer; }
.button:hover { background: #f9fafb; }
.button.primary { color: #fff; border-color: var(--blue); background: var(--blue); }
.button.primary:hover { background: var(--blue-dark); }
.button.wide { width: 100%; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th { color: #4b5563; background: #f9fafb; font-size: 13px; font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td strong { display: block; font-weight: 600; }
td small { display: block; margin-top: 3px; color: var(--muted); }
.actions-col { min-width: 280px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.status { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.status.enabled { color: #166534; background: #dcfce7; }
.status.disabled { color: #6b7280; background: #f3f4f6; }
.row-actions { display: flex; flex-wrap: wrap; gap: 7px 12px; }
.row-actions form { display: inline; }
.link-button { padding: 0; border: 0; color: var(--blue); background: transparent; cursor: pointer; }
.link-button.danger { color: var(--danger); }
.public-link { max-width: 350px; margin-top: 8px; color: var(--muted); overflow-wrap: anywhere; font-size: 11px; }

.form-panel { padding: 24px; }
.form-panel.narrow { max-width: 680px; margin-left: max(0px, calc((100% - 1280px) / 2)); }
.form { display: grid; gap: 18px; }
.form label { display: grid; gap: 7px; font-weight: 600; }
.form input, .form textarea, .form select { width: 100%; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 5px; color: var(--text); background: #fff; outline: none; }
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(37, 99, 235, .1); }
.form textarea { min-height: 440px; resize: vertical; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.form-actions { display: flex; gap: 10px; }
.help-text { margin: -5px 0 0; color: var(--muted); font-size: 13px; }
.empty { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 16px; }

.messages { max-width: 1280px; margin: 0 auto 15px; }
.message { padding: 10px 12px; border: 1px solid #bfdbfe; border-radius: 5px; color: #1e40af; background: #eff6ff; }
.message + .message { margin-top: 8px; }
.message.error { color: #991b1b; border-color: #fecaca; background: #fef2f2; }
.message.success { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #eef1f5; }
.login-panel { width: min(390px, 100%); padding: 32px; border: 1px solid #dfe3e8; border-radius: 8px; background: #fff; box-shadow: 0 8px 24px rgba(31, 41, 55, .08); }
.login-title { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-title h1 { margin: 0; font-size: 20px; font-weight: 600; }
.login-title p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.payment-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #f3f4f6; }
.payment-card { width: min(420px, 100%); padding: 30px; text-align: center; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.payment-brand { color: #166534; font-weight: 600; }
.payment-card h1 { margin: 12px 0 4px; font-size: 22px; font-weight: 600; }
.amount { margin: 8px 0 18px; font-size: 36px; font-weight: 700; }
.amount span { margin-right: 3px; font-size: 18px; }
.qr-frame { display: inline-block; padding: 10px; border: 1px solid var(--border); }
.qr-frame img { display: block; width: min(280px, 72vw); height: auto; }
.payment-tip { color: #4b5563; }
.payment-footnote, .error-code { color: #9ca3af; font-size: 12px; }
.error-symbol { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 50%; color: #fff; background: var(--danger); font-size: 24px; font-weight: 700; }
.error-message { color: #4b5563; }

@media (max-width: 760px) {
  .layout { display: block; }
  .sidebar { position: static; height: auto; padding: 12px; }
  .system-name { padding-bottom: 12px; }
  .menu { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-box { display: none; }
  .content { padding: 22px 14px 40px; }
  .page-title-row { align-items: flex-start; }
  .page-title-row h1 { font-size: 21px; }
  th, td { padding: 12px; }
}
