/* Cairo Sand: every colour, font, corner and gap comes from variables that app.js sets on <html>. */
* { box-sizing: border-box }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--body); font-size: var(--fs); line-height: 1.6 }
button, input { font: inherit; color: inherit }
button { cursor: pointer }
button:disabled { cursor: default; opacity: .5 }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px }
.ic { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none }
.muted { color: var(--muted) } .warn { color: var(--warn) } .b { font-weight: 600 } .b5 { font-weight: 500 } .nowrap { white-space: nowrap }
.sm { font-size: .9em } .xs { font-size: 12px } .lg { font-size: 18px } .end { text-align: end }
.grow { flex: 1; min-width: 0 } .col { display: flex; flex-direction: column } .gap { gap: 10px } .g4 { gap: 4px }
.between { display: flex; justify-content: space-between; gap: 8px } .wrap { flex-wrap: wrap }
.display { font-family: var(--display); font-weight: var(--dw); margin: 0 }
h1.display { font-size: 36px; line-height: 1.15 }
.num { font-family: var(--display); font-weight: var(--dw); line-height: 1.1; font-variant-numeric: tabular-nums }
.xl { font-size: 68px; line-height: 1 } .lg2 { font-size: 40px } .lg3 { font-size: 30px }
.note { padding: 40px; border: 1px dashed var(--line); border-radius: var(--r-card); color: var(--muted); text-align: center }

/* shell */
.top { background: var(--paper); border-bottom: 1px solid var(--line) }
.topin { max-width: 1180px; margin: 0 auto; padding: 14px 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px }
.brand { display: flex; align-items: baseline; gap: 10px }
.brand .word { font-size: 34px; line-height: 1; color: var(--fill) }
.brand .sub { font-size: 13px; color: var(--muted); letter-spacing: .04em }
.tabs { flex: 1 1 460px; display: flex; flex-wrap: wrap; gap: 4px }
.tab { display: flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 15px; border: 0; border-radius: var(--r-pill); background: transparent; font-weight: 500 }
.tab .ic { width: 16px; height: 16px; opacity: .8 }
.tab:hover { background: var(--soft) }
.tab.on { background: var(--fill); color: var(--onfill) }
.count { font-size: 12px; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--acsoft); text-align: center }
.on .count { background: rgba(255,255,255,.22) }
.content { max-width: 1180px; margin: 0 auto; padding: 30px 28px 120px; display: flex; flex-direction: column; gap: var(--gap) }
.railwrap { display: flex; min-height: 100vh }
.rail { position: sticky; top: 0; height: 100vh; width: 236px; flex: none; display: flex; flex-direction: column; gap: 20px; padding: 24px 16px; background: var(--paper); border-inline-end: 1px solid var(--line) }
.rail nav { display: flex; flex-direction: column; gap: 4px; flex: 1 }
.railbtn { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--r-ctl); background: transparent; font-weight: 500; text-align: start }
.railbtn span:nth-child(2) { flex: 1 }
.railbtn:hover { background: var(--soft) }
.railbtn.on { background: var(--acsoft); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--fill) }
[dir=rtl] .railbtn.on { box-shadow: inset -3px 0 0 var(--fill) }
.railwrap .content { flex: 1; max-width: 1080px }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: transparent; font-weight: 500 }
.btn:hover { background: var(--soft) }
.btn.primary { border-color: var(--fill); background: var(--fill); color: var(--onfill); font-weight: 600 }
.btn.primary:hover { filter: brightness(1.08) }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px }
.ghost { border: 0; background: transparent; text-align: start }
.ghost:hover { background: var(--soft) }

/* cards */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--pad) }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px }
.ttl { display: block; margin-bottom: 6px }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: var(--gap) }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: var(--gap) }
.grid5 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: var(--gap) }
.split { display: flex; flex-wrap: wrap; gap: var(--gap) } .grow2 { flex: 2 1 440px; min-width: 0 } .grow1 { flex: 1 1 300px; min-width: 0 }
.kpi { display: flex; flex-direction: column; gap: 4px }

/* hero */
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 32px; padding: var(--padhero); border-radius: var(--r-hero) }
.heromain { flex: 2 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 10px }
.bigline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px }
.meter { height: 12px; border-radius: 99px; background: var(--soft); overflow: hidden }
.meter div { height: 100%; border-radius: 99px; background: var(--fill) }
.pace { display: flex; align-items: center; gap: 8px; font-weight: 500 }
.brief { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; border-radius: var(--r-card); background: var(--acsoft) }
.bl { display: flex; gap: 8px; font-size: 14px; text-wrap: pretty }
.bl i { width: 6px; height: 6px; flex: none; margin-top: 10px; border-radius: 50%; background: var(--fill) }
.ringrow { display: flex; flex-wrap: wrap; align-items: center; gap: 20px }
.ringtext { font-family: var(--display); font-weight: var(--dw); font-size: 26px; fill: var(--ink) }
.stack { display: flex; flex-direction: column; gap: 10px }
.statement { font-family: var(--display); font-weight: var(--dw); font-size: 40px; line-height: 1.25; margin: 4px 0; text-wrap: balance }
.runchart { width: 100%; height: auto; max-height: 230px }
.runchart .lbl { font-size: 13px; font-family: var(--body) }
.person { align-items: center }
.actions { display: flex; flex-wrap: wrap; gap: 8px }

/* charts */
.legend { display: flex; align-items: center; gap: 8px }
.dash { width: 20px; border-top: 2px dashed var(--muted) }
.bars { position: relative; height: 150px; display: flex; align-items: flex-end; gap: 3px; border-bottom: 1px solid var(--line) }
.bars div { flex: 1 1 0; min-width: 0; border-radius: 5px 5px 0 0 }
.bars .avgline { position: absolute; inset-inline: 0; height: 0; border-top: 2px dashed var(--muted); opacity: .6; pointer-events: none; border-radius: 0 }
.axis { display: flex; justify-content: space-between; margin-top: 6px }
.track { height: 9px; border-radius: 4px; background: var(--soft) }
.track i { display: block; height: 100%; border-radius: 4px; background: var(--fill) }
.prod { display: flex; flex-direction: column; gap: 4px; margin-top: 8px }
.heat { display: flex; flex-direction: column; gap: 3px }
.hrow { display: flex; gap: 3px; align-items: center }
.hrow i { flex: 1; height: 22px; border-radius: 4px }
.hday { width: 64px; flex: none }
.hh { flex: 1; text-align: center }
.scale { display: flex; align-items: center; gap: 8px; margin-top: 10px; justify-content: flex-end }
.scale i { width: 120px; height: 8px; border-radius: 4px }
.split2 { display: flex; gap: 2px; height: 16px }
.split2 i { min-width: 0; border-radius: 6px }
.legendrow { display: flex; flex-wrap: wrap; gap: 6px 22px }
.legendrow span { display: flex; align-items: center; gap: 8px }
.legendrow i { width: 12px; height: 12px; border-radius: 3px }

/* lists, people */
.list { display: flex; flex-direction: column; gap: 4px }
.row { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 6px; border-radius: var(--r-ctl); width: 100% }
.av { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--soft) }
.av.warnav { background: var(--warnbg); color: var(--warn) }
.av.big { width: 40px; height: 40px; font-size: 14px }
.av.huge { width: 64px; height: 64px; font-size: 20px }
.pill { display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--soft); border: 1px solid transparent }
.titlebar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px }
.titlebar h1 { flex: 1 1 auto }
.search { flex: 0 1 300px; display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--paper); color: var(--muted) }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--ink) }
.chips { display: flex; flex-wrap: wrap; gap: 8px }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--paper); font-weight: 500 }
.chip span { opacity: .75 }
.chip:hover:not(:disabled) { border-color: var(--muted) }
.chip.on { background: var(--fill); border-color: var(--fill); color: var(--onfill) }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: var(--gap) }
.cbtn { display: flex; flex-direction: column; gap: 10px; text-align: start }
.cbtn:hover { border-color: var(--muted) }
.cbtn .row { padding: 0; min-height: 0 }
.backbtn { align-self: flex-start; display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border-radius: var(--r-ctl); color: var(--muted) }
[dir=ltr] .backbtn .ic { transform: scaleX(-1) }
.timeline { margin: 0; padding: 0; list-style: none }
.timeline li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line) }
.timeline .when { width: 78px; flex: none }
.dot { width: 10px; height: 10px; flex: none; margin-top: 8px; border-radius: 50% }
.furow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 58px; border-top: 1px solid var(--line); padding: 6px 0 }
.furow.off { opacity: .5 } .furow.off .futext { text-decoration: line-through }
.staffrow { padding: 10px 0; border-bottom: 1px solid var(--line) }

/* ledger tables */
.tbl { display: flex; flex-direction: column }
.tr { display: grid; grid-template-columns: 2fr 1fr 1.2fr; gap: 10px; align-items: center; min-height: 40px; padding: 4px 6px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: start; width: 100% }
.tbl.wide .tr { grid-template-columns: 2.2fr 1.2fr 1.1fr .6fr .8fr .7fr }
.tbl.md .tr { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column }
.th { font-size: 12.5px; color: var(--muted); font-weight: 600; min-height: 32px }
.tr.link:hover { background: var(--soft) }
.minibar { display: block; height: 8px; background: var(--soft); border-radius: 2px }
.minibar i { display: block; height: 100%; background: var(--fill); border-radius: 2px }
[data-layout=ledger] h1.display { font-size: 28px }
[data-layout=ledger] .xl { font-size: 52px }

/* bento */
.bento { display: grid; gap: var(--gap); grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "hero hero hero k1" "hero hero hero k2" "daily daily late k3" "daily daily late top" "busy busy gone top" }
.bento > div { min-width: 0; display: flex } .bento > div > * { flex: 1 }
.b-hero { grid-area: hero } .b-k1 { grid-area: k1 } .b-k2 { grid-area: k2 } .b-k3 { grid-area: k3 } .b-daily { grid-area: daily } .b-late { grid-area: late } .b-busy { grid-area: busy } .b-gone { grid-area: gone } .b-top { grid-area: top }
.bento .hero { align-items: stretch; flex-direction: column } .bento .heromain, .bento .brief { flex: none }
@media (max-width: 1000px) { .bento { grid-template-columns: 1fr; grid-template-areas: "hero" "k1" "k2" "k3" "daily" "late" "busy" "gone" "top" } }

/* ask */
.thread { display: flex; flex-direction: column; gap: 14px; max-width: 820px }
.msg { display: flex; flex-direction: column; gap: 8px }
.msg .q { align-self: flex-end; max-width: 80%; padding: 10px 16px; border-radius: var(--r-card); font-weight: 500 }
.msg .a { align-self: flex-start; max-width: 92% }
.msg .a p { margin: 0 0 6px } .msg .a.err { border-color: var(--bad) }
.bul { padding-inline-start: 6px; margin-bottom: 4px }
.askbox { display: flex; gap: 8px; max-width: 820px }
.askbox input { flex: 1; min-height: 48px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--paper); color: var(--ink) }

/* studio chrome: always LTR, neutral, so it never reads as part of the design */
.studio, .st-panel, .st-open, .toast { font-family: system-ui, 'Segoe UI', sans-serif; font-size: 13px; line-height: 1.3 }
.studio { position: fixed; z-index: 20; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: calc(100vw - 32px); padding: 8px 10px; border-radius: 14px; background: #1c1b1f; color: #f2f0eb; box-shadow: 0 10px 30px rgba(0,0,0,.28) }
.st-name { font-weight: 600; padding: 0 6px }
.st-seg { display: flex; flex-wrap: wrap; gap: 2px; padding: 2px; border-radius: 9px; background: #2c2b30 }
.st-seg button, .st-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: #d9d6cf; text-decoration: none }
.st-seg button:hover, .st-btn:hover { background: #3a3940; color: #fff }
.st-seg button.on, .st-btn.on { background: #f2f0eb; color: #1c1b1f }
.st-seg i { width: 9px; height: 9px; border-radius: 50% }
.st-save { background: #f2f0eb; color: #1c1b1f; font-weight: 600 } .st-save:hover { background: #fff; color: #000 }
.st-panel { position: fixed; z-index: 20; bottom: 74px; left: 50%; transform: translateX(-50%); width: min(880px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 14px; background: #1c1b1f; color: #f2f0eb; box-shadow: 0 10px 30px rgba(0,0,0,.28) }
.st-row { display: flex; align-items: center; gap: 10px } .st-row > span { width: 74px; flex: none; color: #a9a59c }
.st-row input[type=color] { width: 40px; height: 30px; padding: 0; border: 0; background: none }
.st-open { position: fixed; z-index: 20; bottom: 16px; right: 16px; min-height: 36px; padding: 0 14px; border: 0; border-radius: 10px; background: #1c1b1f; color: #f2f0eb }
.toast { position: fixed; z-index: 30; top: 18px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px; background: #1c1b1f; color: #f2f0eb; box-shadow: 0 10px 30px rgba(0,0,0,.25) }
@media (max-width: 760px) { .rail { display: none } .xl { font-size: 48px } .statement { font-size: 28px } .content { padding: 18px 16px 160px } .topin { padding: 12px 16px } }
