:root {
  --bg: #070d1a; --bg-2: #0c1526; --surface: rgba(255,255,255,.04);
  --line: rgba(120,160,220,.16); --line-2: rgba(120,160,220,.3);
  --text: #e8f0fb; --muted: #94a8c4; --dim: #6b7f9c;
  --blue: #2b8cff; --cyan: #35d6d0; --orange: #ff8a3d; --red: #ff6b6b;
  --grad: linear-gradient(120deg,#2b8cff,#35d6d0); --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "PingFang SC","Microsoft YaHei","Segoe UI",Arial,sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
button, input, textarea, select { font-family: inherit; }
/* 关键修复：[hidden] 必须显式生效。
   .login-wrap / .admin-wrap 上的 display:flex 会覆盖浏览器默认的 [hidden]{display:none}，
   导致登录成功后登录框仍然可见（表现为“点登录没反应、没跳转”）。 */
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 0%,#102445,var(--bg) 70%); padding: 20px; }
.login-box { width: 100%; max-width: 400px; padding: 44px 40px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; text-align: center; }
.login-logo { width: 82px; height: auto; object-fit: contain; margin: 0 auto 20px; display: block; }
.login-box h1 { font-size: 25px; font-weight: 600; }
.login-box > p { color: var(--muted); font-size: 13px; margin: 8px 0 30px; }
.login-box label { display: block; text-align: left; font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.login-box input { width: 100%; margin-top: 8px; padding: 12px 14px; background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: 6px; color: var(--text); outline: none; }
.login-box input:focus { border-color: var(--blue); }
/* 覆盖浏览器自动填充的浅黄色背景，保持深色主题并避免误判为错误状态 */
.login-box input:-webkit-autofill,
.login-box input:-webkit-autofill:hover,
.login-box input:-webkit-autofill:focus { -webkit-text-fill-color: var(--text); -webkit-box-shadow: 0 0 0 1000px #0d1526 inset; transition: background-color 5000s ease-in-out 0s; }
.login-tip { margin: 12px 0 0; font-size: 12px; color: var(--dim); line-height: 1.5; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 22px; border: 0; border-radius: 6px; font-size: 14px; cursor: pointer; background: var(--grad); color: #04101f; font-weight: 600; transition: .2s; }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.login-box .btn { width: 100%; margin-top: 8px; }
.msg { min-height: 20px; margin-top: 14px; font-size: 13px; color: var(--red); }
.back-link { display: inline-block; margin-top: 20px; font-size: 13px; color: var(--dim); }
.back-link:hover { color: var(--cyan); }

/* Admin layout */
.admin-wrap { display: flex; min-height: 100vh; }
.sidebar { width: 220px; flex-shrink: 0; background: #050a14; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 22px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 600; line-height: 1.3; }
.side-brand img { width: 40px; height: auto; object-fit: contain; flex-shrink: 0; }
.side-brand small { font-size: 11px; color: var(--dim); font-weight: 400; }
.sidebar nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.sidebar nav button { display: block; width: 100%; text-align: left; padding: 11px 14px; margin-bottom: 4px; background: none; border: 0; border-radius: 6px; color: var(--muted); font-size: 14px; cursor: pointer; transition: .2s; }
.sidebar nav button:hover { background: var(--surface); color: var(--text); }
.sidebar nav button.active { background: rgba(43,140,255,.15); color: var(--cyan); }
.side-bottom { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.side-bottom a, .side-bottom button { font-size: 13px; color: var(--muted); background: none; border: 0; cursor: pointer; text-align: left; }
.side-bottom a:hover, .side-bottom button:hover { color: var(--cyan); }
.admin-main { flex: 1; min-width: 0; }
.admin-header { display: flex; justify-content: space-between; align-items: center; padding: 22px 36px; border-bottom: 1px solid var(--line); background: rgba(7,13,26,.9); position: sticky; top: 0; z-index: 10; }
.admin-header h1 { font-size: 20px; font-weight: 600; }
.admin-header span { font-size: 13px; color: var(--muted); }
.admin-content { padding: 30px 36px 60px; }

/* Toolbar & list */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.toolbar h2 { font-size: 16px; font-weight: 500; color: var(--muted); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.btn-danger { background: rgba(255,107,107,.15); border: 1px solid rgba(255,107,107,.4); color: #ff9b9b; }
.item-list { display: grid; gap: 10px; }
.item { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.item-main { flex: 1; min-width: 0; }
.item-main h3 { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.item-main p { font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.icon-btn { padding: 6px 12px; font-size: 12px; border: 1px solid var(--line); border-radius: 5px; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--cyan); border-color: var(--cyan); }
.icon-btn.del:hover { color: #ff9b9b; border-color: var(--red); }
.empty { text-align: center; padding: 60px 20px; color: var(--dim); }

/* Modal */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; overflow-y: auto; }
.modal { width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 28px; }
.modal h3 { font-size: 19px; margin-bottom: 20px; }
.modal label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.modal label > span { display: block; margin-bottom: 6px; }
.modal input, .modal textarea, .modal select { width: 100%; padding: 10px 12px; background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: 6px; color: var(--text); font-size: 14px; outline: none; }
.modal input:focus, .modal textarea:focus, .modal select:focus { border-color: var(--blue); }
.modal textarea { resize: vertical; min-height: 90px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.modal-msg { font-size: 13px; color: var(--red); min-height: 18px; margin-top: 8px; }
.file-drop { border: 1px dashed var(--line-2); border-radius: 8px; padding: 20px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; }
.file-drop:hover { border-color: var(--cyan); }
.file-info { font-size: 12px; color: var(--cyan); margin-top: 8px; word-break: break-all; }

/* Messages */
.msg-item { display: block; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; }
.msg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.msg-head strong { font-size: 15px; }
.msg-head time { font-size: 12px; color: var(--dim); }
.msg-meta { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.msg-meta span { margin-right: 16px; }
.msg-content { font-size: 14px; color: #c8d8ec; background: rgba(0,0,0,.2); padding: 12px; border-radius: 6px; white-space: pre-wrap; }
.unread-dot { display: inline-block; width: 7px; height: 7px; background: var(--orange); border-radius: 50%; margin-left: 8px; }

/* Settings */
.settings-card { max-width: 760px; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 20px; }
.settings-card h3 { font-size: 17px; margin-bottom: 18px; }
.settings-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.settings-card label > span { display: block; margin-bottom: 6px; }
.settings-card input, .settings-card textarea { width: 100%; padding: 10px 12px; background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: 6px; color: var(--text); font-size: 14px; outline: none; }
.settings-card textarea { resize: vertical; min-height: 100px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-msg { font-size: 13px; margin-top: 10px; min-height: 18px; }
.settings-msg.ok { color: var(--cyan); }
.settings-msg.err { color: var(--red); }
.hint { font-size: 12px; color: var(--dim); line-height: 1.8; }

@media (max-width: 820px) {
  .sidebar { width: 64px; }
  .side-brand span, .sidebar nav button, .side-bottom a, .side-bottom button { font-size: 0; }
  .side-brand { justify-content: center; padding: 16px 0; }
  .sidebar nav button { text-align: center; padding: 12px 0; font-size: 11px; }
  .sidebar nav button::first-letter { font-size: 14px; }
  .side-bottom { align-items: center; padding: 12px 0; }
  .admin-content { padding: 20px 16px 40px; }
  .admin-header { padding: 16px 20px; }
  .settings-grid { grid-template-columns: 1fr; }
  .item { flex-direction: column; align-items: flex-start; }
}
