:root {
  --green: #0f8a6d; --green-d: #0b6e57; --gold: #c79a3a;
  --ink: #1d2b27; --muted: #5e716c; --bg: #f1f5f3; --card: #fff;
  --line: #e2ece8; --shadow: 0 8px 30px rgba(15,80,64,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--ink); background: var(--bg); }
a { cursor: pointer; }
.hidden { display: none !important; }
.btn { background: var(--green); color: #fff; padding: 10px 18px; border-radius: 8px; border: none; font-weight: 600; cursor: pointer; font-size: 14px; }
.btn:hover { background: var(--green-d); }
.btn-ghost { background: #fff; color: var(--green); border: 1.5px solid var(--green); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.brand { font-weight: 800; font-size: 20px; color: var(--green); }
.brand span { color: var(--gold); }
input, select, textarea { font-family: inherit; font-size: 14px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); border-color: var(--green); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f8a6d, #0a5a48); }
.login-card { background: #fff; padding: 36px; border-radius: 16px; width: 340px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.login-card .brand { text-align: center; font-size: 24px; }
.login-sub { text-align: center; color: var(--muted); margin-bottom: 6px; }
.login-card .btn { margin-top: 6px; }
.msg { color: #c0392b; font-size: 13px; min-height: 18px; text-align: center; }

/* Admin layout */
.admin { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: #0c2b24; color: #cfe6df; padding: 22px 16px; display: flex; flex-direction: column; gap: 8px; }
.sidebar .brand { color: #fff; margin-bottom: 14px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar nav a { padding: 11px 14px; border-radius: 8px; color: #cfe6df; font-weight: 500; }
.sidebar nav a:hover, .sidebar nav a.active { background: var(--green); color: #fff; }
.sidebar .logout { margin-top: auto; }

.main { padding: 28px 32px; overflow: auto; }
.panel h1 { font-size: 24px; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.panel-head h1 { margin: 0; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); }
.stat strong { display: block; font-size: 32px; color: var(--green); }
.stat span { color: var(--muted); font-size: 14px; }
.hint { margin-top: 18px; color: var(--muted); font-size: 13px; }

/* Table */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f3f8f6; color: var(--muted); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
.tag { background: #eaf5f0; color: var(--green-d); font-size: 12px; padding: 2px 8px; border-radius: 999px; display: inline-block; margin: 2px; }
.actions { display: flex; gap: 6px; white-space: nowrap; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal-card { background: #fff; border-radius: 14px; padding: 26px; width: min(560px, 100%); max-height: 90vh; overflow: auto; }
.modal-card h2 { margin-bottom: 16px; }
#modalForm { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#modalForm .full { grid-column: 1 / -1; }
#modalForm label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

@media (max-width: 720px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar .logout { margin: 0; }
  #modalForm { grid-template-columns: 1fr; }
}
