/* ==========================================================================
   TechPigeon Device Inventory — Portal Stylesheet
   Visual language matched to the shop's existing Warehouse Management
   Portal: navy sidebar, steel-blue accent, ElaAdmin-style gradient KPI
   cards, rounded panels.
   ========================================================================== */

:root {
	--tpdi-page:        #ffffff;
	--tpdi-sidebar:      #1e3144;
	--tpdi-sidebar-dark: #162538;
	--tpdi-card:         #ffffff;
	--tpdi-card2:        #f5f7fa;
	--tpdi-topbar:       #ffffff;

	--tpdi-bd:  #e3e8ef;
	--tpdi-bd2: #c9d3df;
	--tpdi-bd3: #9ca3af;

	--tpdi-t1: #1a2332;
	--tpdi-t2: #5a6a7e;
	--tpdi-t3: #8fa0b3;
	--tpdi-t4: #c9d3df;

	--tpdi-input: #f9fafb;

	--tpdi-accent:       #76a3c0;
	--tpdi-accent-dark:  #5e8caa;
	--tpdi-accent-light: #9bc0d8;
	--tpdi-accent-glow:  rgba(118,163,192,.22);
	--tpdi-accent-bg:    #edf4f9;

	--tpdi-kpi-green:  #4cae8a;
	--tpdi-kpi-purple: #9b6dcc;
	--tpdi-kpi-blue:   #5ba4d4;
	--tpdi-kpi-orange: #e8835c;
	--tpdi-kpi-teal:   #3ab0a8;

	--tpdi-green:  #16a34a; --tpdi-green-bg: #f0fdf4; --tpdi-green-bd: #bbf7d0; --tpdi-green-t: #15803d;
	--tpdi-red:    #dc2626; --tpdi-red-bg:   #fef2f2; --tpdi-red-bd:   #fecaca; --tpdi-red-t:   #b91c1c;
	--tpdi-amber:  #d97706; --tpdi-amber-bg: #fffbeb; --tpdi-amber-bd: #fde68a; --tpdi-amber-t: #b45309;
	--tpdi-blue:   #2563eb; --tpdi-blue-bg:  #eff6ff; --tpdi-blue-bd:  #bfdbfe; --tpdi-blue-t:  #1d4ed8;
	--tpdi-purple: #7c3aed; --tpdi-purple-bg:#f5f3ff; --tpdi-purple-bd:#ddd6fe; --tpdi-purple-t:#6d28d9;

	--tpdi-shadow-xs: 0 1px 4px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
	--tpdi-shadow:    0 2px 10px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.05);
	--tpdi-shadow-md: 0 4px 20px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06);
	--tpdi-shadow-lg: 0 8px 36px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.07);

	--tpdi-r:    10px;
	--tpdi-r-lg: 14px;
	--tpdi-r-xl: 18px;

	--tpdi-sidebar-w: 270px;
	--tpdi-sidebar-collapsed-w: 76px;
	--tpdi-font: 'Times New Roman', Times, Georgia, serif;
	--tpdi-mono: 'JetBrains Mono', 'Courier New', monospace;
}

/* ─── RESET & BASE ────────────────────────────────────────────── */
.tpdi-portal *, .tpdi-login-page * { box-sizing: border-box; margin: 0; padding: 0; text-decoration: none !important; }
.tpdi-portal a, .tpdi-portal a:hover, .tpdi-portal a:visited,
.tpdi-login-page a, .tpdi-login-page a:hover { text-decoration: none !important; }
.tpdi-portal, .tpdi-login-page { font-family: var(--tpdi-font); color: var(--tpdi-t1); -webkit-font-smoothing: antialiased; }
.tpdi-portal-body { margin: 0; padding: 0; }
.tpdi-portal { min-height: 100vh; background: var(--tpdi-page); display: flex; }
.tpdi-portal button { font-family: var(--tpdi-font); cursor: pointer; }

/* ─── LOGIN PAGE ──────────────────────────────────────────────── */
.tpdi-login-page {
	min-height: 100vh;
	background: linear-gradient(145deg, #e8edf4 0%, #dde4ed 100%);
	display: flex; align-items: center; justify-content: center;
	padding: 40px 20px;
}
.tpdi-login-card {
	background: #fff; border-radius: 24px;
	box-shadow: 0 20px 60px rgba(30,49,68,.14), 0 6px 20px rgba(30,49,68,.08);
	padding: 48px 44px 32px; width: 100%; max-width: 440px;
	text-align: center; position: relative;
}
.tpdi-login-brand { margin-bottom: 28px; }
.tpdi-login-logo { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; margin: 0 auto 20px; display: block; box-shadow: 0 8px 28px rgba(30,49,68,.3); }
.tpdi-login-logo-fallback {
	width: 90px; height: 90px; border-radius: 50%;
	background: linear-gradient(135deg, #76a3c0 0%, #1e3144 100%);
	display: flex; align-items: center; justify-content: center;
	margin: 0 auto 24px; box-shadow: 0 8px 28px rgba(30,49,68,.3);
}
.tpdi-login-logo-fallback .bi { font-size: 2.4rem; width: 2.4rem; height: 2.4rem; color: #fff; }
.tpdi-login-brand h1 { font-size: 1.25rem; font-weight: 800; color: #1e3144; letter-spacing: -.01em; margin-bottom: 6px; line-height: 1.3; }
.tpdi-login-brand p { font-size: .84rem; color: #8fa0b3; font-weight: 600; line-height: 1.5; }

.tpdi-login-error {
	display: flex; align-items: center; gap: 9px;
	background: #fef2f2; border: 1.5px solid #fecaca; color: #c0392b;
	padding: 12px 16px; border-radius: 12px; font-size: .83rem; font-weight: 600;
	margin-bottom: 22px; text-align: left;
}

.tpdi-login-form { text-align: left; }
.tpdi-hp-wrap { position: absolute; left: -9999px; top: -9999px; }
.tpdi-field { margin-bottom: 18px; }
.tpdi-field label { display: block; font-size: .78rem; font-weight: 700; color: var(--tpdi-t2); margin-bottom: 8px; }
.tpdi-login-form input[type="text"],
.tpdi-login-form input[type="password"] {
	width: 100%; padding: 14px 16px;
	background: #f4f7fb; border: 1.5px solid #e3e8ef; border-radius: 12px;
	font-family: var(--tpdi-font); font-size: .95rem; color: #1e3144;
	outline: none; transition: border-color .15s, box-shadow .15s;
}
.tpdi-login-form input:focus { border-color: #76a3c0; box-shadow: 0 0 0 3px rgba(118,163,192,.18); }

.tpdi-field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.tpdi-checkbox-label { display: flex; align-items: center; gap: 8px; font-size: .83rem; color: #5a6a7e; font-weight: 600; cursor: pointer; }
.tpdi-forgot-link { font-size: .82rem; color: #76a3c0; font-weight: 700; }

.tpdi-login-btn {
	width: 100%; padding: 16px;
	background: linear-gradient(135deg, #76a3c0 0%, #1e3144 100%);
	border: none; border-radius: 14px;
	font-size: 1.02rem; font-weight: 800; color: #fff; letter-spacing: .14em;
	box-shadow: 0 8px 24px rgba(30,49,68,.3);
	transition: transform .15s, box-shadow .15s;
}
.tpdi-login-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(30,49,68,.4); }

.tpdi-login-footer {
	font-size: .72rem; color: #8fa0b3; margin-top: 26px;
	padding-top: 18px; border-top: 1px solid #e8edf4;
}

/* ─── SIDEBAR ─────────────────────────────────────────────────── */
.tpdi-sidebar {
	width: var(--tpdi-sidebar-w); min-height: 100vh; height: 100%;
	background: var(--tpdi-sidebar);
	display: flex; flex-direction: column;
	position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
	overflow-y: auto; scrollbar-width: none;
	transition: transform .22s cubic-bezier(.4,0,.2,1);
	box-shadow: 4px 0 20px rgba(0,0,0,.22);
}
.tpdi-sidebar::-webkit-scrollbar { display: none; }

.tpdi-sb-brand {
	display: flex; align-items: center; gap: 12px;
	padding: 22px 18px 18px; border-bottom: 1px solid rgba(255,255,255,.08);
	flex-shrink: 0; overflow: hidden;
}
.tpdi-sb-logo { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; flex-shrink: 0; }
.tpdi-sb-logo-icon { font-size: 1.5rem; width: 1.5rem; height: 1.5rem; color: #fff; flex-shrink: 0; }
.tpdi-sb-brand-text { font-size: 1rem; font-weight: 800; color: #fff; line-height: 1.25; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tpdi-sb-nav { flex: 1; padding: 18px 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.tpdi-sb-link {
	display: flex; align-items: center; gap: 12px;
	padding: 12px 14px; border-radius: var(--tpdi-r);
	color: rgba(255,255,255,.78); font-size: .95rem; font-weight: 700;
	transition: background .14s, color .12s; position: relative;
}
.tpdi-sb-link .bi { font-size: 1.1rem; width: 1.1rem; height: 1.1rem; flex-shrink: 0; }
.tpdi-sb-link:hover { color: #fff; background: rgba(255,255,255,.1); }
.tpdi-sb-link.is-active { background: var(--tpdi-accent); color: #fff; font-weight: 800; }
.tpdi-sb-link.is-active::before {
	content: ''; position: absolute; left: 0; top: 6px; bottom: 6px;
	width: 4px; background: #fff; border-radius: 0 4px 4px 0;
}

.tpdi-sb-footer { padding: 16px 18px 20px; border-top: 1px solid rgba(255,255,255,.08); }
.tpdi-sb-tagline { font-size: .68rem; color: rgba(255,255,255,.4); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }

/* ─── SIDEBAR COLLAPSED (desktop icon-only mode) ──────────────── */
.tpdi-portal.tpdi-sb-collapsed .tpdi-sidebar { width: var(--tpdi-sidebar-collapsed-w); }
.tpdi-portal.tpdi-sb-collapsed .tpdi-main { margin-left: var(--tpdi-sidebar-collapsed-w); }
.tpdi-portal.tpdi-sb-collapsed .tpdi-sb-brand-text,
.tpdi-portal.tpdi-sb-collapsed .tpdi-sb-link span:not(.bi),
.tpdi-portal.tpdi-sb-collapsed .tpdi-sb-tagline {
	opacity: 0; width: 0; overflow: hidden; white-space: nowrap;
}
.tpdi-portal.tpdi-sb-collapsed .tpdi-sb-brand { justify-content: center; padding-left: 0; padding-right: 0; }
.tpdi-portal.tpdi-sb-collapsed .tpdi-sb-link { justify-content: center; padding-left: 0; padding-right: 0; }
.tpdi-portal.tpdi-sb-collapsed .tpdi-sb-footer { padding-left: 0; padding-right: 0; text-align: center; }
.tpdi-sidebar, .tpdi-main, .tpdi-sb-brand-text, .tpdi-sb-link span, .tpdi-sb-tagline {
	transition: width .2s ease, margin-left .2s ease, opacity .15s ease;
}

/* Hover-to-peek: while collapsed, hovering the sidebar temporarily expands
   it back to full width as an overlay (does NOT shift .tpdi-main, so the
   page underneath doesn't reflow every time the mouse passes near the
   edge) — snaps back the instant the mouse leaves. Mirrors the standard
   "peek" pattern used by VS Code / Slack style collapsed sidebars. */
.tpdi-portal.tpdi-sb-collapsed .tpdi-sidebar:hover {
	width: var(--tpdi-sidebar-w);
	box-shadow: 6px 0 28px rgba(0,0,0,.32);
}
.tpdi-portal.tpdi-sb-collapsed .tpdi-sidebar:hover .tpdi-sb-brand-text,
.tpdi-portal.tpdi-sb-collapsed .tpdi-sidebar:hover .tpdi-sb-link span:not(.bi),
.tpdi-portal.tpdi-sb-collapsed .tpdi-sidebar:hover .tpdi-sb-tagline {
	opacity: 1; width: auto; overflow: visible;
}
.tpdi-portal.tpdi-sb-collapsed .tpdi-sidebar:hover .tpdi-sb-brand,
.tpdi-portal.tpdi-sb-collapsed .tpdi-sidebar:hover .tpdi-sb-link {
	justify-content: flex-start; padding-left: 18px; padding-right: 18px;
}
.tpdi-portal.tpdi-sb-collapsed .tpdi-sidebar:hover .tpdi-sb-link { padding-left: 14px; }
.tpdi-portal.tpdi-sb-collapsed .tpdi-sidebar:hover .tpdi-sb-footer { padding-left: 18px; padding-right: 18px; text-align: left; }

/* Click flourish: a brief "close then open" pulse layered on top of the
   normal width transition above, purely for tactile feedback when the
   toggle is clicked. Doesn't change the actual collapsed/expanded state —
   the class is added and removed by JS around the real toggle. */
@keyframes tpdi-sb-pulse {
	0%   { transform: scaleX(1); }
	35%  { transform: scaleX(.94); }
	100% { transform: scaleX(1); }
}
.tpdi-sb-flourish { animation: tpdi-sb-pulse .32s cubic-bezier(.4,0,.2,1); transform-origin: left center; }

/* ─── MAIN AREA ───────────────────────────────────────────────── */
.tpdi-main { flex: 1; margin-left: var(--tpdi-sidebar-w); display: flex; flex-direction: column; min-height: 100vh; background: #fff; }

.tpdi-topbar {
	height: 62px; background: var(--tpdi-topbar); border-bottom: 1px solid var(--tpdi-bd);
	display: flex; align-items: center; justify-content: space-between;
	padding: 0 28px; flex-shrink: 0; position: sticky; top: 0; z-index: 100; gap: 16px;
}
.tpdi-sb-toggle {
	display: flex; align-items: center; justify-content: center;
	background: none; border: none; padding: 6px;
	border-radius: 8px; color: var(--tpdi-t2); cursor: pointer;
	transition: background .12s;
}
.tpdi-sb-toggle:hover { background: var(--tpdi-card2); }
.tpdi-sb-toggle .bi { font-size: 1.3rem; width: 1.3rem; height: 1.3rem; }
.tpdi-topbar-title { font-size: 1.05rem; font-weight: 800; color: var(--tpdi-t1); flex: 1; }
.tpdi-topbar-right { display: flex; align-items: center; gap: 14px; }

.tpdi-notif-bell { position: relative; width: 38px; height: 38px; border-radius: 50%; background: var(--tpdi-card2); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .12s; }
.tpdi-notif-bell:hover { background: var(--tpdi-accent-bg); }
.tpdi-notif-bell .bi { color: var(--tpdi-t2); }
.tpdi-notif-count {
	position: absolute; top: -4px; right: -4px;
	background: var(--tpdi-red); color: #fff; font-size: .62rem; font-weight: 800;
	border-radius: 50px; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 4px;
}

.tpdi-user-menu { position: relative; }
.tpdi-user-btn {
	display: flex; align-items: center; gap: 9px; padding: 6px 10px 6px 6px;
	border-radius: 50px; border: 1.5px solid var(--tpdi-bd2); background: var(--tpdi-card);
	transition: border-color .14s, box-shadow .14s;
}
.tpdi-user-btn:hover { border-color: var(--tpdi-accent); box-shadow: 0 0 0 3px var(--tpdi-accent-glow); }
.tpdi-user-avatar {
	width: 32px; height: 32px; border-radius: 50%;
	background: linear-gradient(135deg, #1e3144 0%, #2d4a6b 100%);
	display: flex; align-items: center; justify-content: center;
	font-size: .75rem; font-weight: 800; color: #fff; flex-shrink: 0;
	border: 2px solid rgba(118,163,192,.4);
}
.tpdi-user-info { display: flex; flex-direction: column; line-height: 1.25; text-align: left; }
.tpdi-user-name { font-size: .8rem; font-weight: 700; color: var(--tpdi-t1); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpdi-user-role { font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.tpdi-role-admin { color: var(--tpdi-purple-t); }
.tpdi-role-supervisor { color: var(--tpdi-blue-t); }
.tpdi-role-staff { color: var(--tpdi-t3); }
.tpdi-user-btn .bi { color: var(--tpdi-t3); font-size: 1rem; width: 1rem; height: 1rem; }

.tpdi-user-dropdown {
	position: absolute; top: calc(100% + 8px); right: 0; min-width: 180px;
	background: #fff; border: 1px solid var(--tpdi-bd2); border-radius: 14px;
	box-shadow: 0 12px 40px rgba(0,0,0,.14); overflow: hidden; display: none; z-index: 400;
}
.tpdi-user-dropdown.is-open { display: block; }
.tpdi-dropdown-logout {
	display: flex; align-items: center; gap: 10px; width: 100%;
	padding: 12px 16px; font-size: .84rem; font-weight: 600;
	color: var(--tpdi-red); background: none; border: none;
}
.tpdi-dropdown-logout:hover { background: var(--tpdi-red-bg); }

.tpdi-content { padding: 28px 28px 50px; flex: 1; }

/* ─── BANNER ──────────────────────────────────────────────────── */
.tpdi-banner {
	display: flex; align-items: center; gap: 10px;
	padding: 14px 18px; border-radius: var(--tpdi-r); margin-bottom: 22px;
	font-size: .88rem; font-weight: 600;
}
.tpdi-banner-warning { background: var(--tpdi-amber-bg); border: 1px solid var(--tpdi-amber-bd); color: var(--tpdi-amber-t); }
.tpdi-banner .bi { flex-shrink: 0; }

/* ─── KPI CARDS (ElaAdmin-style gradient) ────────────────────── */
.tpdi-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 20px; margin-bottom: 26px; }
.tpdi-kpi-card {
	position: relative; display: flex; align-items: center; gap: 16px;
	padding: 24px 22px; border-radius: var(--tpdi-r-lg); overflow: hidden;
	box-shadow: 0 6px 24px rgba(0,0,0,.15);
	transition: transform .18s, box-shadow .18s;
}
.tpdi-kpi-card:hover { transform: translateY(-3px); box-shadow: 0 12px 36px rgba(0,0,0,.2); }
.tpdi-kpi-green  { background: linear-gradient(135deg, var(--tpdi-kpi-green) 0%, #3a9878 100%); }
.tpdi-kpi-purple { background: linear-gradient(135deg, var(--tpdi-kpi-purple) 0%, #8558b8 100%); }
.tpdi-kpi-blue   { background: linear-gradient(135deg, var(--tpdi-kpi-blue) 0%, #4690c0 100%); }
.tpdi-kpi-orange { background: linear-gradient(135deg, var(--tpdi-kpi-orange) 0%, #d4704a 100%); }
.tpdi-kpi-teal   { background: linear-gradient(135deg, var(--tpdi-kpi-teal) 0%, #2c8f88 100%); }
.tpdi-kpi-icon {
	width: 50px; height: 50px; border-radius: 12px; flex-shrink: 0;
	background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center;
}
.tpdi-kpi-icon .bi { color: #fff; font-size: 1.3rem; width: 1.3rem; height: 1.3rem; }
.tpdi-kpi-body { display: flex; flex-direction: column; min-width: 0; }
.tpdi-kpi-label { font-size: .72rem; font-weight: 800; color: rgba(255,255,255,.88); text-transform: uppercase; letter-spacing: .1em; }
.tpdi-kpi-value { font-size: 1.7rem; font-weight: 800; color: #fff; line-height: 1.2; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* ─── PANELS ──────────────────────────────────────────────────── */
.tpdi-grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; margin-bottom: 22px; }
.tpdi-panel { background: var(--tpdi-card); border: 1px solid var(--tpdi-bd); border-radius: var(--tpdi-r-lg); overflow: hidden; box-shadow: var(--tpdi-shadow-xs); margin-bottom: 22px; }
.tpdi-panel-header { padding: 18px 22px; border-bottom: 1px solid var(--tpdi-bd); display: flex; align-items: center; justify-content: space-between; }
.tpdi-panel-header h2 { font-size: .92rem; font-weight: 800; color: var(--tpdi-t1); }
.tpdi-panel-header-row { flex-wrap: wrap; gap: 12px; }
.tpdi-panel-body { padding: 22px; }

.tpdi-btn-icon { background: var(--tpdi-card2); border: 1px solid var(--tpdi-bd2); border-radius: 8px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; color: var(--tpdi-t2); transition: background .12s; }
.tpdi-btn-icon:hover { background: var(--tpdi-accent-bg); color: var(--tpdi-accent-dark); }
.tpdi-btn-icon .bi { font-size: 1rem; width: 1rem; height: 1rem; }

.tpdi-empty-note { font-size: .85rem; color: var(--tpdi-t3); text-align: center; padding: 20px 0; }

/* ─── TABLE CONTROLS ──────────────────────────────────────────── */
.tpdi-table-controls { display: flex; gap: 10px; flex-wrap: wrap; }
.tpdi-search-input, .tpdi-select-sm {
	padding: 9px 14px; border-radius: 50px; border: 1.5px solid var(--tpdi-bd2);
	background: var(--tpdi-input); font-family: var(--tpdi-font); font-size: .85rem; color: var(--tpdi-t1);
	outline: none; transition: border-color .15s;
}
.tpdi-search-input { min-width: 220px; }
.tpdi-search-input:focus, .tpdi-select-sm:focus { border-color: var(--tpdi-accent); }

/* ─── TABLE ───────────────────────────────────────────────────── */
.tpdi-table-wrap { overflow-x: auto; padding: 0; }
.tpdi-panel .tpdi-table-wrap { padding: 0; }
.tpdi-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tpdi-table thead th {
	padding: 13px 18px; background: var(--tpdi-card2);
	font-size: .72rem; font-weight: 700; color: var(--tpdi-t2);
	text-transform: uppercase; letter-spacing: .06em;
	border-bottom: 1px solid var(--tpdi-bd); text-align: left; white-space: nowrap;
}
.tpdi-table tbody td { padding: 14px 18px; border-bottom: 1px solid var(--tpdi-bd); color: var(--tpdi-t1); vertical-align: middle; }
.tpdi-table tbody tr:last-child td { border-bottom: none; }
.tpdi-table tbody tr:hover { background: var(--tpdi-card2); }
.tpdi-table-loading { text-align: center; color: var(--tpdi-t3); padding: 30px 0 !important; }

/* ─── BADGES ──────────────────────────────────────────────────── */
.tpdi-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 11px; border-radius: 50px; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.tpdi-badge-in_stock  { background: var(--tpdi-green-bg); color: var(--tpdi-green-t); }
.tpdi-badge-sold      { background: var(--tpdi-blue-bg);  color: var(--tpdi-blue-t); }
.tpdi-badge-returned  { background: var(--tpdi-amber-bg); color: var(--tpdi-amber-t); }
.tpdi-badge-defective { background: var(--tpdi-red-bg);   color: var(--tpdi-red-t); }
.tpdi-badge-pending   { background: var(--tpdi-amber-bg); color: var(--tpdi-amber-t); }
.tpdi-badge-approved  { background: var(--tpdi-green-bg); color: var(--tpdi-green-t); }
.tpdi-badge-rejected  { background: var(--tpdi-red-bg);   color: var(--tpdi-red-t); }
.tpdi-badge-neutral   { background: var(--tpdi-card2); color: var(--tpdi-t2); border: 1px solid var(--tpdi-bd2); }
.tpdi-badge-role-admin { background: var(--tpdi-purple-bg); color: var(--tpdi-purple-t); }

.tpdi-positive { color: var(--tpdi-green-t); font-weight: 700; }
.tpdi-negative { color: var(--tpdi-red-t); font-weight: 700; }

/* ─── RANGE PILLS ─────────────────────────────────────────────── */
.tpdi-range-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.tpdi-pill {
	padding: 8px 16px; border-radius: 50px; font-size: .8rem; font-weight: 700;
	border: 1px solid var(--tpdi-bd2); background: #fff; color: var(--tpdi-t2);
	transition: all .12s;
}
.tpdi-pill:hover { border-color: var(--tpdi-accent); color: var(--tpdi-accent-dark); }
.tpdi-pill.is-active { background: var(--tpdi-accent); border-color: var(--tpdi-accent); color: #fff; }

/* ─── FORMS ───────────────────────────────────────────────────── */
.tpdi-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 18px; align-items: start; }
.tpdi-field-wide { grid-column: 1 / -1; }
.tpdi-field-checkbox { grid-column: 1 / -1; }
.tpdi-field label { display: block; font-size: .78rem; font-weight: 700; color: var(--tpdi-t2); margin-bottom: 7px; }
.tpdi-field input[type="text"], .tpdi-field input[type="number"],
.tpdi-field input[type="date"], .tpdi-field input[type="email"],
.tpdi-field select {
	width: 100%; padding: 10px 14px; border-radius: var(--tpdi-r);
	border: 1.5px solid var(--tpdi-bd2); background: var(--tpdi-input);
	color: var(--tpdi-t1); font-size: .88rem; font-family: var(--tpdi-font);
	outline: none; transition: border-color .15s, box-shadow .15s;
}
.tpdi-field input:focus, .tpdi-field select:focus { border-color: var(--tpdi-accent); box-shadow: 0 0 0 3px var(--tpdi-accent-glow); }
.tpdi-field-hint { font-size: .74rem; color: var(--tpdi-t3); margin-top: 6px; }
.tpdi-static-value { padding: 10px 14px; border-radius: var(--tpdi-r); background: var(--tpdi-accent-bg); color: var(--tpdi-accent-dark); font-weight: 700; font-size: .95rem; }
.tpdi-form-actions { grid-column: 1 / -1; display: flex; gap: 12px; margin-top: 6px; }

/* ─── BUTTONS ─────────────────────────────────────────────────── */
.tpdi-btn {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 11px 22px; border-radius: 50px; border: none;
	font-size: .85rem; font-weight: 700; font-family: var(--tpdi-font);
	transition: transform .12s, box-shadow .12s, opacity .12s;
}
.tpdi-btn .bi { font-size: .95rem; width: .95rem; height: .95rem; }
.tpdi-btn-primary { background: linear-gradient(135deg, var(--tpdi-accent) 0%, var(--tpdi-sidebar) 100%); color: #fff; box-shadow: 0 6px 18px rgba(30,49,68,.25); }
.tpdi-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(30,49,68,.32); }
.tpdi-btn-secondary { background: var(--tpdi-accent-bg); color: var(--tpdi-accent-dark); }
.tpdi-btn-secondary:hover { opacity: .8; }
.tpdi-btn-ghost { background: var(--tpdi-card2); color: var(--tpdi-t2); border: 1px solid var(--tpdi-bd2); }
.tpdi-btn-ghost:hover { opacity: .8; }
.tpdi-btn-sm { padding: 6px 14px; font-size: .76rem; }
.tpdi-btn-approve { background: var(--tpdi-green-bg); color: var(--tpdi-green-t); border: 1px solid var(--tpdi-green-bd); }
.tpdi-btn-reject { background: var(--tpdi-red-bg); color: var(--tpdi-red-t); border: 1px solid var(--tpdi-red-bd); }
.tpdi-btn-danger-icon { background: var(--tpdi-red-bg); color: var(--tpdi-red-t); border: 1px solid var(--tpdi-red-bd); border-radius: 8px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; }
.tpdi-row-actions { display: flex; gap: 6px; }

/* ─── QUICK ACTIONS ───────────────────────────────────────────── */
.tpdi-quick-actions { display: flex; gap: 14px; flex-wrap: wrap; }

/* ─── LOGO UPLOADER (Settings) ────────────────────────────────── */
.tpdi-logo-uploader { display: flex; align-items: center; gap: 16px; }
.tpdi-logo-uploader img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; border: 1px solid var(--tpdi-bd2); }

/* ─── DEVICE PHOTO THUMBNAIL (table) ──────────────────────────── */
.tpdi-device-thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; border: 1px solid var(--tpdi-bd2); display: block; }
.tpdi-device-thumb-placeholder {
	width: 42px; height: 42px; border-radius: 8px; background: var(--tpdi-card2);
	border: 1px solid var(--tpdi-bd2); display: flex; align-items: center; justify-content: center;
	color: var(--tpdi-t3); font-size: 1.1rem !important; width: 42px !important; height: 42px !important;
}

/* ─── RECEIPT / INVOICE MODAL ─────────────────────────────────── */
.tpdi-modal-overlay {
	position: fixed; inset: 0; background: rgba(20,30,42,.55);
	display: none; align-items: center; justify-content: center;
	z-index: 500; padding: 24px; backdrop-filter: blur(2px);
}
.tpdi-modal-overlay.is-open { display: flex; }
.tpdi-modal {
	background: #fff; border-radius: var(--tpdi-r-lg);
	box-shadow: var(--tpdi-shadow-lg); width: 100%; max-width: 480px;
	max-height: 90vh; display: flex; flex-direction: column; overflow: hidden;
}
.tpdi-modal-header {
	display: flex; align-items: center; justify-content: space-between;
	padding: 14px 18px; border-bottom: 1px solid var(--tpdi-bd); flex-shrink: 0;
}
.tpdi-doc-toggle { display: flex; gap: 4px; background: var(--tpdi-card2); border-radius: 50px; padding: 3px; }
.tpdi-doc-toggle-btn {
	padding: 7px 16px; border-radius: 50px; border: none; background: transparent;
	font-size: .8rem; font-weight: 700; color: var(--tpdi-t2); transition: all .12s;
}
.tpdi-doc-toggle-btn.is-active { background: var(--tpdi-sidebar); color: #fff; }
.tpdi-modal-close { background: none; border: none; color: var(--tpdi-t3); padding: 6px; border-radius: 8px; }
.tpdi-modal-close:hover { background: var(--tpdi-card2); }
.tpdi-modal-close .bi { font-size: 1.1rem; width: 1.1rem; height: 1.1rem; }
.tpdi-modal-body { padding: 24px; overflow-y: auto; flex: 1; background: var(--tpdi-card2); }
.tpdi-modal-footer { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--tpdi-bd); flex-shrink: 0; }
.tpdi-modal-footer .tpdi-btn { flex: 1; justify-content: center; }

.tpdi-receipt-doc { background: #fff; border-radius: var(--tpdi-r); padding: 28px 26px; box-shadow: var(--tpdi-shadow-xs); }
.tpdi-receipt-inner { max-width: 380px; margin: 0 auto; }
.tpdi-receipt-head { text-align: center; margin-bottom: 18px; border-bottom: 2px solid var(--tpdi-sidebar); padding-bottom: 14px; }
.tpdi-receipt-logo { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; margin: 0 auto 8px; display: block; }
.tpdi-receipt-shop-name { font-size: 1.1rem; font-weight: 800; color: var(--tpdi-t1); }
.tpdi-receipt-shop-contact { font-size: .72rem; color: var(--tpdi-t3); margin-top: 2px; }
.tpdi-receipt-doc-title { font-size: .78rem; font-weight: 700; letter-spacing: .12em; color: var(--tpdi-t2); margin-top: 6px; }
.tpdi-receipt-doc-number { font-size: .78rem; color: var(--tpdi-t3); margin-top: 2px; }
.tpdi-receipt-meta { display: flex; justify-content: space-between; font-size: .78rem; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.tpdi-receipt-meta span { display: block; color: var(--tpdi-t3); }
.tpdi-receipt-billto { font-size: .82rem; margin-bottom: 14px; padding: 10px 0; border-top: 1px solid var(--tpdi-bd); border-bottom: 1px solid var(--tpdi-bd); }
.tpdi-receipt-billto span { display: block; color: var(--tpdi-t3); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 3px; }
.tpdi-receipt-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: .85rem; }
.tpdi-receipt-table th { text-align: left; font-size: .7rem; text-transform: uppercase; color: var(--tpdi-t3); border-bottom: 1px solid var(--tpdi-bd); padding: 6px 0; }
.tpdi-receipt-table td { padding: 10px 0; border-bottom: 1px solid var(--tpdi-card2); color: var(--tpdi-t1); }
.tpdi-receipt-amt { text-align: right; }
.tpdi-receipt-total { display: flex; justify-content: space-between; font-size: 1.05rem; font-weight: 800; color: var(--tpdi-t1); border-top: 2px solid var(--tpdi-sidebar); padding-top: 12px; margin-bottom: 18px; }
.tpdi-receipt-terms { font-size: .72rem; color: var(--tpdi-t3); line-height: 1.5; margin-bottom: 14px; }
.tpdi-receipt-footer { text-align: center; font-size: .82rem; font-weight: 700; color: var(--tpdi-t2); }

/* ─── TOASTS ──────────────────────────────────────────────────── */
.tpdi-toast-stack { position: fixed; top: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.tpdi-toast {
	padding: 14px 20px; border-radius: var(--tpdi-r); box-shadow: var(--tpdi-shadow-lg);
	font-size: .85rem; font-weight: 600; color: #fff; min-width: 240px; max-width: 360px;
	animation: tpdi-toast-in .2s ease;
}
.tpdi-toast-success { background: linear-gradient(135deg, var(--tpdi-kpi-green) 0%, #3a9878 100%); }
.tpdi-toast-error { background: linear-gradient(135deg, #e05c5c 0%, #c0392b 100%); }
@keyframes tpdi-toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ─── MOBILE / RESPONSIVE ─────────────────────────────────────── */
.tpdi-sb-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.32); z-index: 199; backdrop-filter: blur(2px); }

@media (max-width: 980px) {
	.tpdi-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 880px) {
	.tpdi-sidebar { transform: translateX(-100%); }
	.tpdi-portal.tpdi-sb-open .tpdi-sidebar { transform: translateX(0); }
	.tpdi-portal.tpdi-sb-open .tpdi-sb-overlay { display: block; }
	.tpdi-main { margin-left: 0; }
	.tpdi-sb-toggle { display: flex; }
	.tpdi-topbar { padding: 0 16px; }
	.tpdi-content { padding: 18px 16px 40px; }
	.tpdi-user-info { display: none; }

	.tpdi-table thead { display: none; }
	.tpdi-table tbody tr {
		display: block; border-bottom: 8px solid var(--tpdi-card2);
		padding: 10px 0;
	}
	.tpdi-table tbody td {
		display: flex; justify-content: space-between; align-items: center;
		border-bottom: 1px solid var(--tpdi-bd); padding: 10px 16px; text-align: right;
	}
	.tpdi-table tbody td:last-child { border-bottom: none; }
	.tpdi-table tbody td::before {
		content: attr(data-label); font-weight: 700; color: var(--tpdi-t2);
		font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
		text-align: left; margin-right: 12px;
	}
}

@media (max-width: 600px) {
	.tpdi-login-card { padding: 36px 26px 28px; }
	.tpdi-kpi-grid { grid-template-columns: 1fr 1fr; }
	.tpdi-form-grid { grid-template-columns: 1fr; }
	.tpdi-modal-overlay { padding: 0; align-items: flex-end; }
	.tpdi-modal { max-width: 100%; max-height: 95vh; border-radius: var(--tpdi-r-lg) var(--tpdi-r-lg) 0 0; }
	.tpdi-receipt-doc { padding: 20px 16px; }
}

/* ==========================================================================
   DEMO-SPECIFIC ADDITIONS
   ========================================================================== */

/* ─── DEMO BANNER ─────────────────────────────────────────────── */
.tpdi-demo-banner {
	display: flex; align-items: center; gap: 10px;
	background: linear-gradient(135deg, #1e3144 0%, #2d4a6b 100%);
	color: #fff; padding: 12px 20px; font-size: .84rem; font-weight: 600;
	position: relative; z-index: 9999;
}
.tpdi-demo-banner .bi { font-size: 1rem; flex-shrink: 0; }
.tpdi-demo-banner span { flex: 1; }
#tpdi-demo-banner-close {
	background: rgba(255,255,255,.15); border: none; color: #fff;
	border-radius: 50%; width: 26px; height: 26px; display: flex;
	align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
#tpdi-demo-banner-close:hover { background: rgba(255,255,255,.3); }

/* ─── LOGIN PAGE ──────────────────────────────────────────────── */
/* bi icons render via ::before pseudo, not a separate span —
   size them with font-size instead of width/height */
.tpdi-login-logo-fallback .bi {
	font-size: 2.4rem !important;
	line-height: 1;
}

/* ─── SIDEBAR ICON SIZING ─────────────────────────────────────── */
.tpdi-sb-link .bi,
.tpdi-sb-logo-icon.bi {
	font-size: 1.1rem;
	line-height: 1;
	flex-shrink: 0;
}
.tpdi-sb-logo-icon.bi {
	font-size: 1.5rem;
	color: #fff;
}
.tpdi-sb-toggle .bi { font-size: 1.3rem; line-height: 1; }
.tpdi-notif-bell .bi { line-height: 1; }
.tpdi-user-btn .bi { line-height: 1; }
.tpdi-kpi-icon .bi { font-size: 1.3rem; line-height: 1; color: #fff; }
.tpdi-btn .bi,
.tpdi-btn-icon .bi,
.tpdi-btn-danger-icon .bi { font-size: .95rem; line-height: 1; }
.tpdi-banner .bi { line-height: 1; }
.tpdi-dropdown-logout .bi { line-height: 1; }

/* Device thumbnail placeholder */
.tpdi-device-thumb-placeholder.bi {
	width: 42px; height: 42px; border-radius: 8px;
	background: var(--tpdi-card2); border: 1px solid var(--tpdi-bd2);
	display: flex; align-items: center; justify-content: center;
	font-size: 1.1rem !important; color: var(--tpdi-t3);
}

/* ─── RECEIPT / INVOICE MODAL ─────────────────────────────────── */
.tpdi-modal-overlay {
	position: fixed; inset: 0; background: rgba(0,0,0,.55);
	display: flex; align-items: center; justify-content: center;
	z-index: 1000; padding: 20px; backdrop-filter: blur(4px);
}
.tpdi-modal-inner {
	background: #fff; border-radius: var(--tpdi-r-xl);
	width: 100%; max-width: 560px; max-height: 90vh;
	overflow-y: auto; box-shadow: var(--tpdi-shadow-lg);
	display: flex; flex-direction: column;
}
.tpdi-modal-header {
	display: flex; align-items: center; justify-content: space-between;
	padding: 16px 20px; border-bottom: 1px solid var(--tpdi-bd);
	gap: 12px; flex-shrink: 0;
}
.tpdi-modal-tabs { display: flex; gap: 8px; }
.tpdi-modal-tab {
	padding: 7px 16px; border-radius: 50px; border: 1px solid var(--tpdi-bd2);
	background: var(--tpdi-card2); color: var(--tpdi-t2);
	font-size: .82rem; font-weight: 700; cursor: pointer;
	font-family: var(--tpdi-font); transition: all .12s;
}
.tpdi-modal-tab.is-active { background: var(--tpdi-accent); border-color: var(--tpdi-accent); color: #fff; }
.tpdi-modal-actions { display: flex; align-items: center; gap: 8px; }
.tpdi-modal-body { padding: 24px; }

/* Receipt document styles (inside modal + print window) */
.tpdi-receipt-inner { max-width: 480px; margin: 0 auto; font-family: var(--tpdi-font); }
.tpdi-receipt-head { text-align: center; border-bottom: 2px solid var(--tpdi-sidebar); padding-bottom: 14px; margin-bottom: 18px; }
.tpdi-receipt-shop-name { font-size: 1.1rem; font-weight: 800; color: var(--tpdi-t1); }
.tpdi-receipt-shop-contact { font-size: .72rem; color: var(--tpdi-t3); margin-top: 2px; }
.tpdi-receipt-doc-title { font-size: 1.4rem; font-weight: 800; color: var(--tpdi-sidebar); letter-spacing: .06em; margin-top: 10px; }
.tpdi-receipt-doc-number { font-size: .82rem; color: var(--tpdi-t3); margin-top: 4px; }
.tpdi-receipt-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 18px; font-size: .88rem; }
.tpdi-receipt-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; font-size: .9rem; }
.tpdi-receipt-table th { text-align: left; padding: 8px 0; border-bottom: 2px solid var(--tpdi-bd); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--tpdi-t2); }
.tpdi-receipt-table td { padding: 12px 0; border-bottom: 1px solid var(--tpdi-bd); vertical-align: top; }
.tpdi-receipt-totals { display: flex; justify-content: flex-end; margin-bottom: 18px; }
.tpdi-receipt-total-row { display: flex; gap: 40px; font-weight: 800; font-size: 1rem; border-top: 2px solid var(--tpdi-sidebar); padding-top: 10px; color: var(--tpdi-sidebar); }
.tpdi-receipt-footer { text-align: center; font-size: .78rem; color: var(--tpdi-t3); border-top: 1px solid var(--tpdi-bd); padding-top: 16px; line-height: 1.6; }

/* ─── NETLIFY DEPLOY NOTICE (footer of login page) ────────────── */
.tpdi-demo-credit {
	position: fixed; bottom: 12px; right: 16px;
	font-size: .72rem; color: rgba(255,255,255,.5);
	font-family: var(--tpdi-font); pointer-events: none;
}

/* ─── TOAST ANIMATION FIX (no jQuery fadeOut in demo) ─────────── */
.tpdi-toast { transition: opacity .3s; }

/* ==========================================================================
   Demo-specific additions
   ========================================================================== */

/* ─── DEMO BANNER ─────────────────────────────────────────────── */
.tpdi-demo-banner {
	position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
	background: linear-gradient(135deg, #1e3144 0%, #76a3c0 100%);
	color: #fff; padding: 10px 20px;
	display: flex; align-items: center; gap: 10px;
	font-family: 'Times New Roman', Times, Georgia, serif;
	font-size: .84rem; font-weight: 600;
}
.tpdi-demo-banner i { flex-shrink: 0; }
.tpdi-demo-banner span { flex: 1; }
#tpdi-demo-banner-close {
	background: rgba(255,255,255,.2); border: none; color: #fff;
	border-radius: 50%; width: 26px; height: 26px; cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	flex-shrink: 0;
}
#tpdi-demo-banner-close:hover { background: rgba(255,255,255,.35); }

/* Push portal down when banner is showing */
body:has( #tpdi-demo-banner:not([style*="display: none"]) ) .tpdi-login-page,
body:has( #tpdi-demo-banner:not([style*="display: none"]) ) .tpdi-portal { margin-top: 42px; }
body:has( #tpdi-demo-banner:not([style*="display: none"]) ) .tpdi-sidebar { top: 42px; }

/* ─── MODAL ───────────────────────────────────────────────────── */
.tpdi-modal-overlay {
	position: fixed; inset: 0; z-index: 500;
	background: rgba(0,0,0,.48); backdrop-filter: blur(3px);
	display: flex; align-items: center; justify-content: center;
	padding: 20px;
}
.tpdi-modal-inner {
	background: #fff; border-radius: 16px;
	width: 100%; max-width: 580px;
	box-shadow: 0 20px 60px rgba(0,0,0,.24);
	max-height: 90vh; overflow-y: auto;
}
.tpdi-modal-header {
	display: flex; align-items: center; justify-content: space-between;
	padding: 16px 20px; border-bottom: 1px solid var(--tpdi-bd);
	gap: 12px; flex-wrap: wrap;
}
.tpdi-modal-tabs { display: flex; gap: 6px; }
.tpdi-modal-tab {
	padding: 7px 16px; border-radius: 50px; border: 1.5px solid var(--tpdi-bd2);
	background: #fff; color: var(--tpdi-t2); font-weight: 700;
	font-family: var(--tpdi-font); font-size: .82rem; cursor: pointer;
	transition: all .12s;
}
.tpdi-modal-tab.is-active { background: var(--tpdi-sidebar); color: #fff; border-color: var(--tpdi-sidebar); }
.tpdi-modal-actions { display: flex; gap: 8px; align-items: center; }
.tpdi-modal-body { padding: 24px; }

/* ─── RECEIPT / INVOICE DOCUMENT ──────────────────────────────── */
.tpdi-receipt-inner { font-family: 'Times New Roman', Times, Georgia, serif; }
.tpdi-receipt-head {
	text-align: center; border-bottom: 2px solid var(--tpdi-sidebar);
	padding-bottom: 14px; margin-bottom: 18px;
}
.tpdi-receipt-shop-name { font-size: 1.1rem; font-weight: 800; color: var(--tpdi-t1); }
.tpdi-receipt-shop-contact { font-size: .72rem; color: var(--tpdi-t3); margin-top: 2px; }
.tpdi-receipt-doc-title {
	font-size: 1.4rem; font-weight: 800; color: var(--tpdi-sidebar);
	letter-spacing: .06em; margin-top: 8px;
}
.tpdi-receipt-doc-number { font-size: .82rem; color: var(--tpdi-t2); margin-top: 4px; }
.tpdi-receipt-meta {
	display: flex; justify-content: space-between; gap: 16px;
	margin-bottom: 18px; font-size: .88rem;
}
.tpdi-receipt-table {
	width: 100%; border-collapse: collapse; margin-bottom: 18px; font-size: .9rem;
}
.tpdi-receipt-table th {
	text-align: left; padding: 8px 0;
	border-bottom: 2px solid var(--tpdi-bd); font-size: .72rem;
	text-transform: uppercase; letter-spacing: .06em; color: var(--tpdi-t2);
}
.tpdi-receipt-table td { padding: 12px 0; border-bottom: 1px solid var(--tpdi-bd); }
.tpdi-receipt-totals { display: flex; justify-content: flex-end; margin-bottom: 18px; }
.tpdi-receipt-total-row {
	display: flex; gap: 40px; font-weight: 800; font-size: 1rem;
	border-top: 2px solid var(--tpdi-sidebar); padding-top: 10px;
}
.tpdi-receipt-footer {
	text-align: center; font-size: .78rem; color: var(--tpdi-t2);
	border-top: 1px solid var(--tpdi-bd); padding-top: 16px;
}
.tpdi-receipt-footer p + p { margin-top: 4px; }
