/* Pitechpedia People — Material Design 3 system. White-first, Google blue/red/yellow/green accents. */
:root {
  --blue: #1a73e8; --red: #ea4335; --yellow: #f9ab00; --green: #188038;
  --blue-container: #e8f0fe; --red-container: #fce8e6; --yellow-container: #fef7e0; --green-container: #e6f4ea;
  --on-blue-container: #174ea6; --on-red-container: #a50e0e; --on-yellow-container: #7a4f01; --on-green-container: #0d652d;
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f8f9fa; --surface-3: #f1f3f4;
  --outline: #dadce0; --outline-strong: #bdc1c6;
  --text: #202124; --text-2: #5f6368; --text-3: #80868b;
  --primary: var(--blue); --on-primary: #fff;
  --shadow-1: 0 1px 2px rgba(60,64,67,.15), 0 1px 3px 1px rgba(60,64,67,.08);
  --shadow-2: 0 1px 3px rgba(60,64,67,.2), 0 4px 8px 3px rgba(60,64,67,.1);
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 28px; --r-full: 999px;
  --sidebar-w: 264px; --topbar-h: 64px;
  --font: 'Inter', 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --blue: #8ab4f8; --red: #f28b82; --yellow: #fdd663; --green: #81c995;
  --blue-container: #1c2b44; --red-container: #3c1f1d; --yellow-container: #3a3012; --green-container: #17301f;
  --on-blue-container: #aecbfa; --on-red-container: #f6aea9; --on-yellow-container: #fde293; --on-green-container: #a8dab5;
  --bg: #131314; --surface: #1e1f20; --surface-2: #252627; --surface-3: #2d2e30;
  --outline: #3c4043; --outline-strong: #5f6368;
  --text: #e8eaed; --text-2: #bdc1c6; --text-3: #9aa0a6;
  --primary: #8ab4f8; --on-primary: #062e6f;
  --shadow-1: 0 1px 2px rgba(0,0,0,.5); --shadow-2: 0 2px 8px rgba(0,0,0,.55);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.material-symbols-outlined { font-family: 'Material Symbols Outlined'; font-weight: normal; font-style: normal; font-size: 22px; line-height: 1; display: inline-block; vertical-align: middle; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; user-select: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); } .small { font-size: 12px; } .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.hidden { display: none !important; }

/* ---- App shell ---- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--outline); padding: 12px 12px 24px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 10px 12px 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 24px; font-weight: 800; color: #fff; background: conic-gradient(from 210deg, var(--red), var(--yellow), var(--green), var(--blue), var(--red)); }
.brand-name { font-weight: 700; font-size: 18px; color: var(--blue); line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--text-2); }
.nav-group { margin: 14px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 14px; padding: 9px 14px; margin: 1px 0; border-radius: var(--r-full); color: var(--text); font-weight: 500; }
.nav-item:hover { background: var(--surface-3); text-decoration: none; }
.nav-item.active { background: var(--blue-container); color: var(--on-blue-container); font-weight: 600; }
.nav-item.active .material-symbols-outlined { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
.nav-item .badge { margin-left: auto; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 24px; background: color-mix(in srgb, var(--bg) 92%, transparent); border-bottom: 1px solid var(--outline); backdrop-filter: blur(6px); }
.topbar .spacer { flex: 1; }
.page { padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title { font-size: 24px; font-weight: 600; }
.page-sub { color: var(--text-2); margin-top: 2px; }
.menu-btn { display: none; }
.scrim { display: none; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 22px; border-radius: var(--r-full); border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; transition: background .15s, box-shadow .15s; text-decoration: none !important; white-space: nowrap; }
.btn .material-symbols-outlined { font-size: 20px; }
.btn-filled { background: var(--primary); color: var(--on-primary); } .btn-filled:hover { box-shadow: var(--shadow-1); filter: brightness(1.05); }
.btn-tonal { background: var(--blue-container); color: var(--on-blue-container); } .btn-tonal:hover { filter: brightness(.97); }
.btn-outlined { background: transparent; color: var(--primary); border-color: var(--outline-strong); } .btn-outlined:hover { background: var(--blue-container); }
.btn-text { background: transparent; color: var(--primary); padding: 0 12px; } .btn-text:hover { background: var(--blue-container); }
.btn-danger { background: var(--red); color: #fff; } :root[data-theme="dark"] .btn-danger { color: #3c1f1d; }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn-icon { width: 40px; padding: 0; border-radius: 50%; background: transparent; color: var(--text-2); border: 0; cursor: pointer; display: inline-grid; place-items: center; height: 40px; } .btn-icon:hover { background: var(--surface-3); }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn.loading::after { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--outline); border-radius: var(--r-lg); padding: 20px; }
.card-elev { box-shadow: var(--shadow-1); border-color: transparent; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.stat { display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.stat-icon.blue { background: var(--blue-container); color: var(--on-blue-container); }
.stat-icon.green { background: var(--green-container); color: var(--on-green-container); }
.stat-icon.yellow { background: var(--yellow-container); color: var(--on-yellow-container); }
.stat-icon.red { background: var(--red-container); color: var(--on-red-container); }
.stat-value { font-size: 26px; font-weight: 600; line-height: 1.1; }
.stat-label { color: var(--text-2); font-size: 12px; }
.quick { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 10px; border-radius: var(--r-md); font-weight: 500; text-align: center; color: var(--text); }
.quick:hover { text-decoration: none; filter: brightness(.97); }
.quick.blue { background: var(--blue-container); } .quick.green { background: var(--green-container); } .quick.yellow { background: var(--yellow-container); } .quick.red { background: var(--red-container); }

/* ---- Chips / badges ---- */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: var(--r-full); font-size: 12px; font-weight: 600; }
.chip-green { background: var(--green-container); color: var(--on-green-container); }
.chip-blue { background: var(--blue-container); color: var(--on-blue-container); }
.chip-yellow { background: var(--yellow-container); color: var(--on-yellow-container); }
.chip-red { background: var(--red-container); color: var(--on-red-container); }
.chip-grey { background: var(--surface-3); color: var(--text-2); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full); background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }

/* ---- Forms ---- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; }
.input, .select, .textarea { width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--outline-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s; }
.textarea { height: auto; padding: 10px 14px; min-height: 90px; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.field-error { color: var(--red); font-size: 12px; margin-top: 4px; }
.help { color: var(--text-2); font-size: 12px; margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.searchbar { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; background: var(--surface-3); border-radius: var(--r-full); min-width: 220px; }
.searchbar input { border: 0; background: transparent; font: inherit; color: var(--text); flex: 1; outline: none; min-width: 0; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--outline); border-radius: var(--r-lg); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--outline); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--outline); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--blue-container); color: var(--on-blue-container); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 72px; height: 72px; font-size: 24px; }

/* ---- Feedback ---- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-md); margin-bottom: 16px; }
.alert-error { background: var(--red-container); color: var(--on-red-container); }
.alert-success { background: var(--green-container); color: var(--on-green-container); }
.alert-info { background: var(--blue-container); color: var(--on-blue-container); }
.alert-warning { background: var(--yellow-container); color: var(--on-yellow-container); }
.empty { text-align: center; padding: 48px 16px; color: var(--text-2); }
.empty .material-symbols-outlined { font-size: 48px; color: var(--outline-strong); }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--r-sm); min-height: 16px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #323232; color: #fff; padding: 12px 18px; border-radius: var(--r-sm); box-shadow: var(--shadow-2); animation: slidein .2s ease-out; max-width: 360px; }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } }
dialog.modal { border: 0; border-radius: var(--r-xl); padding: 24px; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-2); }
dialog.modal::backdrop { background: rgba(32,33,36,.5); }
.modal h3 { margin-bottom: 12px; } .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---- Progress / lists ---- */
.progress { height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--green); border-radius: inherit; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--outline); }
.list-row:last-child { border-bottom: 0; }
.legend { display: flex; flex-direction: column; gap: 6px; }
.legend-row { display: flex; align-items: center; gap: 8px; } .legend-row .dot { width: 10px; height: 10px; border-radius: 50%; } .legend-row .pct { margin-left: auto; font-weight: 600; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--outline); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 10px 16px; font-weight: 500; color: var(--text-2); border-bottom: 3px solid transparent; white-space: nowrap; } .tab.active { color: var(--primary); border-color: var(--primary); } .tab:hover { text-decoration: none; background: var(--surface-2); }
.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; } .kv dt { color: var(--text-2); } .kv dd { margin: 0; }

/* ---- Permission matrix ---- */
.matrix th.mod, .matrix td.mod { position: sticky; left: 0; background: var(--surface); font-weight: 600; z-index: 1; }
.matrix select { height: 30px; font-size: 12px; padding: 0 6px; }
.matrix td { padding: 6px 10px; }

/* ---- Auth pages ---- */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--surface-2); }
.auth-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--outline); border-radius: var(--r-xl); padding: 40px 36px; box-shadow: var(--shadow-1); }
.auth-card .brand-mark { margin: 0 auto 8px; width: 52px; height: 52px; font-size: 32px; border-radius: 16px; }
.auth-title { font-size: 24px; font-weight: 500; text-align: center; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--text-2); margin: 0 0 24px; }
.auth-foot { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text-3); }
.pw-wrap { position: relative; } .pw-wrap .btn-icon { position: absolute; right: 2px; top: 2px; }

/* ---- Public QR verification ---- */
.verify-body { background: var(--surface-2); min-height: 100vh; display: grid; place-items: start center; padding: 24px 16px; }
.verify-card { width: min(420px, 100%); background: var(--surface); border-radius: var(--r-xl); border: 1px solid var(--outline); padding: 28px; text-align: center; box-shadow: var(--shadow-1); }
.verify-photo { width: 120px; height: 120px; border-radius: 50%; margin: 16px auto; background: var(--blue-container); display: grid; place-items: center; font-size: 40px; font-weight: 700; color: var(--on-blue-container); overflow: hidden; }
.verify-photo img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Responsive ---- */
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-2-1 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 60; transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-2); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(32,33,36,.5); z-index: 50; }
  .menu-btn { display: inline-grid; }
  .page { padding: 16px; } .topbar { padding: 0 12px; }
  .searchbar { display: none; }
}
@media (max-width: 600px) { .grid-4, .grid-3, .grid-2, .form-grid { grid-template-columns: 1fr; } .kv { grid-template-columns: 1fr; } .auth-card { padding: 28px 20px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .sidebar, .topbar, .no-print { display: none !important; } .app { display: block; } .card { break-inside: avoid; } }
