:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0b3b66;
  --brand-2: #0f766e;
  --accent: #2563eb;
  --danger: #b91c1c;
  --ok: #15803d;
  --shadow: 0 10px 30px rgba(15, 23, 42, .06), 0 2px 8px rgba(15, 23, 42, .04);
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef2f7; padding: 2px 6px; border-radius: 6px; }
h1 { font-size: 26px; line-height: 1.25; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.tiny { color: var(--muted); font-size: 12px; margin-top: 12px; }
.eyebrow { color: var(--brand-2); font-size: 11px; letter-spacing: .18em; font-weight: 700; margin: 0 0 8px; }

/* ---------- login ---------- */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1000px 500px at 10% -10%, rgba(37, 99, 235, .10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(15, 118, 110, .10), transparent 55%),
    var(--bg);
  padding: 28px;
}
.login-wrap {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  background: var(--surface);
  border-radius: 26px;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, .8);
}
.login-hero {
  padding: 48px 44px;
  background: linear-gradient(155deg, #0b3b66 0%, #0b4f6c 55%, #0f766e 100%);
  color: #eaf2f8;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-hero .eyebrow { color: #7dd3c7; }
.login-hero h1 { font-size: 32px; color: #fff; margin-bottom: 12px; }
.login-copy { color: #c7d7e6; margin-bottom: 20px; }
.login-points { margin: 0; padding: 0; list-style: none; color: #d7e5f1; font-size: 13px; }
.login-points li { margin: 6px 0; padding-left: 20px; position: relative; }
.login-points li::before { content: "✦"; position: absolute; left: 0; color: #7dd3c7; }
.brand.big { margin-bottom: 24px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px;
  background: #ffffff; color: var(--brand);
  font-weight: 800; font-size: 14px; letter-spacing: .02em;
}
.login-card { padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.login-card h2 { font-size: 22px; margin-bottom: 4px; }
.login-card form { margin-top: 18px; }
.error-card { max-width: 520px; margin: 40px auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); padding: 32px; text-align: left; }

/* ---------- shell ---------- */
.page-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand .brand-mark { width: 34px; height: 34px; background: var(--brand); color: #fff; font-size: 12px; border-radius: 9px; }
.topnav { display: flex; align-items: center; gap: 16px; color: var(--muted); }
.topnav a { color: var(--muted); font-size: 13px; }
.topnav a:hover { color: var(--ink); text-decoration: none; }
.user-pill { background: #eef4fb; color: var(--brand); border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; }
.inline-form { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; }
.link-button:hover { color: var(--danger); }
.page { width: min(1180px, 100%); margin: 0 auto; padding: 28px 24px 40px; flex: 1; }
.foot { text-align: center; color: #94a3b8; font-size: 11px; padding: 10px 0 22px; }

/* ---------- dashboard ---------- */
.hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 4px 0 22px; }
.security-chip { font-size: 12px; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.security-chip.secure { background: #e7f6ec; color: #166534; }
.security-chip.warn { background: #fff4e5; color: #9a3412; }
.apps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.app-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 2px rgba(15,23,42,.03); display: flex; flex-direction: column; gap: 6px; }
.app-card-head { display: flex; align-items: center; gap: 8px; }
.app-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.app-card p { color: var(--muted); font-size: 13px; margin: 2px 0 4px; }
.app-url { color: #94a3b8; font-size: 11px; margin-bottom: 8px; }
.app-card .btn { margin-top: auto; justify-content: center; }
.health { margin-left: auto; font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.health i { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; display: inline-block; }
.health.ok i { background: #16a34a; }
.health.down i { background: #dc2626; }

/* ---------- panels / tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 2px rgba(15,23,42,.03); }
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel.narrow { max-width: 560px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.subtle { color: var(--muted); font-size: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 9px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
tbody tr:hover { background: #fafcff; }
td.ua { color: var(--muted); font-size: 11px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 18px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.ok { background: #e7f6ec; color: #166534; }
.badge.bad { background: #fdeaea; color: #991b1b; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.filter { display: flex; gap: 8px; margin: 14px 0; }

/* ---------- forms ---------- */
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
input, select, button { font-family: inherit; font-size: 14px; }
input, select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); outline: none; }
input:focus, select:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 600; font-size: 13px; }
.btn:hover { border-color: #cbd5e1; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #0a3358; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; justify-content: center; padding: 11px; margin-top: 4px; }
.filter input { max-width: 240px; }
.alert { border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 10px 0; }
.alert.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert.ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { padding: 32px 28px; }
  .login-card { padding: 32px 28px; }
  .apps { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .topnav { gap: 10px; }
  .topnav a { font-size: 12px; }
  .page { padding: 20px 16px 32px; }
  .user-pill { display: none; }
  .hero { flex-direction: column; }
}
