/* =========================================================
   Bunci Calm – laddas sist.
   1. Ny färg och typsnitt (korall/persika i stället för blå-lila, Bricolage Grotesque för rubriker)
   2. En fast ram som i Arc/Dia: sidomeny + topbar står still, bara innehållet rör sig
   3. Avatarmeny uppe till höger
   4. Lugnare projektkort: hela texten syns, verktygen bara vid hover
   5. Inloggning som inte hoppar när tangentbordet på telefonen stängs
   ========================================================= */
/* Typsnittet ligger på vår egen server – inga anrop till Google (GDPR) */
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(/fonts/bricolage-latin.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(/fonts/bricolage-latin-ext.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
:root {
  --accent: #FF6B3D;
  --accent-soft: rgba(255,107,61,.16);
  --accent-2: #FF3D7F;
  --lime: #C8F25A;
  --g-blue: linear-gradient(135deg, #FF8552 0%, #FF3D7F 100%);
  --g-violet: linear-gradient(135deg, #FFC53D 0%, #FF6B3D 100%);
  --display: "Bricolage Grotesque", var(--font);
  --frame: #0b0b0d;
  --panel: rgba(20,20,23,.72);
}

/* ---------- Typsnitt ---------- */
.brand, .side-top .brand, .login-brand b, .login-card h2, .page-head h2, .page-txt h1, .ov-head h2,
.category-title, .modal-head h2, .kb-col h3, .hero h2, .block-head h3 {
  font-family: var(--display); font-optical-sizing: auto; letter-spacing: -.02em;
}
.side-top .brand, .login-brand b { font-weight: 800; letter-spacing: -.03em; }
.login-card h2 { font-weight: 800; font-size: 32px; }
.page-head h2 { font-weight: 750; }
.category-title { font-weight: 650; }

/* ---------- 2. Ramen (dator och iPad) ---------- */
@media (min-width: 861px) {
  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  body { background: var(--frame) !important; }
  .ambient { opacity: .55; }
  .side { background: transparent !important; border-right: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; box-shadow: none !important; }
  /* Tre delar som var för sig står still: sidomenyn, toppraden och innehållsfönstret.
     Bara --side-w flyttar dem – och den ändras bara när personen drar i kanten eller trycker ⌘S. */
  .side { width: var(--side-pref, 232px) !important; max-width: none !important; overflow: hidden; transition: transform .28s cubic-bezier(.2,.8,.2,1), box-shadow .2s; }
  .header {
    position: fixed !important; top: 0; left: var(--side-w); right: 0; z-index: 120;
    background: transparent !important; border: none !important; box-shadow: none !important;
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  }
  .header::after { display: none !important; }
  /* Innehållet ligger i ett eget rundat fönster i ramen – det är bara här det scrollas och dras */
  .layout {
    position: fixed; top: var(--top-h); left: max(10px, var(--side-w)); right: 10px; bottom: 10px;
    overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable;
    border-radius: 16px; background: var(--panel);
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 20px 60px -30px rgba(0,0,0,.8);
  }
  body.side-anim .header, body.side-anim .layout { transition: left .28s cubic-bezier(.2,.8,.2,1); }
  body.side-resizing, body.side-resizing * { cursor: col-resize !important; user-select: none !important; }
  /* Kanten man drar i */
  .side-grip { position: absolute; top: 0; right: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 5; }
  .side-grip::after { content: ''; position: absolute; top: 50%; right: 2px; width: 3px; height: 36px; margin-top: -18px; border-radius: 3px; background: rgba(255,255,255,.18); opacity: 0; transition: opacity .15s; }
  .side-grip:hover::after, body.side-resizing .side-grip::after { opacity: 1; }
  /* Dold meny: glider ut åt vänster; kanten tar fram den ovanpå innehållet */
  body.side-hidden .side { transform: translateX(-100%); }
  body.side-hidden.side-peek .side { transform: none; z-index: 700; background: rgba(16,16,19,.96) !important; box-shadow: 12px 0 40px -10px rgba(0,0,0,.7), inset -1px 0 0 rgba(255,255,255,.08) !important; border-radius: 0 14px 14px 0; }
  body.side-hidden .side-grip { display: none; }
  .side-peek-zone { position: fixed; left: 0; top: 0; bottom: 0; width: 8px; z-index: 690; display: none; }
  body.side-hidden .side-peek-zone { display: block; }
  /* Knappen som tar tillbaka menyn syns bara när den är dold */
  .side-show { display: none !important; width: 30px; height: 30px; margin-right: 4px; }
  body.side-hidden .side-show { display: inline-flex !important; }
  body.side-hidden .header { padding-left: 14px; }
  /* Flikarna: namnet kortas med … och krysset ligger ovanpå – inget får ändra bredden */
  .side .tabs { max-width: none !important; width: 100%; }
  .side .tabs button { width: 100%; position: relative; }
  .side .tabs button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
  .side .tabs .tab-x { position: absolute; right: 6px; top: 50%; margin: -10px 0 0 !important; display: inline-flex !important; opacity: 0; pointer-events: none; transition: opacity .12s; }
  .side .tabs button[data-tid]:hover .tab-x { opacity: 1; pointer-events: auto; }
  .side .tabs button[data-tid]:hover span { padding-right: 22px; }
  .side-toggle { white-space: nowrap; overflow: hidden; }
  body[data-view="board"] .layout, body[data-view="notes"] .layout { padding: 0; overflow: hidden; }
  body[data-view^="tab-"] .layout { padding: 14px; }
  .board-view { position: absolute !important; inset: 0 !important; }
  .notes-view { height: 100% !important; }
  .lt-frame { height: calc(100dvh - var(--top-h) - 60px); }
}
/* Telefon: ingen gummiband-studs som drar med sig toppraden */
@media (max-width: 860px) {
  html { overscroll-behavior-y: none; }
}

/* ---------- 3. Avatarmenyn ---------- */
.avatar-btn {
  width: 32px; height: 32px; border-radius: 50%; padding: 0; border: none; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: var(--g-blue); color: #fff; font: 700 14px var(--display);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), 0 0 0 2px transparent; transition: box-shadow .15s, transform .2s var(--spring, ease);
}
.avatar-btn:hover { box-shadow: inset 0 0 0 1px rgba(255,255,255,.35), 0 0 0 3px rgba(255,107,61,.3); }
.avatar-btn:active { transform: scale(.94); }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.menu { min-width: 240px; padding: 6px; }
.menu hr { border: none; height: 1px; background: rgba(255,255,255,.08); margin: 5px 6px; }
.menu button { display: flex; align-items: center; width: 100%; }
.menu button small { margin-left: auto; color: var(--text-3); font-size: 11.5px; }
.menu button.danger { color: #FF7A70; }
.menu button:hover, .menu button:hover small { background: rgba(255,255,255,.08) !important; box-shadow: none !important; color: var(--text); }
.menu-me { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; margin-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,.08); }
.menu-me:empty { display: none; }
.menu-me div { display: flex; flex-direction: column; min-width: 0; }
.menu-me b { font-size: 13.5px; }
.menu-me small { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-av { background: var(--g-blue) !important; }
.acct-av.sm { width: 32px; height: 32px; font-size: 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; flex-shrink: 0; }

/* ---------- 4. Lugnare projektkort ---------- */
/* En kolumn: Tasks överst, To buy under – full bredd så att hela texten får plats */
.category.open .category-body { grid-template-columns: minmax(0, 1fr) !important; row-gap: 6px; }
.subcategory { background: none !important; border: none !important; box-shadow: none !important; padding: 0 !important; }
.sub-header { height: 30px; }
.sub-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.sub-label .sub-ic { display: none; }
.checklist-item { height: auto !important; min-height: 38px; padding: 7px 4px; border-top-color: rgba(255,255,255,.05) !important; background: none !important; }
.checklist-item .item-text { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; overflow-wrap: anywhere; display: block !important; -webkit-line-clamp: unset !important; line-height: 1.35; font-size: 14.5px; }
/* Verktyg (öppna, ta bort, länk) bara när man pekar på raden */
.checklist-item .item-open, .checklist-item .item-delete, .checklist-item .link-add { opacity: 0 !important; transition: opacity .12s; }
.checklist-item:hover .item-open, .checklist-item:hover .item-delete, .checklist-item:hover .link-add, .checklist-item:focus-within .item-open { opacity: .65 !important; }
.link-head { display: none !important; }
/* Lägg till: en tyst rad i stället för fält + blå knapp */
.add-item-row { border-top: none !important; padding-top: 2px !important; }
.add-item-input { background: none !important; border: none !important; box-shadow: none !important; padding-left: 34px !important; height: 34px; font-size: 14px !important; }
.add-item-input::placeholder { color: var(--text-3); opacity: .7; }
.add-item-row { position: relative; }
.add-item-row::before { content: '+'; position: absolute; left: 10px; top: 50%; transform: translateY(-40%); color: var(--text-3); font-size: 18px; pointer-events: none; }
.add-item-btn { display: none !important; }
.add-item-row:focus-within .add-item-btn { display: flex !important; }
/* "Add column" bara när man hovrar över delen */
.category-body .add-sub-btn { opacity: 0; height: 0; padding: 0 !important; overflow: hidden; border: none !important; transition: opacity .15s; }
.category.open:hover .category-body .add-sub-btn { opacity: .6; height: 30px; padding: 6px !important; border: 1px dashed rgba(255,255,255,.15) !important; }
@media (hover: none) { .category-body .add-sub-btn { display: none !important; } }
/* Projektöversikten: lugnare och kompaktare */
.overview .legend { row-gap: 2px; }

/* ---------- 5. Inloggning ---------- */
.login-btn.primary { background: var(--g-blue) !important; }
.login-btn.passkey { background: #fff; color: #111; }
.lock { background: radial-gradient(120% 80% at 15% 0%, rgba(255,107,61,.25), transparent 60%), radial-gradient(90% 70% at 100% 100%, rgba(255,61,127,.18), transparent 60%), #08080a !important; }
.lock-error { line-height: 1.4; }
.login-switch b { color: var(--accent); }
@media (max-width: 860px) {
  /* Kortet står överst – då hoppar det inte när tangentbordet stängs och knappen hamnar där man trycker */
  .lock { align-items: flex-start !important; }
  .login-card { margin: 4vh auto auto !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; background: rgba(28,28,32,.92) !important; }
  .login-btn { touch-action: manipulation; }
}
body.locked .omni-fab, body.locked .tabs { display: none !important; }

/* ---------- Toaster: läsbara på telefon ---------- */
@media (max-width: 860px) {
  .toast { max-width: calc(100vw - 24px); width: max-content; }
  .toast button { white-space: nowrap; }
}

/* ---------- Konto: anslutna appar, data och aktivitet ---------- */
.acct-apps { display: flex; flex-direction: column; gap: 4px; }
.acct-app { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.acct-app img { width: 28px; height: 28px; border-radius: 8px; object-fit: contain; background: rgba(255,255,255,.06); }
.acct-app .acct-av.sm { width: 28px; height: 28px; font-size: 13px; border-radius: 8px; }
.acct-rows { display: flex; flex-direction: column; }
.acct-rows a.pick-row { text-decoration: none; color: inherit; }
.acct-log { display: flex; flex-direction: column; max-height: 240px; overflow: auto; border-radius: 12px; background: rgba(255,255,255,.04); padding: 4px 10px; }
.acct-log div { display: flex; flex-direction: column; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.05); font-size: 13.5px; }
.acct-log div:last-child { border-bottom: none; }
.acct-log small { color: var(--text-3); font-size: 12px; }
.ghost-btn.danger { color: #FF7A70; }

/* ---------- Beam som Spotlight ---------- */
@media (min-width: 861px) {
  .omni.open { padding-top: 14vh !important; }
  .omni.open .omni-field { box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 30px 90px -20px rgba(0,0,0,.75), 0 0 0 1px rgba(0,0,0,.4) !important; }
  /* Bara fältet: rundat runt om när inget visas under */
  .omni.open.bare .omni-field { border-radius: 26px !important; border-bottom-color: rgba(255,255,255,.16) !important; }
  .omni.open .omni-panel { max-height: min(56vh, 560px) !important; box-shadow: 0 40px 100px -20px rgba(0,0,0,.75) !important; }
}
.om-row { transition: background .08s; }
@media (hover: hover) { .om-row:not(.sel):hover { background: rgba(255,255,255,.06) !important; } }

/* ---------- Beams kort: projektet direkt i svaret ---------- */
.ai-msg.bot .ai-h { margin: 12px 0 4px; font-weight: 650; font-size: 13px; letter-spacing: .01em; color: var(--text); }
.ai-msg.bot .ai-h:first-child { margin-top: 0; }
.bc { margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in oklab, var(--text) 3%, transparent); display: flex; flex-direction: column; gap: 2px; }
.bc-head { display: flex; align-items: baseline; gap: 8px; padding: 2px 4px 8px; }
.bc-head b { font-size: 15px; }
.bc-head span, .bc-sec { font-size: 12px; color: var(--text-3); }
.bc-sec { padding: 8px 4px 4px; font-weight: 600; text-transform: none; }
.bc-sec:first-child { padding-top: 2px; }
.bc-part, .bc-task { all: unset; box-sizing: border-box; display: grid; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text); }
.bc-part { grid-template-columns: 18px minmax(0, 1fr) 72px 34px; }
.bc-task { grid-template-columns: 16px minmax(0, 1fr); }
.bc-part:hover, .bc-task:hover { background: color-mix(in oklab, var(--text) 7%, transparent); }
.bc-part:focus-visible, .bc-task:focus-visible { outline: 2px solid var(--accent); }
.bc-step { font-size: 11px; color: var(--text-3); text-align: center; font-variant-numeric: tabular-nums; }
.bc-name, .bc-task span { min-width: 0; display: flex; flex-direction: column; }
.bc-name, .bc-task span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-name small, .bc-task small { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.bc-part.wait .bc-name small { color: #d9822b; }
.bc-part.done .bc-name small { color: var(--green); }
.bc-bar { height: 5px; border-radius: 3px; background: color-mix(in oklab, var(--text) 10%, transparent); overflow: hidden; }
.bc-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.bc-part.done .bc-bar i { background: var(--green); }
.bc-num { font-size: 11.5px; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.bc-task svg { width: 14px; height: 14px; opacity: .6; }
.bc-money { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; padding: 2px 4px 6px; }
.bc-money small { display: block; font-size: 11.5px; color: var(--text-3); }
.bc-money b { font-size: 15px; font-variant-numeric: tabular-nums; }
.bc-money b.neg { color: #e5484d; }
.bc-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* Toppraden: sökfältet krymper först, sidans namn får alltid plats (som i Dia) */
@media (min-width: 861px) {
  .header { grid-template-columns: minmax(auto, 1fr) minmax(220px, 560px) minmax(auto, 1fr) !important; }
  .header .crumbs { min-width: max-content !important; }
  .header .page-txt { max-width: 220px; min-width: 0; }
  .header .page-txt h1, .header .page-txt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
  .header .proj b { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Mobilen har dockan i stället för sidomenyn */
@media (max-width: 860px) { .side-show, .side-peek-zone { display: none !important; } }
@media (max-width: 560px) {
  .bc-part { grid-template-columns: 14px minmax(0, 1fr) 40px 30px; gap: 8px; }
}
