:root{
  --bg0:#0a0e1f;
  --bg1:#0f1629;
  --card: rgba(255,255,255,.08);
  --card2: rgba(255,255,255,.10);
  --border: rgba(255,255,255,.12);
  --text: rgba(255,255,255,.95);
  --muted: rgba(255,255,255,.75);
  --muted2: rgba(255,255,255,.62);

  --primary: #6366f1;
  --primarySoft: rgba(99,102,241,.18);
  --accent: #22c55e;
  --accentSoft: rgba(34,197,94,.15);

  --r: 20px;
  --r2: 16px;

  --shadow: 0 20px 50px rgba(0,0,0,.45);
  --shadow2: 0 10px 28px rgba(0,0,0,.32);

  --pad: 16px;

  /* Safe areas */
  --sat: env(safe-area-inset-top);
  --sab: env(safe-area-inset-bottom);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: var(--text);
  background:
    radial-gradient(1400px 800px at 20% -12%, rgba(99,102,241,.28), transparent 60%),
    radial-gradient(1000px 600px at 115% -5%, rgba(34,197,94,.16), transparent 65%),
    radial-gradient(800px 500px at 50% 100%, rgba(236,72,153,.08), transparent 70%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg0) 60%, #050810 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a{ color:inherit; }

/* ---------- APPBAR ---------- */
.appbar{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1002;

  padding: calc(var(--sat) + 8px) var(--pad) 10px;
  background: rgba(10,14,30,.92);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  transition: opacity 0.3s ease;
  opacity: 1;
}

.appbar__row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

.appbar__title{
  font-weight: 950;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: -.2px;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,.85) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.appbar__subtitle{
  font-weight: 800;
  font-size: 12px;
  opacity: .72;
  margin-top: 3px;
  letter-spacing: .3px;
}

.appbar__right{
  display:flex;
  gap: 8px;
}

#userName {
  cursor: pointer;
  transition: opacity 0.2s ease;
  border-radius: 4px;
  padding: 2px 6px;
}

#userName:hover {
  opacity: 1 !important;
  background: rgba(99, 102, 241, 0.15);
}

/* Admin Menu Popup */
.admin-menu {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 70px);
  right: 16px;
  background: rgba(15,22,41,.95);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 8px;
  z-index: 1500;
  min-width: 240px;
  box-shadow: 0 12px 32px rgba(0,0,0,.35);
  backdrop-filter: blur(20px);
  animation: slideUp 0.3s ease forwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.admin-menu__content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-menu__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.2s ease;
  text-align: left;
}

.admin-menu__item:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.15);
}

.admin-menu__item:active {
  transform: scale(0.98);
}

.admin-menu__icon {
  font-size: 20px;
  min-width: 24px;
  text-align: center;
}

.admin-menu__text {
  flex: 1;
}

.admin-menu__title {
  font-weight: 600;
  font-size: 13px;
}

.admin-menu__desc {
  font-size: 11px;
  opacity: 0.65;
  margin-top: 2px;
}

.admin-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1400;
}

.btn{
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 14px;
  line-height: 1;
  min-height: 42px;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  cursor: pointer;
  transition: all .2s ease;
  user-select: none;
}
.btn:hover{
  background: rgba(255,255,255,.12);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,.28);
}
.btn:active{ 
  transform: translateY(0px); 
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.btn--primary{
  background: linear-gradient(135deg, var(--primary) 0%, #5558e3 100%);
  border-color: rgba(99,102,241,.5);
  color: white;
  box-shadow: 0 4px 16px rgba(99,102,241,.4);
}
.btn--primary:hover{
  background: linear-gradient(135deg, #7376f4 0%, #6366f1 100%);
  box-shadow: 0 6px 20px rgba(99,102,241,.5);
}
.btn--ghost{
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.10);
}

/* ---------- WRAP ---------- */
.wrap{
  padding: calc(var(--sat) + 62px) var(--pad) calc(var(--sab) + 100px);
  max-width: 920px;
  margin: 0 auto;
}

.sectionHeader{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 4px 12px;
  flex-wrap: nowrap;
}

.sectionTitle{
  font-size: 17px;
  font-weight: 950;
  opacity: .96;
  letter-spacing: -.2px;
  margin: 0;
}

/* When sectionTitle is used alone (not in sectionHeader) */
.sectionTitle:not(.sectionHeader > .sectionTitle){
  margin: 18px 4px 12px;
}

.compactFields{
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

.compactField{
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,.06) 100%);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 6px 10px;
  transition: all .2s ease;
  white-space: nowrap;
}

.compactField:focus-within{
  background: rgba(255,255,255,.10);
  border-color: rgba(99,102,241,.5);
  box-shadow: 0 0 0 2px rgba(99,102,241,.12);
}

.compactField span{
  font-size: 11px;
  font-weight: 900;
  color: var(--muted2);
  letter-spacing: .3px;
  text-transform: uppercase;
}

.compactField input,
.compactField select{
  appearance: none;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  padding: 0;
  min-width: 70px;
}

.compactField select{
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255,255,255,.55) 50%),
    linear-gradient(135deg, rgba(255,255,255,.55) 50%, transparent 50%);
  background-position:
    calc(100% - 8px) calc(50% - 2px),
    calc(100% - 4px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 18px;
}

/* ---------- CARDS ---------- */
.card{
  background: linear-gradient(135deg, rgba(255,255,255,.10) 0%, rgba(255,255,255,.06) 100%);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--r);
  padding: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  backdrop-filter: blur(10px);
  transition: all .3s ease;
}

.card:hover{
  border-color: rgba(255,255,255,.16);
  transform: translateY(-2px);
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}

/* ---------- CONTROLS ---------- */
.controls{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field{
  display:flex;
  flex-direction:column;
  gap: 7px;
  background: linear-gradient(135deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,.05) 100%);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--r2);
  padding: 12px 14px;
  transition: all .2s ease;
}

.field:focus-within{
  background: rgba(255,255,255,.10);
  border-color: rgba(99,102,241,.5);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.field span{
  font-size: 12px;
  font-weight: 900;
  color: var(--muted);
  letter-spacing: .3px;
  text-transform: uppercase;
}

.field input,
.field select{
  appearance: none;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 16px;
  padding: 2px 0;
  min-height: 22px;
}

/* gjør selects litt mer “app” */
.field select{
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255,255,255,.55) 50%),
    linear-gradient(135deg, rgba(255,255,255,.55) 50%, transparent 50%);
  background-position:
    calc(100% - 14px) calc(50% - 2px),
    calc(100% - 9px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

.status{
  grid-column: 1 / -1;
  margin-top: 2px;
  font-weight: 800;
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
}

.actionsGrid{
  grid-column: 1 / -1;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}

.actionsGrid .btn{
  border-radius: 16px;
  min-height: 48px;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}

/* ---------- TABLE -> APP LIST ---------- */
.tableWrap{
  overflow: visible;
}

/* Desktop-ish header for large screens */
.dataTable{
  width: 100%;
  border-collapse: collapse;
}
.dataTable th, .dataTable td{
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  vertical-align: top;
}
.dataTable th{
  font-size: 12px;
  letter-spacing: .2px;
  color: var(--muted2);
  font-weight: 950;
}

.assignCell select{
  width: 100%;
  min-height: 38px;
  border-radius: 16px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(135deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,.06) 100%);
  color: var(--text);
  font-weight: 900;
  transition: all .2s ease;
}

.assignCell select:focus{
  background: rgba(255,255,255,.12);
  border-color: rgba(99,102,241,.5);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
  outline: none;
}

.recentLine{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.25;
}
.recentNames{ margin-top: 2px; color: rgba(255,255,255,.82); }

/* Mobil: gjør hver rad til et “kort” */
@media (max-width: 760px){
  .dataTable thead{ display:none; }

  .dataTable, .dataTable tbody, .dataTable tr, .dataTable td{
    display:block;
    width: 100%;
  }

  .dataTable tr{
    background: linear-gradient(135deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,.06) 100%);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 18px;
    padding: 8px 10px 6px;
    margin-bottom: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,.28);
    transition: all .25s ease;
  }

  .dataTable tr:hover{
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0,0,0,.35);
    border-color: rgba(255,255,255,.18);
  }

  .dataTable td{
    border-bottom: 0;
    padding: 0;
  }

  .dataTable td:nth-child(1){
    font-weight: 950;
    font-size: 15px;
    margin-bottom: 6px;
    letter-spacing: -.2px;
    color: var(--primary);
    text-shadow: 0 2px 8px rgba(99,102,241,.3);
  }

  .dataTable td:nth-child(2){
    margin-bottom: 8px;
  }
}

/* ---------- DETAILS (kompetanse) ---------- */
.details{
  transition: all .3s ease;
}

.details summary{
  cursor: pointer;
  font-weight: 950;
  font-size: 16px;
  list-style: none;
  padding: 4px 0;
  transition: opacity .2s ease;
}
.details summary:hover{
  opacity: .85;
}
.details summary::-webkit-details-marker{ display:none; }

.detailsBody{
  margin-top: 14px;
}

.qualList{
  margin-top: 12px;
  max-height: 56vh;
  overflow: auto;
  padding-right: 4px;
}

.qualRow{
  display:flex;
  gap: 12px;
  align-items:center;
  padding: 12px 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,.06) 0%, rgba(255,255,255,.04) 100%);
  margin-bottom: 10px;
  font-weight: 900;
  color: rgba(255,255,255,.90);
  transition: all .2s ease;
}
.qualRow:hover{
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.16);
  transform: translateX(2px);
}
.qualRow input{ 
  transform: scale(1.2);
  cursor: pointer;
}

/* ---------- STICKY BOTTOM ACTIONS (app feel) ---------- */
.bottomBar{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;

  padding: 10px var(--pad) calc(var(--sab) + 8px);
  background: rgba(10,14,30,.94);
  backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 -8px 32px rgba(0,0,0,.3);
}

.bottomBar__inner{
  max-width: 920px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.bottomBar .btn{
  border-radius: 18px;
  min-height: 50px;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  font-size: 15px;
}

/* ---------- FOOTER + TOAST ---------- */
.footer{
  display: none;
}
.footer__credit{
  display: none;
}
.footer__disclaimer{
  display: none;
}

.toast{
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--sab) + 90px);
  background: rgba(0,0,0,.88);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 16px;
  padding: 12px 16px;
  color: white;
  font-weight: 900;
  font-size: 14px;
  opacity: 0;
  transform: translateY(12px);
  transition: all .25s cubic-bezier(0.4, 0.0, 0.2, 1);
  pointer-events: none;
  z-index: 80;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  backdrop-filter: blur(10px);
}
.toast.show{
  opacity: 1;
  transform: translateY(0);
}

/* ---------- BOTTOM NAV ---------- */
.bottomNav{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;

  padding: 10px var(--pad) calc(var(--sab) + 8px);
  background: rgba(10,14,30,.94);
  backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 -8px 32px rgba(0,0,0,.3);
}

.bottomNav__inner{
  max-width: 100%;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.bottomNav .btn{
  border-radius: 16px;
  min-height: 48px;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  font-size: 12px;
  padding: 10px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  flex-shrink: 0;
}

/* Login Overlay */
.sc-login-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(8px);
  z-index: 2000;
}

.sc-login-card {
  background: rgba(15,22,41,0.98);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px;
  padding: 24px;
  width: min(90vw, 320px);
  backdrop-filter: blur(20px);
}

.sc-login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sc-login-overlay.hidden {
  display: none !important;
}

.sc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sc-field__label {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
}

.sc-field input, .sc-field select {
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.05);
  border-radius: 8px;
  color: white;
  font-size: 14px;
}

.sc-field input::placeholder {
  color: rgba(255,255,255,.5);
}
