:root { --bg:#f4f8f6; --fg:#111; --muted:#6b7280; --brand:#22c55e; --card:#fff; --line:#e5e7eb; }
* { box-sizing: border-box; }
body{
  margin:0;
  font:14px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Ubuntu;
  color:var(--fg);
  background:
    radial-gradient(900px 600px at 20% 10%, rgba(46,229,157,0.16), transparent 55%),
    radial-gradient(900px 600px at 80% 20%, rgba(255,204,102,0.14), transparent 55%),
    radial-gradient(900px 600px at 60% 90%, rgba(255,92,122,0.12), transparent 55%),
    linear-gradient(180deg, #050816 0%, #0b1020 55%, #060a16 100%);
}
a { color:#0ea5e9; text-decoration:none; }
.container { max-width: 960px; margin: 0 auto; padding: 20px; }
.topbar { display:flex; justify-content:space-between; align-items:center; margin-bottom: 10px; }
h1 { margin:10px 0 20px; }
section { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:16px; margin:16px 0; }
.auth { max-width:420px; margin-top:60px; }
.footer-main { margin:2rem 0 1rem 0; text-align:center; }
label { display:block; margin:8px 0 4px; }
input[type=text], input[type=password], input[type=file] {
  width:100%; padding:10px; border:1px solid var(--line); border-radius:8px; background:#fff;
}
button { background:var(--brand); color:#fff; border:none; padding:10px 14px; border-radius:8px; cursor:pointer; }
button:hover { filter:brightness(0.95); }
.error { background:#fee2e2; color:#991b1b; border:1px solid #fecaca; padding:10px; border-radius:8px; margin:10px 0; white-space:pre-line;}
.msg { background:#dcfce7; color:#14532d; border:1px solid #bbf7d0; padding:10px; border-radius:8px; margin:10px 0;}
.hint { color:var(--muted); font-size:12px; margin-top:6px; }
.gallery .grid { display:grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap:12px; }
.card { background:#fff; border:1px solid var(--line); border-radius:10px; padding:8px; }
.card img { width:100%; height:220px; object-fit:cover; border-radius:8px; display:block; }
.card figcaption { font-size:12px; color:var(--muted); margin-top:6px; }
.chat-box { border:1px solid var(--line); border-radius:8px; background:#f8fafc; height:440px; overflow:auto; padding:8px; }
.chat-msg { padding:4px 0; }
.chat-form{ display:flex; gap:8px; margin-top:8px; }
.chat-form input{ flex:1; }
.tbl{width:100%; border-collapse:collapse; }
.tbl th, .tbl td{ border:1px solid var(--line); padding:8px; font-size:13px; vertical-align:top; }
.tbl th{ background:#f3f4f6; text-align:left; }
.actions{ display:flex; flex-wrap:wrap; gap:8px; }
.actions--spread{ justify-content:space-between; }
.inline{ display:inline-block; margin:0; }
.btn{
  display:inline-flex;
  align-items:center;
  padding:8px 12px;
  border: none;
  border-radius:8px;
  background:var(--brand);
  color:#fff;
  text-decoration:none;
  font:inherit;
  line-height:1;
  cursor:pointer;
}
.btn:hover{ filter:brightness(0.95); }
.btn-warn{ background:#f59e0b; }
.btn-danger{ background:#ef4444; }
.badge{ display:inline-block; padding:2px 8px; border-radius:999px; font-size:12px; border:1px solid var(--line); background:#fff; }
.badge-admin{ background:#dbeafe; border-color:#bfdbfe; }
.badge-user{ background:#f1f5f9; }
.badge-ok{ background:#dcfce7; border-color:#bbf7d0; }
.badge-off{ background:#fee2e2; border-color:#fecaca; }
.thumb90{ width:90px; height:90px; object-fit:cover; border-radius:6px; }
.btn-ghost{
  display:inline-flex;
  align-items:center;
  padding:8px 12px;
  border: none;
  border-radius:8px;
  background:transparent;
  color:var(--fg);
  text-decoration:none;
  font:inherit;
  line-height:1;
  cursor:pointer;
}
.btn-ghost:hover{ filter:none; opacity:.9; }
.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
@media (max-width: 640px) {
  .container { padding: 12px; }
  .topbar { flex-direction: column; gap: 8px; align-items: stretch; }
  .auth { max-width: 100%; margin-top: 20px; }
  .gallery .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .card img { height: 160px; }
  .chat-box { height: 40vh; }
  .chat-form{ flex-direction:column; }
  .chat-form .btn{ width:100%; }
}
@supports (padding: max(0px)) {
  .container {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
}
@supports (aspect-ratio: 4 / 3) {
  .card img { height: auto; aspect-ratio: 4 / 3; }
  .thumb90  { height: auto; aspect-ratio: 1 / 1; }
}
:root[data-theme="dark"] {
  --bg:#0b0f10; --fg:#E0E0E0; --muted:#9ca3af; --brand:#22c55e;
  --card:#0f172a; --line:#1f2937;
}
:root[data-theme="light"] {
  --bg:#f4f8f6; --fg:#111; --muted:#6b7280; --brand:#22c55e; --card:#fff; --line:#e5e7eb;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg:#0b0f10; --fg:#d5753c; --muted:#9ca3af; --brand:#22c55e;
    --card:#0f172a; --line:#1f2937;
  }
}
input[type=text], input[type=password], input[type=file] {
  background: var(--card); color: var(--fg); border-color: var(--line);
}
.card { background: var(--card); border-color: var(--line); }
.chat-box { background: var(--card); border-color: var(--line); }
.badge { background: var(--card); border-color: var(--line); }
.no-scroll { overflow: hidden; }
.lightbox.hidden { display: none; }
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
}
.lightbox__backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.75);
  backdrop-filter: blur(2px);
}
.lightbox__content {
  position: relative; max-width: 95vw; max-height: 90vh;
  background: var(--card); border:1px solid var(--line);
  border-radius: 12px; padding: 8px 44px; display: grid; gap: 8px;
}
.lightbox__img {
  max-width: 90vw; max-height: 75vh; width: auto; height: auto; display:block; border-radius: 8px;
}
.lightbox__meta { font-size: 13px; color: var(--muted); }
.lightbox__title { color: var(--fg); font-weight: 600; }
.lightbox__close {
  position: absolute; top: 6px; right: 8px;
  width: 32px; height: 32px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--fg); cursor: pointer;
}
.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--fg); cursor: pointer;
}
.lightbox__prev { left: 6px; }
.lightbox__next { right: 6px; }
@media (max-width:640px){
  .lightbox__content { padding: 8px 40px; }
  .lightbox__img { max-width: 94vw; max-height: 70vh; }
}
.report-link { font-size:12px; color:#ef4444; }
.report-link:hover { text-decoration: underline; }
.badge-alert{ background:#fee2e2; border-color:#fecaca; color:#991b1b; }
.visibility--private { color: #6b7280; }
.caption { font-size: 12px; color: #6b7280; }
.chat-time { color: #9ca3af; font-size: 12px; margin-right: 8px; }
.chat-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 440px;
  margin: 0 auto;
}
.chat-form input,
.chat-form select,
.chat-form textarea,
.chat-form button {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
}
@media (max-width: 700px) {
  .chat-form { max-width: 99vw; }
}
.note-margin { margin: 16px 0 0 0; }
.actions--mt16 { margin-top: 16px; }
.cell-break { max-width: 420px; word-break: break-word; }
.grid-auto120 { display: grid; grid-template-columns: repeat(auto-fit,minmax(120px,1fr)); gap: 12px; }
.grid-auto240 { display: grid; grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); gap: 12px; }
.grid-gap { display: grid; gap: 8px; }
.w120 { max-width: 120px; }
.w140 { max-width: 140px; }
.w180 { max-width: 180px; }
.mt2 { margin-top: 2rem; }
.admin-chat-controls, .admin-chat-bulk {
  margin-bottom: 1.4rem;
}
.admin-form {
  margin-right: 16px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.tbl-message {
  max-width: 480px;
  word-break: break-word;
}
@media (max-width: 700px) {
  .tbl-message { max-width: 240px; }
}
.grid-auto180 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.report-section {
  max-width: 420px;
  margin: 2.5rem auto;
  padding: 2rem 2.5rem 1.5rem 2.5rem;
  background: var(--surface, #2222 4%);
  border-radius: 1.5rem;
  box-shadow: 0 4px 20px #0002;
}
.report-img-meta {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.form-vertical {
  display: grid;
  gap: 14px;
  margin-top: 1rem;
}
.form-vertical label {
  font-weight: 500;
  margin-bottom: 2px;
}
.form-vertical input[type="text"], .form-vertical select {
  padding: 0.5em;
  border-radius: 6px;
  border: 1px solid #8883;
  background: var(--input-bg, #fff);
  width: 100%;
  box-sizing: border-box;
}
.form-vertical button {
  margin-top: 1rem;
  font-size: 1rem;
}
.rapportbajs {
  max-width: 360px;
  word-break: break-word;
}
.chat-msg { 
  display: flex; align-items: baseline; gap: 8px; 
  font-size: 14px; padding: 4px 0;
}
.chat-time { color: #9ca3af; font-size: 12px; min-width: 54px; text-align: right; }
.chat-user { color: #22c55e; }
.chat-text { color: #d5753c; word-break: break-word; }
[data-theme="dark"] .chat-text { color: #ffe; }
[data-theme="dark"] .chat-user { color: #34d399; }
.upload-preview {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
}
.upload-preview--empty {
  display: none;
}
.upload-preview__item {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: var(--card);
}
.upload-preview__thumb {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}
.upload-preview__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: none;
  background: rgba(15,23,42,0.85);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.upload-preview__remove:hover {
  opacity: .9;
}
.upload-preview__meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  word-break: break-word;
}
.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .85rem;
  border: 1px solid #24314f;
  color: #b7c3e6;
}




/* ==========================================================
   Login-side med yessir.jpg som responsiv bakgrunn
   ========================================================== */

body.login-page {
  min-height: 100vh;
  color: #f8fafc;
  background:
    linear-gradient(90deg, rgba(5, 8, 22, 0.78) 0%, rgba(5, 8, 22, 0.38) 36%, rgba(5, 8, 22, 0.18) 100%),
    url("yessir.jpg") center center / cover no-repeat fixed;
}

.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(800px 500px at 18% 20%, rgba(34, 197, 94, 0.18), transparent 60%),
    radial-gradient(700px 480px at 82% 20%, rgba(255, 204, 102, 0.13), transparent 60%),
    radial-gradient(700px 520px at 68% 92%, rgba(255, 92, 122, 0.12), transparent 60%);
  z-index: 0;
}

.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  align-items: center;
  justify-items: start;
  padding: 32px;
}

.login-card {
  animation: floatIn 0.6s ease-out;
  transform: translateY(20px);
  width: min(360px, 100%);
  margin-left: clamp(12px, 2vw, 36px);
  padding: 24px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.72);
  box-shadow: 0 24px 80px rgba(0,0,0,0.42);
  backdrop-filter: blur(14px);
}

.login-card h1 {
  margin: 6px 0 8px;
  color: #ffffff;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1;
  letter-spacing: -0.06em;
}

.login-kicker {
  display: inline-flex;
  padding: 5px 10px;
  border: 1px solid rgba(34,197,94,0.45);
  border-radius: 999px;
  color: #86efac;
  background: rgba(34,197,94,0.10);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-subtitle {
  margin: 0 0 20px;
  color: rgba(248,250,252,0.72);
}

.login-form label {
  color: rgba(248,250,252,0.82);
  font-weight: 600;
}

.login-form input[type=text],
.login-form input[type=password] {
  background: rgba(2, 6, 23, 0.72);
  color: #f8fafc;
  border-color: rgba(255,255,255,0.16);
}

.login-form input:focus {
  outline: none;
  border-color: rgba(34,197,94,0.75);
  box-shadow: 0 0 0 4px rgba(34,197,94,0.16);
}

.login-form button {
  width: 100%;
  margin-top: 16px;
  font-weight: 800;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 12px 32px rgba(34,197,94,0.24);
}

.login-register {
  margin: 18px 0 0;
  color: rgba(248,250,252,0.72);
  text-align: center;
}

.login-register a {
  color: #7dd3fc;
  font-weight: 700;
}

.login-page .error {
  background: rgba(127, 29, 29, 0.78);
  color: #fee2e2;
  border-color: rgba(248, 113, 113, 0.38);
}

/* Mobil: vis mer av teksten i bildet, men behold login lesbar */
@media (max-width: 760px) {
  body.login-page {
    background:
      linear-gradient(180deg, rgba(5, 8, 22, 0.72) 0%, rgba(5, 8, 22, 0.88) 58%, rgba(5, 8, 22, 0.96) 100%),
      url("yessir.jpg") 34% center / cover no-repeat scroll;
  }

  .login-shell {
    align-items: end;
    padding: 16px;
  }

  .login-card {
    margin: 0;
    padding: 22px;
    border-radius: 18px;
  }
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}


/* ==========================================================
   Søknadsside / register.php
   ========================================================== */

body.register-page {
  min-height: 100vh;
  color: #f8fafc;
  background:
    linear-gradient(90deg, rgba(5, 8, 22, 0.82) 0%, rgba(5, 8, 22, 0.48) 42%, rgba(5, 8, 22, 0.20) 100%),
    url("yessir.jpg") center center / cover no-repeat fixed;
}

.register-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(700px 460px at 16% 20%, rgba(34,197,94,0.18), transparent 60%),
    radial-gradient(700px 520px at 82% 18%, rgba(255,204,102,0.12), transparent 60%),
    radial-gradient(800px 540px at 68% 92%, rgba(255,92,122,0.12), transparent 60%);
  z-index: 0;
}

.register-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  align-items: center;
  justify-items: start;
  padding: 32px;
}

.register-card {
  width: min(420px, 100%);
  margin-left: clamp(12px, 2vw, 42px);
  padding: 26px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.76);
  box-shadow: 0 24px 80px rgba(0,0,0,0.42);
  backdrop-filter: blur(14px);
  animation: floatIn 0.6s ease-out;
}

.register-card h1 {
  margin: 8px 0 8px;
  color: #ffffff;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
  letter-spacing: -0.06em;
}

.anna-status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  padding: 10px 12px;
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: 14px;
  color: rgba(226, 232, 240, 0.82);
  background: rgba(14, 165, 233, 0.08);
  font-size: 12px;
}

.anna-status__dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 6px rgba(34,197,94,0.14), 0 0 18px rgba(34,197,94,0.55);
  animation: annaPulse 1.8s ease-in-out infinite;
}

.register-hint {
  margin: 7px 0 2px;
  color: rgba(248,250,252,0.56);
}

.register-page .msg {
  background: rgba(20, 83, 45, 0.72);
  color: #dcfce7;
  border-color: rgba(134, 239, 172, 0.34);
}

@keyframes annaPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.75;
  }
  50% {
    transform: scale(1.18);
    opacity: 1;
  }
}

@media (max-width: 760px) {
  body.register-page {
    background:
      linear-gradient(180deg, rgba(5, 8, 22, 0.70) 0%, rgba(5, 8, 22, 0.88) 58%, rgba(5, 8, 22, 0.96) 100%),
      url("yessir.jpg") 34% center / cover no-repeat scroll;
  }

  .register-shell {
    align-items: end;
    padding: 16px;
  }

  .register-card {
    width: 100%;
    margin: 0;
    padding: 22px;
    border-radius: 18px;
  }
}


/* Mobil + "datamaskinversjon på mobil"-fiks */
@media (max-width: 760px), (max-height: 760px), (orientation: portrait) {
  body.login-page,
  body.register-page {
    min-height: 100svh;
    background:
      linear-gradient(180deg, rgba(5, 8, 22, 0.48) 0%, rgba(5, 8, 22, 0.78) 48%, rgba(5, 8, 22, 0.96) 100%),
      url("yessir.jpg") 42% center / cover no-repeat scroll;
  }

  .login-shell,
  .register-shell {
    min-height: 100svh;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 18px;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .login-card,
  .register-card {
    width: min(100%, 430px);
    margin: 0;
    padding: clamp(18px, 5vw, 26px);
    max-height: calc(100svh - 36px);
    overflow: auto;
  }

  .login-card h1,
  .register-card h1 {
    font-size: clamp(2.1rem, 10vw, 3.2rem);
  }
}
