:root {
  --navy: #0A1C36;
  --blue: #1F69DC;
  --cyan: #34B7DB;
  --orange: #FF9747;
  --bg: #F4F7FB;
  --card: #FFFFFF;
  --line: #E2E8F2;
  --ink: #132238;
  --muted: #5F7088;
  --ok: #177B5F;
  --danger: #C93A3A;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Login Page */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 15%, rgba(52,183,219,.18), transparent 45%),
              linear-gradient(160deg, #09172B 0%, #102A4C 100%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 12px;
  padding: 36px 32px 30px;
  box-shadow: 0 24px 60px -20px rgba(4, 15, 32, .55);
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  color: var(--ink);
  font-weight: 700;
  font-size: 18px;
}
.brand-row:hover { text-decoration: none; }
.brand-row .ai { color: var(--blue); }
.auth-card h1 { font-size: 22px; margin: 0 0 6px; }
.auth-sub { color: var(--muted); margin: 0 0 22px; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; color: #31435B; }
.field input, .field select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31,105,220,.12);
}
.field small { color: var(--muted); font-size: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 18px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.btn:hover { background: #195BC2; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--full { width: 100%; }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: #F7F9FC; }
.btn--sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn--danger { background: #fff; color: var(--danger); border-color: rgba(201,58,58,.3); }
.btn--danger:hover { background: rgba(201,58,58,.06); }
.auth-error { min-height: 20px; color: var(--danger); font-size: 13px; margin: 6px 0 10px; }
.auth-ok { color: var(--ok); font-size: 13px; margin: 6px 0 10px; }
.auth-footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.link-btn {
  background: none;
  border: 0;
  color: var(--blue);
  font: inherit;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { text-decoration: underline; }

/* Portal Page */
.topbar {
  background: var(--navy);
  color: #fff;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar a { color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(31,105,220,.12);
  color: var(--blue);
}
.badge--ok { background: rgba(23,123,95,.12); color: var(--ok); }
.badge--muted { background: #EEF2F7; color: var(--muted); }
.badge--warn { background: rgba(255,151,71,.16); color: #B45A14; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 32px 20px 64px; }
.section-title { font-size: 18px; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin-bottom: 36px; }
.app-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.app-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.app-card h2 { font-size: 17px; margin: 0; }
.app-card p { color: var(--muted); margin: 0; font-size: 13px; flex: 1; }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 24px;
}
.form-inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 18px; }
.form-inline .field { margin-bottom: 0; min-width: 140px; }
.checks { display: flex; gap: 14px; align-items: center; height: 40px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
code.invite-code {
  background: #F1F5FB;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--navy);
}
.table-wrap { overflow-x: auto; }
.hidden { display: none !important; }
