:root {
  --bg: #f4f5f2;
  --surface: #fff;
  --ink: #17201d;
  --muted: #66716d;
  --line: #d8ded9;
  --accent: #087f6b;
  --accent-dark: #056252;
  --danger: #a12626;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
a { color: var(--accent-dark); }
.muted { color: var(--muted); line-height: 1.7; }
.eyebrow { margin: 0 0 8px; color: var(--accent-dark); font-size: 12px; font-weight: 800; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 5px; background: var(--ink); color: #fff; font-weight: 900;
}
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-panel {
  width: min(440px, 100%); padding: 36px; border: 1px solid var(--line);
  background: var(--surface); box-shadow: 0 18px 50px rgba(26, 42, 36, .1);
}
.auth-panel .brand-mark { margin: 24px 0; }
.auth-panel h1 { margin: 0 0 10px; font-size: 27px; }
.back-link { font-size: 13px; }
.stack-form { display: grid; gap: 16px; margin-top: 22px; }
.stack-form label > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
input, select {
  width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #b8c0bb;
  border-radius: 3px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 3px solid rgba(0,107,214,.15); border-color: #006bd6; }
button {
  min-height: 40px; padding: 8px 14px; border: 1px solid var(--line);
  border-radius: 3px; background: #fff; color: var(--ink); font-weight: 700;
}
button.primary {
  border-color: var(--accent); background: var(--accent); color: #fff;
}
button.primary:hover { background: var(--accent-dark); }
.notice { margin: 20px 0; padding: 12px 14px; border: 1px solid; font-size: 13px; line-height: 1.6; }
.notice.success { border-color: #83bcae; background: #e1f2ed; color: #075947; }
.notice.error { border-color: #dfaaaa; background: #fff0f0; color: #7d1717; }
.admin-header { border-bottom: 1px solid var(--line); background: #fff; }
.admin-header-inner {
  width: min(1180px, calc(100% - 40px)); min-height: 68px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
}
.admin-brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.admin-header nav, .admin-header nav form { display: flex; align-items: center; gap: 12px; }
.admin-header nav a { font-size: 13px; font-weight: 700; }
.admin-header nav button { min-height: 34px; }
.admin-main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 60px; }
.dashboard-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.dashboard-heading h1 { margin: 0 0 8px; font-size: 34px; }
.dashboard-heading p { margin-bottom: 0; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); background: #fff; }
.metrics div { padding: 20px 24px; }
.metrics div + div { border-left: 1px solid var(--line); }
.metrics span, .metrics strong { display: block; }
.metrics span { color: var(--muted); font-size: 12px; }
.metrics strong { margin-top: 7px; font-size: 22px; }
.management-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; margin-top: 18px; }
.panel, .file-panel { border: 1px solid var(--line); background: #fff; }
.panel { padding: 24px; }
.panel h2, .file-panel h2 { margin: 0 0 8px; font-size: 19px; }
.panel p, .file-panel p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.panel small { color: var(--muted); line-height: 1.5; }
.file-panel { margin-top: 18px; }
.visitor-management { grid-template-columns: 1.5fr 1fr; }
.visitor-idle { margin-top: 20px !important; }
.visitor-log-wrap { max-height: 360px; }
.visitor-table { table-layout: fixed; min-width: 650px; }
.visitor-table th:first-child { width: 21%; }
.visitor-table th:nth-child(2) { width: 17%; }
.visitor-table th:nth-child(3) { width: 14%; }
.visitor-table th:nth-child(4) { width: 38%; }
.visitor-table th:nth-child(5) { width: 10%; }
.visitor-table td { overflow-wrap: anywhere; }
.visitor-table .visitor-detail { color: var(--muted); }
.visitor-clear-form { display: flex; align-items: center; gap: 8px; }
.visitor-clear-form input { width: 210px; min-height: 36px; }
.visitor-delete-form { margin: 0; }
.visitor-admin { margin: 26px 0 0; font-size: 13px; }
.file-panel-heading {
  padding: 20px 22px; display: flex; align-items: center; justify-content: space-between;
  gap: 20px; border-bottom: 1px solid var(--line);
}
.file-panel-heading input { max-width: 360px; }
.admin-table-wrap { max-height: 680px; overflow: auto; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { position: sticky; top: 0; z-index: 2; padding: 11px 14px; background: #eef1ed; color: var(--muted); font-size: 12px; text-align: left; }
th:first-child { width: 55%; padding-left: 22px; }
th:nth-child(2) { width: 18%; }
th:nth-child(3) { width: 14%; }
th:nth-child(4) { width: 13%; }
td { padding: 12px 14px; border-top: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
td:first-child { padding-left: 22px; }
td a { display: block; overflow: hidden; color: var(--ink); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
td small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.danger { min-height: 32px; padding: 5px 10px; border-color: #dfaaaa; color: var(--danger); }
.danger:hover { border-color: var(--danger); background: #fff0f0; }
tr[hidden] { display: none; }
@media (max-width: 760px) {
  .admin-header-inner, .admin-main { width: min(100% - 24px, 1180px); }
  .dashboard-heading { align-items: flex-start; flex-direction: column; }
  .metrics { grid-template-columns: 1fr; }
  .metrics div + div { border-left: 0; border-top: 1px solid var(--line); }
  .management-grid { grid-template-columns: 1fr; }
  .visitor-management { grid-template-columns: 1fr; }
  .visitor-table th:nth-child(2), .visitor-table td:nth-child(2),
  .visitor-table th:nth-child(3), .visitor-table td:nth-child(3),
  .visitor-table th:nth-child(4), .visitor-table td:nth-child(4),
  .visitor-table th:nth-child(5), .visitor-table td:nth-child(5) { display: table-cell; }
  .visitor-clear-form { width: 100%; align-items: stretch; flex-direction: column; }
  .visitor-clear-form input { width: 100%; }
  .file-panel-heading { align-items: stretch; flex-direction: column; }
  .file-panel-heading input { max-width: none; }
  th:nth-child(2), td:nth-child(2), th:nth-child(3), td:nth-child(3) { display: none; }
  th:first-child { width: 75%; }
  th:nth-child(4) { width: 25%; }
}
