/* Member 360 demo — teal accent, one member per screen, sources colour-coded. rem only. */
:root {
  --accent: #1f7a72; --accent-soft: #e2f2ef;
  --src-crm: #7c5cff; --src-erp: #2f6bff; --src-wms: #c77a06; --src-support: #e0457b; --src-finance: #16a34a;
  --top: 3.5rem;
}
:root[data-theme="dark"] { --accent: #3fb6a8; --accent-soft: #15322f; --accent-text: #08201d; }

.k-topbar { gap: 0.75rem; z-index: 40; }
.omni { position: relative; flex: 1; max-width: 34rem; min-width: 0; }
.omni .k-input { padding-right: 2.5rem; background: var(--surface-2); }
.omni kbd { position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%); font: 600 0.6875rem var(--font); color: var(--muted); border: 0.0625rem solid var(--line-strong); border-radius: 0.3rem; padding: 0.05rem 0.35rem; background: var(--surface); }
.omni:focus-within kbd { display: none; }
.omni-pop { position: absolute; top: calc(100% + 0.375rem); left: 0; right: 0; z-index: 60; background: var(--surface); border: 0.0625rem solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 0.375rem; max-height: 70vh; overflow: auto; display: none; }
.omni.open .omni-pop { display: block; }
.omni-head { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 0.5rem 0.625rem 0.25rem; }
.omni-res { display: flex; align-items: center; gap: 0.625rem; padding: 0.5rem 0.625rem; border-radius: var(--radius-sm); cursor: pointer; min-width: 0; }
.omni-res.hl, .omni-res:hover { background: var(--surface-2); }
.omni-res > .ms { color: var(--muted); }
.omni-res .tx { min-width: 0; display: flex; flex-direction: column; }
.omni-res .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.omni-res .s { color: var(--muted); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.omni-res .src { margin-left: auto; }
.omni-res mark { background: var(--accent-soft); color: inherit; border-radius: 0.2rem; }
.brand-txt { white-space: nowrap; }

/* ---------- Layout: rail | page | ask ---------- */
.layout { flex: 1; display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 0; }
.rail { position: sticky; top: var(--top); height: calc(100vh - var(--top)); background: var(--surface); border-right: 0.0625rem solid var(--line); padding: 0.75rem 0.625rem; display: flex; flex-direction: column; gap: 0.125rem; overflow: auto; }
.rail h4 { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 0.75rem 0.5rem 0.375rem; display: flex; justify-content: space-between; }
.rail h4:first-child { padding-top: 0.25rem; }
.rail button { all: unset; cursor: pointer; display: flex; align-items: center; gap: 0.625rem; padding: 0.375rem 0.5rem; border-radius: var(--radius-sm); min-width: 0; }
.rail button:hover { background: var(--surface-2); }
.rail button.active { background: var(--accent-soft); }
.rail button .k-avatar { width: 1.625rem; height: 1.625rem; font-size: 0.625rem; border-radius: 0.4rem; }
.rail .nm { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.rail .dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }

.ask { position: fixed; z-index: 70; top: var(--top); right: 0; bottom: 0; width: min(24rem, 100vw); background: var(--surface); border-left: 0.0625rem solid var(--line); box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .22s ease; display: flex; flex-direction: column; }
.ask.open { transform: none; }
.scrim { position: fixed; inset: var(--top) 0 0 0; background: rgb(10 12 16 / 30%); z-index: 65; display: none; }
.scrim.show { display: block; }
@media (min-width: 88rem) {
  .layout { grid-template-columns: 15rem minmax(0, 1fr) 23rem; }
  .ask { position: sticky; top: var(--top); height: calc(100vh - var(--top)); width: auto; transform: none; box-shadow: none; z-index: 1; }
  .ask-toggle, .ask-close { display: none !important; }
  .scrim { display: none !important; }
}
@media (max-width: 60rem) { .layout { grid-template-columns: 1fr; } .rail { display: none; } }

/* ---------- Page ---------- */
.k-main { gap: 1rem; }
.hero { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.hero .logo { width: 3.5rem; height: 3.5rem; border-radius: 0.875rem; font-size: 1.125rem; }
.hero .meta { flex: 1; min-width: 14rem; display: flex; flex-direction: column; gap: 0.35rem; }
.hero .name { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.hero .line { display: flex; flex-wrap: wrap; gap: 0.25rem 0.875rem; color: var(--muted); font-size: 0.8125rem; }
.hero .line span { display: inline-flex; align-items: center; gap: 0.25rem; }
.hero .line .ms { font-size: 1rem; }
.owner { display: flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.875rem 0.375rem 0.375rem; border: 0.0625rem solid var(--line); border-radius: 2rem; background: var(--surface-2); }
.owner .k-avatar { width: 1.875rem; height: 1.875rem; font-size: 0.625rem; }
.owner small { display: block; color: var(--muted); font-size: 0.6875rem; line-height: 1.1; }
.owner b { font-weight: 600; font-size: 0.8125rem; }

.ids { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.875rem; }
.ids button { all: unset; cursor: pointer; display: flex; align-items: center; gap: 0.375rem; font-size: 0.75rem; padding: 0.25rem 0.5rem; border: 0.0625rem dashed var(--line-strong); border-radius: 0.4rem; }
.ids button:hover { border-color: var(--accent); }
.ids .k { color: var(--muted); }
.ids .v { font-family: ui-monospace, Consolas, monospace; font-weight: 600; }
.ids .ms { font-size: 0.875rem; color: var(--muted); }

.src { display: inline-flex; align-items: center; gap: 0.3rem; height: 1.375rem; padding: 0 0.5rem; border-radius: 1rem; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.02em; background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--c); white-space: nowrap; }
.src::before { content: ''; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--c); }
.src.crm { --c: var(--src-crm); } .src.erp { --c: var(--src-erp); } .src.wms { --c: var(--src-wms); } .src.support { --c: var(--src-support); } .src.finance { --c: var(--src-finance); }
.src.syncing { animation: pulse .7s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .35; } }
.sources { display: flex; flex-wrap: wrap; gap: 0.375rem; align-items: center; margin-top: 0.875rem; padding-top: 0.875rem; border-top: 0.0625rem solid var(--line); }
.sources .sync { color: var(--muted); font-size: 0.75rem; display: inline-flex; align-items: center; gap: 0.25rem; margin-left: auto; }
.sources .sync .k-icon-btn { width: 1.75rem; height: 1.75rem; }
.sources .sync .ms { font-size: 1.0625rem; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.kpis { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr)); }
.kpis .k-card { padding: 0.875rem 1rem; display: flex; flex-direction: column; gap: 0.125rem; animation: k-pop .3s ease-out both; }
.kpis .label { display: flex; align-items: center; justify-content: space-between; gap: 0.25rem; }
.kpis .value { font-size: 1.375rem; }
.kpis .foot { font-size: 0.75rem; color: var(--muted); display: flex; align-items: center; gap: 0.375rem; flex-wrap: wrap; }
.kpis .foot.bad { color: var(--bad); font-weight: 600; }

.duo { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); align-items: stretch; }
.bars { display: flex; align-items: flex-end; gap: 0.375rem; height: 9rem; padding-top: 0.5rem; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; height: 100%; justify-content: flex-end; min-width: 0; position: relative; }
.bars .bar { width: 100%; max-width: 2.25rem; border-radius: 0.3rem 0.3rem 0.1rem 0.1rem; background: var(--accent); opacity: .8; transition: height .6s cubic-bezier(.2,.8,.2,1), opacity .15s; min-height: 0.125rem; height: 0; }
.bars .b:hover .bar { opacity: 1; }
.bars .bar.zero { background: var(--line); }
.bars .lbl { font-size: 0.625rem; color: var(--muted); }
.bars .tip { position: absolute; bottom: calc(100% + 0.25rem); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: 0.6875rem; font-weight: 600; padding: 0.15rem 0.4rem; border-radius: 0.3rem; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; }
.bars .b:hover .tip { opacity: 1; }
.chart-sum { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: 0.75rem; color: var(--muted); margin-top: 0.75rem; }
.chart-sum b { color: var(--text); font-size: 0.9375rem; display: block; }

.flag-row { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.625rem 0; border-top: 0.0625rem solid var(--line); }
.flag-row:first-of-type { border-top: 0; padding-top: 0; }
.flag-row > .ms { color: var(--warn); margin-top: 0.0625rem; }
.flag-row.ok > .ms { color: var(--ok); }
.flag-row .body { flex: 1; min-width: 0; }
.flag-row .t { font-weight: 600; }
.flag-row .s { color: var(--muted); font-size: 0.75rem; }
.flag-row .diff { color: var(--bad); font-weight: 700; }

/* tabs + tables */
.tabbar { display: flex; align-items: center; gap: 0.5rem; margin: -0.25rem -0.25rem 0.875rem; }
.tabbar .k-tabs { flex: 1; min-width: 0; }
.k-tabs .cnt { display: inline-grid; place-items: center; min-width: 1.25rem; height: 1.125rem; padding: 0 0.3rem; margin-left: 0.25rem; border-radius: 1rem; background: var(--surface-2); color: var(--muted); font-size: 0.6875rem; }
.k-tabs .active .cnt { background: var(--accent-soft); color: var(--accent); }
.k-table tbody tr.click { cursor: pointer; }
.k-table td.nowrap, .k-table th.nowrap { white-space: nowrap; }
.k-table tr.flagged td { background: var(--warn-soft); }
.k-table tr.overdue td:first-child { box-shadow: inset 0.1875rem 0 0 var(--bad); }
.k-table .ean { font-family: ui-monospace, Consolas, monospace; font-size: 0.75rem; color: var(--muted); }
.k-table .neg { color: var(--bad); font-weight: 600; }
.tbl-tools { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.75rem; }
.tbl-tools .k-search { flex: 1; min-width: 10rem; max-width: 18rem; }
.tbl-tools .k-select { min-width: 9.5rem; width: auto; }
.tbl-tools .grow { flex: 1; }
.tbl-foot { display: flex; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; padding: 0.625rem 0.875rem; font-size: 0.75rem; color: var(--muted); border-top: 0.0625rem solid var(--line); background: var(--surface-2); }
.proof { display: inline-flex; gap: 0.25rem; }
.proof button { all: unset; cursor: pointer; display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 0.4rem; border: 0.0625rem solid var(--line); color: var(--accent); }
.proof button:hover { background: var(--accent-soft); }
.proof button[disabled] { color: var(--line-strong); pointer-events: none; }
.proof .ms { font-size: 1rem; }

.tl-filters { display: flex; gap: 0.375rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.chip { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 0.3rem; height: 1.75rem; padding: 0 0.625rem; border-radius: 1rem; border: 0.0625rem solid var(--line-strong); font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.chip:hover { color: var(--text); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.tl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tl li { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: 0.625rem; padding: 0.5rem 0; position: relative; animation: k-pop .25s ease-out both; }
.tl li::before { content: ''; position: absolute; left: 0.9375rem; top: 2.5rem; bottom: -0.375rem; width: 0.125rem; background: var(--line); }
.tl li:last-child::before { display: none; }
.tl .ic { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--c); }
.tl .ic .ms { font-size: 1.0625rem; }
.tl .what { font-weight: 500; }
.tl .sub { color: var(--muted); font-size: 0.75rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.tl .when { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.tl li.fresh .ic { box-shadow: 0 0 0 0.25rem var(--accent-soft); }

.contacts { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }
.contact { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.875rem; border: 0.0625rem solid var(--line); border-radius: var(--radius); }
.contact .k-avatar { width: 2.5rem; height: 2.5rem; }
.contact .e { color: var(--accent); font-size: 0.8125rem; word-break: break-all; }
.contact .r { color: var(--muted); font-size: 0.75rem; }
.contact .k-pill { margin-top: 0.375rem; }

/* ---------- Ask panel ---------- */
.ask-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.875rem 1rem; border-bottom: 0.0625rem solid var(--line); }
.ask-head .ms.fill { color: var(--accent); }
.ask-head h3 { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ask-body { flex: 1; overflow: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.ask .hint { color: var(--muted); font-size: 0.8125rem; }
.q-chips { display: flex; flex-direction: column; gap: 0.375rem; }
.q-chips button { all: unset; cursor: pointer; display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.625rem; border-radius: var(--radius-sm); border: 0.0625rem solid var(--line); font-size: 0.8125rem; background: var(--surface-2); }
.q-chips button:hover { border-color: var(--accent); color: var(--accent); }
.q-chips .ms { font-size: 1rem; color: var(--accent); }
.thread { display: flex; flex-direction: column; gap: 0.625rem; }
.msg { padding: 0.625rem 0.75rem; border-radius: 0.75rem; font-size: 0.8125rem; line-height: 1.55; animation: k-pop .2s ease-out; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 0.2rem; max-width: 90%; }
.msg.bot { background: var(--surface-2); border: 0.0625rem solid var(--line); border-bottom-left-radius: 0.2rem; display: flex; flex-direction: column; gap: 0.375rem; }
.msg.bot ul { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.2rem; }
.msg.bot .used { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-top: 0.25rem; align-items: center; }
.msg.bot .used small { color: var(--muted); font-size: 0.6875rem; margin-right: 0.125rem; }
.steps { color: var(--muted); font-size: 0.75rem; display: flex; flex-direction: column; gap: 0.25rem; }
.steps div { display: flex; align-items: center; gap: 0.375rem; }
.steps .ms { font-size: 0.9375rem; }
.steps .done { color: var(--ok); }
.steps code { font-size: 0.6875rem; background: var(--surface); border: 0.0625rem solid var(--line); border-radius: 0.25rem; padding: 0 0.25rem; }
.ship-card { border: 0.0625rem solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 0.625rem; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.75rem; }
.ship-card .top { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.ship-card .ref { margin-left: auto; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.ship-card .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.375rem 0.75rem; }
.ship-card .grid .k { color: var(--muted); font-size: 0.6875rem; }
.ask form { display: flex; gap: 0.375rem; padding: 0.75rem 1rem; border-top: 0.0625rem solid var(--line); }
.ask form .k-input { flex: 1; }
.caret::after { content: ''; display: inline-block; width: 0.4rem; height: 0.9rem; background: var(--accent); margin-left: 0.125rem; vertical-align: -0.125rem; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* dialogs */
dialog.k-dialog.wide { width: min(46rem, 94vw); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 0.375rem 1rem; font-size: 0.8125rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.stepper { display: flex; gap: 0.25rem; }
.stepper div { flex: 1; display: flex; flex-direction: column; gap: 0.375rem; font-size: 0.6875rem; color: var(--muted); font-weight: 600; }
.stepper div::before { content: ''; height: 0.3125rem; border-radius: 1rem; background: var(--line); }
.stepper div.on { color: var(--text); }
.stepper div.on::before { background: var(--accent); }
.photo { aspect-ratio: 4 / 3; border-radius: var(--radius-sm); display: grid; place-items: center; color: rgb(255 255 255 / 85%); position: relative; overflow: hidden; }
.photo .ms { font-size: 3rem; }
.photo small { position: absolute; left: 0.75rem; bottom: 0.625rem; font-size: 0.75rem; font-weight: 600; }
.sig { border: 0.0625rem dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.sig svg { display: block; width: 100%; height: 9rem; }
.sig path { fill: none; stroke: var(--text); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sig-cap { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); padding: 0.375rem 0.625rem; border-top: 0.0625rem solid var(--line); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sk 1.1s linear infinite; border-radius: var(--radius-sm); }
@keyframes sk { to { background-position: -200% 0; } }
.fade-in { animation: k-pop .3s ease-out both; }

.foot-badge { display: none; justify-content: center; padding-top: 0.5rem; }
@media (max-width: 40rem) {
  .foot-badge { display: flex; }
  .brand-txt { display: none; }
  .hero .logo { width: 2.75rem; height: 2.75rem; }
  .sources .sync { margin-left: 0; width: 100%; }
}
