/* Signoff app shell + shared primitives (_layout.html, _komponenter.html) */

/* --- Shell (paired with legacy .os-* on same nodes) --- */

.app.os-shell,
.os-shell.app {
  display: flex;
  min-height: 100vh;
}

.sidebar.os-sidebar,
.os-sidebar.sidebar {
  flex: 0 0 var(--os-sidebar-width);
  width: var(--os-sidebar-width);
  max-width: 100%;
  background: var(--surface);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  padding: 14px 10px 12px;
  gap: 10px;
  border-right: 1px solid var(--border);
}

.brand.os-brand,
.os-brand.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin: 0 2px;
}

.brand.os-brand:hover,
.os-brand.brand:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--surface);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.os-brand-logo {
  display: block;
  height: 28px;
  width: auto;
  max-width: 120px;
}

.brand .os-brand-logo {
  max-height: 28px;
}

.nav.os-nav,
.os-nav.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 4px 2px 8px;
}

.nav-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-4);
  font-weight: 600;
  padding: 16px 12px 6px;
  margin: 0;
}

.nav-section:first-child {
  padding-top: 6px;
}

.os-nav-link {
  border-radius: var(--radius-sm);
}

.nav.os-nav .os-nav-link .meta {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  line-height: 1.2;
}

.nav.os-nav .os-nav-link .meta.dot {
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.sidebar-foot {
  margin-top: auto;
  padding: 10px 8px 8px;
  border-top: 1px solid var(--border);
  overflow: visible;
  position: relative;
  z-index: 3;
}

.sidebar-foot__guest {
  padding: 4px 2px;
}

/* KONTO- / FÖRETAGSVÄXLARE */
.acct {
  position: relative;
  width: 100%;
}

.acct.is-sa .acct-btn {
  background: var(--sa-bg);
  border-color: var(--sa-bd);
}

.acct.is-sa .acct-co {
  background: var(--sa-solid);
  color: #fff;
}

.acct-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.acct-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.acct-co {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.acct-meta {
  min-width: 0;
  flex: 1;
}

.acct-meta .co {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acct-meta .role {
  margin-top: 3px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-3);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
}

.acct-chev {
  flex: none;
  color: var(--ink-4);
  transition: transform 0.16s ease;
}

.acct.open .acct-chev {
  transform: rotate(180deg);
}

.acct-pop {
  position: absolute;
  left: 0;
  right: auto;
  bottom: calc(100% + 10px);
  width: min(360px, calc(100vw - 24px));
  min-width: 300px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  max-height: min(72vh, 560px);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-3);
  transform: scale(0.96) translateY(6px);
  transform-origin: bottom center;
  pointer-events: none;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.acct.open .acct-pop {
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.acct-pop[hidden] {
  display: none !important;
}

.pop-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
}

.pop-head-meta {
  min-width: 0;
  flex: 1;
}

.pop-head-co {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.pop-head-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  word-break: break-word;
}

.pop-head-role {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-3);
}

.acct-search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.acct-search input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.acct-search input:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: var(--os-focus-ring);
}

.acct-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
}

.acct-grp {
  padding: 10px 8px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-4);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  line-height: 1.45;
  flex-wrap: wrap;
}

.acct-grp.sa {
  color: var(--sa-ink);
}

.acct-count {
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-3);
}

.acct-grp.sa .acct-count {
  color: var(--sa-ink);
}

.co-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  min-height: 48px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.co-item:hover {
  background: var(--surface-2);
}

.co-item.active {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.co-item:disabled {
  opacity: 0.65;
  cursor: default;
}

.co-item .co-item-initials {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex: none;
}

.co-item.sa .co-item-initials {
  background: var(--sa-bg);
  border-color: var(--sa-bd);
  color: var(--sa-ink);
}

.co-item-copy {
  min-width: 0;
}

.co-item-name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}

.co-item-role {
  margin-top: 2px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--ink-3);
}

.co-item-trail {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  flex: none;
}

.co-item .ck {
  width: 18px;
  height: 18px;
  color: var(--ink);
  opacity: 0;
}

.co-item.active .ck {
  opacity: 1;
}

.acct-foot {
  border-top: 1px solid var(--border);
  padding: 12px 14px 14px;
}

.acct-foot-mail {
  font-size: 11px;
  color: var(--ink-4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acct-foot-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: 10px;
}

.acct-foot-links a {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  text-decoration: none;
}

.acct-foot-links a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.acct-empty-hint {
  padding: 10px 12px 12px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-3);
}

/* Superadmin banner (top of main) */
.sa-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 10px 20px;
  background: var(--sa-bg);
  border-bottom: 1px solid var(--sa-bd);
  color: var(--sa-ink);
}

.sa-banner__text {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.sa-banner__text b {
  font-weight: 700;
  color: var(--sa-ink);
}

.sa-banner__leave {
  flex: none;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--sa-bd);
  background: var(--surface);
  color: var(--sa-ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.sa-banner__leave:hover {
  border-color: var(--sa-solid);
}

.main.os-main,
.os-main.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.topbar.os-topbar,
.os-topbar.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  min-height: var(--topbar-h);
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

.topbar.os-topbar .crumb,
.os-topbar.topbar .crumb {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-4);
  line-height: 1.2;
}

.topbar.os-topbar h1,
.os-topbar.topbar h1,
.topbar.os-topbar .os-topbar__title,
.os-topbar.topbar .os-topbar__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.25;
}

.os-topbar__lead-row {
  align-items: flex-start;
}

.os-topbar__kicker {
  display: none;
}

.spacer {
  flex: 1;
}

.page.os-content,
.os-content.page {
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  padding: 20px 22px 28px;
}

/*
 * Preferred in-page header pattern (.page-head / .page-title / .page-sub).
 * When the topbar shows a visible route title, avoid repeating the same title here —
 * use subtitle/intro only (see Planering). Job Details keeps its own header.
 * Legacy .os-page-header remains on some routes; migrate in a follow-up batch.
 */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 18px;
  margin-bottom: 18px;
}

.page-title {
  margin: 0 0 6px;
  font-size: clamp(1.28rem, 1.1vw + 1rem, 1.55rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.2;
}

h1.page-title,
h2.page-title {
  font-size: clamp(1.28rem, 1.1vw + 1rem, 1.55rem);
}

.page-sub {
  margin: 0;
  max-width: 42rem;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-3);
  font-weight: 400;
}

/* --- Buttons (.btn.* per prototype; keep .os-button in parallel) --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

.btn.primary:hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
  color: var(--surface);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-3);
}

.btn.ghost:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.btn.sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn.lg {
  height: 40px;
  padding: 0 18px;
  font-size: 14px;
}

.btn.icon {
  width: 34px;
  height: 34px;
  padding: 0;
}

.btn.icon.sm {
  width: 30px;
  height: 30px;
}

.btn.icon svg,
.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn.sm svg {
  width: 15px;
  height: 15px;
}

.nav.os-nav .os-nav-icon,
.os-nav.nav .os-nav-icon {
  width: 18px;
  height: 18px;
}

.btn.danger {
  background: var(--danger-bg);
  border-color: var(--danger-bd);
  color: var(--danger-ink);
}

.btn.danger:hover {
  filter: brightness(0.98);
}

/* Bridge: existing platform buttons */
.os-button {
  border-radius: var(--radius);
}

.os-button-primary,
.os-button.os-button-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

.os-button-primary:hover,
.os-button.os-button-primary:hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
  color: var(--surface);
}

.os-button-secondary,
.os-button.os-button-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
}

.os-button-secondary:hover,
.os-button.os-button-secondary:hover {
  background: var(--surface-2);
}

/* --- Tags --- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  background: var(--muted-bg);
  color: var(--muted-ink);
  border: 1px solid var(--muted-bd);
  white-space: nowrap;
}

.tag.dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
  flex-shrink: 0;
}

.tag.ok {
  background: var(--ok-bg);
  color: var(--ok-ink);
  border-color: var(--ok-bd);
}

.tag.warn {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-color: var(--warn-bd);
}

.tag.info {
  background: var(--info-bg);
  color: var(--info-ink);
  border-color: var(--info-bd);
}

.tag.danger {
  background: var(--danger-bg);
  color: var(--danger-ink);
  border-color: var(--danger-bd);
}

.tag.accent {
  background: var(--accent-bg);
  color: var(--accent-ink);
  border-color: var(--accent-bd);
}

.tag.muted {
  background: var(--muted-bg);
  color: var(--muted-ink);
  border-color: var(--muted-bd);
}

.tag.plain {
  background: var(--surface);
  color: var(--ink-3);
  border-color: var(--border);
}

.tag.lg {
  min-height: 26px;
  padding: 0 12px;
  font-size: 12.5px;
}

/* --- Toolbar, search, chips, segment --- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.search {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.search svg {
  flex-shrink: 0;
  opacity: 0.45;
  color: var(--ink-3);
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
}

.search input::placeholder {
  color: var(--ink-4);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-3);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.chip:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.chip.on,
.chip.is-on {
  border-color: var(--ink);
  background: var(--surface-2);
  color: var(--ink);
}

.chip .count {
  margin-left: 4px;
  font-weight: 600;
  color: var(--ink-4);
}

.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}

.seg button {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  padding: 6px 12px;
  cursor: pointer;
}

.seg button + button {
  border-left: 1px solid var(--border);
}

.seg button.on,
.seg button.is-on {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 600;
}

/* --- Forms --- */

.input,
.select,
.textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 14px;
  color: var(--ink);
}

.textarea {
  min-height: 88px;
  resize: vertical;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.input-wrap .input {
  border: 0;
  flex: 1;
  min-width: 0;
  background: transparent;
}

.input-wrap .lead-ic {
  width: 18px;
  height: 18px;
  margin-left: 10px;
  flex-shrink: 0;
  color: var(--ink-4);
}

.input-wrap .trail {
  margin-right: 10px;
  font-size: 12px;
  color: var(--ink-4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.field .help {
  font-size: 12px;
  color: var(--ink-3);
}

/* --- Card (Signoff card-head; distinct from Bootstrap .card-header) --- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.card-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.card-body {
  padding: 16px;
}

.card-body.flush {
  padding: 0;
}

/* --- Key/value, empty, avatar --- */

.kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.kv:last-child {
  border-bottom: 0;
}

.kv .k {
  color: var(--ink-3);
  font-weight: 500;
}

.kv .v {
  font-weight: 500;
  color: var(--ink);
  text-align: right;
}

.empty {
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink-3);
}

.empty .ttl {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.empty .sub {
  font-size: 14px;
  max-width: 28rem;
  margin: 0 auto 16px;
  line-height: 1.5;
}

.empty .act {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 4px;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
}

.avastack {
  display: flex;
  align-items: center;
}

.avastack .avatar {
  margin-left: -6px;
  border-width: 2px;
  border-color: var(--surface);
}

.avastack .avatar:first-child {
  margin-left: 0;
}

.avastack .more {
  margin-left: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
}

.muted {
  color: var(--ink-3);
}

.muted-sm {
  font-size: 12px;
  color: var(--ink-3);
}

.mono {
  font-family: var(--font-mono);
}

.tnum {
  font-variant-numeric: tabular-nums;
}

.kbd {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
}

/* --- Layout helpers --- */

.flex {
  display: flex;
  align-items: center;
}

.flex.center,
.flex.align-center {
  align-items: center;
}

.gap-6 {
  gap: 6px;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.gap-16 {
  gap: 16px;
}

.right {
  margin-left: auto;
}

.grow {
  flex: 1;
  min-width: 0;
}

.row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.aside-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (max-width: 900px) {
  .page.os-content,
  .os-content.page {
    padding: var(--os-space-4);
  }

  .row-2,
  .row-3 {
    grid-template-columns: 1fr;
  }
}
