/* Inventory Manager — UI layer (assets list, details, edit form).
   Everything is scoped under .ncn-ui so wp-admin and theme styles don't leak in. */

.ncn-ui {
	--ui-bg: #ffffff;
	--ui-bg-soft: #f6f7f9;
	--ui-border: #e3e6eb;
	--ui-border-strong: #cfd4dc;
	--ui-text: #1b2230;
	--ui-muted: #667085;
	--ui-primary: #2457d6;
	--ui-primary-dark: #1b44ab;
	--ui-primary-soft: #eaf0fd;
	--ui-danger: #c0362c;
	--ui-radius: 12px;
	--ui-radius-sm: 8px;
	--ui-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
	--ui-shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);

	box-sizing: border-box;
	color: var(--ui-text);
	font-size: 14px;
	line-height: 1.5;
	max-width: none;
	width: 100%;
	margin: 0;
}
.ncn-ui *, .ncn-ui *::before, .ncn-ui *::after { box-sizing: border-box; }
.ncn-ui [hidden] { display: none !important; }
.ncn-ui a { color: var(--ui-primary); text-decoration: none; }
.ncn-ui a:hover { color: var(--ui-primary-dark); }
.ncn-ui code { background: var(--ui-bg-soft); border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }
.ncn-ui .ncn-ui-icon { width: 18px; height: 18px; flex: 0 0 auto; }
.ncn-ui .ncn-ui-muted { color: var(--ui-muted); }
.ncn-ui .screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Buttons ---------- */
.ncn-ui .ncn-ui-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 7px;
	min-height: 38px; padding: 0 14px;
	background: var(--ui-bg); color: var(--ui-text);
	border: 1px solid var(--ui-border-strong); border-radius: var(--ui-radius-sm);
	font: inherit; font-weight: 600; font-size: 13.5px; line-height: 1; cursor: pointer;
	text-decoration: none; box-shadow: var(--ui-shadow); white-space: nowrap;
	transition: background .12s, border-color .12s, box-shadow .12s;
}
.ncn-ui .ncn-ui-btn:hover { background: var(--ui-bg-soft); color: var(--ui-text); border-color: #b8bfca; }
.ncn-ui .ncn-ui-btn:focus-visible, .ncn-ui .ncn-ui-input:focus, .ncn-ui .ncn-ui-select:focus, .ncn-ui .ncn-ui-tab:focus-visible {
	outline: 2px solid var(--ui-primary); outline-offset: 1px;
}
.ncn-ui .ncn-ui-btn--primary { background: var(--ui-primary); border-color: var(--ui-primary); color: #fff; }
.ncn-ui .ncn-ui-btn--primary:hover { background: var(--ui-primary-dark); border-color: var(--ui-primary-dark); color: #fff; }
.ncn-ui .ncn-ui-btn--danger { color: var(--ui-danger); }
.ncn-ui .ncn-ui-btn--danger:hover { background: #fdf0ef; border-color: #eab3ae; color: var(--ui-danger); }
.ncn-ui .ncn-ui-btn--sm { min-height: 32px; padding: 0 10px; font-size: 12.5px; }
.ncn-ui .ncn-ui-btn--icon { width: 36px; min-height: 36px; padding: 0; list-style: none; }
.ncn-ui summary.ncn-ui-btn::-webkit-details-marker { display: none; }

/* ---------- Page heading ---------- */
.ncn-ui .ncn-ui-pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 6px 0 18px; flex-wrap: wrap; }
.ncn-ui .ncn-ui-title { margin: 0; padding: 0; font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; color: var(--ui-text); }
.ncn-ui .ncn-ui-sub { margin: 4px 0 0; color: var(--ui-muted); }
.ncn-ui .ncn-ui-back { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 8px; font-weight: 600; font-size: 13px; color: var(--ui-muted); }
.ncn-ui .ncn-ui-back:hover { color: var(--ui-text); }
.ncn-ui .ncn-ui-tagcode { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- Cards ---------- */
.ncn-ui .ncn-ui-card { background: var(--ui-bg); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); padding: 20px; margin: 0 0 18px; }
.ncn-ui .ncn-ui-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.ncn-ui .ncn-ui-card__title { display: flex; align-items: center; gap: 9px; margin: 0; padding: 0; font-size: 15px; font-weight: 700; color: var(--ui-text); }
.ncn-ui .ncn-ui-card__title .ncn-ui-icon { color: var(--ui-primary); }
.ncn-ui .ncn-ui-card__desc, .ncn-ui .ncn-ui-card__hint { margin: 2px 0 0; color: var(--ui-muted); font-size: 12.5px; }

/* ---------- Summary cards ---------- */
.ncn-ui .ncn-ui-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.ncn-ui .ncn-ui-stat { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--ui-bg); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); color: var(--ui-text); transition: transform .12s, box-shadow .12s, border-color .12s; }
.ncn-ui .ncn-ui-stat:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,24,40,.1); color: var(--ui-text); }
.ncn-ui .ncn-ui-stat.is-active { border-color: var(--stat-c); box-shadow: 0 0 0 1px var(--stat-c), var(--ui-shadow); }
.ncn-ui .ncn-ui-stat__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--stat-bg); color: var(--stat-c); flex: 0 0 auto; }
.ncn-ui .ncn-ui-stat__icon .ncn-ui-icon { width: 22px; height: 22px; }
.ncn-ui .ncn-ui-stat__body { display: flex; flex-direction: column; min-width: 0; }
.ncn-ui .ncn-ui-stat__num { font-size: 26px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.ncn-ui .ncn-ui-stat__label { color: var(--ui-muted); font-size: 12.5px; font-weight: 600; }
.ncn-ui .ncn-ui-stat--total { --stat-c: #2457d6; --stat-bg: #eaf0fd; }
.ncn-ui .ncn-ui-stat--assigned { --stat-c: #0b7a8f; --stat-bg: #e1f5f8; }
.ncn-ui .ncn-ui-stat--in_stock { --stat-c: #14804a; --stat-bg: #e3f6ec; }
.ncn-ui .ncn-ui-stat--damaged { --stat-c: #c2410c; --stat-bg: #ffedd9; }
.ncn-ui .ncn-ui-stat--retired { --stat-c: #5b6472; --stat-bg: #eceef2; }

/* ---------- Status badges (larger, colour-coded) ---------- */
.ncn-ui .ncn-ui-badge, .ncn-ui-badge.ncn-im-status {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 5px 12px 5px 9px; border-radius: 999px; border: 1px solid var(--b-bd, #cfd4dc);
	background: var(--b-bg, #eef0f3); color: var(--b-fg, #3b4352);
	font-size: 13px; font-weight: 700; line-height: 1.2; white-space: nowrap;
}
.ncn-ui .ncn-ui-badge .ncn-ui-icon { width: 15px; height: 15px; }
.ncn-ui .ncn-ui-badge--lg { padding: 7px 16px 7px 12px; font-size: 15px; }
.ncn-ui .ncn-ui-badge--lg .ncn-ui-icon { width: 18px; height: 18px; }
.ncn-ui .ncn-im-status-in_stock { --b-bg: #e3f6ec; --b-fg: #0f6a3d; --b-bd: #9fd8b9; }
.ncn-ui .ncn-im-status-assigned { --b-bg: #e1f5f8; --b-fg: #0a6577; --b-bd: #97d3de; }
.ncn-ui .ncn-im-status-in_repair { --b-bg: #fff3d6; --b-fg: #8a5a00; --b-bd: #f0cf80; }
.ncn-ui .ncn-im-status-damaged { --b-bg: #ffe6d1; --b-fg: #a2380a; --b-bd: #f4b78c; }
.ncn-ui .ncn-im-status-on_loan { --b-bg: #efe7fb; --b-fg: #5b2db0; --b-bd: #cdb7f0; }
.ncn-ui .ncn-im-status-lost { --b-bg: #fde4e2; --b-fg: #a3231a; --b-bd: #f0aaa5; }
.ncn-ui .ncn-im-status-retired { --b-bg: #eceef2; --b-fg: #4a5262; --b-bd: #c9ced8; }
.ncn-ui .ncn-im-status-disposed { --b-bg: #dfe2e8; --b-fg: #2b323f; --b-bd: #b3b9c5; }

.ncn-ui .ncn-ui-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: #e3f6ec; color: #0f6a3d; }
.ncn-ui .ncn-ui-pill--soon { background: #fff3d6; color: #8a5a00; }
.ncn-ui .ncn-ui-pill--expired { background: #fde4e2; color: #a3231a; }

/* ---------- Toolbar ---------- */
.ncn-ui .ncn-ui-toolbar { background: var(--ui-bg); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); padding: 14px; margin: 0 0 12px; }
.ncn-ui .ncn-ui-toolbar__main { display: flex; gap: 10px; align-items: center; }
.ncn-ui .ncn-ui-search { position: relative; flex: 1; display: block; margin: 0; }
.ncn-ui .ncn-ui-search > .ncn-ui-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ui-muted); pointer-events: none; z-index: 1; }
.ncn-ui .ncn-ui-search .ncn-im-ac-wrap { display: block; width: 100%; }
.ncn-ui .ncn-ui-search .ncn-ui-input { padding-left: 38px; }
.ncn-ui .ncn-ui-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 12px; }
.ncn-ui .ncn-ui-filter { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.ncn-ui .ncn-ui-filter > span { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ui-muted); }
.ncn-ui .ncn-ui-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--ui-primary); color: #fff; font-size: 11px; font-weight: 700; }
.ncn-ui .ncn-ui-tab .ncn-ui-count { background: var(--ui-bg-soft); color: var(--ui-muted); border: 1px solid var(--ui-border); }

.ncn-ui .ncn-ui-input, .ncn-ui .ncn-ui-select, .ncn-ui select.ncn-ui-select, .ncn-ui textarea.ncn-ui-input {
	display: block; width: 100%; max-width: none; min-height: 40px; margin: 0; padding: 8px 12px;
	background: #fff; color: var(--ui-text); border: 1px solid var(--ui-border-strong); border-radius: var(--ui-radius-sm);
	font: inherit; font-size: 14px; line-height: 1.4; box-shadow: none;
}
.ncn-ui textarea.ncn-ui-input { min-height: 90px; resize: vertical; }
.ncn-ui .ncn-ui-input--xs { width: 80px; min-height: 32px; display: inline-block; }
.ncn-ui input[type="file"].ncn-ui-input { padding: 7px 10px; }

.ncn-ui .ncn-ui-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.ncn-ui .ncn-ui-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 12px; background: var(--ui-primary-soft); color: var(--ui-primary-dark); border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.ncn-ui .ncn-ui-chip .ncn-ui-icon { width: 14px; height: 14px; }
.ncn-ui .ncn-ui-chip:hover { background: #d8e3fb; }
.ncn-ui .ncn-ui-chips__clear { font-size: 12.5px; font-weight: 600; }

/* filter toggle only exists on small screens */
.ncn-ui .ncn-ui-filter-toggle { display: none !important; }

/* ---------- Bulk bar ---------- */
.ncn-ui .ncn-ui-bulkbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; padding: 10px 14px; margin: 0 0 12px; background: var(--ui-bg-soft); border: 1px dashed var(--ui-border-strong); border-radius: var(--ui-radius); }
.ncn-ui .ncn-ui-bulkbar__count { font-weight: 600; color: var(--ui-muted); }
.ncn-ui .ncn-ui-bulkbar__count.is-active { color: var(--ui-primary-dark); }
.ncn-ui .ncn-ui-bulkbar__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.ncn-ui .ncn-ui-bulkbar__note { flex-basis: 100%; font-size: 12.5px; color: var(--ui-muted); }
.ncn-ui .ncn-ui-inline-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ui-muted); }

/* ---------- Tables ---------- */
.ncn-ui .ncn-ui-tablewrap { background: var(--ui-bg); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); overflow: visible; }
.ncn-ui table.ncn-ui-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0; border: 0; background: transparent; }
.ncn-ui .ncn-ui-table th { padding: 11px 16px; text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ui-muted); background: var(--ui-bg-soft); border-bottom: 1px solid var(--ui-border); }
.ncn-ui .ncn-ui-table thead th:first-child { border-top-left-radius: var(--ui-radius); }
.ncn-ui .ncn-ui-table thead th:last-child { border-top-right-radius: var(--ui-radius); }
.ncn-ui .ncn-ui-table td { padding: 12px 16px; vertical-align: middle; border-bottom: 1px solid var(--ui-border); background: transparent; color: var(--ui-text); }
.ncn-ui .ncn-ui-table tbody tr:last-child td { border-bottom: 0; }
.ncn-ui .ncn-ui-table tbody tr:hover td { background: #fafbfc; }
.ncn-ui .ncn-ui-col-asset { width: 34%; }
.ncn-ui .ncn-ui-col-check { width: 36px; padding-right: 0 !important; }
.ncn-ui .ncn-ui-col-actions { width: 60px; text-align: right !important; }
.ncn-ui .ncn-ui-date { white-space: nowrap; }
.ncn-ui .ncn-ui-iconline { display: inline-flex; align-items: center; gap: 6px; }
.ncn-ui .ncn-ui-iconline .ncn-ui-icon { width: 15px; height: 15px; color: var(--ui-muted); }

.ncn-ui .ncn-ui-asset { display: flex; align-items: center; gap: 14px; color: var(--ui-text); min-width: 220px; }
.ncn-ui .ncn-ui-asset strong { display: block; font-size: 14.5px; font-weight: 700; color: var(--ui-text); }
.ncn-ui .ncn-ui-asset:hover strong { color: var(--ui-primary); }
.ncn-ui .ncn-ui-asset__meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 2px; color: var(--ui-muted); font-size: 12.5px; }
.ncn-ui .ncn-ui-asset__meta .ncn-ui-tagcode { color: var(--ui-text); }
.ncn-ui .ncn-ui-thumb { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; border: 1px solid var(--ui-border); background: var(--ui-bg-soft); flex: 0 0 auto; display: block; max-width: none; }
.ncn-ui .ncn-ui-thumb--empty { display: grid; place-items: center; color: #98a1b0; }
.ncn-ui .ncn-ui-thumb--empty .ncn-ui-icon { width: 24px; height: 24px; }

/* ---------- Row action menu ---------- */
.ncn-ui .ncn-ui-menu { position: relative; display: inline-block; text-align: left; }
.ncn-ui .ncn-ui-menu__list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; padding: 6px; background: #fff; border: 1px solid var(--ui-border); border-radius: 10px; box-shadow: var(--ui-shadow-lg); }
.ncn-ui .ncn-ui-menu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 7px; background: none; color: var(--ui-text); font: inherit; font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer; }
.ncn-ui .ncn-ui-menu__item:hover, .ncn-ui .ncn-ui-menu__item:focus-visible { background: var(--ui-bg-soft); color: var(--ui-text); outline: none; }
.ncn-ui .ncn-ui-menu__item .ncn-ui-icon { color: var(--ui-muted); }

/* ---------- Pagination ---------- */
.ncn-ui .ncn-ui-pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 14px 2px; color: var(--ui-muted); }
.ncn-ui .ncn-ui-pager__links { display: inline-flex; gap: 4px; align-items: center; }
.ncn-ui .ncn-ui-pager__link { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid var(--ui-border); border-radius: 8px; background: #fff; color: var(--ui-text); font-weight: 600; }
.ncn-ui a.ncn-ui-pager__link:hover { background: var(--ui-bg-soft); }
.ncn-ui .ncn-ui-pager__link.is-current { background: var(--ui-primary); border-color: var(--ui-primary); color: #fff; }

/* ---------- Empty state ---------- */
.ncn-ui .ncn-ui-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 16px; text-align: center; color: var(--ui-muted); }
.ncn-ui .ncn-ui-empty .ncn-ui-icon { width: 38px; height: 38px; color: #aab2c0; }
.ncn-ui .ncn-ui-empty strong { color: var(--ui-text); font-size: 15px; }
.ncn-ui .ncn-ui-empty p { margin: 0 0 6px; }

/* ---------- Detail hero ---------- */
.ncn-ui .ncn-ui-hero { display: flex; gap: 22px; align-items: flex-start; }
.ncn-ui .ncn-ui-hero__img { display: grid; place-items: center; width: 132px; height: 132px; padding: 0; overflow: hidden; border: 1px solid var(--ui-border); border-radius: 16px; background: var(--ui-bg-soft); cursor: zoom-in; }
.ncn-ui .ncn-ui-hero__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ncn-ui .ncn-ui-hero__img--empty { flex-direction: column; gap: 4px; color: var(--ui-muted); cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; border-style: dashed; }
.ncn-ui .ncn-ui-hero__img--empty .ncn-ui-icon { width: 30px; height: 30px; }
.ncn-ui .ncn-ui-hero__main { flex: 1; min-width: 0; }
.ncn-ui .ncn-ui-hero__title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.ncn-ui .ncn-ui-hero__title h2 { margin: 0; padding: 0; font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; color: var(--ui-text); }
.ncn-ui .ncn-ui-hero__meta { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin: 10px 0 16px; color: var(--ui-muted); }
.ncn-ui .ncn-ui-tagchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border: 1px solid var(--ui-border-strong); border-radius: 8px; background: #fff; color: var(--ui-text); cursor: pointer; font: inherit; }
.ncn-ui .ncn-ui-tagchip code { background: none; padding: 0; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ncn-ui .ncn-ui-tagchip.is-copied { border-color: #14804a; background: #e3f6ec; }
.ncn-ui .ncn-ui-hero__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ncn-ui .ncn-ui-menu--right .ncn-ui-menu__list { right: 0; }

/* ---------- Lifecycle ---------- */
.ncn-ui .ncn-ui-lifecycle { display: flex; list-style: none; margin: 4px 0 0; padding: 0; }
.ncn-ui .ncn-ui-lifecycle__step { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; min-width: 0; padding: 0 4px; margin: 0; }
.ncn-ui .ncn-ui-lifecycle__step::after { content: ""; position: absolute; top: 20px; left: calc(50% + 24px); right: calc(-50% + 24px); height: 3px; border-radius: 2px; background: var(--ui-border); }
.ncn-ui .ncn-ui-lifecycle__step:last-child::after { display: none; }
.ncn-ui .ncn-ui-lifecycle__step.is-linked::after { background: #14804a; }
.ncn-ui .ncn-ui-lifecycle__dot { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #fff; border: 2px solid var(--ui-border-strong); color: #98a1b0; z-index: 1; }
.ncn-ui .ncn-ui-lifecycle__step.is-done .ncn-ui-lifecycle__dot { background: #14804a; border-color: #14804a; color: #fff; }
.ncn-ui .ncn-ui-lifecycle__step.is-current .ncn-ui-lifecycle__dot { background: var(--ui-primary); border-color: var(--ui-primary); color: #fff; box-shadow: 0 0 0 5px var(--ui-primary-soft); }
.ncn-ui .ncn-ui-lifecycle__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ncn-ui .ncn-ui-lifecycle__text strong { font-size: 13px; color: var(--ui-muted); }
.ncn-ui .ncn-ui-lifecycle__step.is-done strong, .ncn-ui .ncn-ui-lifecycle__step.is-current strong { color: var(--ui-text); }
.ncn-ui .ncn-ui-lifecycle__now { font-style: normal; font-size: 11px; font-weight: 700; color: var(--ui-primary); text-transform: uppercase; letter-spacing: .05em; }
.ncn-ui .ncn-ui-lifecycle__text small { color: var(--ui-muted); font-size: 11.5px; }

/* ---------- Tabs ---------- */
.ncn-ui .ncn-ui-tablist { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--ui-border); margin: 0 0 18px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.ncn-ui .ncn-ui-tablist::-webkit-scrollbar { display: none; }
.ncn-ui .ncn-ui-tab { display: inline-flex; align-items: center; gap: 8px; padding: 11px 14px; margin: 0 0 -1px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--ui-muted); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ncn-ui .ncn-ui-tab:hover { color: var(--ui-text); }
.ncn-ui .ncn-ui-tab[aria-selected="true"] { color: var(--ui-primary); border-bottom-color: var(--ui-primary); }
.ncn-ui .ncn-ui-tabs.is-ready .ncn-ui-tabpanel { display: none; }
.ncn-ui .ncn-ui-tabs.is-ready .ncn-ui-tabpanel.is-active { display: block; }
.ncn-ui .ncn-ui-tabs:not(.is-ready) .ncn-ui-tablist { display: none; }

/* ---------- Overview ---------- */
.ncn-ui .ncn-ui-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; align-items: start; }
.ncn-ui .ncn-ui-grid .ncn-ui-card { margin: 0; }
.ncn-ui .ncn-ui-card--wide { grid-column: 1 / -1; }
.ncn-ui dl.ncn-ui-dl { margin: 0; }
.ncn-ui .ncn-ui-dl__row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--ui-border); }
.ncn-ui .ncn-ui-dl__row:last-child { border-bottom: 0; }
.ncn-ui .ncn-ui-dl dt { margin: 0; color: var(--ui-muted); font-weight: 500; flex: 0 0 40%; }
.ncn-ui .ncn-ui-dl dd { margin: 0; text-align: right; font-weight: 600; word-break: break-word; }
.ncn-ui .ncn-ui-prose { white-space: normal; }
.ncn-ui .ncn-ui-meter { margin-top: 14px; }
.ncn-ui .ncn-ui-meter__bar { height: 8px; border-radius: 4px; background: var(--ui-border); overflow: hidden; }
.ncn-ui .ncn-ui-meter__bar span { display: block; height: 100%; background: var(--ui-primary); border-radius: 4px; }
.ncn-ui .ncn-ui-meter__text { margin: 6px 0 0; color: var(--ui-muted); font-size: 12.5px; }

/* ---------- Timeline ---------- */
.ncn-ui .ncn-ui-timeline { list-style: none; margin: 0; padding: 0; }
.ncn-ui .ncn-ui-timeline__day { margin: 18px 0 8px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ui-muted); }
.ncn-ui .ncn-ui-timeline__day:first-child { margin-top: 0; }
.ncn-ui .ncn-ui-timeline__item { position: relative; display: flex; gap: 14px; padding: 0 0 20px; margin: 0; --t-c: #5b6472; --t-bg: #eceef2; }
.ncn-ui .ncn-ui-timeline__item::before { content: ""; position: absolute; left: 17px; top: 38px; bottom: 0; width: 2px; background: var(--ui-border); }
.ncn-ui .ncn-ui-timeline__item:last-child::before { display: none; }
.ncn-ui .tone-green { --t-c: #14804a; --t-bg: #e3f6ec; }
.ncn-ui .tone-blue { --t-c: #2457d6; --t-bg: #eaf0fd; }
.ncn-ui .tone-teal { --t-c: #0b7a8f; --t-bg: #e1f5f8; }
.ncn-ui .tone-purple { --t-c: #6a38c7; --t-bg: #efe7fb; }
.ncn-ui .tone-amber { --t-c: #a16207; --t-bg: #fff3d6; }
.ncn-ui .tone-indigo { --t-c: #4338ca; --t-bg: #e8e8fc; }
.ncn-ui .tone-dark { --t-c: #2b323f; --t-bg: #dfe2e8; }
.ncn-ui .ncn-ui-timeline__dot { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--t-bg); color: var(--t-c); flex: 0 0 auto; }
.ncn-ui .ncn-ui-timeline__body { flex: 1; min-width: 0; padding-top: 2px; }
.ncn-ui .ncn-ui-timeline__top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ncn-ui .ncn-ui-timeline__top strong { font-size: 14.5px; }
.ncn-ui .ncn-ui-timeline__top time, .ncn-ui .ncn-ui-timeline__by { color: var(--ui-muted); font-size: 12.5px; }
.ncn-ui .ncn-ui-timeline__detail { margin-top: 3px; font-weight: 500; }
.ncn-ui .ncn-ui-timeline__note { margin: 8px 0 0; padding: 8px 12px; background: var(--ui-bg-soft); border-left: 3px solid var(--ui-border-strong); border-radius: 0 8px 8px 0; color: var(--ui-text); }
.ncn-ui .ncn-ui-changes { list-style: none; margin: 10px 0 0; padding: 10px 12px; background: var(--ui-bg-soft); border-radius: 10px; display: grid; gap: 7px; }
.ncn-ui .ncn-ui-changes li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0; font-size: 13px; }
.ncn-ui .ncn-ui-changes__field { font-weight: 700; min-width: 130px; }
.ncn-ui .ncn-ui-changes__arrow { color: var(--ui-muted); }
.ncn-ui .ncn-ui-val { display: inline-block; max-width: 100%; padding: 1px 8px; border-radius: 6px; font-size: 12.5px; word-break: break-word; }
.ncn-ui .ncn-ui-val--old { background: #fde9e7; color: #8f2a22; text-decoration: line-through; text-decoration-color: rgba(143, 42, 34, .45); }
.ncn-ui .ncn-ui-val--new { background: #e3f6ec; color: #0f6a3d; }

/* ---------- Audit table ---------- */
.ncn-ui .ncn-ui-audit-table .ncn-ui-audit-first td { border-top: 1px solid var(--ui-border-strong); }
.ncn-ui .ncn-ui-audit-table tbody tr:first-child td { border-top: 0; }
.ncn-ui .ncn-ui-audit-table td { padding: 9px 16px; }

/* ---------- Documents & photos ---------- */
.ncn-ui .ncn-ui-gallery { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.ncn-ui .ncn-ui-gallery__item { align-self: start; position: relative; margin: 0; border: 1px solid var(--ui-border); border-radius: 12px; overflow: hidden; background: var(--ui-bg-soft); }
.ncn-ui .ncn-ui-gallery__item.is-main { border-color: var(--ui-primary); box-shadow: 0 0 0 1px var(--ui-primary); }
.ncn-ui .ncn-ui-gallery__img { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.ncn-ui .ncn-ui-gallery__img img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.ncn-ui .ncn-ui-gallery__flag { position: absolute; top: 8px; left: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px 3px 7px; border-radius: 999px; background: var(--ui-primary); color: #fff; font-size: 11.5px; font-weight: 700; }
.ncn-ui .ncn-ui-gallery__flag .ncn-ui-icon { width: 12px; height: 12px; }
.ncn-ui .ncn-ui-gallery__tools { display: flex; gap: 6px; justify-content: space-between; padding: 8px; background: #fff; }
.ncn-ui .ncn-ui-inline-form { display: inline-block; margin: 0; }
.ncn-ui .ncn-ui-files { list-style: none; margin: 0; padding: 0; }
.ncn-ui .ncn-ui-files__item { display: flex; align-items: center; gap: 14px; padding: 12px 0; margin: 0; border-bottom: 1px solid var(--ui-border); }
.ncn-ui .ncn-ui-files__icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: #eceef2; color: #4a5262; flex: 0 0 auto; }
.ncn-ui .ncn-ui-files__icon.type-invoice { background: #e3f6ec; color: #0f6a3d; }
.ncn-ui .ncn-ui-files__icon.type-warranty { background: #fff3d6; color: #8a5a00; }
.ncn-ui .ncn-ui-files__icon.type-manual { background: #eaf0fd; color: #1b44ab; }
.ncn-ui .ncn-ui-files__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ncn-ui .ncn-ui-files__text strong { color: var(--ui-text); word-break: break-word; }
.ncn-ui .ncn-ui-files__text small { color: var(--ui-muted); }
.ncn-ui .ncn-ui-files__tools { display: flex; gap: 6px; }
.ncn-ui .ncn-ui-upload { margin-top: 18px; padding: 16px; background: var(--ui-bg-soft); border: 1px dashed var(--ui-border-strong); border-radius: 12px; }
.ncn-ui .ncn-ui-upload h4 { margin: 0 0 10px; font-size: 14px; }
.ncn-ui .ncn-ui-upload__row { display: grid; grid-template-columns: 180px 1fr 1.2fr auto; gap: 12px; align-items: end; }
.ncn-ui .ncn-ui-help { margin: 6px 0 0; color: var(--ui-muted); font-size: 12.5px; }

/* QR panel (re-uses the legacy print box) */
.ncn-ui .ncn-ui-tabpanel .ncn-im-qr-box { margin: 0; padding: 20px; background: var(--ui-bg); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); }

/* ---------- Dialog ---------- */
.ncn-ui-dialog { width: min(520px, calc(100vw - 24px)); padding: 0; border: 0; border-radius: 16px; box-shadow: var(--ui-shadow-lg); color: #1b2230; }
.ncn-ui-dialog::backdrop { background: rgba(16, 24, 40, .5); }
.ncn-ui .ncn-ui-dialog__form { margin: 0; }
.ncn-ui-dialog .ncn-ui-dialog__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #e3e6eb; }
.ncn-ui-dialog .ncn-ui-dialog__head h3 { margin: 0; font-size: 17px; }
.ncn-ui-dialog .ncn-ui-dialog__body { display: grid; gap: 14px; padding: 20px; }
.ncn-ui-dialog .ncn-ui-dialog__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid #e3e6eb; background: #f6f7f9; border-radius: 0 0 16px 16px; }
.ncn-ui-lightbox { width: auto; max-width: min(94vw, 1100px); background: transparent; box-shadow: none; overflow: visible; }
.ncn-ui-lightbox img { display: block; max-width: 100%; max-height: 88vh; margin: 0 auto; border-radius: 12px; background: #fff; }
.ncn-ui-lightbox .ncn-ui-lightbox__close { position: absolute; top: -44px; right: 0; background: #fff; }

/* Dialog & detail share the field / button primitives, but the dialog lives inside .ncn-ui (it is rendered there). */
.ncn-ui .ncn-ui-field { display: flex; flex-direction: column; gap: 5px; margin: 0; min-width: 0; }
.ncn-ui .ncn-ui-field > label, .ncn-ui .ncn-ui-field > span { font-size: 12.5px; font-weight: 700; color: #3b4352; }
.ncn-ui .ncn-ui-field abbr.required { color: var(--ui-danger); text-decoration: none; }

/* ---------- Edit form ---------- */
.ncn-ui .ncn-ui-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.ncn-ui .ncn-ui-form-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.ncn-ui .ncn-ui-form-col .ncn-ui-card { margin: 0; }
.ncn-ui .ncn-ui-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 16px; }
.ncn-ui .ncn-ui-field--full { grid-column: 1 / -1; }
.ncn-ui .ncn-ui-photo { flex-direction: row; gap: 16px; align-items: center; }
.ncn-ui .ncn-ui-photo__preview { display: grid; place-items: center; width: 96px; height: 96px; border: 1px dashed var(--ui-border-strong); border-radius: 14px; background: var(--ui-bg-soft); color: #98a1b0; overflow: hidden; flex: 0 0 auto; }
.ncn-ui .ncn-ui-photo__preview img { width: 100%; height: 100%; object-fit: cover; }
.ncn-ui .ncn-ui-photo__preview .ncn-ui-icon { width: 30px; height: 30px; }
.ncn-ui .ncn-ui-photo__input { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ncn-ui .ncn-ui-photo__input > label { font-size: 12.5px; font-weight: 700; color: #3b4352; }
.ncn-ui .ncn-ui-actionbar { position: sticky; bottom: 0; z-index: 20; margin: 22px -4px 0; padding: 12px 4px; background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(246,247,249,.96) 30%); backdrop-filter: blur(2px); }
.ncn-ui .ncn-ui-actionbar__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; background: var(--ui-bg); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow-lg); }
.ncn-ui .ncn-ui-actionbar__spacer { flex: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
	.ncn-ui .ncn-ui-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
	.ncn-ui .ncn-ui-form-grid { grid-template-columns: minmax(0, 1fr); }
	.ncn-ui .ncn-ui-upload__row { grid-template-columns: 1fr 1fr; }
	.ncn-ui .ncn-ui-upload__row .ncn-ui-btn { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
	.ncn-ui .ncn-ui-title, .ncn-ui .ncn-ui-hero__title h2 { font-size: 22px; }
	.ncn-ui .ncn-ui-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.ncn-ui .ncn-ui-stat--total { grid-column: 1 / -1; }
	.ncn-ui .ncn-ui-stat { padding: 12px; gap: 10px; }
	.ncn-ui .ncn-ui-stat__icon { width: 38px; height: 38px; }
	.ncn-ui .ncn-ui-stat__num { font-size: 22px; }
	.ncn-ui .ncn-ui-pagehead .ncn-ui-btn { width: 100%; }

	/* toolbar: filters fold behind a toggle */
	.ncn-ui .ncn-ui-filter-toggle { display: inline-flex !important; }
	.ncn-ui .ncn-ui-toolbar.has-toggle .ncn-ui-filters { display: none; }
	.ncn-ui .ncn-ui-toolbar.has-toggle.is-open .ncn-ui-filters { display: grid; grid-template-columns: 1fr 1fr; }
	.ncn-ui .ncn-ui-toolbar__main { flex-wrap: wrap; }
	.ncn-ui .ncn-ui-search { flex-basis: 100%; }
	.ncn-ui .ncn-ui-toolbar__main .ncn-ui-btn { flex: 1; }
	.ncn-ui .ncn-ui-bulkbar__tools { margin-left: 0; }

	/* tables become cards */
	.ncn-ui table.ncn-ui-table, .ncn-ui .ncn-ui-table tbody, .ncn-ui .ncn-ui-table tr, .ncn-ui .ncn-ui-table td { display: block; width: 100%; }
	.ncn-ui .ncn-ui-table thead { position: absolute; left: -9999px; }
	.ncn-ui .ncn-ui-table tbody tr { position: relative; padding: 12px 14px; border-bottom: 1px solid var(--ui-border); }
	.ncn-ui .ncn-ui-table tbody tr:last-child { border-bottom: 0; }
	.ncn-ui .ncn-ui-table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border: 0; text-align: right; }
	.ncn-ui .ncn-ui-table td[data-label]:not([data-label=""])::before { content: attr(data-label); flex: 0 0 auto; color: var(--ui-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; text-align: left; }
	.ncn-ui .ncn-ui-table td.ncn-ui-col-asset { display: block; padding-top: 0; padding-right: 46px; text-align: left; }
	.ncn-ui .ncn-ui-table td.ncn-ui-col-asset::before { display: none; }
	.ncn-ui .ncn-ui-table td.ncn-ui-col-actions { position: absolute; top: 10px; right: 10px; left: auto; width: auto; padding: 0; }
	.ncn-ui .ncn-ui-table td.ncn-ui-col-check { position: absolute; top: 18px; right: 58px; left: auto; width: auto; padding: 0; z-index: 1; }
	.ncn-ui .ncn-ui-table tbody tr:hover td { background: transparent; }
	.ncn-ui .ncn-ui-audit-table td { text-align: left; }
	.ncn-ui .ncn-ui-audit-table td:empty { display: none; }
	.ncn-ui .ncn-ui-empty-row td { display: block; }
	.ncn-ui .ncn-ui-menu__list { right: 0; left: auto; }

	/* detail */
	.ncn-ui .ncn-ui-hero { flex-direction: column; align-items: stretch; padding: 16px; }
	.ncn-ui .ncn-ui-hero__img { width: 100%; height: 190px; }
	.ncn-ui .ncn-ui-hero__actions .ncn-ui-btn { flex: 1 1 calc(50% - 8px); }
	.ncn-ui .ncn-ui-hero__actions .ncn-ui-menu { flex: 1 1 100%; }
	.ncn-ui .ncn-ui-hero__actions .ncn-ui-menu > .ncn-ui-btn { width: 100%; }
	.ncn-ui .ncn-ui-hero__actions .ncn-ui-menu__list { left: 0; right: 0; }

	/* lifecycle goes vertical */
	.ncn-ui .ncn-ui-lifecycle { flex-direction: column; gap: 0; }
	.ncn-ui .ncn-ui-lifecycle__step { flex-direction: row; align-items: flex-start; text-align: left; gap: 14px; padding: 0 0 18px; }
	.ncn-ui .ncn-ui-lifecycle__step::after { top: 42px; bottom: 0; left: 20px; right: auto; width: 3px; height: auto; }
	.ncn-ui .ncn-ui-lifecycle__dot { width: 40px; height: 40px; }
	.ncn-ui .ncn-ui-lifecycle__text { padding-top: 8px; }

	.ncn-ui .ncn-ui-card { padding: 16px; }
	.ncn-ui .ncn-ui-grid { grid-template-columns: minmax(0, 1fr); }
	.ncn-ui .ncn-ui-upload__row { grid-template-columns: 1fr; }
	.ncn-ui .ncn-ui-files__item { flex-wrap: wrap; }
	.ncn-ui .ncn-ui-files__tools { width: 100%; }
	.ncn-ui .ncn-ui-actionbar { position: static; background: none; }
	.ncn-ui .ncn-ui-actionbar__inner .ncn-ui-btn { flex: 1 1 auto; }
	.ncn-ui .ncn-ui-actionbar__spacer { display: none; }
	.ncn-ui .ncn-ui-photo { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
	.ncn-ui * { transition: none !important; }
}
