:root{
  --bg: #e5e7ebe5;
  --text: #e5e7eb;
  --text-nav: #0f172a;
  --muted: #94a3b8;
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  --ok:   #16a34a;
  --warn: #f59e0b;
  --bad:  #ef4444;

  --muted-card: #1f2937;
  --card-bg:    #0f172a;
  --header-bg:  #e5e7eb;
  --accent:     #38bdf8;

  --grid-gap: 1.0rem;
  --card-radius: 5px;

  --header-h: 7vh;
  --footer-h: 48px;

  /* Status-board sticky header row heights (tweak if needed) */
  --sb-h1: 26px;
  --sb-h2: 22px;
}

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

/* =========================================================
   BASE WALL
   ========================================================= */
body.wall{
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.35;

  background-image:
    linear-gradient(
      105deg,
      var(--bg) 0%,
      var(--bg) 70%,
      rgba(0,0,0,0) 80%
    );
  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
  background-attachment: fixed;

  position: relative;
  z-index: 0;
}

/* Vessel backgrounds */
body.vessel-const.wall{
  background-image:
    linear-gradient(105deg, var(--bg) 0%, var(--bg) 70%, rgba(0,0,0,0) 80%),
    url("/assets/const.jpg");
}
body.vessel-wells.wall{
  background-image:
    linear-gradient(105deg, var(--bg) 0%, var(--bg) 70%, rgba(0,0,0,0) 80%),
    url("/assets/wells.jpg");
}

/* =========================================================
   HEADER + NAV (fixed)
   ========================================================= */
.app-header{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 1200;

  background: var(--header-bg);
  backdrop-filter: saturate(120%) blur(6px);
  border-bottom: 1px solid #111827;
}

.header-inner{
  height: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 0 clamp(12px, 3vw, 28px);
}

.header-logo{
  display: grid;
  place-items: center;
  pointer-events: none;
}

.header-logo img{
  max-height: calc(var(--header-h) - 16px);
  height: 90%;
  width: auto;
}

.branding{
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.main-header-title{
  font-size: clamp(20px, 2.4vh + 0.5rem, 34px);
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
}

.page-title{
  margin-top: 2px;
  font-size: clamp(14px, 1.2vh + 0.3rem, 20px);
  font-weight: 500;
  color: var(--muted);
}

.user-area{
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
}

/* NAV */
.app-nav{
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  z-index: 1150;

  background: var(--header-bg);
  border-bottom: 1px solid rgba(15,23,42,0.15);
}

.app-nav ul{
  display: flex;
  justify-content: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 10px 0;
}

.app-nav a{
  position: relative;
  text-decoration: none;
  color: var(--text-nav);
  font-weight: 400;
  padding: 4px 2px;
}

.app-nav a.active{
  font-weight: 700;
}

/* Hover underline (as agreed) */
.app-nav a::after{
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 2px;
  background: var(--text-nav);
  opacity: 0;
  transform: scaleX(0);
  transition: opacity 120ms ease, transform 120ms ease;
}

.app-nav a:not(.active):hover::after{
  opacity: 1;
  transform: scaleX(1);
}

/* =========================================================
   CONTENT
   ========================================================= */
.content{
  padding-top: calc(var(--header-h) + 44px);
  min-height: calc(100vh - var(--footer-h));
  padding-left: clamp(12px, 3vw, 28px);
  padding-right: clamp(12px, 3vw, 28px);
  padding-bottom: 24px;
}

.wrap{
  max-width: 1000px;
  margin: 0 auto;
}

/* =========================================================
   PS CARDS (URØRT)
   ========================================================= */
.card{
  background: #122033;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--card-radius);
  padding: 20px;
  margin-bottom: 32px;
}

.card .card-title{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #dbeafe;
  font-weight: 700;
  margin-bottom: 12px;
}

/* FORM (URØRT) */
.form-grid{
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.field{
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: #0f172a;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 4px;
}

.field label{ font-weight: 700; }

.field input,
.field select,
.field textarea{
  padding: .5rem .6rem;
  border: 1px solid #334155;
  border-radius: 4px;
  background: #0b1220;
  color: var(--text);
}

.field textarea{
  resize: vertical;
  min-height: 80px;
}

fieldset.tb{
  margin: 0;
  padding: 12px;
  background: #0f172a;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.12);
}

fieldset.tb legend{
  padding: 0 6px;
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 6px;
}

@media (max-width: 640px){
  .form-grid{ grid-template-columns: 1fr; }
}

/* PDF button (URØRT) */
.ps-pdf-btn{
  font-size: 0.9rem;
  padding: 6px 16px;
  border-radius: 4px;
  background: var(--ok);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

.ps-pdf-btn:hover{ background: #105b2b; }
.ps-pdf-btn:active{ background: #0f4423; }

/* =========================================================
   FOOTER
   ========================================================= */
.app-footer{
  position: sticky;
  bottom: 0;
  height: var(--footer-h);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 clamp(12px, 3vw, 28px);
  color: var(--muted);
  background: var(--header-bg);
  border-top: 1px solid #111827;
}

/* =========================================================
   PDF MODAL (ryddet, én definisjon)
   ========================================================= */
.pdf-modal{
  position: fixed;
  inset: 0;
  z-index: 5000;
}

.pdf-modal[hidden]{ display: none; }

.pdf-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}

.pdf-dialog{
  position: relative;
  width: min(95vw, 2000px);
  height: min(95vh, 1200px);
  margin: 2.5vh auto;
  background: #0b1220;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.pdf-dialog iframe{
  width: 100%;
  height: 100%;
  border: none;
}

.pdf-close{
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 1;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
}

/* =========================================================
   STATUS BOARD (RYDDIG OG STABIL)
   ========================================================= */

.status-board-title{
  font-size: 1.3rem;
  font-weight: 700;
  margin: 30 0 30px 0;
  color: #1f2937;
}

.status-grid-wrap{
  overflow: auto;
  max-height: calc(100vh - 240px);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 6px;
  background: rgba(15,23,42,0.7);
}

.status-grid{
  width: 100%;
  min-width: 1100px;
  border-collapse: separate;
  border-spacing: 0;

  /* uniform font in status board */
  font-family: var(--font);
  font-size: 0.75rem;
}

/* Header cells */
.status-grid thead th{
  position: sticky;
  background: rgba(11,18,32,0.95);
  color: #dbeafe;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 8px;
  text-align: center;
  vertical-align: middle;
  z-index: 3;

  /* white gridlines */
  border-bottom: 1px solid rgba(255,255,255,0.9);
  border-right: 1px solid rgba(255,255,255,0.9);
}

/* sticky offsets for multi-row header */
.status-grid thead tr.hrow-1 th{ top: 0; }
.status-grid thead tr.hrow-2 th{ top: var(--sb-h1); }
.status-grid thead tr.hrow-3 th{ top: calc(var(--sb-h1) + var(--sb-h2)); }



/* Robust vertical line after "Operational deviations" (rowspan=2 cell in hrow-2) */
.status-grid thead tr.hrow-2 th[rowspan="2"]{
  position: sticky;
}

.status-grid thead tr.hrow-2 th[rowspan="2"]::after{
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 1px;
  
  background: rgba(255,255,255,0.9);
  z-index: 10;
  pointer-events: none;
}

/* Body cells */
.status-grid tbody td{
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
  vertical-align: top;
}

/*
.status-grid tbody tr:hover td{
  background: rgba(255,255,255,0.03);
}
*/

/* Row background by Barrier (except OD cell) */
.status-grid tbody tr.row-ok td:not(.od-ok):not(.od-warn):not(.od-bad):not(.od-iso){
  background: rgba(13,94,43,0.9);
}
.status-grid tbody tr.row-warn td:not(.od-ok):not(.od-warn):not(.od-bad):not(.od-iso){
  background: rgba(119,112,12,0.9);
}
.status-grid tbody tr.row-bad td:not(.od-ok):not(.od-warn):not(.od-bad):not(.od-iso){
  background: rgba(177,46,46,0.9);
}
.status-grid tbody tr.row-iso td:not(.od-ok):not(.od-warn):not(.od-bad):not(.od-iso){
  background: rgba(11,18,32,0.9);
}
.status-grid tbody tr.row-unknown td{
  background: transparent;
}

/* Operational deviations cell color (only OD) */
.status-grid tbody td.od-ok{ background: rgba(13,94,46,0.9); }
.status-grid tbody td.od-warn{ background: rgba(119,112,12,0.9); }
.status-grid tbody td.od-bad{ background: rgba(177,46,46,0.9); }
.status-grid tbody td.od-iso{ background: rgba(11,18,32,0.9); }


/* Power BI Visning */

.pbi-area{
  width: 100%;
  height: calc(100vh - var(--header-h) - 44px - var(--footer-h) - 24px);
  min-height: 520px;
  overflow: hidden;          /* <- dette gjør “kappingen” */
  position: relative;        /* <- nødvendig for absolutt pos av iframe */
}

.pbi-area iframe{
  position: absolute;
  left: 0;
  top: 0;                  /* <- skyv opp 7% */
  width: 100%;
  height: 100%;              /* <- gjør iframe høyere, så vi fyller hele ramma */
  border: 0;
  display: block;
}





/* =========================================================
 ABOUT / DOCUMENT SHEET (NYTT TILLEGG – påvirker ikke eksisterende stiler)
 ========================================================= */
.doc-sheet{
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(16px, 2.2vw, 28px);
  background: rgba(15, 23, 42, 1.0);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.35);
}

.doc-head{
  padding-bottom: 10px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.16);
}

.doc-title{
  margin: 0;
  font-size: clamp(22px, 1.2rem + 1vw, 34px);
  line-height: 1.15;
  font-weight: 800;
  color: #ffffff;
}

.doc-section{
  margin: 0 0 18px 0;
}

.doc-section h2{
  margin: 46px 0 18px;
  font-size: clamp(16px, 0.95rem + 0.4vw, 22px);
  line-height: 1.2;
  font-weight: 800;
  color: #ffffff;
}

.doc-section h3{
  margin: 24px 0 6px;
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 700;
  color: #ffffff;
}

.doc-section p{
  margin: 0 0 10px 0;
  color: #ffffff;
}

.doc-section ul{
  margin: 8px 0 12px 22px;
  padding: 0;
}

.doc-section li{
  margin: 6px 0;
  color: #ffffff;
}

.doc-section strong{
  font-weight: 800;
}


.user-area a{
  color: inherit;
  text-decoration: underline;
}

.user-area a:hover{
  text-decoration: none;
}



