:root {
  color-scheme: light;
  --ink: #202522;
  --muted: #6e746f;
  --line: #dfe3df;
  --soft: #f4f6f4;
  --paper: #ffffff;
  --nav: #171b19;
  --green: #1f6b4d;
  --green-soft: #e8f3ed;
  --red: #a63f36;
  --red-soft: #f8eae8;
  --amber: #956d19;
  --amber-soft: #f8f0dc;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #f7f8f7; font-size: 14px; letter-spacing: 0; }
button, input, textarea { font: inherit; letter-spacing: 0; }
button, summary { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: 25px; font-weight: 680; }
h2 { margin-bottom: 4px; font-size: 16px; }
small { display: block; margin-top: 4px; color: var(--muted); }
code { color: #38413c; font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 5; display: flex; width: 220px; flex-direction: column; color: #eef1ee; background: var(--nav); }
.brand { display: flex; align-items: center; gap: 10px; height: 74px; padding: 0 22px; font-size: 15px; font-weight: 650; }
.brand-mark { display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid #607068; color: #dcf2e5; font: 700 14px Georgia, serif; }
.sidebar nav { display: grid; gap: 4px; padding: 10px 12px; }
.sidebar nav a { padding: 11px 14px; border-radius: 5px; color: #aeb6b1; text-decoration: none; }
.sidebar nav a:hover { color: white; background: #232a26; }
.sidebar nav a.active { color: white; background: #2d3832; box-shadow: inset 3px 0 #5ab183; }
.sidebar-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding: 18px 22px; border-top: 1px solid #2d332f; color: #aeb6b1; }
.link-button { padding: 0; border: 0; color: #d6ddd8; background: none; }

.content { min-height: 100vh; margin-left: 220px; padding: 34px 38px 60px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 25px; }
.page-header p, .section-title p { margin-bottom: 0; color: var(--muted); }
.healthy { display: inline-flex; align-items: center; gap: 8px; color: var(--green); }
.healthy i { width: 8px; height: 8px; border-radius: 50%; background: #35a46d; box-shadow: 0 0 0 4px var(--green-soft); }
.flash, .error { margin-bottom: 18px; padding: 11px 13px; border: 1px solid #b8d8c7; border-radius: 5px; color: #19583e; background: var(--green-soft); }
.error { border-color: #e4bbb6; color: var(--red); background: var(--red-soft); }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 28px; border: 1px solid var(--line); background: var(--paper); }
.metrics div { min-height: 110px; padding: 22px; border-right: 1px solid var(--line); }
.metrics div:last-child { border-right: 0; }
.metrics span { display: block; margin-bottom: 12px; color: var(--muted); }
.metrics strong { font-size: 27px; font-weight: 650; }
.section-block { border: 1px solid var(--line); background: var(--paper); }
.section-title { padding: 18px 20px; border-bottom: 1px solid var(--line); }

/* Dashboard: existing 4/8 spacing rhythm, bordered paper sections, status colors only. */
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(290px, .75fr); gap: 18px; margin-bottom: 18px; }
.dashboard-grid > * { min-width: 0; }
.dashboard-section-header { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dashboard-section-header h2 { margin-bottom: 4px; }
.dashboard-section-header p { margin: 0; color: var(--muted); font-size: 13px; }
.trend-legend { display: flex; flex-wrap: wrap; gap: 13px; color: var(--muted); font-size: 12px; }
.trend-legend span { display: inline-flex; align-items: center; gap: 6px; }
.trend-legend i { width: 8px; height: 8px; border-radius: 2px; }
.trend-legend .register, .trend-bars .register { background: var(--green); }
.trend-legend .login, .trend-bars .login { background: #526f86; }
.trend-legend .recharge, .trend-bars .recharge { background: #b6862b; }
.trend-totals { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.trend-totals div { padding: 14px 20px; border-right: 1px solid var(--line); }
.trend-totals div:last-child { border-right: 0; }
.trend-totals span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.trend-totals strong { font-size: 18px; }
.trend-scroll { overflow-x: auto; }
.trend-chart { display: grid; min-width: 560px; grid-template-columns: repeat(7, 1fr); gap: 8px; padding: 22px 18px 16px; }
.trend-day { min-width: 0; text-align: center; }
.trend-day > strong { display: block; margin-top: 10px; font-size: 12px; font-weight: 600; }
.trend-day > span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.trend-bars { display: flex; height: 132px; align-items: flex-end; justify-content: center; gap: 4px; border-bottom: 1px solid #cfd5d0; background-image: linear-gradient(to top, var(--line) 1px, transparent 1px); background-size: 100% 25%; }
.trend-bars i { display: block; width: 9px; min-height: 0; border-radius: 2px 2px 0 0; transition: opacity .15s ease; }
.trend-bars i:hover { opacity: .72; }
.attention-list { display: grid; }
.attention-list a { display: flex; min-height: 70px; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 18px; border-bottom: 1px solid #ecefec; color: var(--ink); text-decoration: none; }
.attention-list a:last-child { border-bottom: 0; }
.attention-list a:hover { background: #fafbfa; }
.attention-list strong { font-size: 13px; }
.attention-list b { display: grid; min-width: 32px; height: 32px; place-items: center; padding: 0 8px; border-radius: 4px; font-size: 14px; }
.attention-list b.quiet { color: #506057; background: var(--soft); }
.attention-list b.warn { color: var(--amber); background: var(--amber-soft); }
.attention-list b.danger { color: var(--red); background: var(--red-soft); }
.activity-panel { margin-bottom: 18px; }
.activity-header { min-height: 76px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.quick-actions a { padding: 7px 10px; border: 1px solid #cdd3ce; border-radius: 4px; color: #45514a; background: white; text-decoration: none; }
.quick-actions a:hover { border-color: #87aa96; color: var(--green); background: var(--green-soft); }
.activity-list { display: grid; }
.activity-row { display: grid; min-height: 60px; grid-template-columns: 132px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 10px 20px; border-bottom: 1px solid #ecefec; }
.activity-row:last-child { border-bottom: 0; }
.activity-row > div { min-width: 0; }
.activity-row > div strong { overflow-wrap: anywhere; }
.activity-row time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.activity-kind { display: inline-flex; width: fit-content; padding: 4px 7px; border-radius: 3px; color: #4f5b54; background: var(--soft); font-size: 12px; }
.activity-kind.success { color: var(--green); background: var(--green-soft); }
.activity-empty { padding: 34px 20px; color: var(--muted); text-align: center; }
.toolbar { position: relative; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; min-height: 42px; margin-bottom: 16px; }
.search { display: flex; width: min(480px, 60vw); }
input, textarea { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid #cdd3ce; border-radius: 4px; outline: none; color: var(--ink); background: var(--paper); }
input:focus, textarea:focus { border-color: #6b967e; box-shadow: 0 0 0 3px #e7f0eb; }
.search input { border-radius: 4px 0 0 4px; }
.search button { padding: 0 17px; border: 1px solid #bfc7c1; border-left: 0; border-radius: 0 4px 4px 0; color: #3e4742; background: #f0f2f0; }
.primary { display: inline-block; padding: 10px 16px; border: 0; border-radius: 4px; color: white; background: var(--green); text-decoration: none; list-style: none; }
.primary:hover { background: #18583f; }
.full { width: 100%; }
.popover { position: relative; }
.popover summary::-webkit-details-marker { display: none; }
.popover-form { position: absolute; top: 48px; right: 0; z-index: 5; display: grid; gap: 13px; width: 320px; padding: 20px; border: 1px solid var(--line); border-radius: 6px; background: white; box-shadow: 0 16px 40px rgba(24, 31, 27, .13); }
label { display: grid; gap: 6px; color: #4e5751; font-size: 13px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; }
th { padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--muted); background: #fafbfa; font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid #ecefec; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfb; }
.actions-col { min-width: 370px; }
.row-actions { display: flex; align-items: center; gap: 6px; }
.row-actions form { margin: 0; }
.extend { display: flex; }
.extend input { width: 78px; padding: 6px 8px; border-radius: 4px 0 0 4px; }
.extend button { border-radius: 0 4px 4px 0; }
.compact { padding: 6px 9px; border: 1px solid #cdd3ce; border-radius: 4px; color: #47504a; background: white; white-space: nowrap; }
.compact:hover { background: var(--soft); }
.copy-code { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.copy-button { display: inline-grid; width: 25px; height: 25px; place-items: center; padding: 0; border: 1px solid #cdd3ce; border-radius: 4px; color: #53615a; background: white; font-size: 15px; line-height: 1; }
.copy-button:hover { color: var(--green); border-color: #83a991; background: var(--green-soft); }
.danger-text { color: var(--red); }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 3px; font-size: 12px; white-space: nowrap; }
.badge.success { color: var(--green); background: var(--green-soft); }
.badge.warn { color: var(--amber); background: var(--amber-soft); }
.badge.danger { color: var(--red); background: var(--red-soft); }
.muted, .empty { color: var(--muted); }
.empty { padding: 40px; text-align: center; }

.generated { display: grid; grid-template-columns: 220px 1fr; gap: 24px; margin-bottom: 16px; padding: 20px; border: 1px solid #aed0bd; background: var(--green-soft); }
.generated p { margin: 0; color: #4a6858; }
.generated textarea { resize: vertical; font-family: "Cascadia Code", Consolas, monospace; line-height: 1.65; }

.login-body { min-height: 100vh; background: #e9edea; }
.login-shell { display: grid; grid-template-columns: 1.05fr .95fr; width: min(900px, calc(100vw - 40px)); min-height: 540px; margin: max(40px, calc((100vh - 540px) / 2)) auto; border: 1px solid #cad1cc; background: white; box-shadow: 0 24px 70px rgba(20, 29, 24, .13); }
.login-intro { padding: 48px; color: white; background: #1d2b24; }
.login-intro .brand { height: auto; padding: 0; }
.login-intro h1 { max-width: 360px; margin-top: 118px; font-size: 34px; font-weight: 600; }
.login-intro p { color: #aebeb5; }
.login-panel { display: grid; place-items: center; padding: 46px; }
.login-form { display: grid; gap: 19px; width: 100%; max-width: 310px; }
.login-form header { margin-bottom: 8px; }
.login-form header h2 { margin-bottom: 7px; font-size: 22px; }
.login-form header p { color: var(--muted); }

@media (max-width: 900px) {
  .sidebar { position: static; width: 100%; height: auto; }
  .sidebar .brand { height: 58px; }
  .sidebar nav { display: flex; overflow-x: auto; padding: 6px 10px; }
  .sidebar nav a { flex: 0 0 auto; }
  .sidebar-footer { position: absolute; top: 0; right: 0; border: 0; }
  .content { margin-left: 0; padding: 25px 18px 45px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics div:nth-child(2) { border-right: 0; }
  .metrics div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; min-height: 0; }
  .login-intro { padding: 28px; }
  .login-intro h1 { margin-top: 45px; font-size: 27px; }
  .login-panel { padding: 42px 28px; }
}

@media (max-width: 560px) {
  .sidebar-footer span { display: none; }
  .page-header { align-items: flex-start; }
  .metrics { grid-template-columns: 1fr; }
  .metrics div { min-height: 88px; border-right: 0; border-bottom: 1px solid var(--line); }
  .metrics div:last-child { border-bottom: 0; }
  .dashboard-section-header, .activity-header { align-items: flex-start; flex-direction: column; }
  .trend-totals div { padding: 12px; }
  .activity-row { grid-template-columns: 1fr auto; gap: 6px 12px; }
  .activity-row > div { grid-column: 1 / -1; grid-row: 2; }
  .activity-row time { grid-column: 2; grid-row: 1; }
  .toolbar { gap: 10px; }
  .search { width: 100%; }
  .popover-form { position: fixed; inset: 108px 18px auto; width: auto; }
  .generated { grid-template-columns: 1fr; }
}

/* PHP shared-hosting adapter: keeps the original control-console visual system. */
.content > .nav { display: none; }
.content > .wrap { max-width: none; margin: 0; padding: 0; }
.content .panel { margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 0; background: var(--paper); }
.content .panel > h2 { margin: 0; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.content .panel > form:not(.row-actions), .content .panel > textarea, .content .panel > p { margin: 18px 20px; }
.content .grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 28px; border: 1px solid var(--line); background: var(--paper); }
.content .metric { min-height: 110px; padding: 22px; border-right: 1px solid var(--line); background: var(--paper); }
.content .metric:last-child { border-right: 0; }
.content .metric strong { display: block; margin-top: 12px; font-size: 27px; }
.content table form { display: inline-flex !important; margin: 0 4px 0 0; }
.content table button { padding: 6px 9px; border: 1px solid #cdd3ce; border-radius: 4px; color: #47504a; background: white; white-space: nowrap; }
.content table button:hover { background: var(--soft); }
.tools-form { display: grid; gap: 13px; max-width: 420px; padding: 20px; }
.tools-form select { width: 100%; padding: 9px 10px; border: 1px solid #cdd3ce; border-radius: 4px; background: white; }
.tools-form button { width: fit-content; }

@media (max-width: 900px) {
  .content .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .content .grid { grid-template-columns: 1fr; }
  .content .metric { border-right: 0; border-bottom: 1px solid var(--line); }
}
