:root {
  --bg: #f4f6fb; --panel: #fff; --ink: #1b2333; --muted: #6b7488; --line: #e5e9f2;
  --brand: #0f62c4; --brand-dark: #0b4c9c; --danger: #dc2626; --ok: #16a34a;
  --radius: 12px; --shadow: 0 10px 30px rgba(23,37,84,.08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--ink); background: var(--bg); font-size: 14px; }
code { background: #eef2ff; padding: 2px 6px; border-radius: 6px; font-size: 12px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(1200px 600px at 50% -10%, #dbe6ff 0%, var(--bg) 55%); }
.login-card { width: 100%; max-width: 400px; background: var(--panel); border-radius: 16px; padding: 32px; box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 6px; font-size: 20px; }
.login-sub { margin: 0 0 22px; color: var(--muted); line-height: 1.6; }
.login-error { color: var(--danger); background: #fef2f2; border: 1px solid #fecaca; padding: 10px 12px; border-radius: 10px; margin: 14px 0 0; }
.login-tip { color: var(--muted); font-size: 12px; margin: 16px 0 0; }

.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: #0b1830; color: #cbd5e1; display: flex; flex-direction: column; padding: 20px 14px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 6px 8px 20px; }
.brand strong { color: #fff; display: block; } .brand small { color: #94a3b8; font-size: 12px; }
.brand-dot { width: 12px; height: 12px; border-radius: 4px; background: var(--brand); }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item { text-align: left; background: transparent; border: 0; color: #cbd5e1; padding: 11px 12px; border-radius: 10px; cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 8px; font-family: inherit; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.badge { background: #f59e0b; color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; margin-left: auto; }
.sidebar-foot { display: flex; flex-direction: column; gap: 6px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.link { background: none; border: 0; color: #94a3b8; cursor: pointer; text-align: left; padding: 6px 8px; text-decoration: none; font-size: 13px; font-family: inherit; }
.link:hover { color: #fff; } .link.danger:hover { color: #f87171; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 22px 28px; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 5; }
.topbar h2 { margin: 0; font-size: 18px; } .topbar-state { color: var(--ok); font-size: 13px; }
.panel { padding: 24px 28px 48px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.muted { color: var(--muted); margin: 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-full { grid-column: 1 / -1; }
.field span { font-size: 13px; color: var(--muted); }
.field input, .field textarea, .field select { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: inherit; color: var(--ink); background: #fff; width: 100%; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid #bfdbfe; border-color: var(--brand); }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }

.btn { border: 0; border-radius: 10px; padding: 10px 16px; font-size: 14px; cursor: pointer; font-family: inherit; }
.btn-primary { background: var(--brand); color: #fff; } .btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); } .btn-ghost:hover { background: #f8fafc; }
.btn-block { width: 100%; margin-top: 18px; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.icon-btn { background: none; border: 0; font-size: 16px; cursor: pointer; color: var(--muted); }

.card-list { display: flex; flex-direction: column; gap: 12px; }
.item-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; gap: 16px; align-items: flex-start; }
.item-card .item-main { flex: 1; min-width: 0; }
.item-card h4 { margin: 0 0 4px; font-size: 15px; }
.item-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.thumb { width: 76px; height: 52px; border-radius: 8px; object-fit: cover; background: #eef2f8; flex-shrink: 0; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #eef2ff; color: var(--brand); margin-right: 6px; }
.tag.status-new { background: #fef3c7; color: #b45309; } .tag.status-read { background: #dcfce7; color: #15803d; }
.empty { color: var(--muted); text-align: center; padding: 40px; border: 1px dashed var(--line); border-radius: var(--radius); }

.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50; }
.modal-card { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 22px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow); z-index: 100; font-size: 14px; }
.toast.ok { background: #15803d; } .toast.err { background: #b91c1c; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { padding-bottom: 6px; } .nav { flex-direction: row; flex-wrap: wrap; } .sidebar-foot { flex-direction: row; border-top: 0; }
  .form-grid { grid-template-columns: 1fr; }
}
