/* AW Cycles: a classic business web application look (top bar, side menu, kanban, lists), on top of demo.css tokens. */
.crm-page { max-width: 1320px; }
.erpapp {
	--erp: #714b67;
	--erp-ink: #ffffff;
	--erp-soft: color-mix(in srgb, var(--erp) 10%, var(--surface));
	--erp-side: color-mix(in srgb, var(--surface-2) 70%, var(--surface));
	border: 1px solid var(--border);
	border-radius: 10px;
	overflow: hidden;
	background: var(--surface);
	box-shadow: var(--shadow);
	font-size: .94rem;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .erpapp { --erp: #8f6585; } }
:root[data-theme="dark"] .erpapp { --erp: #8f6585; }

.erp-top { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; background: var(--erp); color: var(--erp-ink); flex-wrap: wrap; }
.erp-brand { font-size: 1.05rem; letter-spacing: .01em; white-space: nowrap; }
.erp-modules { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.erp-modules::-webkit-scrollbar { display: none; }
.erp-modules a { color: rgba(255, 255, 255, .86); text-decoration: none; padding: 0 12px; line-height: 48px; white-space: nowrap; }
.erp-modules a:hover, .erp-modules a[aria-current="true"] { background: rgba(0, 0, 0, .18); color: #fff; }
.erp-burger { display: none; width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; color: #fff; cursor: pointer; }
.erp-ask { flex: 0 1 360px; min-width: 200px; }
.erp-ask input { min-height: 34px; padding: 4px 12px; border-radius: 6px; border: 0; background: rgba(255, 255, 255, .95); color: #222; font-size: 15px; }
.erp-ask-panel { border-bottom: 1px solid var(--border); background: var(--surface); padding: 12px 16px; max-height: 70vh; overflow: auto; }
.erp-ask-panel h4 { margin: 10px 0 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.erp-ask-panel .ask-grid { display: grid; gap: 4px 20px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.ask-hit { display: block; width: 100%; padding: 6px 8px; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ask-hit:hover { background: var(--surface-2); }
.ask-hit small { color: var(--muted); }

.erp-body { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 620px; }
.erp-side { background: var(--erp-side); border-right: 1px solid var(--border); padding: 8px 0 16px; }
.erp-side-h { margin: 14px 16px 4px; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.erp-side a { display: block; padding: 7px 16px 7px 22px; color: var(--text); text-decoration: none; border-left: 3px solid transparent; }
.erp-side a:hover { background: var(--surface-2); }
.erp-side a[aria-current="page"] { background: var(--erp-soft); border-left-color: var(--erp); font-weight: 600; color: var(--erp); }
.erp-main { min-width: 0; padding: 0 0 20px; }

@media (max-width: 860px) {
	.erp-burger { display: inline-grid; place-items: center; }
	.erp-modules { display: none; }
	.erp-ask { flex: 1 1 100%; order: 3; padding-bottom: 8px; }
	.erp-body { grid-template-columns: minmax(0, 1fr); }
	.erp-side { position: absolute; z-index: 25; width: 240px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); display: none; }
	.erpapp.side-open .erp-side { display: block; }
	.erpapp { position: relative; }
}

/* control panel / breadcrumb row, as in classic back offices */
.erp-cp { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.erp-cp h2 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.erp-cp .crumb a { color: var(--erp); text-decoration: none; }
.erp-cp .spacer { flex: 1; }
.erp-cp select, .erp-cp input[type="search"], .erp-cp input[type="text"] { width: auto; min-height: 34px; padding: 4px 10px; border-radius: 6px; font-size: 15px; }
.erp-cp input[type="search"] { min-width: 220px; flex: 1 1 220px; }
.erp-sec { padding: 12px 16px; }
.erp-sec + .erp-sec { border-top: 1px solid var(--border); }
.erp-sec h3 { margin: 0 0 8px; font-size: .95rem; }
.erp-grid2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .erp-grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.erp-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.erp-btn.primary { background: var(--erp); border-color: var(--erp); color: #fff; }
.erp-btn:hover { filter: brightness(.97); }
.erp-pills { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.erp-pills::-webkit-scrollbar { display: none; }
.erp-pills .pill { min-height: 32px; font-size: .84rem; }

/* status badges */
.st { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.st.Draft { background: var(--surface-2); color: var(--muted); }
.st.Proposed { background: var(--accent-soft); color: var(--accent); }
.st.Confirmed { background: var(--good-soft); color: var(--good); }
.st.Rejected { background: var(--bad-soft); color: var(--bad); }
.sim { font-family: var(--mono); font-size: .76rem; color: var(--muted); }
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--erp); color: #fff; font-size: .66rem; font-weight: 700; flex: none; }

/* kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 10px; padding: 12px 16px; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
@media (max-width: 760px) { .kanban { grid-auto-columns: 82%; } }
.kcol { background: var(--surface-2); border-radius: 8px; padding: 8px; scroll-snap-align: start; min-height: 300px; }
.kcol h3 { display: flex; justify-content: space-between; align-items: baseline; margin: 2px 4px 8px; font-size: .95rem; }
.kcol h3 small { color: var(--muted); font-weight: 500; }
.kcard { display: block; width: 100%; text-align: left; margin-bottom: 8px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border); border-left: 4px solid var(--muted); background: var(--surface); color: inherit; font: inherit; cursor: pointer; }
.kcard:hover { border-color: var(--erp); }
.kcard.Proposed { border-left-color: var(--accent); }
.kcard.Confirmed { border-left-color: var(--good); }
.kcard.Rejected { border-left-color: var(--bad); }
.kcard .row1 { display: flex; justify-content: space-between; gap: 6px; font-weight: 700; }
.kcard .row2 { color: var(--muted); font-size: .84rem; }
.kcard .row3 { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.ktag { font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }

/* lists */
.erp-list { width: 100%; border-collapse: collapse; }
.erp-list th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.erp-list td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.erp-list tr.clickable { cursor: pointer; }
.erp-list tr.clickable:hover td { background: var(--surface-2); }
.erp-list .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
	.erp-list thead { display: none; }
	.erp-list, .erp-list tbody, .erp-list tr, .erp-list td { display: block; width: 100%; }
	.erp-list tr { padding: 8px 12px; border-bottom: 1px solid var(--border); }
	.erp-list td { border: 0; padding: 1px 0; }
	.erp-list .num { text-align: left; }
	.erp-list td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: .8rem; }
}

/* notes timeline */
.note { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); margin-bottom: 8px; }
.note .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .82rem; color: var(--muted); }
.note .subj { font-weight: 700; margin: 4px 0 2px; }
.note .near { margin-top: 8px; padding: 8px; border-radius: 6px; background: var(--surface-2); }
.note .near .note { margin: 6px 0 0; }
.tag-o { font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text); }
.tag-o.good { background: var(--good-soft); color: var(--good); }
.tag-o.bad { background: var(--bad-soft); color: var(--bad); }
.tag-o.warn { background: var(--warn-soft); color: var(--warn); }

/* dashboard */
.erp-kpis { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .erp-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.erp-kpi { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.erp-kpi small { color: var(--muted); font-size: .78rem; display: block; }
.erp-kpi b { font-size: 1.25rem; display: block; font-variant-numeric: tabular-nums; }
.period-box { padding: 10px 12px; border-radius: 8px; border: 1px dashed var(--erp); background: var(--erp-soft); }
.period-box .row { gap: 6px; }
.period-input { flex: 1 1 260px; min-height: 36px; }
.calstrip { display: grid; grid-template-columns: 44px repeat(53, minmax(0, 1fr)); gap: 1px; align-items: center; font-size: .72rem; color: var(--muted); margin-top: 8px; }
.calstrip i { display: block; height: 14px; border-radius: 2px; background: var(--surface-2); }
.calstrip .mlabels { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(12, 1fr); font-size: .66rem; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 3px 0; font-size: .88rem; }
.hbar .bar { height: 10px; }
.chart svg { width: 100%; height: auto; display: block; }

/* treemap */
.tm-wrap { position: relative; width: 100%; height: 440px; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
@media (max-width: 760px) { .tm-wrap { height: 380px; } }
.tm-rect { position: absolute; box-sizing: border-box; border: 2px solid var(--surface); padding: 6px 8px; color: #fff; overflow: hidden; cursor: pointer; text-align: left; font: inherit; }
.tm-rect b { display: block; font-size: .92rem; line-height: 1.2; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.tm-rect span { font-size: .78rem; opacity: .92; }
.tm-rect[aria-pressed="true"] { outline: 3px solid var(--text); outline-offset: -3px; }
.tm-rect.others { color: var(--text); }
.tm-rect.tiny { padding: 0; border-width: 1px; }
.histo { display: flex; align-items: flex-end; gap: 1px; height: 40px; margin-top: 4px; position: relative; }
.histo i { flex: 1; background: color-mix(in srgb, var(--erp) 55%, transparent); border-radius: 1px 1px 0 0; }
.histo .cut { position: absolute; top: -2px; bottom: 0; width: 2px; background: var(--bad); }
.labels-box { min-height: 130px; font-size: 15px; }

/* detail */
.erp-form { display: grid; gap: 4px 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.erp-form div { padding: 4px 0; border-bottom: 1px dotted var(--border); }
.erp-form small { display: block; color: var(--muted); font-size: .76rem; }
.sugg { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.sugg small { color: var(--muted); grid-column: 1 / -1; }
.reason { padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); margin-bottom: 8px; }
