/* 4zure Legacy Portal shell v0.7.50
   Visual reference: 4zurePortal frontend commit 6d4ff87e. */

:root {
  --brand-400:#75d56c; --brand-500:#54bf55; --brand-600:#389b45; --brand-700:#247937;
  --brand-glow:rgba(84,191,85,.2);
  --graphite-950:#111512; --graphite-900:#171c18; --graphite-850:#1c221e;
  --ink-900:#202622; --ink-700:#4d5750; --ink-600:#657068; --ink-500:#7d877f;
  --canvas:#f3f1ec; --surface:#fff; --surface-muted:#f8f7f3;
  --border:#dfddd5; --border-strong:#cac7bd; --focus:#287e3a;
  --shadow-sm:0 1px 2px rgba(20,25,21,.04),0 4px 14px rgba(20,25,21,.035);
  --shadow-lg:0 24px 80px rgba(8,13,10,.16);
  --radius-sm:.65rem; --radius-md:.95rem; --radius-lg:1.25rem; --radius-xl:1.65rem;
  --shell-sidebar-width:17.5rem; --shell-topbar-height:4.75rem;
  --shell-content-max-width:100rem;
  --shell-content-padding:clamp(1.5rem,3vw,3rem) clamp(1rem,3vw,3rem) 5rem;
  --shell-control-height:2.75rem; --shell-control-radius:.82rem;
  --shell-drawer-width:min(19rem,calc(100vw - 3rem));
}

html,body { min-width:320px; }
body { overflow-x:hidden; }

.skip-link {
  position:fixed; z-index:1000; top:.7rem; left:.7rem;
  padding:.65rem .85rem; border-radius:var(--radius-sm);
  background:var(--graphite-950); color:#fff; text-decoration:none;
  transform:translateY(-180%); transition:transform 160ms ease;
}
.skip-link:focus { transform:translateY(0); }

.page:has(#portalView:not([hidden])) { display:block; min-height:100vh; padding:0; }

.portal-shell[hidden] { display:none; }

.portal-shell {
  display:grid; width:100%; min-height:100vh;
  grid-template-columns:var(--shell-sidebar-width) minmax(0,1fr);
  padding:0; border:0; border-radius:0; background:var(--canvas); box-shadow:none;
}
.portal-shell__body { min-width:0; grid-column:2; background:var(--canvas); }

.sidebar {
  position:fixed; z-index:30; inset:0 auto 0 0;
  display:flex; width:var(--shell-sidebar-width); min-height:100vh;
  flex-direction:column; padding:0 .75rem 1rem; overflow-y:auto;
  color:#e9eee9;
  background:
    radial-gradient(circle at 20% -10%,rgba(84,191,85,.18),transparent 17rem),
    linear-gradient(180deg,var(--graphite-900),var(--graphite-950));
  border-right:1px solid rgba(255,255,255,.06); scrollbar-width:thin;
}

.sidebar__brand-row {
  display:flex; min-height:5.2rem; align-items:center; justify-content:space-between;
  gap:.75rem; padding:0 .5rem;
}
.sidebar__brand-row .brand { display:flex; align-items:center; }
.sidebar__brand-row .brand picture { display:flex; align-items:center; }
.sidebar__brand-row .brand img {
  width:auto; max-width:8.5rem; max-height:2.25rem; object-fit:contain;
}
.sidebar__brand-actions { display:flex; align-items:center; gap:.35rem; }

.sidebar__context {
  display:grid; grid-template-columns:auto minmax(0,1fr); align-items:center; gap:.7rem;
  margin:0 .25rem 1.35rem; padding:.75rem;
  border:1px solid rgba(117,213,108,.12); border-radius:.85rem;
  background:rgba(84,191,85,.065);
}
.sidebar__context-mark {
  display:grid; width:2.25rem; height:2.25rem; place-items:center; border-radius:.62rem;
  background:linear-gradient(145deg,var(--brand-400),var(--brand-500));
  color:#142017; font-size:.72rem; font-weight:850;
}
.sidebar__context-copy { display:grid; min-width:0; gap:.08rem; }
.sidebar__context-copy small {
  color:#839087; font-size:.67rem; font-weight:650; letter-spacing:.06em; text-transform:uppercase;
}
.sidebar__context-copy strong {
  overflow:hidden; color:#ecf1ed; font-size:.83rem; text-overflow:ellipsis; white-space:nowrap;
}
.sidebar__context-copy > span {
  overflow:hidden; color:rgba(226,234,228,.58); font-size:.67rem;
  text-overflow:ellipsis; white-space:nowrap;
}

.sidebar__navigation { flex:1 1 auto; padding:0 .15rem; }
.sidebar__navigation > p,
#workflowTabs::before {
  display:block; margin:0 .5rem .55rem; color:#647168; font-size:.65rem;
  font-weight:750; letter-spacing:.12em; text-transform:uppercase;
}
#workflowTabs::before { grid-column:1/-1; margin-top:1.25rem; content:"Arbeidsflyt"; }

.product-navigation,
#workflowTabs {
  display:grid; gap:.3rem; width:100%; margin:0; padding:0;
  border:0; border-radius:0; background:transparent;
}

.product-navigation .product-pill,
#workflowTabs button {
  position:relative; display:grid; width:100%; min-height:3rem;
  grid-template-columns:1.6rem minmax(0,1fr); align-items:center; gap:.65rem;
  margin:0; padding:.55rem .7rem; border:1px solid transparent; border-radius:.75rem;
  background:transparent; color:#9da8a0; box-shadow:none; font:inherit; text-align:left;
  transition:background-color 140ms ease,border-color 140ms ease,color 140ms ease,transform 140ms ease;
}
.product-navigation .product-pill:hover,
#workflowTabs button:hover {
  border-color:transparent; background:rgba(255,255,255,.05); color:#f1f5f2;
}
.product-navigation .product-pill:focus-visible,
#workflowTabs button:focus-visible,
.icon-button:focus-visible {
  outline:3px solid color-mix(in srgb,#5ecf8b 70%,white); outline-offset:2px;
}
.product-navigation .product-pill.active,
#workflowTabs button.active {
  border-color:rgba(94,207,139,.38);
  background:linear-gradient(90deg,rgba(84,191,85,.17),rgba(84,191,85,.055));
  color:#f7faf7;
}
.product-navigation .product-pill.active::after,
#workflowTabs button.active::after {
  position:absolute; inset:.55rem auto .55rem -.9rem; width:.18rem;
  border-radius:0 999px 999px 0; background:var(--brand-400);
  content:""; box-shadow:0 0 1.2rem var(--brand-glow);
}
.nav-icon,
#workflowTabs button::before {
  display:inline-grid; width:1.6rem; height:1.6rem; place-items:center; border-radius:.5rem;
  background:rgba(255,255,255,.06); color:rgba(226,234,228,.72);
  font-size:.72rem; font-weight:780;
}
.product-pill.active .nav-icon,
#workflowTabs button.active::before {
  background:rgba(94,207,139,.1); color:#72d99a;
}
.nav-copy { display:grid; min-width:0; gap:.1rem; }
.nav-copy strong { font-size:.88rem; font-weight:690; }
.nav-copy small { color:rgba(226,234,228,.57); font-size:.7rem; line-height:1.3; }

#workflowTabs button::before { content:"•"; }
#workflowTabs button[data-workflow-tab="planned"]::before { content:"P"; }
#workflowTabs button[data-workflow-tab="assignments"]::before { content:"O"; }
#workflowTabs button[data-workflow-tab="followup"]::before { content:"F"; }
#workflowTabs button[data-workflow-tab="reports"]::before { content:"R"; }

.sidebar__footer { padding:1rem .25rem 0; }
.sidebar__footer > p {
  margin:.7rem 0 0; padding:0 .25rem; color:rgba(226,234,228,.58);
  font-size:.67rem; line-height:1.45;
}
.environment-card {
  display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:.6rem;
  padding:.65rem .75rem; border:1px solid rgba(255,255,255,.07); border-radius:.78rem;
  background:rgba(255,255,255,.035);
}
.environment-card__indicator {
  width:.5rem; height:.5rem; border-radius:999px; background:var(--brand-400);
  box-shadow:0 0 0 .28rem rgba(117,213,108,.1);
}
.environment-card small,
.environment-card strong { display:block; }
.environment-card small {
  color:rgba(226,234,228,.58); font-size:.62rem; text-transform:uppercase;
}
.environment-card strong { margin-top:.05rem; color:#d7ded8; font-size:.75rem; }
.environment-card__version {
  color:rgba(226,234,228,.58); font-size:.68rem; font-weight:700;
}

.topbar {
  position:sticky; z-index:20; top:0; display:flex; min-height:var(--shell-topbar-height);
  align-items:center; justify-content:space-between; gap:1rem;
  padding:.8rem clamp(1rem,2.4vw,2.25rem);
  border-bottom:1px solid color-mix(in srgb,var(--border) 80%,transparent);
  background:color-mix(in srgb,var(--canvas) 88%,transparent);
  backdrop-filter:blur(18px) saturate(130%);
}
.topbar__start,
.topbar__actions { display:flex; min-width:0; align-items:center; gap:.7rem; }
.topbar__start > div { display:grid; min-width:0; gap:.08rem; }
.topbar__eyebrow {
  color:var(--ink-500); font-size:.67rem; font-weight:680;
  letter-spacing:.06em; text-transform:uppercase;
}
.topbar__title {
  overflow:hidden; color:var(--ink-900); font-size:.98rem;
  text-overflow:ellipsis; white-space:nowrap;
}
.topbar__actions button { min-height:var(--shell-control-height); padding:0 .85rem; }

#userRoleBadge:not(:empty) {
  display:inline-flex; min-height:2rem; align-items:center; padding:0 .65rem;
  border:1px solid var(--border); border-radius:999px; background:var(--surface);
  color:var(--ink-600); font-size:.72rem; font-weight:700;
}

.icon-button {
  display:grid; width:var(--shell-control-height); height:var(--shell-control-height);
  flex:0 0 auto; place-items:center; padding:0; border:0;
  border-radius:var(--shell-control-radius); background:var(--surface);
  color:var(--ink-700); box-shadow:inset 0 0 0 1px var(--border);
}
.icon-button svg {
  width:1.15rem; height:1.15rem; fill:none; stroke:currentColor;
  stroke-width:1.8; stroke-linecap:round;
}
.topbar__menu,
.sidebar__close { display:none; }

.main-content {
  width:min(100%,var(--shell-content-max-width)); margin:0 auto;
  padding:var(--shell-content-padding);
}
.main-content .portal-header {
  margin:0 0 1.5rem; padding:0 0 1.25rem; border-bottom:1px solid var(--border);
}
.content-eyebrow {
  display:inline-block; margin-bottom:.55rem; color:var(--brand-700);
  font-size:.68rem; font-weight:750; letter-spacing:.11em; text-transform:uppercase;
}
.main-content .portal-header h1 {
  margin:0; color:var(--graphite-950);
  font-family:"Segoe UI Variable Display","Aptos Display",ui-sans-serif,system-ui,sans-serif;
  font-size:clamp(2rem,3vw,3.1rem); letter-spacing:-.045em;
}
.main-content .portal-header .lead {
  max-width:52rem; margin:.7rem 0 0; color:var(--ink-600);
}

.toolbar {
  position:sticky; z-index:10; top:calc(var(--shell-topbar-height) + .75rem);
  padding:.7rem; border:1px solid color-mix(in srgb,var(--border) 80%,transparent);
  border-radius:var(--radius-lg);
  background:color-mix(in srgb,var(--canvas) 92%,transparent);
  box-shadow:var(--shadow-sm); backdrop-filter:blur(16px);
}
.license-status,
.dashboard-card,
.table-wrap,
.report-card,
.assignment-card,
.planned-object-card,
.followup-card,
.followup-message-card {
  border-color:var(--border) !important;
  border-radius:var(--radius-lg) !important;
  background:var(--surface); box-shadow:var(--shadow-sm);
}

.navigation-scrim { display:none; }
.navigation-scrim[hidden] { display:none !important; }
body.portal-navigation-open { overflow:hidden; }

.page {
  background:
    radial-gradient(circle at 16% 18%, rgba(84,191,85,.16), transparent 30rem),
    radial-gradient(circle at 86% 78%, rgba(117,213,108,.07), transparent 34rem),
    linear-gradient(145deg,#171c18,#252c27 62%,#111512);
}

.page:has(#portalView:not([hidden])) {
  background:var(--canvas);
}

.login-card {
  position:relative;
  width:min(100%,35rem);
  min-height:34rem;
  display:flex;
  flex-direction:column;
  justify-content:center;
  padding:clamp(5.5rem,8vw,7rem) clamp(2rem,6vw,4rem) clamp(2.5rem,6vw,4rem);
  border:1px solid rgba(255,255,255,.10);
  border-radius:1.75rem;
  background:rgba(23,28,24,.92);
  color:#f5f8f5;
  box-shadow:0 2rem 5.6rem rgba(0,0,0,.34);
  backdrop-filter:blur(18px);
}

.login-brand {
  position:absolute;
  inset:1.75rem 2rem auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  margin:0;
}

.login-brand__mark {
  display:flex;
  align-items:center;
  width:11rem;
  height:3.4rem;
  min-width:0;
  min-height:0;
  padding:0;
  border-radius:0;
  background:transparent;
}

.login-brand__mark img {
  width:100%;
  max-width:11rem;
  max-height:3.4rem;
  object-fit:contain;
  object-position:left center;
}

.login-kicker {
  margin:0 0 .65rem;
  color:var(--brand-400);
  font-size:.72rem;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.login-card h1 {
  max-width:28rem;
  margin:0 0 .9rem;
  color:#fff;
  font-family:"Segoe UI Variable Display","Aptos Display",ui-sans-serif,system-ui,sans-serif;
  font-size:clamp(2.35rem,5vw,3.15rem);
  line-height:1.03;
  letter-spacing:-.045em;
}

.login-card .lead {
  max-width:29rem;
  margin:0 0 1.8rem;
  color:rgba(239,245,240,.66);
  font-size:1rem;
  line-height:1.6;
}

.login-card .form {
  gap:1rem;
}

.login-card label {
  gap:.5rem;
  color:rgba(244,248,245,.82);
  font-size:.8rem;
  font-weight:700;
  letter-spacing:.01em;
}

.login-card input {
  min-height:3.15rem;
  padding:.8rem .9rem;
  border:1px solid rgba(255,255,255,.13);
  border-radius:.85rem;
  background:rgba(255,255,255,.055);
  color:#fff;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.025);
}

.login-card input::placeholder {
  color:rgba(232,239,234,.34);
}

.login-card input:hover {
  border-color:rgba(255,255,255,.21);
}

.login-card input:focus {
  border-color:var(--brand-400);
  outline:3px solid rgba(84,191,85,.18);
  background:rgba(255,255,255,.075);
}

.login-card button[type="submit"] {
  min-height:3.15rem;
  margin-top:.35rem;
  border-radius:.85rem;
  background:linear-gradient(180deg,var(--brand-500),var(--brand-600));
  color:#fff;
  box-shadow:0 .75rem 1.9rem rgba(56,155,69,.18);
  transition:transform 140ms ease,box-shadow 140ms ease,background-color 140ms ease;
}

.login-card button[type="submit"]:hover {
  background:linear-gradient(180deg,var(--brand-400),var(--brand-600));
  box-shadow:0 1rem 2.25rem rgba(56,155,69,.24);
  transform:translateY(-1px);
}

.login-card button[type="submit"]:active {
  transform:translateY(0);
}

.login-card .error:not(:empty) {
  margin:.9rem 0 0;
  padding:.7rem .8rem;
  border:1px solid rgba(244,114,104,.22);
  border-radius:.75rem;
  background:rgba(180,35,24,.12);
  color:#ffb4ab;
  line-height:1.45;
}

@media (max-width:960px) {
  .portal-shell { display:block; }
  .portal-shell__body { grid-column:auto; }

  .sidebar {
    width:var(--shell-drawer-width); transform:translateX(-105%);
    transition:transform 200ms ease; box-shadow:var(--shadow-lg);
  }
  .sidebar.sidebar--open { transform:translateX(0); }

  .sidebar__close,
  .topbar__menu { display:grid; }

  .sidebar__close {
    background:rgba(255,255,255,.05); color:#dbe2dc; box-shadow:none;
  }

  .navigation-scrim {
    position:fixed; z-index:25; inset:0; display:block;
    width:100%; height:100%; padding:0; border:0; border-radius:0;
    background:rgba(7,11,8,.56); box-shadow:none; backdrop-filter:blur(3px);
  }
}

@media (max-width:720px) {
  :root {
    --shell-topbar-height:4.25rem;
    --shell-content-padding:
      1.35rem max(.8rem,env(safe-area-inset-right)) 4rem
      max(.8rem,env(safe-area-inset-left));
  }
  .topbar {
    padding:
      .65rem max(.8rem,env(safe-area-inset-right)) .65rem
      max(.8rem,env(safe-area-inset-left));
  }
  .topbar__actions { gap:.4rem; }
  #userRoleBadge { display:none !important; }
  .topbar__actions button { padding-inline:.7rem; }
}

@media (max-width:480px) {
  .topbar__eyebrow { display:none; }
  .topbar__title { max-width:10rem; font-size:.88rem; }
  .sidebar { width:min(19rem,calc(100vw - 1.5rem)); }
}

@media (prefers-reduced-motion:reduce) {
  .sidebar,
  .skip-link,
  .product-navigation .product-pill,
  #workflowTabs button { transition:none; }
}

@media (max-width:720px) {
  .page {
    align-items:start;
    padding:1rem;
  }

  .login-card {
    min-height:calc(100vh - 2rem);
    padding:6.2rem 1.65rem 2.2rem;
    border-radius:1.4rem;
  }

  .login-brand {
    inset:1.55rem 1.65rem auto;
  }

  .login-brand__mark {
    width:9.25rem;
    height:2.9rem;
  }

  .login-card h1 {
    font-size:clamp(2.15rem,10vw,2.75rem);
  }
}
