/* DEJOIY Control. Layout: an ink side menu, a paper work area, white cards; tables become labelled cards on phones. */
:root {
	--ink: #121212;
	--ink-2: #2A2A28;
	--paper: #F3F2EE;
	--paper-2: #E9E7E1;
	--white: #FFFFFF;
	--lime: #D4FF3A;
	--lime-soft: #EEFFB8;
	--muted: #5C5A55;
	--line: #E2DFD8;
	--good: #1E7A3C;
	--good-bg: #E3F4E7;
	--warn: #9A4A06;
	--warn-bg: #FFF0DC;
	--bad: #B42318;
	--bad-bg: #FDE7E5;
	--info: #1D4ED8;
	--info-bg: #E5EDFF;
	--display: "Bricolage Grotesque", "DM Sans", system-ui, sans-serif;
	--ui: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	--side: 248px;
	--r: 14px;
	--ease: cubic-bezier(.16, 1, .3, 1);
	color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body.djc { background: var(--paper); color: var(--ink); font: 400 15px/1.5 var(--ui); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: var(--ink); }
img { max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--lime); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; letter-spacing: .02em; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stack { display: grid; gap: 14px; align-content: start; min-width: 0; }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--lime); color: var(--ink); font: 800 16px/1 var(--display); }
.logo-word { display: grid; font: 700 10.5px/1.1 var(--ui); letter-spacing: .12em; color: inherit; }
.logo-word b { font: 800 18px/1.05 var(--display); letter-spacing: -.01em; }

/* Frame */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--ink); color: var(--paper); padding: 18px 12px; overflow-y: auto; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 18px; }
.side-logo { color: var(--paper); text-decoration: none; }
.side .side-close { display: none; }
.side-nav { display: grid; gap: 2px; }
.side-group { margin: 16px 10px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; color: rgba(243, 242, 238, .5); }
.side-link { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: rgba(243, 242, 238, .82); text-decoration: none; font-weight: 500; transition: background .15s; }
.side-link:hover { background: rgba(255, 255, 255, .07); color: var(--paper); }
.side-link.is-on { background: var(--lime); color: var(--ink); font-weight: 700; }
.side-link .ic { width: 19px; height: 19px; flex: none; }
.nav-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: #FF7A1A; color: var(--ink); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.side-link.is-on .nav-badge { background: var(--ink); color: var(--lime); }
.side-foot { margin-top: auto; padding: 18px 8px 4px; display: grid; gap: 8px; border-top: 1px solid rgba(255, 255, 255, .1); }
.side-foot a { display: flex; align-items: center; gap: 8px; color: rgba(243, 242, 238, .7); text-decoration: none; font-size: 13.5px; }
.side-foot a:hover { color: var(--paper); }
.side-foot .ic { width: 15px; height: 15px; }
.side-scrim { display: none; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px clamp(16px, 3vw, 32px); background: rgba(243, 242, 238, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .menu-btn { display: none; }
.search { flex: 1; max-width: 560px; display: flex; align-items: center; gap: 8px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; min-height: 42px; }
.search:focus-within { border-color: var(--ink); }
.search .ic { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; outline: none; padding: 10px 0; }
.me { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.me-name { font-weight: 600; }
.role-chip { padding: 4px 10px; border-radius: 999px; background: var(--ink); color: var(--lime); font-size: 12px; font-weight: 700; white-space: nowrap; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); color: var(--ink); cursor: pointer; }
.icon-btn:hover { border-color: var(--ink); }
.content { padding: clamp(18px, 3vw, 32px); display: grid; gap: 18px; align-content: start; max-width: 1440px; width: 100%; }

/* Page head */
.ph { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.ph h1 { margin: 0; font: 800 clamp(26px, 2vw + 14px, 36px)/1.08 var(--display); letter-spacing: -.02em; text-wrap: balance; }
.ph p { margin: 6px 0 0; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Cards and grids */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(16px, 2vw, 22px); min-width: 0; }
.card h2 { margin: 0 0 12px; font: 700 17px/1.25 var(--ui); }
.card h3 { margin: 14px 0 6px; font: 700 14px/1.3 var(--ui); }
.card p { margin: 0 0 8px; }
.card-flush { padding: 0; overflow: hidden; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-h h2 { margin: 0; }
.card-h a { font-size: 13.5px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { display: grid; gap: 4px; padding: 16px 18px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--ink); min-width: 0; }
a.kpi:hover { border-color: var(--ink); }
.kpi-l { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi-v { font: 800 clamp(20px, 1vw + 14px, 28px)/1.1 var(--display); letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-h { font-size: 12.5px; color: var(--muted); }
.kpi-warn { background: var(--warn-bg); border-color: #F5D3A7; }

/* Tables */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 10px 14px; background: #FAF9F6; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #FCFBF8; }
.tbl a { text-decoration: none; }
.tbl a:hover { text-decoration: underline; text-underline-offset: 3px; }
.card:not(.card-flush) .tbl th, .card:not(.card-flush) .tbl td { padding-left: 4px; padding-right: 10px; }
.prod { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.prod img, .prod-ph { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--paper-2); flex: none; }
.prod-big { width: 100%; max-height: 280px; object-fit: contain; border-radius: 10px; background: var(--paper); margin-bottom: 12px; }

/* Chips */
.chip { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--paper-2); color: var(--ink-2); }
.chip-good { background: var(--good-bg); color: var(--good); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-bad { background: var(--bad-bg); color: var(--bad); }
.chip-info { background: var(--info-bg); color: var(--info); }
.chip-muted { background: var(--paper-2); color: var(--muted); }

/* Tabs, filters, pager */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tab { padding: 8px 14px; border-radius: 999px; background: var(--white); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.tab:hover { border-color: var(--ink); }
.tab.is-on { background: var(--ink); color: var(--lime); border-color: var(--ink); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters input, .filters select { min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); font: inherit; min-width: 0; }
.filters input { flex: 1 1 240px; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.pager .muted { margin-right: auto; font-size: 13px; }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); color: var(--ink); font: 600 14px/1 var(--ui); text-decoration: none; cursor: pointer; white-space: nowrap; transition: border-color .15s, background .15s, transform .1s; }
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--lime); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); }
.btn-danger { background: var(--white); color: var(--bad); border-color: #F2B8B3; }
.btn-danger:hover { background: var(--bad); color: var(--white); border-color: var(--bad); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-lg { min-height: 48px; font-size: 15.5px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.field { display: grid; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > span, .field > legend { font-size: 13.5px; font-weight: 700; padding: 0; }
.field em { font-style: normal; font-weight: 600; color: var(--warn); }
.field input, .field select, .field textarea, .inline-form input, .inline-form select { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid #D6D2C9; border-radius: 10px; background: var(--white); font: inherit; color: var(--ink); }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .inline-form input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(212, 255, 58, .55); }
.field-missing input { border-color: #F0B46A; background: #FFFBF4; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.inline-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 3px 0; }
.inline-form input, .inline-form select { width: auto; min-width: 130px; flex: 1 1 130px; min-height: 34px; padding: 6px 10px; font-size: 13.5px; }
.danger-zone { display: grid; gap: 10px; margin-top: 6px; padding: 14px; border-radius: 12px; background: var(--bad-bg); }

/* Flash and empty */
.flash { padding: 12px 16px; border-radius: 12px; font-weight: 600; }
.flash-success { background: var(--lime-soft); color: var(--ink); }
.flash-error { background: var(--bad-bg); color: var(--bad); }
.empty { padding: 36px 20px; text-align: center; }
.empty-t { margin: 0 0 4px; font: 700 16px/1.3 var(--ui); }
.note { padding: 10px 12px; border-radius: 10px; background: var(--paper); font-size: 13.5px; }

/* Facts, sums, timeline, links, shares */
.facts { margin: 0; display: grid; gap: 0; }
.facts > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); font-size: 13.5px; }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.sums { margin: 12px 0 0; display: grid; gap: 6px; max-width: 360px; margin-left: auto; }
.sums > div { display: flex; justify-content: space-between; gap: 12px; }
.sums dt { color: var(--muted); }
.sums dd { margin: 0; font-weight: 600; }
.sum-total { padding-top: 8px; border-top: 1px solid var(--line); font-size: 16px; }
.sum-total dt, .sum-total dd { color: var(--ink); font-weight: 800; }
.timeline { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; max-height: 360px; overflow-y: auto; }
.timeline li { padding: 10px 12px; border-radius: 10px; background: var(--paper); }
.timeline p { margin: 4px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.links { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.links a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.links a:hover { background: var(--paper); }
.links .ic { width: 15px; height: 15px; color: var(--muted); }
.shares { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.shares li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
.share-l { font-weight: 600; overflow-wrap: anywhere; }
.share-v { color: var(--muted); font-size: 13px; }
.share-bar { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.share-bar span { display: block; height: 100%; background: var(--ink); border-radius: 999px; }

/* Chart */
.chart-box { margin: 0; }
.chart-box figcaption { font-weight: 700; margin-bottom: 10px; }
.chart { width: 100%; height: auto; display: block; }
.chart-bar { fill: var(--ink); }
.chart-bar:hover { fill: #6B8A00; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-x, .chart-y { fill: var(--muted); font: 11px var(--ui); }

/* Sign in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--ink); }
.auth-card { width: min(420px, 100%); background: var(--white); border-radius: 20px; padding: 32px 28px; display: grid; gap: 14px; }
.auth-card h1 { margin: 10px 0 0; font: 800 28px/1.1 var(--display); letter-spacing: -.02em; }
.auth-card p { margin: 0; }
.auth-card .logo-word { color: var(--ink); }

/* Tablet and phone */
@media (max-width: 1100px) {
	.grid-main, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
	.app { grid-template-columns: 1fr; }
	.side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 60; transform: translateX(-102%); transition: transform .25s var(--ease); padding-top: max(18px, env(safe-area-inset-top)); }
	.side.is-open { transform: none; }
	.side .side-close { display: inline-grid; background: transparent; color: var(--paper); border-color: rgba(255, 255, 255, .2); }
	.side-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(18, 18, 18, .45); }
	.side.is-open + .side-scrim { display: block; }
	.top .menu-btn { display: inline-grid; }
	.me-name { display: none; }
}
@media (max-width: 720px) {
	.top { gap: 8px; padding: 10px 12px; }
	.role-chip { display: none; }
	.row-2, .row-3 { grid-template-columns: 1fr; }
	.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.facts > div { grid-template-columns: 1fr; gap: 2px; }
	.tbl thead { display: none; }
	.tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
	.tbl tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
	.tbl tbody tr:last-child { border-bottom: 0; }
	.tbl td, .card:not(.card-flush) .tbl td { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; padding: 5px 0; border: 0; }
	.tbl td::before { content: attr(data-label); font-size: 12px; font-weight: 700; color: var(--muted); padding-top: 2px; }
	.tbl .cell { min-width: 0; overflow-wrap: anywhere; }
	.tbl td[data-label=""] { grid-template-columns: 1fr; }
	.tbl td[data-label=""]::before { display: none; }
	.prod { min-width: 0; }
	.pager { justify-content: stretch; }
}
@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
}
