:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f3f4f6;
  background: #070b12;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top right, #172033 0, #0b111d 35%, #070b12 75%); }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); padding: 38px; border: 1px solid #263143; border-radius: 24px; background: rgba(13,20,32,.94); box-shadow: 0 28px 80px rgba(0,0,0,.42); }
.brand-mark { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 15px; background: linear-gradient(135deg,#f59e0b,#f97316); color: #111827; font-weight: 900; font-size: 28px; margin-bottom: 24px; }
.brand-mark.small { width: 40px; height: 40px; margin: 0; border-radius: 12px; font-size: 21px; }
.eyebrow { margin: 0 0 6px; color: #f59e0b; letter-spacing: .16em; font-size: 11px; font-weight: 800; }
h1,h2,h3,p { margin-top: 0; }
h1 { font-size: 34px; margin-bottom: 12px; }
.subtle,.security-note { color: #9ca3af; line-height: 1.55; }
.security-note { font-size: 12px; margin: 20px 0 0; }
.login-form { display: grid; gap: 16px; margin-top: 26px; }
.login-form label { display: grid; gap: 8px; color: #cbd5e1; font-size: 13px; font-weight: 700; }
.login-form input { width: 100%; border: 1px solid #344154; border-radius: 12px; padding: 13px 14px; background: #0a101a; color: #f9fafb; outline: none; }
.login-form input:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.14); }
.login-form button { border: 0; border-radius: 12px; padding: 13px 16px; background: #f59e0b; color: #171717; font-weight: 900; }
.error-text { margin: 14px 0 0; color: #fca5a5; font-size: 13px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 16px; border-right: 1px solid #1f2937; background: #090e17; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; }
.sidebar-brand strong,.sidebar-brand span { display: block; }
.sidebar-brand strong { letter-spacing: .14em; font-size: 13px; }
.sidebar-brand span { color: #8f9bad; font-size: 12px; margin-top: 2px; }
.nav { display: grid; gap: 6px; }
.nav button { width: 100%; text-align: left; border: 0; border-radius: 11px; padding: 11px 12px; color: #aeb8c7; background: transparent; font-weight: 700; }
.nav button:hover,.nav button.active { background: #151e2d; color: white; }
.nav button.active { box-shadow: inset 3px 0 0 #f59e0b; }
.sidebar-footer { margin-top: auto; border-top: 1px solid #1f2937; padding: 16px 6px 0; }
.user-summary { margin-bottom: 10px; font-size: 12px; color: #9ca3af; word-break: break-word; }
.user-summary strong { color: white; display: block; margin-bottom: 2px; }
.ghost-button { border: 1px solid #344154; border-radius: 10px; padding: 9px 12px; background: #101722; color: #d6deea; font-weight: 750; }
.workspace { min-width: 0; min-height: 100vh; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid #1f2937; background: rgba(10,15,24,.85); backdrop-filter: blur(12px); }
.topbar h2 { margin: 0; font-size: 22px; }
.home-panel { padding: 26px; }
.hero-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 28px; border: 1px solid #263143; border-radius: 18px; background: linear-gradient(135deg,#111a29,#0d141f); }
.hero-card h3 { font-size: 30px; margin-bottom: 8px; }
.hero-card p:not(.eyebrow) { color: #aab5c4; margin-bottom: 0; max-width: 760px; line-height: 1.5; }
.status-pill { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; border: 1px solid #244a36; border-radius: 999px; padding: 8px 12px; color: #b7f7ce; background: #0c2017; font-size: 12px; font-weight: 800; }
.status-pill span { width: 8px; height: 8px; background: #22c55e; border-radius: 50%; box-shadow: 0 0 0 4px rgba(34,197,94,.12); }
.module-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(230px,1fr)); gap: 16px; margin-top: 20px; }
.module-card { position: relative; min-height: 174px; padding: 22px; border: 1px solid #253144; border-radius: 16px; background: #0d141f; color: white; text-align: left; transition: transform .15s ease,border-color .15s ease; }
.module-card:hover { transform: translateY(-2px); border-color: #5c4b25; }
.module-card .icon { font-size: 28px; margin-bottom: 22px; }
.module-card h4 { margin: 0 0 7px; font-size: 18px; }
.module-card p { margin: 0; color: #8f9bad; line-height: 1.4; font-size: 13px; }
.module-card .badge { position: absolute; top: 14px; right: 14px; border-radius: 999px; padding: 5px 8px; background: #142235; color: #a9bdd5; font-size: 10px; font-weight: 800; letter-spacing: .06em; }
.module-card.unavailable { opacity: .55; cursor: default; }
.module-panel { height: calc(100vh - 76px); background: white; }
.module-panel iframe { display: block; width: 100%; height: 100%; border: 0; background: white; }
.pending-panel { min-height: calc(100vh - 76px); display: grid; place-items: center; padding: 24px; }
.pending-card { width: min(520px,100%); padding: 30px; border: 1px solid #39465a; border-radius: 18px; background: #0e1622; text-align: center; }
.pending-card p { color: #9eabba; line-height: 1.5; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 9999; max-width: 380px; padding: 12px 14px; border-radius: 10px; background: #182232; color: white; box-shadow: 0 12px 30px rgba(0,0,0,.35); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; width: 100%; height: auto; border-right: 0; border-bottom: 1px solid #1f2937; }
  .nav { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .sidebar-footer { margin-top: 14px; }
  .hero-card { align-items: flex-start; flex-direction: column; }
  .module-panel { height: 75vh; }
}

/* Admin / User Management */
.admin-panel { padding: 26px; }
.admin-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; padding: 24px; border: 1px solid #263143; border-radius: 18px; background: linear-gradient(135deg,#111a29,#0d141f); }
.admin-toolbar h3 { margin-bottom: 7px; font-size: 25px; }
.admin-toolbar p:not(.eyebrow) { color: #9eabba; margin-bottom: 0; line-height: 1.5; }
.admin-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 18px; align-items: start; }
.user-list-card,.user-editor-card { border: 1px solid #263143; border-radius: 16px; background: #0d141f; overflow: hidden; }
.panel-heading { padding: 17px 18px; border-bottom: 1px solid #263143; }
.panel-heading strong,.panel-heading span { display: block; }
.panel-heading span { margin-top: 3px; color: #8491a3; font-size: 12px; }
.user-list { display: grid; max-height: calc(100vh - 270px); overflow: auto; }
.user-list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 14px 16px; border: 0; border-bottom: 1px solid #1e2937; background: transparent; color: white; text-align: left; }
.user-list-row:hover,.user-list-row.selected { background: #141e2d; }
.user-list-row.selected { box-shadow: inset 3px 0 0 #f59e0b; }
.user-list-main { min-width: 0; }
.user-list-main strong,.user-list-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-list-main strong { font-size: 13px; }
.user-list-main small { margin-top: 3px; color: #8794a6; font-size: 11px; }
.user-status { flex: 0 0 auto; border: 1px solid #344154; border-radius: 999px; padding: 4px 7px; font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; }
.user-status.active { border-color: #22543a; color: #9df0bb; background: #0b2016; }
.user-status.admin { border-color: #765b1b; color: #ffd978; background: #271d08; }
.user-status.disabled { border-color: #663238; color: #ffb1b7; background: #251013; }
.user-status.pending { border-color: #3e4d61; color: #aab7c8; background: #111923; }
.user-editor-card { min-height: 510px; padding: 22px; }
.admin-message { min-height: 360px; display: grid; place-items: center; align-content: center; text-align: center; color: #98a5b6; }
.admin-message h3 { color: white; margin-bottom: 6px; }
.user-editor-header { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid #253143; }
.user-editor-header h3 { margin: 0 0 5px; font-size: 20px; word-break: break-word; }
.user-editor-header p:not(.eyebrow) { margin: 0; color: #8996a8; font-size: 12px; }
.admin-form-grid { display: grid; grid-template-columns: 1fr 220px; gap: 16px; margin-top: 20px; }
.admin-form-grid label { display: grid; gap: 8px; color: #cbd5e1; font-size: 12px; font-weight: 800; }
.admin-form-grid input,.admin-form-grid select { width: 100%; border: 1px solid #344154; border-radius: 11px; padding: 11px 12px; background: #090f18; color: #f7f9fb; outline: none; }
.admin-form-grid input:focus,.admin-form-grid select:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.12); }
.admin-form-grid select:disabled,.active-toggle input:disabled { opacity: .55; cursor: not-allowed; }
.active-toggle { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 16px; padding: 15px 16px; border: 1px solid #263143; border-radius: 13px; background: #0a111b; }
.active-toggle strong,.active-toggle small { display: block; }
.active-toggle strong { font-size: 13px; }
.active-toggle small { margin-top: 4px; color: #8491a3; line-height: 1.4; }
.active-toggle input { width: 20px; height: 20px; accent-color: #f59e0b; }
.self-note { margin: 10px 0 0; padding: 9px 11px; border: 1px solid #4b421d; border-radius: 10px; background: #201b08; color: #e8d896; font-size: 11px; }
.permissions-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-top: 24px; margin-bottom: 10px; }
.permissions-heading h4 { margin: 0; font-size: 17px; }
.permissions-heading > span { color: #7f8da0; font-size: 11px; text-align: right; max-width: 360px; }
.permission-grid { display: grid; gap: 8px; }
.permission-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 14px; border: 1px solid #263143; border-radius: 12px; background: #0a111b; }
.permission-copy { min-width: 0; }
.permission-copy strong,.permission-copy small { display: block; }
.permission-copy strong { font-size: 13px; }
.permission-copy small { margin-top: 3px; color: #7f8da0; line-height: 1.35; }
.permission-control { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; color: #c6d0dc; font-size: 11px; font-weight: 800; }
.permission-control input { width: 18px; height: 18px; accent-color: #f59e0b; }
.admin-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 20px; }
.primary-button { border: 0; border-radius: 11px; padding: 11px 16px; background: #f59e0b; color: #151515; font-weight: 900; }
.primary-button:disabled { opacity: .55; cursor: wait; }
.save-status { color: #9bb0c5; font-size: 12px; }
.admin-footnote { margin-top: 16px; padding: 13px 15px; border: 1px solid #263143; border-radius: 12px; background: #0a111b; color: #8896a8; font-size: 11px; line-height: 1.5; }
.admin-footnote strong { color: #cfd8e4; }
@media (max-width: 980px) {
  .admin-layout { grid-template-columns: 1fr; }
  .user-list { max-height: 310px; }
  .admin-form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .admin-panel { padding: 16px; }
  .admin-toolbar,.permissions-heading,.permission-row,.active-toggle { align-items: flex-start; flex-direction: column; }
  .permissions-heading > span { text-align: left; }
  .permission-row { gap: 10px; }
}
