/* Loomwork console mockup: clickable views. Loaded after styles.css. Motion: transform/opacity only. */

.dash [hidden] { display: none !important; }
.cv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.dash button { font: inherit; color: inherit; cursor: pointer; }
.dash button:focus-visible, .bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Sidebar tabs ---------- */
.cv-tabs { display: grid; gap: 2px; }
.cv-tabs button { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--muted); transition: color .2s; }
.cv-tabs button:hover { color: var(--ink); }
.cv-tabs button[aria-selected="true"] { background: var(--white); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }

/* ---------- Views ---------- */
.dash-main { min-height: 520px; }
.view:not([hidden]) { animation: cvIn .4s var(--ease) both; }
@keyframes cvIn { from { opacity: 0; transform: translateY(8px); } }
.dash-top { gap: 12px; flex-wrap: wrap; }
.cv-top-r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.cv-foot { margin-top: 14px; font: 400 11.5px/1.5 var(--mono); color: var(--muted); }

/* segmented control (period + filter) */
.seg { display: inline-flex; padding: 3px; border-radius: 99px; background: #F2F1EC; box-shadow: inset 0 0 0 1px var(--line); }
.seg button { border: 0; background: none; padding: 6px 11px; border-radius: 99px; font-size: 12.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--white); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(22,23,27,.06); }

/* ---------- Chart: transform-only bars so period changes glide ---------- */
.chart { position: relative; }
.bar { cursor: pointer; border-radius: 6px; transition: opacity .3s var(--ease); }
.bar i, .bar em { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; margin: 0; }
.bar i { border-radius: 5px 5px 0 0 / calc(5px / var(--h)) calc(5px / var(--h)) 0 0; }
.bar em { border-radius: 5px 5px 0 0 / calc(5px / var(--e)) calc(5px / var(--e)) 0 0; transform: translateY(0) scaleY(0); }
.dash.is-in .bar i { transform: scaleY(var(--h)); }
.dash.is-in .bar em { transform: translateY(calc(var(--h) * -100% - 2px)) scaleY(var(--e)); }
.bars.has-tip .bar:not(.is-tip) { opacity: .4; }
.bar-tip { position: absolute; top: 0; left: 0; z-index: 2; display: grid; gap: 2px; padding: 8px 11px; border-radius: 10px; background: var(--ink); color: #F2F2F5; font: 400 12px/1.35 var(--mono); pointer-events: none; white-space: nowrap; box-shadow: 0 10px 24px -12px rgba(22,23,27,.5); }
.bar-tip b { font: 500 12.5px/1.3 var(--sans); }
.bar-tip small { color: #8E9099; font-size: 10.5px; }

/* ---------- Switch ---------- */
.sw { position: relative; flex: none; width: 36px; height: 20px; border: 0; border-radius: 99px; background: #D3D2CC; padding: 0; transition: background-color .25s; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(22,23,27,.2); transition: transform .3s var(--ease); }
.sw[aria-checked="true"] { background: var(--accent); }
.sw[aria-checked="true"]::after { transform: translateX(16px); }

/* ---------- Agents ---------- */
.ag-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ag { border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); padding: 16px; display: grid; gap: 10px; align-content: start; }
.ag-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ag-h b { font-weight: 500; }
.ag > p { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.ag-st { display: flex; align-items: center; gap: 7px; font: 500 12px/1 var(--mono); color: #2D7A55; }
.ag-st i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.ag.is-off .ag-st { color: var(--muted); }
.ag.is-off .ag-st i { background: #B9BAC2; }
.ag dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 0; padding-top: 12px; border-top: 1px solid var(--paper-2); transition: opacity .3s; }
.ag.is-off dl { opacity: .45; }
.ag dt { font: 400 11px/1 var(--mono); color: var(--muted); }
.ag dd { margin: 6px 0 0; font-size: 22px; font-weight: 500; letter-spacing: -.02em; }
.ag small { font: 400 11px/1 var(--mono); color: #A3A4AA; }

/* ---------- Approvals ---------- */
.ap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ap { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; padding: 14px 16px; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); transition: opacity .35s var(--ease), transform .45s var(--ease); }
.ap b { font-weight: 500; }
.ap p { font-size: 13.5px; color: var(--muted); }
.ap small { font: 400 11px/1 var(--mono); color: #A3A4AA; }
.ap.is-out { opacity: 0; }
.ap.is-yes { transform: translateX(28px); }
.ap.is-no { transform: translateX(-28px); }
.ap-act { display: flex; gap: 8px; }
.btn-s { border: 0; padding: 8px 14px; border-radius: 99px; background: var(--white); box-shadow: inset 0 0 0 1px var(--line); font-size: 13px !important; font-weight: 500 !important; transition: opacity .2s; }
.btn-s:hover { opacity: .8; }
.btn-s.is-pri { background: var(--ink); color: var(--white) !important; box-shadow: none; }
.ap-empty { text-align: center; padding: 56px 20px; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 6px; justify-items: center; }
.ap-empty b { font-weight: 500; font-size: 17px; }
.ap-empty p { color: var(--muted); font-size: 14px; }
.lnk { margin-top: 8px; border: 0; background: none; padding: 4px; color: var(--accent-ink) !important; text-decoration: underline; text-underline-offset: 3px; font-size: 14px !important; }

/* ---------- Activity log ---------- */
.alog { list-style: none; margin: 0; padding: 0; }
.alog li { display: grid; grid-template-columns: 82px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--paper-2); font-size: 13.5px; transition: transform .45s var(--ease); }
.alog li:first-child { border-top: 0; }
.alog li[hidden] { display: none; }
.alog p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alog small { font: 400 11.5px/1 var(--mono); color: var(--muted); }
.alog .is-new { animation: cvNew .6s var(--ease) both; }
@keyframes cvNew { from { opacity: 0; transform: translateY(-10px); } }
.st.no { background: #EFEEEA; color: var(--muted); }

/* ---------- Rules ---------- */
.rules { list-style: none; margin: 0; padding: 0; }
.rules li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 2px; border-top: 1px solid var(--paper-2); font-size: 14.5px; }
.rules li:first-child { border-top: 0; }
.rules b { font-weight: 500; }

/* ---------- Connections ---------- */
.cn-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cn { display: grid; gap: 8px; justify-items: start; text-align: left; padding: 14px; border: 0; border-radius: 14px; background: var(--white); box-shadow: inset 0 0 0 1px var(--line); transition: opacity .2s; }
.cn:hover { opacity: .85; }
.cn-ic { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: #F2F1EC; font: 500 11px/1 var(--mono); color: var(--muted); }
.cn[aria-pressed="true"] .cn-ic { background: var(--accent-soft); color: var(--accent-ink); }
.cn b { font-weight: 500; font-size: 14px; }
.cn small { display: flex; align-items: center; gap: 6px; font: 400 11.5px/1 var(--mono); color: var(--muted); }
.cn small::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #B9BAC2; }
.cn[aria-pressed="true"] small { color: #2D7A55; }
.cn[aria-pressed="true"] small::before { background: var(--ok); }
.cn.is-busy small { color: var(--accent-ink); }
.cn.is-busy small::before { background: var(--accent); animation: cvPulse .8s ease-in-out infinite alternate; }
@keyframes cvPulse { to { opacity: .25; } }

/* ---------- Tablet and phone: sidebar becomes a tab row ---------- */
@media (max-width: 980px) {
  .dash-side { display: block; min-width: 0; padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .dash-brand, .dash-note { display: none; }
  .cv-tabs { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .cv-tabs::-webkit-scrollbar { display: none; }
  .cv-tabs button { flex: none; white-space: nowrap; }
  .dash-main { min-height: 0; }
  .ag-grid { grid-template-columns: 1fr; }
  .cn-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .dash-main { padding: 16px; }
  .seg button { padding: 6px 9px; font-size: 12px; }
  .ap { grid-template-columns: 1fr; gap: 12px; }
  .alog li { grid-template-columns: 74px 1fr auto; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .view:not([hidden]), .alog .is-new, .cn.is-busy small::before { animation: none; }
  .bar i, .bar em, .ap, .alog li, .sw::after { transition: none; }
}
