/* Shared styles for the sign-in, request-access and admin pages. */
:root {
  --bg: #f6f7f9; --panel: #fff; --text: #0f172a; --muted: #64748b; --border: #e5e7eb;
  --accent: #2563eb; --accent-hover: #1d4ed8; --accent-soft: #eff4ff;
  --ok-bg: #ecfdf3; --ok: #067647; --err-bg: #fef3f2; --err: #b42318; --warn-bg: #fffaeb; --warn: #b54708;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.05);
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { color: var(--muted); font-size: 12px; }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 32px; box-shadow: 0 12px 32px rgba(16,24,40,.06); }
.auth-card.wide { max-width: 540px; }
h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.01em; }
.sub { color: var(--muted); margin: 0 0 20px; }
label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text); font: inherit; font-size: 14px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 72px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } .auth-card { padding: 24px; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 10px; border: 1px solid transparent; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.block { width: 100%; margin-top: 22px; padding: 11px; }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: #f9fafb; }
.btn.danger { background: #fff; color: var(--err); border-color: #fecdca; }
.btn.danger:hover { background: var(--err-bg); }
.btn.success { background: #067647; }
.btn.success:hover { background: #05603a; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }

.msg { margin-top: 14px; padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.err { background: var(--err-bg); color: var(--err); }
.msg.info { background: var(--accent-soft); color: #1e40af; margin: 0 0 14px; }
.foot { margin-top: 18px; text-align: center; color: var(--muted); font-size: 13px; }

/* Admin console */
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 16px; }
.topbar .brand { margin: 0; }
.spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.user-chip .who { line-height: 1.2; }
.user-chip .who small { display: block; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.page { max-width: 1180px; margin: 0 auto; padding: 24px; }
.page-title { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 20px 0; overflow-x: auto; }
.tab { padding: 10px 14px; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.count { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; margin: 0; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card-body { padding: 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid #f0f1f3; font-size: 13px; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: #fafbfc; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td input, td select { padding: 7px 9px; font-size: 13px; border-radius: 8px; min-width: 110px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.err { background: var(--err-bg); color: var(--err); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.muted { background: #f2f4f7; color: #475467; }
.muted { color: var(--muted); }
.empty { padding: 32px; text-align: center; color: var(--muted); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions select, .actions input { width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.form-grid label { margin-top: 0; }
.perm-table td:not(:first-child), .perm-table th:not(:first-child) { text-align: center; width: 100px; }
.perm-table input[type=checkbox] { width: 18px; height: 18px; min-width: 0; accent-color: var(--accent); }
.perm-desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
@media (max-width: 640px) { .topbar-inner, .page { padding-left: 16px; padding-right: 16px; } .user-chip .who { display: none; } }
