/* Platform desktop client — design tokens and components.
   Tokens ported 1:1 from the concept kit (concept-kit/assets/styles.css),
   component classes ported from the kit's desktop tier inline styles.
   Fonts are bundled locally (wwwroot/fonts) — no CDN requests at runtime. */

/* ---- Bundled fonts ------------------------------------------------------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/inter-latin-500-normal.woff2") format("woff2");
}

/* ---- Design tokens (iteration-2: concept-kit/iteration-2) -----------------
   Tokens pinned to the owner's "envisioned finished product" demo
   (concept-kit/iteration-2/virtuella-medarbetare-demo.html, TICKET-0021).
   Names are kept stable so existing markup keeps working; the values are the
   demo's. Mapping demo → token:
     --bg     #ecebe6 → --color-background-app   (window backdrop behind the card)
     --card   #fff    → --color-background-primary
     --cream  #faf9f6 → --color-background-tertiary
     --cream2 #f6f5f1 → --color-background-secondary
   text/border/accent and the info/suc/warn/dan bg+text pairs already matched. */
:root {
  --color-background-app:       #ecebe6;
  --color-background-primary:   #ffffff;
  --color-background-secondary: #f6f5f1;
  --color-background-tertiary:  #faf9f6;
  --color-background-info:    #e6f1fb;
  --color-background-success: #e1f5ee;
  --color-background-warning: #faeeda;
  --color-background-danger:  #fcebeb;

  --color-text-primary:   #1f1e1b;
  --color-text-secondary: #6b6a61;
  --color-text-tertiary:  #9a988c;
  --color-text-info:    #185fa5;
  --color-text-success: #0f6e56;
  --color-text-warning: #854f0b;
  --color-text-danger:  #a32d2d;

  --color-border-tertiary:  rgba(31,30,27,0.10);
  --color-border-secondary: rgba(31,30,27,0.17);
  --color-border-info:      rgba(24,95,165,0.5);

  /* solid accent for filled buttons / badges — readable in light + dark */
  --color-accent:    #185fa5;
  --color-on-accent: #ffffff;

  --border-radius-md: 8px;   /* demo --r8  */
  --border-radius-10: 10px;  /* demo --r10 */
  --border-radius-lg: 12px;  /* demo --r12 */
  --border-radius-xl: 16px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-background-app:       #141311;
    --color-background-primary:   #1f1e1c;
    --color-background-secondary: #2a2926;
    --color-background-tertiary:  #18120f;
    --color-background-info:    #123a5e;
    --color-background-success: #0e4a3b;
    --color-background-warning: #5a3608;
    --color-background-danger:  #5a1f1f;

    --color-text-primary:   #f2f1ec;
    --color-text-secondary: #a8a69b;
    --color-text-tertiary:  #75736a;
    --color-text-info:    #9fc6ee;
    --color-text-success: #7fd8bd;
    --color-text-warning: #f0c277;
    --color-text-danger:  #f0a3a3;

    --color-border-tertiary:  rgba(255,255,255,0.12);
    --color-border-secondary: rgba(255,255,255,0.20);
    --color-border-info:      rgba(120,180,240,0.5);

    --color-accent:    #2f7bc9;
    --color-on-accent: #ffffff;
  }
}

/* ---- Base ----------------------------------------------------------------- */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-text-primary);
  /* iteration-2: the window backdrop is the warm grey behind the app card. */
  background: var(--color-background-app);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The OS window is the frame (TICKET-0007): the app fills it edge-to-edge,
   no centering gutter around a preview card. On mobile browsers 100vh can
   overflow behind the dynamic toolbars; dvh tracks the real visible viewport. */
#app {
  height: 100vh;
  height: 100dvh;
  display: flex;
}

/* iteration-2: above the mobile tier the app is a centred card floating on the
   warm-grey backdrop (demo grammar), not full-bleed. On mobile it returns to
   edge-to-edge — the framed-card chrome is removed below (mobile media query). */
@media (min-width: 640px) {
  #app {
    padding: 18px;
    justify-content: center;
  }
  .app {
    flex: 0 1 1120px;
    max-width: 1120px;
    border: 0.5px solid var(--color-border-secondary);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  }
}

input, button { font-family: inherit; color: inherit; }
button { cursor: pointer; }
p { margin: 0; }

/* ---- Reveal animation (kit behaviour, no JS needed in-app) ----------------
   Elements marked .reveal rise in when inserted into the DOM — on first render
   and on navigation. */
.reveal {
  animation: ve-rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: var(--d, 0s);
}
@keyframes ve-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none !important; }
}

/* ---- The app frame ---------------------------------------------------------
   The kit framed each screen as a 720px preview card (border, radius, fixed
   width) because the screens sat inside a webpage. In the desktop app the OS
   window is the frame, so the kit's own chrome — top bar, panes, tokens —
   becomes the window content, rendered once and full-bleed (TICKET-0007). */
.app {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-background-primary);
}

.topbar {
  flex-shrink: 0;
  border-bottom: 0.5px solid var(--color-border-tertiary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 18px;
}
.topbar-title { font-size: 14px; font-weight: 500; }
.topbar-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--color-background-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; color: var(--color-text-secondary);
}
.topbar-dots { display: flex; gap: 6px; align-items: center; }
.topbar-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-border-secondary); }
.topbar-dot.active { background: var(--color-text-info); }

/* Fills whatever height the window gives; panes scroll internally. */
.main { display: flex; flex: 1; min-height: 0; }

/* ---- Team rail (left) ------------------------------------------------------ */
/* iteration-2: wider rail (208px) on the cream surface; members are roomier rows
   and the bottom strip is now a 6-icon nav (HQ · Team · Register · Dokument ·
   Akademin · Mer) instead of the old 3-icon section strip. */
.rail {
  width: 208px;
  flex-shrink: 0;
  background: var(--color-background-tertiary);
  border-right: 0.5px solid var(--color-border-tertiary);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.rail .kicker { margin-bottom: 10px; }

.rail-member {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px;
  border: none; border-radius: 9px;
  background: transparent;
  margin-bottom: 3px;
  width: 100%; text-align: left;
}
.rail-member:hover { background: var(--color-background-secondary); }
.rail-member.active-info    { background: var(--color-background-info); }
.rail-member.active-success { background: var(--color-background-success); }
.rail-member.active-warning { background: var(--color-background-warning); }

.rail-name { font-size: 13.5px; font-weight: 500; line-height: 1.15; }
.rail-role { font-size: 11.5px; color: var(--color-text-secondary); line-height: 1.25; }
.rail-member.active-info .rail-name,    .rail-member.active-info .rail-role    { color: var(--color-text-info); }
.rail-member.active-success .rail-name, .rail-member.active-success .rail-role { color: var(--color-text-success); }
.rail-member.active-warning .rail-name, .rail-member.active-warning .rail-role { color: var(--color-text-warning); }

.rail-add {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px;
  border: none; background: transparent;
  color: var(--color-text-tertiary);
  font-size: 13px;
  width: 100%; text-align: left;
}
.rail-add-circle {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px dashed var(--color-border-secondary);
  display: flex; align-items: center; justify-content: center;
}
.rail-add-circle .ti { font-size: 15px; }

/* iteration-2 bottom icon-nav: 6 evenly-spread targets across the foot of the
   rail (demo .iconnav) — HQ · Team · Register · Dokument · Akademin · Mer. */
.rail-iconnav {
  margin-top: auto;
  padding: 12px 2px 2px;
  border-top: 0.5px solid var(--color-border-tertiary);
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  gap: 8px;
}
.rail-iconnav button { border: none; background: transparent; padding: 0; }
.rail-iconnav .ti { font-size: 18px; color: var(--color-text-tertiary); }
.rail-iconnav button:hover .ti { color: var(--color-text-secondary); }
.rail-iconnav button.active .ti { color: var(--color-text-info); }

/* "lär sig" pill on a rail member still learning (demo .lrn). */
.rail-learning {
  margin-left: auto;
  font-size: 10.5px;
  background: var(--color-background-warning);
  color: var(--color-text-warning);
  padding: 2px 7px;
  border-radius: 6px;
}
/* pending-count badge on a rail member (demo .bdg). */
.rail-count {
  margin-left: auto;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: 11px;
  border-radius: 50%;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
}

/* ---- Avatars / tones -------------------------------------------------------- */
.avatar {
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 500;
  flex-shrink: 0;
}
.avatar-28 { width: 28px; height: 28px; font-size: 11px; }
.avatar-32 { width: 32px; height: 32px; font-size: 12px; }
.avatar-40 { width: 40px; height: 40px; font-size: 15px; }
.avatar-24 { width: 24px; height: 24px; font-size: 10px; }
.avatar-22 { width: 22px; height: 22px; font-size: 9.5px; }

.bg-info    { background: var(--color-background-info);    color: var(--color-text-info); }
.bg-success { background: var(--color-background-success); color: var(--color-text-success); }
.bg-warning { background: var(--color-background-warning); color: var(--color-text-warning); }
.bg-danger  { background: var(--color-background-danger);  color: var(--color-text-danger); }
.bg-plain   { background: var(--color-background-primary); }

.text-info      { color: var(--color-text-info); }
.text-success   { color: var(--color-text-success); }
.text-warning   { color: var(--color-text-warning); }
.text-danger    { color: var(--color-text-danger); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary  { color: var(--color-text-tertiary); }

/* ---- Content column --------------------------------------------------------- */
.content { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.agent-header {
  padding: 11px 14px;
  border-bottom: 0.5px solid var(--color-border-tertiary);
  display: flex; align-items: center; gap: 10px;
}
.agent-header-text { line-height: 1.3; flex: 1; }
.agent-header-name { font-size: 13.5px; font-weight: 500; }
.agent-header-tag  { font-size: 11.5px; color: var(--color-text-secondary); }

.icon-square {
  border-radius: var(--border-radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-square-30 { width: 30px; height: 30px; }
.icon-square-32 { width: 32px; height: 32px; }
.icon-square-42 { width: 42px; height: 42px; }
.icon-square.bg-plain { background: var(--color-background-secondary); }

/* ---- Buttons ----------------------------------------------------------------- */
.btn {
  font-size: 12.5px;
  padding: 5px 11px;
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  background: transparent;
}
.btn-primary {
  font-size: 12.5px; font-weight: 500;
  padding: 5px 11px;
  border: none; border-radius: var(--border-radius-md);
  background: var(--color-accent);
  color: var(--color-on-accent);
}
.btn-block { display: block; width: 100%; font-size: 13px; font-weight: 500; padding: 6px 0; }
.btn-cta { font-size: 13.5px; padding: 10px 20px; }
.btn-cta-wide { width: 100%; font-size: 14px; padding: 11px 0; }
.btn-link {
  font-size: 12.5px;
  border: none; background: transparent;
  color: var(--color-text-info);
  text-decoration: underline; text-underline-offset: 2px;
  padding: 0;
}
.btn-ghost { border: none; background: transparent; color: var(--color-text-secondary); }
.btn:disabled, .btn-primary:disabled { opacity: 0.55; cursor: default; }

.quick-actions { padding: 11px 14px 0; display: flex; gap: 7px; flex-wrap: wrap; }
.chip-btn {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px;
  padding: 6px 10px;
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  background: transparent;
}
.chip-btn .ti { font-size: 15px; color: var(--color-text-info); }

/* ---- Chat --------------------------------------------------------------------- */
.chat { flex: 1; padding: 13px 14px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }

.bubble-user {
  align-self: flex-end; max-width: 78%;
  background: var(--color-background-secondary);
  border-radius: var(--border-radius-lg);
  padding: 9px 11px;
  font-size: 12.5px; line-height: 1.5;
}
.bubble-agent {
  align-self: flex-start; max-width: 82%;
  background: var(--color-background-primary);
  border: 0.5px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-lg);
  padding: 9px 11px;
  font-size: 12.5px; line-height: 1.5;
}
.bubble-actions { display: flex; gap: 7px; margin-top: 9px; }
.bubble-draft {
  margin-top: 9px; padding: 8px 10px;
  background: var(--color-background-secondary);
  border-radius: var(--border-radius-md);
  font-size: 11.5px; line-height: 1.55;
  color: var(--color-text-secondary);
}

.voice-meta { display: flex; align-items: center; gap: 8px; }
.voice-meta .ti { font-size: 14px; color: var(--color-text-info); }
.voice-bars { display: flex; align-items: flex-end; gap: 2px; height: 14px; }
.voice-bars span { width: 2px; background: var(--color-text-info); }
.voice-length { font-size: 11px; color: var(--color-text-secondary); }
.voice-quote { margin-top: 5px; font-size: 12px; font-style: italic; color: var(--color-text-secondary); }

.composer {
  padding: 10px 12px;
  border-top: 0.5px solid var(--color-border-tertiary);
  display: flex; align-items: center; gap: 8px;
}
.composer input {
  flex: 1; height: 34px;
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  padding: 0 11px;
  font-size: 12.5px;
  background: var(--color-background-primary);
  color: var(--color-text-primary);
}
.composer-mic { border: none; background: transparent; padding: 0; }
.composer-mic .ti { font-size: 18px; color: var(--color-text-info); }
.composer-send {
  height: 34px; width: 34px;
  border: none; border-radius: var(--border-radius-md);
  background: var(--color-accent); color: var(--color-on-accent);
  display: flex; align-items: center; justify-content: center;
}
.composer-send .ti { font-size: 17px; }

/* ---- Context pane (right) ------------------------------------------------------ */
.context {
  width: 176px;
  flex-shrink: 0;
  border-left: 0.5px solid var(--color-border-tertiary);
  padding: 12px 11px;
  overflow-y: auto;
}

.kicker {
  margin: 0 0 9px;
  font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--color-text-tertiary);
}

.approval-card {
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  padding: 9px 10px;
  margin-bottom: 16px;
}
.approval-title { font-size: 11.5px; font-weight: 500; margin-bottom: 3px; }
.approval-sub   { font-size: 11px; color: var(--color-text-secondary); margin-bottom: 8px; }

.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 16px; }
.tag { font-size: 11px; padding: 3px 8px; border-radius: var(--border-radius-md); }

.stat-card {
  background: var(--color-background-secondary);
  border-radius: var(--border-radius-md);
  padding: 9px 10px;
}
.stat-label { font-size: 10.5px; color: var(--color-text-secondary); }
.stat-value { margin-top: 2px; font-size: 18px; font-weight: 500; }
.stat-sub   { margin-top: 2px; font-size: 10.5px; color: var(--color-text-secondary); }

.context-note {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--color-text-secondary);
}
.context-note .ti { font-size: 15px; flex-shrink: 0; }

.context-hint {
  background: var(--color-background-secondary);
  border-radius: var(--border-radius-md);
  padding: 9px 10px;
  font-size: 10.5px; color: var(--color-text-secondary); line-height: 1.5;
}

/* ---- Pills & badges -------------------------------------------------------------- */
.pill {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 4px 9px;
  background: var(--color-background-secondary);
  border-radius: var(--border-radius-md);
  color: var(--color-text-secondary);
}
.pill .ti { font-size: 14px; }

.badge { font-size: 10.5px; padding: 3px 8px; border-radius: var(--border-radius-md); white-space: nowrap; }
.badge-inline { font-size: 10px; padding: 2px 6px; border-radius: var(--border-radius-md); margin-left: 4px; }

/* ---- List rows (invoices, courses, tools) ------------------------------------------ */
.panel { padding: 13px 14px; flex: 1; overflow-y: auto; min-height: 0; }

.row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0;
  border-bottom: 0.5px solid var(--color-border-tertiary);
}
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 12.5px; font-weight: 500; }
.row-sub   { font-size: 11px; color: var(--color-text-secondary); }
.row-amount { font-size: 12.5px; font-weight: 500; }
.row-status { font-size: 11.5px; white-space: nowrap; }
.row-status .ti { font-size: 15px; vertical-align: -2px; }

button.row {
  width: 100%; text-align: left;
  border: none; border-bottom: 0.5px solid var(--color-border-tertiary);
  background: transparent;
}

.list-row {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--color-border-tertiary);
}
.list-row .ti.tool-icon { font-size: 20px; color: var(--color-text-secondary); }
.list-row-label { flex: 1; font-size: 13px; }
.list-row-sub { font-size: 11px; color: var(--color-text-secondary); margin-top: 2px; }

/* ---- Proposal / banner cards ---------------------------------------------------------- */
.proposal-card {
  margin-top: 14px;
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  padding: 11px 12px;
}
.proposal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.proposal-head .ti { font-size: 16px; color: var(--color-text-info); flex-shrink: 0; }
.proposal-head span { font-size: 12.5px; }
.proposal-sub { margin-bottom: 9px; font-size: 11.5px; color: var(--color-text-secondary); line-height: 1.5; }
.proposal-actions { display: flex; gap: 7px; }
.proposal-draft {
  margin: 0 0 9px; padding: 8px 10px;
  background: var(--color-background-secondary);
  border-radius: var(--border-radius-md);
  font-size: 11.5px; line-height: 1.55; color: var(--color-text-secondary);
}

.banner {
  display: flex; align-items: center; gap: 10px;
  border-radius: var(--border-radius-md);
  padding: 10px 12px;
  margin-bottom: 14px;
}
.banner .ti { font-size: 18px; flex-shrink: 0; }
.banner span { flex: 1; font-size: 12px; line-height: 1.4; }
.banner-success-note {
  display: flex; align-items: center; gap: 10px;
  border-radius: var(--border-radius-md);
  padding: 10px 12px;
  margin-top: 14px;
  background: var(--color-background-success);
  color: var(--color-text-success);
  font-size: 12px; line-height: 1.4;
}
.banner-success-note .ti { font-size: 18px; flex-shrink: 0; }

/* ---- Sub-header (back navigation) -------------------------------------------------------- */
.subheader {
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--color-border-tertiary);
}
.subheader-back {
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--color-text-secondary);
  border: none; background: transparent; padding: 0;
}
.subheader-back .ti { font-size: 15px; }

.subheader-bar {
  padding: 8px 14px;
  border-bottom: 0.5px solid var(--color-border-tertiary);
  display: flex; align-items: center; justify-content: space-between;
}
.subheader-bar .subheader-back { font-size: 12.5px; padding: 4px 6px; }
.subheader-bar .subheader-back .ti { font-size: 17px; }
.subheader-close {
  width: 28px; height: 28px;
  border: none; background: transparent;
  color: var(--color-text-tertiary);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--border-radius-md);
}
.subheader-close .ti { font-size: 18px; }

/* ---- Course page ----------------------------------------------------------------------------- */
.course-head { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; }
.course-head .ti { font-size: 23px; }
.course-title { font-size: 15px; font-weight: 500; line-height: 1.35; }
.course-for { font-size: 12px; color: var(--color-text-secondary); line-height: 1.35; }
.course-desc { margin: 0 0 16px; font-size: 13px; line-height: 1.6; }

.step { display: flex; gap: 11px; margin-bottom: 10px; }
.step-num {
  width: 22px; height: 22px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--color-background-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500;
  color: var(--color-text-secondary);
}
.step-num.highlight { background: var(--color-background-info); color: var(--color-text-info); }
.step span:last-child { font-size: 12.5px; line-height: 1.5; }
.step.highlight span:last-child { font-weight: 500; }

/* ---- Customize page ---------------------------------------------------------------------------- */
.field { margin-bottom: 14px; position: relative; }
/* An open select menu must paint above the following fields — the reveal
   animation gives each field its own stacking context, so lift the field
   that currently hosts a menu. */
.field:has(.select-menu) { z-index: 20; }
.field-label { margin: 0 0 6px; font-size: 12px; font-weight: 500; }

.select-box {
  display: flex; align-items: center; justify-content: space-between;
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  padding: 8px 11px;
  font-size: 12.5px;
  background: transparent;
  width: 100%; text-align: left;
  position: relative;
}
.select-box .chev { font-size: 15px; color: var(--color-text-tertiary); }
.select-wrap { position: relative; }
.select-menu {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 10;
  background: var(--color-background-primary);
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}
.select-menu button {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent;
  padding: 8px 11px; font-size: 12.5px;
}
.select-menu button:hover { background: var(--color-background-secondary); }
.select-menu button.selected { color: var(--color-text-info); font-weight: 500; }

.channel-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.channel-chip {
  font-size: 12px; padding: 5px 11px;
  border: none; border-radius: var(--border-radius-md);
  background: var(--color-background-secondary);
  color: var(--color-text-tertiary);
}
.channel-chip.on { background: var(--color-background-info); color: var(--color-text-info); }
.channel-chip .ti { font-size: 14px; vertical-align: -2px; }

.radio-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; cursor: pointer; border: none; background: transparent; width: 100%; text-align: left; }
.radio-dot { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--color-border-secondary); box-sizing: border-box; flex-shrink: 0; }
.radio-dot.on { border: 4px solid var(--color-text-info); }
.radio-label { font-size: 12.5px; }
.radio-row.off .radio-label { color: var(--color-text-secondary); }

.form-footer {
  display: flex; gap: 8px; align-items: center;
  border-top: 0.5px solid var(--color-border-tertiary);
  padding-top: 14px;
}
.form-footer .btn-primary, .form-footer .btn { font-size: 13px; padding: 9px 18px; }
.form-footer .btn { padding: 9px 16px; }
.form-footer .btn .ti { font-size: 15px; vertical-align: -2px; }
.form-footer .btn-ghost { font-size: 13px; padding: 9px 12px; margin-left: auto; }

.status-line { display: flex; align-items: center; gap: 7px; font-size: 12px; margin-bottom: 13px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-text-success); }
.status-rows { font-size: 11.5px; color: var(--color-text-secondary); line-height: 1.7; margin-bottom: 14px; }
.status-row { display: flex; justify-content: space-between; }
.status-row span:last-child { color: var(--color-text-primary); }

/* ---- Personalisera avatar editor (TICKET-0028, demo scCustomize) ------------------------------- */
/* Generic single-line text input — matches the demo's input[type=text]. */
.text-input {
  font: inherit; font-size: 13.5px;
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  padding: 10px 12px; width: 100%; max-width: 320px;
  outline: none; background: var(--color-background-primary);
}
.text-input:focus { border-color: var(--color-text-info); box-shadow: 0 0 0 3px rgba(24,95,165,0.12); }

/* Live avatar preview card (demo .preview). */
.avatar-preview {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border: 0.5px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-lg);
  background: var(--color-background-tertiary);
  margin-bottom: 12px;
}
.avatar-preview-name { font-weight: 500; }
.avatar-52 { width: 52px; height: 52px; font-size: 22px; }

/* Colour swatches (demo .swatches / .sw). The roster default seeds the choice (D-0003). */
.swatches { display: flex; gap: 9px; flex-wrap: wrap; margin: 4px 0; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; padding: 0;
}
.swatch.on { border-color: var(--color-text-primary); }

/* Emoji avatar picker (demo .emoji / .em). */
.emoji-grid { display: flex; gap: 7px; flex-wrap: wrap; margin: 4px 0; max-width: 260px; }
.emoji-cell {
  width: 34px; height: 34px; border-radius: var(--border-radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer;
  background: var(--color-background-tertiary);
  border: 0.5px solid var(--color-border-tertiary);
}
.emoji-cell.on { border-color: var(--color-text-info); box-shadow: 0 0 0 2px rgba(24,95,165,0.2); }

/* File-upload affordance (demo .up) — a styled <label> wrapping a hidden InputFile. */
.upload-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; padding: 7px 12px;
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  cursor: pointer; background: var(--color-background-primary);
}
.upload-btn:hover { background: var(--color-background-secondary); }

/* Disabled "Kör automatiskt — kommer senare" row (D-0025: autonomy gradient not built). */
.radio-row.disabled { color: var(--color-text-tertiary); cursor: not-allowed; }
.radio-row.disabled .radio-label { color: var(--color-text-tertiary); }

/* Neutral badge (demo .b-neu) — the quiet "kommer senare" tag. */
.bg-neutral { background: var(--color-background-secondary); color: var(--color-text-secondary); }

/* Licence-gating note in the Academy course list (demo README "kräver Fortnox …"). */
.licence-note { display: inline-flex; align-items: center; gap: 4px; color: var(--color-text-warning); }
.licence-note .ti { font-size: 13px; }

/* ---- Onboarding -------------------------------------------------------------------------------- */
.onboarding-body { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 24px 26px; }
.onboarding-inner { max-width: 470px; margin: 0 auto; }
.onboarding-title { margin: 0 0 6px; font-size: 19px; font-weight: 500; text-align: center; }
.onboarding-sub { margin: 0 0 20px; font-size: 13.5px; color: var(--color-text-secondary); text-align: center; line-height: 1.6; }

.member-card {
  display: flex; align-items: center; gap: 12px;
  border: 0.5px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-lg);
  padding: 13px 14px;
  margin-bottom: 10px;
}
.member-card-text { flex: 1; line-height: 1.4; }
.member-card-name { font-size: 14px; font-weight: 500; }
.member-card-desc { font-size: 12.5px; color: var(--color-text-secondary); }

.onboarding-link-row { margin: 0 0 22px; text-align: center; }
.onboarding-hint { margin-top: 6px; font-size: 11.5px; color: var(--color-text-tertiary); }
.onboarding-kicker { margin: 0 0 11px; font-size: 11px; font-weight: 500; letter-spacing: 0.03em; color: var(--color-text-tertiary); }
.onboarding-cta { margin-top: 22px; }

/* Koppla & legitimera rows (iteration-2 scOnboarding): Fortnox + BankID status lines. */
.onboarding-legit-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; font-size: 13.5px;
  border-bottom: 0.5px solid var(--color-border-tertiary);
}
.onboarding-legit-row:last-of-type { border-bottom: none; }
.onboarding-legit-row > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.onboarding-legit-row .ti { font-size: 16px; }

.connected { font-size: 12px; color: var(--color-text-success); font-weight: 500; white-space: nowrap; }
.connected .ti { font-size: 15px; vertical-align: -2px; }

/* ---- Skills list (academy context) -------------------------------------------------------------- */
.skill-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.skill-name { flex: 1; font-size: 12px; }
.skill-count { font-size: 11px; color: var(--color-text-secondary); }

.dept-hint {
  margin-top: 14px;
  display: flex; gap: 8px;
  padding: 10px;
  background: var(--color-background-secondary);
  border-radius: var(--border-radius-md);
}
.dept-hint .ti { font-size: 16px; color: var(--color-text-tertiary); flex-shrink: 0; }
.dept-hint span { font-size: 10.5px; color: var(--color-text-secondary); line-height: 1.45; }

/* ---- Responsive tiers (TICKET-0010) ---------------------------------------------------------------
   One breakpoint rule (product vision §5): desktop 3 panes ≥960px; tablet 2 panes
   (rail stays, context folds into a card at the top of the content column);
   mobile 1 column + bottom tab bar, detail screens use a back header instead.
   The kit's mobile/tablet mockups are GRAMMAR reference only — proportions come
   from the real viewport, never from the 320px/620px preview frames. */

/* Context fold — hidden on desktop; becomes the kit's tablet summary card below
   the screen header on tablet and mobile. Lives inside .content so it stays
   pinned above the scrolling pane. */
.context-fold { display: none; }
.context-fold .kicker { margin: 0 0 3px; letter-spacing: 0.03em; color: var(--color-text-secondary); }
.fold-text { font-size: 12.5px; line-height: 1.45; }
.fold-row { display: flex; align-items: center; gap: 14px; }
.fold-main { flex: 1; min-width: 0; }
.fold-actions { display: flex; gap: 7px; flex-shrink: 0; }

/* Bottom tab bar (mobile top-level screens) — hidden above the mobile breakpoint. */
.tabbar {
  display: none;
  flex-shrink: 0;
  border-top: 0.5px solid var(--color-border-tertiary);
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: var(--color-background-primary);
}
.tabbar button {
  flex: 1; padding: 9px 0 11px;
  border: none; background: transparent;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--color-text-tertiary);
}
.tabbar button.active { color: var(--color-text-info); }
.tabbar .ti { font-size: 20px; }
.tabbar span { font-size: 10px; }

/* Back chevron in agent headers — mobile detail screens only. */
.agent-back {
  display: none;
  align-items: center;
  border: none; background: transparent; padding: 0;
  color: var(--color-text-secondary);
}
.agent-back .ti { font-size: 20px; }

/* Team-home / Att göra / Mer — headers and rows (kit: mobile/team.html grammar). */
.home-header {
  padding: 16px 16px 10px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.home-title { font-size: 17px; font-weight: 500; }
.home-alert {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 14px 14px;
  background: var(--color-background-info);
  border: none; border-radius: var(--border-radius-lg);
  padding: 11px 13px;
  color: var(--color-text-info);
  text-align: left;
  flex-shrink: 0;
}
.home-alert > .ti { font-size: 19px; }
.home-alert span { flex: 1; font-size: 12.5px; font-weight: 500; }
.home-alert .chev { font-size: 17px; }
.home-member {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 0;
  border: none; border-bottom: 0.5px solid var(--color-border-tertiary);
  background: transparent;
  width: 100%; text-align: left;
}
.home-member-main { flex: 1; line-height: 1.35; min-width: 0; }
.home-member-name { font-size: 13.5px; font-weight: 500; }
.home-member-role { font-size: 11.5px; color: var(--color-text-secondary); }
.avatar-38 { width: 38px; height: 38px; font-size: 14px; }
.count-badge {
  font-size: 10.5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: var(--color-accent); color: var(--color-on-accent);
  display: flex; align-items: center; justify-content: center;
}

button.list-row {
  width: 100%; text-align: left;
  border: none; border-bottom: 0.5px solid var(--color-border-tertiary);
  background: transparent;
}
.list-row .chev { font-size: 16px; color: var(--color-text-tertiary); }

/* ---- HQ home cockpit (TICKET-0023) ------------------------------------------------
   The home/hem landing's own grammar, ported faithfully from the iteration-2 demo
   (concept-kit/iteration-2 scHQ/scActivity). Pure presentation; data comes through
   IPlatformClient. Quiet-by-default (D-0025): only the alert/banner surfaces shout. */

/* The home header carries a date line under the greeting. */
.home-dateline { font-size: 12.5px; color: var(--color-text-secondary); margin-top: 2px; }

/* "Synkad · 3 min sen" status chip (demo .sync). */
.sync-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--color-text-secondary);
  border: none; background: transparent; cursor: default;
}
.sync-chip .ti { font-size: 15px; }
.sync-chip.synced { color: var(--color-text-success); }

/* ---- Register (TICKET-0024): segmented control · sync toggle · contact rows -------------------- */
/* Kunder / Leverantörer segmented control (demo .seg). */
.segmented { display: flex; gap: 6px; margin-bottom: 10px; }
.segmented .seg {
  font-size: 12.5px; font-weight: 500;
  padding: 6px 14px;
  border: 0.5px solid var(--color-border-tertiary);
  background: var(--color-background-primary);
  color: var(--color-text-secondary);
  border-radius: var(--border-radius-md);
  cursor: pointer;
}
.segmented .seg.active {
  background: var(--color-background-info);
  color: var(--color-text-info);
  border-color: transparent;
}

/* "Håll synkat med Fortnox" two-way toggle row (demo cream row + .seg toggle). */
.sync-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--color-background-secondary);
  border-radius: var(--border-radius-md);
  padding: 11px 13px;
  margin-bottom: 10px;
}
.sync-row-main { display: flex; align-items: center; gap: 9px; }
.sync-row-main .ti { font-size: 17px; color: var(--color-text-success); }
.sync-row-title { font-size: 12.5px; font-weight: 500; }
.sync-row-sub   { font-size: 11px; color: var(--color-text-secondary); }
.sync-toggle {
  font-size: 12px; font-weight: 500;
  padding: 5px 16px;
  border: 0.5px solid var(--color-border-tertiary);
  background: var(--color-background-primary);
  color: var(--color-text-secondary);
  border-radius: var(--border-radius-md);
  cursor: pointer; white-space: nowrap;
}
.sync-toggle.on { background: var(--color-background-success); color: var(--color-text-success); border-color: transparent; }

/* A contact row in the register (avatar · name/detail · consent badge / chevron). */
.contact-detail { font-size: 11px; color: var(--color-text-secondary); }

/* ---- Connectors (TICKET-0025): the Kopplingar layer (demo .conn / .ci) ------------------------- */
.conn-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 0;
  border-bottom: 0.5px solid var(--color-border-tertiary);
}
.conn-row:last-of-type { border-bottom: none; }
.conn-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.conn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: var(--border-radius-md);
  background: var(--color-background-secondary);
  color: var(--color-text-secondary);
}
.conn-icon .ti { font-size: 17px; }
.conn-name { font-size: 12.5px; font-weight: 500; }
.conn-detail { font-size: 11px; color: var(--color-text-secondary); }

/* The "N saker väntar på ditt ok" banner → Att göra (demo .ibanner). */
.cta-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left;
  background: var(--color-background-info);
  border: none; border-radius: var(--border-radius-lg);
  padding: 13px 16px;
  color: var(--color-text-info);
  font-size: 14px; cursor: pointer;
  margin-bottom: 14px;
}
.cta-banner .ti { font-size: 17px; }
.cta-banner-label { display: flex; align-items: center; gap: 9px; flex: 1; }

/* Week-metric tiles (demo .mrow / .metric). */
.metric-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.metric-tile {
  background: var(--color-background-secondary);
  border: none; border-radius: var(--border-radius-md);
  padding: 11px 13px; text-align: left; cursor: pointer;
}
.metric-tile .metric-label { font-size: 11px; color: var(--color-text-secondary); }
.metric-tile .metric-value { font-size: 20px; font-weight: 500; }

/* Result card + liquidity bar (demo .acard + .bar). */
.result-card {
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-lg);
  padding: 14px; margin-bottom: 12px;
  width: 100%; text-align: left; background: transparent; cursor: pointer;
}
.result-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; margin-bottom: 8px; font-size: 13px;
}
.result-sub { font-size: 12px; color: var(--color-text-secondary); }
.bar { height: 8px; border-radius: 5px; background: var(--color-background-info); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--color-accent); }

/* Likviditet scale labels (idag → prognos) above the cash-flow bar (demo .sub row). */
.liquidity-scale {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--color-text-secondary);
}

/* Reports period selector in the context panel (demo <select>). */
.period-select {
  width: 100%; padding: 8px 10px;
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  background: transparent; color: var(--color-text-primary);
  font-size: 12.5px; cursor: pointer;
}

/* Inline informational note (demo .note) — a quiet hint / status line. Used for the
   ask-first / accountant STOP-line copy on Viktiga datum and Rapporter. */
.note {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 11px;
  background: var(--color-background-secondary);
  border-radius: var(--border-radius-md);
  font-size: 11.5px; line-height: 1.5; color: var(--color-text-secondary);
}
.note .ti { font-size: 15px; flex-shrink: 0; margin-top: 1px; color: var(--color-text-tertiary); }

/* Activity feed events (demo .evt / .dot). Shared by HQ home + Händelser. */
.evt {
  display: flex; gap: 11px; padding: 11px 0;
  border-bottom: 0.5px solid var(--color-border-tertiary);
  font-size: 13.5px;
}
.evt-dot {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.evt-text { line-height: 1.35; }
.evt-when { font-size: 11.5px; color: var(--color-text-tertiary); margin-top: 1px; }

/* Inline text link (demo "Visa alla händelser →"). */
.text-link {
  border: none; background: transparent; padding: 0; cursor: pointer;
  color: var(--color-accent); font-size: 13px;
}

/* Context-panel deadline rows (demo .dl). Reused on the home context panel. */
.deadline-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; background: transparent; cursor: pointer;
  padding: 11px 0; border: none; border-bottom: 0.5px solid var(--color-border-tertiary);
}
.deadline-row:last-of-type { border-bottom: none; }
.deadline-title { font-size: 12.5px; font-weight: 500; }
.deadline-sub { font-size: 11px; color: var(--color-text-secondary); }

/* Context-panel team-status rows on the home (demo .row inside the panel). */
.team-status-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; font-size: 12.5px;
}
.team-status-row .who { display: flex; align-items: center; gap: 8px; }
.team-status-row .state { font-size: 11.5px; }

/* Tablet and below: the right context panel folds into a card at the top of the
   content column (kit: concept-kit/tablet/*). The rail stays. */
@media (max-width: 959.98px) {
  .context { display: none; }
  .context-fold {
    display: block;
    flex-shrink: 0;
    border: 0.5px solid var(--color-border-secondary);
    border-radius: var(--border-radius-lg);
    padding: 12px 14px;
    margin: 14px 16px 0;
  }
}

/* Mobile: single column + bottom bar; detail screens keep a back header instead
   (kit: concept-kit/mobile/*). Content fills the real viewport — no fixed frame. */
@media (max-width: 639.98px) {
  /* Mobile returns to edge-to-edge — the framed card chrome is desktop/tablet only. */
  #app { padding: 0; }
  .app { border: none; border-radius: 0; box-shadow: none; max-width: none; }
  .topbar { display: none; }
  .rail { display: none; }
  .tabbar { display: flex; }
  .agent-back { display: inline-flex; }
  .context-fold { margin: 12px 14px 0; }
  /* Quick actions become the kit's two-column tap grid. */
  .quick-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .chip-btn { padding: 10px 11px; font-size: 12px; font-weight: 500; }
  .chip-btn .ti { font-size: 18px; }
  .onboarding-body { padding: 18px 16px 20px; }
}

/* ---- Misc --------------------------------------------------------------------------------------- */
b, strong { font-weight: 500; }
.skill-header {
  padding: 12px 16px 11px;
  border-bottom: 0.5px solid var(--color-border-tertiary);
  display: flex; align-items: center; gap: 9px;
}
.skill-header .icon-square-30 .ti { font-size: 17px; }
.skill-header-text { line-height: 1.3; flex: 1; }
.skill-header-name { font-size: 14px; font-weight: 500; }
.skill-header-sub { font-size: 11px; color: var(--color-text-secondary); }
