/* =========================================================================
   DesiERP searchable lookup — text-filter dropdown + popup search button
   Ported from the SpringApps/erp iDempiere-style lookup design.
   ========================================================================= */
.lookup { position: relative; display: flex; align-items: stretch; }
.lookup > input { flex: 1 1 auto; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.lookup-btn,
.cell-lookup {
	flex: 0 0 auto;
	border: 1px solid var(--border, #cbd5e1);
	border-left: 0;
	background: #f1f5f9;
	color: #2563eb;
	cursor: pointer;
	padding: 0 12px;
	border-top-right-radius: 8px;
	border-bottom-right-radius: 8px;
	display: inline-flex;
	align-items: center;
	transition: background .15s ease;
}
.lookup-btn:hover,
.cell-lookup:hover { background: #e2e8f0; }

/* ── Picker dialog ─────────────────────────────────────────────────────── */
.lk-backdrop {
	position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
	display: none; align-items: flex-start; justify-content: center;
	z-index: 4000; padding: 6vh 16px 16px;
}
.lk-backdrop.open { display: flex; }
.lk-dialog {
	width: min(1100px, 100%); max-height: 84vh; display: flex; flex-direction: column;
	background: #fff; color: #0f172a; border: 1px solid #e5e7eb; border-radius: 14px; overflow: hidden;
	box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
}

.lk-head { display: flex; align-items: center; gap: 11px; padding: 12px 16px; border-bottom: 1px solid #e5e7eb; }
.lk-head .lk-ic {
	width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
	display: grid; place-items: center; background: #eff6ff; color: #2563eb; font-size: 13px;
}
.lk-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.lk-head .lk-sub { font-size: 11.5px; color: #64748b; margin-top: 1px; }
.lk-close {
	margin-left: auto; width: 32px; height: 32px; border: 0; border-radius: 8px;
	background: transparent; color: #64748b; cursor: pointer; font-size: 15px;
}
.lk-close:hover { background: #f1f5f9; color: #0f172a; }
.lk-close:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }

.lk-toolbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid #eef2f7; background: #fbfcfe; }
.lk-search { position: relative; flex: 1; }
.lk-search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 12px; pointer-events: none; }
.lk-toolbar input {
	width: 100%; height: 34px; padding: 0 12px 0 32px;
	border: 1px solid #d1d5db; border-radius: 8px; outline: none; background: #fff;
	font: inherit; font-size: 13px; color: #0f172a;
}
.lk-toolbar input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
.lk-count { font-size: 12px; color: #64748b; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lk-count b { color: #0f172a; font-weight: 700; }

.lk-table-wrap { overflow: auto; flex: 1; }
.lk-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.lk-table thead th {
	position: sticky; top: 0; z-index: 1;
	background: #f8fafc; text-align: left; padding: 8px 12px;
	border-bottom: 1px solid #e5e7eb; color: #64748b;
	font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
	white-space: nowrap; cursor: pointer; user-select: none;
}
.lk-table thead th:hover { color: #0f172a; background: #f1f5f9; }
.lk-table thead th .lk-sort { display: inline-block; margin-left: 5px; font-size: 9px; color: #cbd5e1; }
.lk-table thead th.asc,
.lk-table thead th.desc { color: #1d4ed8; background: #eff6ff; }
.lk-table thead th.asc .lk-sort,
.lk-table thead th.desc .lk-sort { color: #2563eb; }

.lk-table tbody td {
	padding: 6px 12px; border-bottom: 1px solid #f1f5f9; color: #334155;
	white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis;
}
.lk-table tbody td:first-child { color: #0f172a; font-weight: 600; }
.lk-table tbody tr { cursor: pointer; }
.lk-table tbody tr:nth-child(even) td { background: #fafbfc; }
.lk-table tbody tr:hover td { background: #eff6ff; }
.lk-table tbody tr.lk-active td { background: #dbeafe; }
.lk-table tbody tr.lk-active td:first-child { box-shadow: inset 3px 0 0 #2563eb; }
.lk-table tbody td.lk-dash { color: #cbd5e1; }
.lk-table tbody tr.lk-empty td { text-align: center; color: #94a3b8; padding: 24px 12px; font-weight: 500; cursor: default; background: #fff; }

/* multi-select */
.lk-table th.lk-chk,
.lk-table td.lk-chk { width: 38px; padding-left: 14px; padding-right: 0; cursor: default; }
.lk-table .lk-chk input { width: 15px; height: 15px; margin: 0; vertical-align: middle; accent-color: #2563eb; cursor: pointer; }
.lk-table tbody td.lk-chk + td { color: #0f172a; font-weight: 600; }
.lk-table tbody tr.lk-picked td { background: #eff6ff; }
.lk-table tbody tr.lk-picked td.lk-chk { box-shadow: inset 3px 0 0 #2563eb; }
.lk-selbar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-top: 1px solid #dbeafe; background: #eff6ff; }
.lk-selbar[hidden] { display: none; }
.lk-selcount { font-size: 12.5px; font-weight: 600; color: #1e40af; }
.lk-clear {
	margin-left: auto; padding: 6px 10px; border: 0; border-radius: 7px; background: transparent;
	color: #1d4ed8; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.lk-clear:hover { background: #dbeafe; }
.lk-clear[hidden] { display: none; }
.lk-clear[hidden] + .lk-add { margin-left: auto; }
.lk-add {
	display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 15px;
	border: 0; border-radius: 8px; background: #2563eb; color: #fff;
	font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
	box-shadow: 0 4px 12px rgba(37, 99, 235, .25);
}
.lk-add:hover:not(:disabled) { background: #1d4ed8; }
.lk-add:disabled { background: #93c5fd; box-shadow: none; cursor: default; }
.lk-add:focus-visible, .lk-clear:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 2px; }

.lk-foot {
	display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap;
	padding: 8px 16px; border-top: 1px solid #eef2f7; background: #fbfcfe;
}
.lk-hint { display: flex; flex-wrap: wrap; gap: 6px 14px; color: #64748b; font-size: 11.5px; }

/* pagination */
.lk-pager { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: 12px; color: #64748b; }
.lk-size { display: inline-flex; align-items: center; gap: 6px; }
.lk-size select {
	height: 28px; padding: 0 22px 0 8px; font: inherit; font-size: 12px; color: #0f172a;
	border: 1px solid #d1d5db; border-radius: 7px; background: #fff; cursor: pointer;
}
.lk-size select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
.lk-range { white-space: nowrap; font-variant-numeric: tabular-nums; }
.lk-range b { color: #0f172a; font-weight: 700; }
.lk-pages { display: inline-flex; align-items: center; gap: 3px; }
.lk-pages button {
	width: 28px; height: 28px; display: grid; place-items: center;
	border: 1px solid #e5e7eb; border-radius: 7px; background: #fff; color: #334155;
	font-size: 11px; cursor: pointer; transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.lk-pages button:hover:not(:disabled) { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.lk-pages button:disabled { opacity: .4; cursor: default; }
.lk-pages button:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }
.lk-pageno { min-width: 92px; text-align: center; font-weight: 600; color: #0f172a; font-variant-numeric: tabular-nums; }
.lk-hint kbd {
	font: inherit; font-size: 10.5px; font-weight: 600; color: #334155;
	background: #fff; border: 1px solid #d1d5db; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px;
}

@media (max-width: 640px) {
	.lk-backdrop { padding: 12px 8px; }
	.lk-dialog { max-height: 94vh; }
	.lk-hint { display: none; }
}
