/* ── AssetTrack — Nifty Code Design System ─────────────────────────────────── */
:root {
  --blue:       #2563EB;
  --blue-dark:  #1D4ED8;
  --blue-light: #EFF6FF;
  --bg:         #F8FAFC;
  --white:      #FFFFFF;
  --border:     #E2E8F0;
  --text-1:     #1E293B;
  --text-2:     #334155;
  --text-3:     #64748B;
  --green:      #16A34A;
  --green-bg:   #DCFCE7;
  --amber:      #D97706;
  --amber-bg:   #FEF3C7;
  --red:        #DC2626;
  --red-bg:     #FEE2E2;
  --gray-bg:    #F1F5F9;
  --sidebar-w:  240px;
  --topbar-h:   64px;
  --radius:     8px;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  transition: width .2s ease, transform .2s ease;
  z-index: 100;
}
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .logo-text,
.sidebar.collapsed .sidebar-user-info { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; }
.sidebar.collapsed .logo { justify-content: center; }

.sidebar-toggle {
  position: absolute;
  top: 20px; right: -12px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-3);
  font-size: 10px;
  box-shadow: var(--shadow);
  transition: background .15s;
}
.sidebar-toggle:hover { background: var(--bg); }

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
}

.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #3B82F6, #8B5CF6);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 18px;
  flex-shrink: 0;
}

.logo-text { font-weight: 700; font-size: 15px; color: var(--text-1); }

.nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 8px 8px 4px;
}
.sidebar.collapsed .nav-section-label { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--text-2);
  cursor: pointer;
  transition: background .12s, color .12s;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
}
.nav-item:hover { background: var(--bg); color: var(--text-1); text-decoration: none; }
.nav-item.active { background: var(--blue-light); color: var(--blue); }
.nav-item .icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px 12px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
}
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-weight: 600;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-info .name { font-weight: 600; font-size: 13px; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info .role { font-size: 11px; color: var(--text-3); }

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-3);
  font-size: 13px;
  margin-top: 4px;
  transition: background .12s, color .12s;
}
.logout-btn:hover { background: var(--red-bg); color: var(--red); text-decoration: none; }

/* ── Main content ─────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .2s ease;
}
.sidebar.collapsed ~ .main { margin-left: 64px; }

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { flex: 1; }
.topbar-title h1 { font-size: 18px; font-weight: 700; color: var(--text-1); }
.topbar-title p  { font-size: 12px; color: var(--text-3); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  cursor: pointer;
  transition: background .12s;
  text-decoration: none;
}
.icon-btn:hover { background: var(--bg); color: var(--text-2); text-decoration: none; }

/* ── Page content ────────────────────────────────────────────────────────── */
.page { padding: 24px; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header-left h2 { font-size: 22px; font-weight: 700; color: var(--text-1); }
.page-header-left p  { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.page-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s, color .12s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary   { background: var(--blue);   color: white;          border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-outline   { background: white; color: var(--text-2); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-danger    { background: var(--red-bg); color: var(--red); border-color: #FECACA; }
.btn-danger:hover  { background: var(--red); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px; min-width: 32px; justify-content: center; }

/* ── Company tabs ────────────────────────────────────────────────────────── */
.company-tabs {
  display: flex;
  background: var(--gray-bg);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  margin-bottom: 20px;
  width: fit-content;
}
.company-tab {
  padding: 6px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: background .12s, color .12s;
  text-decoration: none;
  white-space: nowrap;
}
.company-tab:hover { color: var(--text-2); text-decoration: none; }
.company-tab.active { background: var(--white); color: var(--text-1); box-shadow: var(--shadow); }

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; margin-bottom: 20px; }

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #EFF6FF; color: var(--blue); }
.stat-icon.green  { background: var(--green-bg); color: var(--green); }
.stat-icon.amber  { background: var(--amber-bg); color: var(--amber); }
.stat-icon.red    { background: var(--red-bg); color: var(--red); }
.stat-icon.purple { background: #F3E8FF; color: #7C3AED; }
.stat-icon.gray   { background: var(--gray-bg); color: var(--text-3); }

.stat-info .label { font-size: 12px; color: var(--text-3); }
.stat-info .value { font-size: 22px; font-weight: 700; color: var(--text-1); line-height: 1.2; }

/* ── Search & Filter bar ─────────────────────────────────────────────────── */
.search-bar {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.search-bar input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 14px;
  color: var(--text-2);
  background: transparent;
}
.search-bar .search-icon { color: var(--text-3); font-size: 16px; }

.filter-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

.filter-select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--white);
  cursor: pointer;
}
.filter-select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}
th {
  padding: 11px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th a { color: var(--text-3); }
th a:hover { color: var(--text-1); text-decoration: none; }

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFBFC; }

.thumbnail {
  width: 40px; height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.thumb-placeholder {
  width: 40px; height: 40px;
  border-radius: 6px;
  background: var(--gray-bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  font-size: 18px;
  border: 1px solid var(--border);
}

.table-actions { display: flex; gap: 4px; }
.action-btn {
  width: 30px; height: 30px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-3);
  cursor: pointer;
  transition: all .12s;
  text-decoration: none;
  font-size: 13px;
}
.action-btn:hover { text-decoration: none; }
.action-btn.view:hover   { background: var(--blue-light);  color: var(--blue);  border-color: #BFDBFE; }
.action-btn.edit:hover   { background: var(--amber-bg);    color: var(--amber); border-color: #FDE68A; }
.action-btn.delete:hover { background: var(--red-bg);      color: var(--red);   border-color: #FECACA; }
.action-btn.qr:hover     { background: var(--green-bg);    color: var(--green); border-color: #A7F3D0; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-blue   { background: var(--blue-light);color: var(--blue); }
.badge-gray   { background: var(--gray-bg);   color: var(--text-3); }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-3);
}
.pagination-pages { display: flex; gap: 4px; }
.page-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  transition: all .12s;
}
.page-btn:hover { background: var(--bg); text-decoration: none; }
.page-btn.active { background: var(--blue); color: white; border-color: var(--blue); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text-1); }
.form-group .hint  { font-size: 11px; color: var(--text-3); }

.form-control {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-2);
  background: var(--white);
  width: 100%;
  transition: border-color .12s;
}
.form-control:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.form-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.form-section h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity .15s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--white);
  border-radius: 12px;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  transform: translateY(12px);
  transition: transform .15s;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 600; color: var(--text-1); }
.modal-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none;
  color: var(--text-3); font-size: 18px;
  cursor: pointer;
}
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 0 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Toast notifications ─────────────────────────────────────────────────── */
.toasts {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 300;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  color: var(--text-1);
  min-width: 240px;
  max-width: 360px;
  animation: slideIn .2s ease;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } }

/* ── Dashboard charts area ───────────────────────────────────────────────── */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin-bottom: 20px; }
.chart-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.chart-card h4 { font-size: 14px; font-weight: 600; color: var(--text-1); margin-bottom: 14px; }

/* ── Asset detail ────────────────────────────────────────────────────────── */
.asset-detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.detail-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}
.detail-section-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.detail-section-header h3 { font-size: 14px; font-weight: 600; color: var(--text-1); }
.detail-section-body { padding: 16px 20px; }

.detail-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-3); font-weight: 500; }
.detail-value { color: var(--text-1); font-weight: 500; }

.photo-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.gallery-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
}
.gallery-item.cover { border-color: var(--blue); }
.gallery-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.gallery-delete {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  background: rgba(0,0,0,.5);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 11px;
  cursor: pointer; opacity: 0;
  transition: opacity .12s;
}
.gallery-item:hover .gallery-delete { opacity: 1; }

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex;
  gap: 14px;
  padding-bottom: 16px;
  position: relative;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 15px; top: 30px;
  width: 2px;
  bottom: 0;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--blue-light);
  border: 2px solid var(--blue);
  display: flex; align-items: center; justify-content: center;
  color: var(--blue);
  font-size: 13px;
  flex-shrink: 0;
}
.timeline-content { flex: 1; }
.timeline-title { font-weight: 600; font-size: 13.5px; color: var(--text-1); }
.timeline-meta  { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ── Upload zone ─────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  color: var(--text-3);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--blue);
  background: var(--blue-light);
  color: var(--blue);
}
.upload-zone input { display: none; }

/* ── Audit scanner ───────────────────────────────────────────────────────── */
.scanner-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 480px;
}
#qr-reader { border-radius: 8px; overflow: hidden; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main { margin-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .asset-detail-grid { grid-template-columns: 1fr; }
  .page { padding: 16px; }
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.text-muted  { color: var(--text-3); }
.text-danger { color: var(--red); }
.text-success{ color: var(--green); }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; align-items: center; }
.flex-col { flex-direction: column; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 380px;
  box-shadow: var(--shadow-md);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { width: 52px; height: 52px; font-size: 26px; margin: 0 auto 10px; border-radius: 12px; }
.login-logo h2 { font-size: 20px; font-weight: 700; color: var(--text-1); }
.login-logo p  { font-size: 13px; color: var(--text-3); }
.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-error   { background: var(--red-bg);   color: var(--red);   border: 1px solid #FECACA; }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid #A7F3D0; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }

/* ── Checkbox ─────────────────────────────────────────────────────────────── */
.checkbox-col { width: 40px; }
input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--blue); }

/* ── Warning badge for terminated employee ───────────────────────────────── */
.warn-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--amber-bg);
  color: var(--amber);
  font-size: 11px;
  font-weight: 600;
}
