/* ==========================================================================
   TechPigeon Device Inventory — DEMO APP
   Deliberately reuses the real product's own visual language (deep green
   sidebar, gradient KPI cards) rather than the marketing site's palette —
   the whole point of this screen is "this is what you'd actually get."
   ========================================================================== */

:root {
	--sidebar: #0a6603; --sidebar-dark: #073f02;
	--accent: #2e8b3d; --accent-dark: #1f6b2c; --accent-bg: #eaf6e9;
	--card: #ffffff; --card2: #f5f7fa; --bg: #f0f2f5;
	--bd: #e3e8ef; --bd2: #c9d3df;
	--t1: #1a2332; --t2: #5a6a7e; --t3: #8fa0b3;
	--r-lg: 14px; --r-md: 10px;
	--green: #16a34a; --green-bg: #f0fdf4; --green-t: #15803d;
	--red: #dc2626; --red-bg: #fef2f2; --red-t: #b91c1c;
	--amber: #d97706; --amber-bg: #fffbeb; --amber-t: #b45309;
}
* { box-sizing: border-box; }
body {
	margin: 0; background: var(--bg); color: var(--t1);
	font-family: -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 15px;
}
button, input, select { font-family: inherit; }

/* ─── DEMO BANNER ──────────────────────────────────────────────── */
.demo-banner {
	background: #1c1917; color: #fff; display: flex; align-items: center;
	justify-content: center; gap: 16px; padding: 10px 16px; font-size: .83rem;
	font-weight: 600; flex-wrap: wrap; text-align: center; position: relative; z-index: 60;
}
.demo-banner strong { color: #ffb088; }
.demo-banner a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.demo-banner .db-cta {
	background: #e4572e; padding: 6px 14px; border-radius: 999px; text-decoration: none;
	font-weight: 700; font-size: .8rem;
}

/* ─── LAYOUT ───────────────────────────────────────────────────── */
.app { display: flex; min-height: calc(100vh - 40px); }
.sidebar {
	width: 240px; background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-dark) 100%);
	flex-shrink: 0; display: flex; flex-direction: column; color: #fff;
}
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 22px 20px; }
.sb-brand-mark { width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.15); display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
.sb-brand-text strong { display: block; font-size: .92rem; font-weight: 700; }
.sb-brand-text span { font-size: .68rem; color: rgba(255,255,255,.55); }
.sb-nav { flex: 1; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.sb-link {
	display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 9px;
	color: rgba(255,255,255,.72); text-decoration: none; font-size: .87rem; font-weight: 600;
	cursor: pointer; border: none; background: none; width: 100%; text-align: left;
}
.sb-link .ico { width: 18px; text-align: center; flex-shrink: 0; }
.sb-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sb-link.is-active { background: rgba(255,255,255,.16); color: #fff; }
.sb-footer { padding: 16px 18px 20px; border-top: 1px solid rgba(255,255,255,.1); font-size: .68rem; color: rgba(255,255,255,.45); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.sb-footer a { color: inherit; text-decoration: none; }
.sb-credit { display: flex; align-items: center; gap: 8px; }
.sb-credit-chip {
	width: 22px; height: 22px; border-radius: 50%; background: #fff; flex-shrink: 0;
	display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.sb-credit-chip img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }

.main { flex: 1; min-width: 0; }
.topbar {
	background: #fff; border-bottom: 1px solid var(--bd); padding: 0 26px; height: 68px;
	display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.topbar h1 { font-size: 1.2rem; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-search { background: var(--card2); border: 1px solid var(--bd); border-radius: 999px; padding: 9px 16px; font-size: .84rem; color: var(--t3); width: 220px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; }
.content { padding: 26px; }

/* ─── KPI CARDS ────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card { border-radius: var(--r-lg); padding: 18px; color: #fff; box-shadow: 0 6px 18px -8px rgba(0,0,0,.2); }
.kpi-card.wide { grid-column: span 2; }
.kpi-blue { background: linear-gradient(135deg,#5ba4d4,#4690c0); }
.kpi-green { background: linear-gradient(135deg,#4cae8a,#3a9878); }
.kpi-purple { background: linear-gradient(135deg,#9b6dcc,#8558b8); }
.kpi-orange { background: linear-gradient(135deg,#e8835c,#d4704a); }
.kpi-teal { background: linear-gradient(135deg,#3ab0a8,#2c8f88); }
.kpi-slate { background: linear-gradient(135deg,#64748b,#47536b); }
.kpi-label { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; opacity: .9; }
.kpi-value { display: block; font-size: 1.4rem; font-weight: 800; margin-top: 6px; }
.kpi-stat-row { display: flex; gap: 18px; margin-top: 10px; flex-wrap: wrap; }
.kpi-stat { border-right: 1px solid rgba(255,255,255,.25); padding-right: 18px; }
.kpi-stat:last-child { border: none; padding-right: 0; }
.kpi-stat-value { display: block; font-size: 1.05rem; font-weight: 800; }
.kpi-stat-label { font-size: .64rem; font-weight: 700; text-transform: uppercase; opacity: .8; }

/* ─── PANELS / TABLES ──────────────────────────────────────────── */
.panel { background: var(--card); border: 1px solid var(--bd); border-radius: var(--r-lg); margin-bottom: 22px; overflow: hidden; }
.panel-header { padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--bd); gap: 12px; flex-wrap: wrap; }
.panel-header h2 { font-size: 1rem; margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 22px; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--t3); background: var(--card2); white-space: nowrap; }
td { padding: 14px 22px; border-top: 1px solid var(--bd); font-size: .87rem; white-space: nowrap; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.badge-green { background: var(--green-bg); color: var(--green-t); }
.badge-red { background: var(--red-bg); color: var(--red-t); }
.badge-amber { background: var(--amber-bg); color: var(--amber-t); }

/* ─── BUTTONS / FIELDS ─────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 9px; font-weight: 700; font-size: .84rem; border: none; cursor: pointer; text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--sidebar)); color: #fff; }
.btn-ghost { background: var(--card2); color: var(--t2); border: 1px solid var(--bd2); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .78rem; font-weight: 700; color: var(--t2); margin-bottom: 6px; }
.field input, .field select { width: 100%; padding: 10px 12px; border: 1px solid var(--bd2); border-radius: 8px; font-size: .87rem; background: #f9fafb; }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ─── MODAL ────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(20,25,35,.55); display: none; align-items: center; justify-content: center; z-index: 80; padding: 20px; }
.modal-overlay.is-open { display: flex; }
.modal { background: #fff; border-radius: var(--r-lg); max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--bd); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 1.02rem; }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--t3); line-height: 1; }
.modal-body { padding: 22px 24px; }
.modal-actions { display: flex; gap: 10px; margin-top: 4px; }

/* ─── TOAST ────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; right: 24px; background: #1c1917; color: #fff; padding: 14px 20px; border-radius: 10px; font-size: .86rem; font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,.25); z-index: 100; opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

/* ─── VIEWS ────────────────────────────────────────────────────── */
.view { display: none; }
.view.is-active { display: block; }
.chart-wrap { position: relative; height: 260px; padding: 20px; }
.subtext { color: var(--t3); font-size: .76rem; }
.sb-toggle { display: none; }

@media (max-width: 880px) {
	.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 70; transform: translateX(-100%); transition: transform .2s; }
	.sidebar.is-open { transform: translateX(0); }
	.sb-toggle { display: inline-flex; }
	.topbar-search { display: none; }
	.kpi-card.wide { grid-column: span 1; }
	th, td { padding: 12px 14px; }
}
