:root {
  min-height: 100%;
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #17231b;
  background: #f4f7f5;
}
* { box-sizing: border-box; }
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; margin: 0; background: #f4f7f5; }
a { color: #2f7043; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 28px; background: #fff; border-bottom: 1px solid #dce6df;
  position: sticky; top: 0; z-index: 2;
}
.topbar strong { color: #996515; font-size: 21px; }
.topbar span { margin-left: 12px; color: #657269; }
.topbar form { display: flex; align-items: center; gap: 12px; }
.topbar-actions { display: flex; flex: none; flex-direction: row; align-items: center; align-self: center; gap: 12px; white-space: nowrap; }
.topbar-actions form { flex-wrap: nowrap; }
.admin-name { margin-left: 0 !important; color: #17231b !important; }
.page-grid {
  display: grid; grid-template-columns: minmax(300px, 390px) minmax(600px, 1fr);
  flex: 1 0 auto; align-content: start; gap: 20px; width: 100%; max-width: 1500px; margin: 24px auto; padding: 0 20px;
}
.panel, .login-card {
  background: #fff; border: 1px solid #dce6df; border-radius: 16px;
  box-shadow: 0 6px 24px rgba(21, 45, 30, .06); padding: 22px;
}
h1, h2 { margin: 0 0 18px; }
h1 { color: #996515; font-size: 24px; }
h2 { font-size: 21px; }
label { display: block; font-weight: 650; margin: 14px 0; }
input, select {
  width: 100%; min-height: 44px; margin-top: 7px; padding: 9px 11px;
  border: 1px solid #b9c8bd; border-radius: 9px; background: #fff; color: #17231b;
  font: inherit;
}
input:focus, select:focus { outline: 2px solid #9bc7a8; border-color: #3e7950; }
button, .button-link {
  display: inline-flex; align-items: center; justify-content: center; min-height: 42px;
  border: 0; border-radius: 9px; padding: 9px 16px; background: #996515;
  color: #fff; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
}
button.secondary, .button-link.secondary {
  border: 1px solid #3e7950; background: #fff; color: #275b37;
}
.full-width { width: 100%; margin-top: 9px; }
button.small, .button-link.small { min-height: 34px; padding: 6px 10px; font-size: 13px; }
button.danger { background: #a72c25; }
.button-link.danger-outline { border: 1px solid #c84d45; background: #fff; color: #9a271f; }
.editor button[type="submit"] { width: 100%; margin-top: 8px; }
.editor .button-link { width: 100%; margin-top: 9px; }
.hint, .muted { color: #657269; font-size: 13px; line-height: 1.55; }
.alert { padding: 11px 13px; border-radius: 9px; margin: 12px 0; }
.alert.error { color: #861b16; background: #ffebe9; }
.alert.success { color: #1e6333; background: #e5f5e9; }
.list-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.search-form { display: flex; gap: 8px; min-width: 360px; }
.search-form input { margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid #e4ebe6; text-align: left; white-space: nowrap; }
th { color: #657269; font-size: 13px; }
.status { display: inline-block; padding: 4px 9px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.status.normal { color: #226637; background: #e4f5e8; }
.status.closed { color: #9a271f; background: #ffebe9; }
.role { display: inline-block; padding: 4px 9px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.role.highest { color: #6d4a06; background: #fff0bd; }
.role.ordinary { color: #355f42; background: #e8f1ea; }
.protected-label { color: #8a6a28; font-size: 13px; font-weight: 700; }
.action-group { display: flex; align-items: center; gap: 8px; }
.action-group form { margin: 0; }
.danger-panel { margin-bottom: 16px; padding: 14px; border: 1px solid #efbbb7; border-radius: 10px; background: #fff4f3; }
.danger-panel p { margin: 0 0 8px; }
.danger-panel p:last-child { margin-bottom: 0; }
.empty { color: #657269; text-align: center; padding: 32px; }
.login-page { padding: 0; }
.login-card { width: min(430px, 100%); }
.login-page .login-card { margin: auto; }
.login-card button { width: 100%; margin-top: 8px; }
.site-footer {
  flex: 0 0 auto; width: 100%; margin-top: auto; padding: 18px 24px; border-top: 1px solid #dce6df;
  color: #66746b; background: #fff; font-size: 13px; text-align: center;
}
.site-footer a { color: #496c54; }
@media (max-width: 960px) {
  .page-grid { grid-template-columns: 1fr; }
  .list-title { align-items: stretch; flex-direction: column; }
  .search-form { min-width: 0; }
  .topbar { align-items: center; }
  .topbar > div:first-child span { display: block; margin: 4px 0 0; }
  .topbar-actions { flex-direction: row; align-items: center; }
  .topbar-actions form { flex-wrap: nowrap; justify-content: flex-end; }
}

@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; padding: 15px 16px; }
  .topbar strong { font-size: 17px; }
  .topbar-actions { width: 100%; justify-content: flex-end; gap: 8px; }
  .topbar-actions .button-link { min-height: 36px; padding: 7px 10px; font-size: 13px; }
  .page-grid { margin: 16px auto; padding: 0 12px; }
  .panel, .login-card { padding: 18px; }
  .login-page .login-card { width: calc(100% - 28px); }
  .site-footer { padding: 15px 14px; font-size: 12px; }
}
