/* TOP Phone admin theme – inspired by the Valex dashboard (white sidebar, soft blue-grey canvas, gradient KPI cards) */
:root {
  --tp-bg: #eef1f9;
  --tp-card: #ffffff;
  --tp-ink: #1c2437;
  --tp-muted: #7987a1;
  --tp-line: #e6e9f2;
  --tp-primary: #0162e8;
  --tp-yellow: #ffd200;
  --tp-radius: 10px;
  --tp-shadow: 0 4px 16px rgba(28, 36, 55, .06);
}

body, .main-sidebar, .main-header { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }
body { color: var(--tp-ink); font-size: .92rem; }
.content-wrapper { background: var(--tp-bg); }
.font-weight-600 { font-weight: 600; }
.lh-1 { line-height: 1.15; }
a { color: var(--tp-primary); }
.btn-primary { background: var(--tp-primary); border-color: var(--tp-primary); }
.btn-pill { border-radius: 50rem; padding-left: 1rem; padding-right: 1rem; }
.text-ink { color: var(--tp-ink) !important; }
.text-muted { color: var(--tp-muted) !important; }

/* Top bar */
.main-header { border-bottom: 1px solid var(--tp-line) !important; min-height: 64px; }
.topbar-search { position: relative; margin-left: .75rem; }
.topbar-search input {
  width: 340px; max-width: 40vw; border: 0; border-radius: 50rem; background: #f1f3fb;
  padding: .55rem 2.6rem .55rem 1.1rem; color: var(--tp-ink); outline: none;
}
.topbar-search input:focus { box-shadow: 0 0 0 3px rgba(1, 98, 232, .15); background: #fff; }
.topbar-search button { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--tp-muted); padding: .35rem .6rem; }
.avatar-circle {
  width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0db2de, #005bea); color: #fff; font-weight: 700; font-size: .85rem;
}
.user-chip small { font-size: .72rem; }

/* Sidebar */
.main-sidebar { background: #fff; border-right: 1px solid var(--tp-line); box-shadow: none !important; }
.brand-link { height: 64px; display: flex !important; align-items: center; border-bottom: 1px solid var(--tp-line) !important; padding: 0 1rem !important; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--tp-yellow), #ffb300); color: var(--tp-ink); font-size: 1.1rem; margin-right: .6rem; flex-shrink: 0;
}
.brand-text { font-weight: 800 !important; color: var(--tp-ink); letter-spacing: .2px; }
.sidebar-mini.sidebar-collapse .main-sidebar:not(:hover) .brand-text { display: none; }
.nav-sidebar .nav-header { font-size: .7rem !important; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #1c2437 !important; padding: 1.1rem 1rem .4rem !important; }
.sidebar-light-primary .nav-sidebar > .nav-item > .nav-link { color: #5b6e88; border-radius: 0; margin: 0; padding: .6rem 1rem; }
.sidebar-light-primary .nav-sidebar > .nav-item > .nav-link:hover { color: var(--tp-primary); background: #f5f8ff; }
.sidebar-light-primary .nav-sidebar > .nav-item > .nav-link.active {
  background: transparent !important; color: var(--tp-primary) !important; box-shadow: none !important; font-weight: 600;
  border-left: 3px solid var(--tp-primary);
}
.nav-sidebar .nav-icon { color: inherit; }

/* Page heading */
.page-title { font-size: 1.45rem; font-weight: 800; margin: 0; color: var(--tp-ink); }
.page-subtitle { color: var(--tp-muted); }

/* Cards */
.card { border: 0; border-radius: var(--tp-radius); box-shadow: var(--tp-shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--tp-line); padding: 1rem 1.25rem; }
.card-title { font-weight: 700; font-size: 1rem; text-transform: none; }
.card-title.caps { text-transform: uppercase; letter-spacing: .4px; font-size: .9rem; }

/* Gradient KPI cards */
.kpi {
  position: relative; overflow: hidden; border-radius: var(--tp-radius); color: #fff; padding: 1.2rem 1.35rem 3.4rem;
  box-shadow: 0 8px 22px rgba(28, 36, 55, .12); min-height: 150px;
}
.kpi .kpi-label { text-transform: uppercase; font-weight: 700; font-size: .78rem; letter-spacing: .5px; opacity: .95; }
.kpi .kpi-value { font-size: 1.75rem; font-weight: 800; margin: .35rem 0 .1rem; line-height: 1.15; word-break: break-word; }
.kpi .kpi-sub { font-size: .82rem; opacity: .9; }
.kpi .kpi-trend { position: absolute; right: 1.1rem; top: 1.05rem; font-weight: 600; font-size: .8rem; background: rgba(255,255,255,.18); padding: .15rem .55rem; border-radius: 50rem; }
.kpi .kpi-label { padding-right: 5.5rem; }
.kpi canvas.kpi-spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100% !important; height: 52px !important; }
.bg-grad-primary { background: linear-gradient(to left, #0db2de 0%, #005bea 100%); }
.bg-grad-danger { background: linear-gradient(45deg, #f93a5a, #f7778c); }
.bg-grad-success { background: linear-gradient(to left, #48d6a8 0%, #029666 100%); }
.bg-grad-warning { background: linear-gradient(to left, #efa65f, #f76a2d); }
.bg-grad-purple { background: linear-gradient(to left, #a18cd1, #6c5ce7); }

.stat-inline .stat-label { color: var(--tp-muted); font-size: .85rem; }
.stat-inline .stat-value { font-weight: 800; font-size: 1.35rem; color: var(--tp-ink); }

.mini-stat { display: flex; align-items: center; gap: .9rem; }
.mini-stat .icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.mini-stat .value { font-weight: 800; font-size: 1.2rem; line-height: 1.1; }
.mini-stat .label { color: var(--tp-muted); font-size: .8rem; }
.soft-primary { background: #e7f0ff; color: var(--tp-primary); }
.soft-success { background: #e3f8f0; color: #029666; }
.soft-warning { background: #fff3e2; color: #f76a2d; }
.soft-danger { background: #ffe9ed; color: #f93a5a; }
.soft-yellow { background: #fff8d6; color: #a07c00; }

/* Tables */
.table { color: var(--tp-ink); }
.table thead th { border-top: 0; border-bottom: 1px solid var(--tp-line); color: var(--tp-muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
.table td { vertical-align: middle; border-top-color: var(--tp-line); }
.table-hover tbody tr:hover { background: #f8faff; }
.money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.imei { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; letter-spacing: .3px; }
.dataTables_wrapper .dataTables_filter input { border-radius: 50rem; padding-left: .9rem; }
.dataTables_wrapper .dataTables_length select { border-radius: 8px; }
.page-item.active .page-link { background: var(--tp-primary); border-color: var(--tp-primary); }

/* Filters / pills */
.cat-pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.cat-pills a {
  display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .85rem; border-radius: 50rem; background: #fff;
  color: #5b6e88; box-shadow: var(--tp-shadow); font-size: .85rem; font-weight: 500;
}
.cat-pills a.active, .cat-pills a:hover { background: var(--tp-primary); color: #fff; text-decoration: none; }
.cat-pills .count { background: rgba(0,0,0,.07); border-radius: 50rem; padding: 0 .45rem; font-size: .75rem; }
.cat-pills a.active .count { background: rgba(255,255,255,.25); }

.form-control, .custom-select { border-radius: 8px; border-color: #dfe3ee; }
.form-control:focus { border-color: #8fb8f7; box-shadow: 0 0 0 3px rgba(1, 98, 232, .12); }
label { font-weight: 600; font-size: .85rem; color: #3b4863; }
.form-section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .8px; color: var(--tp-muted); font-weight: 700; margin: .5rem 0 1rem; }
.select2-container--bootstrap4 .select2-selection { border-radius: 8px; border-color: #dfe3ee; }
.required::after { content: ' *'; color: #f93a5a; }

/* Sale screen */
.pos-results { max-height: 420px; overflow-y: auto; }
.pos-result { display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem; border-bottom: 1px solid var(--tp-line); cursor: pointer; }
.pos-result:hover, .pos-result.active { background: #f3f7ff; }
.pos-result .ico { width: 40px; height: 40px; border-radius: 10px; background: #f1f3fb; display: flex; align-items: center; justify-content: center; color: var(--tp-primary); flex-shrink: 0; }
.pos-result .t { font-weight: 600; }
.pos-result .price { margin-left: auto; font-weight: 700; white-space: nowrap; }
.cart-total { font-size: 1.6rem; font-weight: 800; }
.cart-empty { color: var(--tp-muted); text-align: center; padding: 2rem 1rem; }

/* Product detail */
.detail-list dt { color: var(--tp-muted); font-weight: 500; font-size: .82rem; }
.detail-list dd { font-weight: 600; margin-bottom: .8rem; }
.product-thumb { width: 100%; max-height: 260px; object-fit: contain; background: #f6f7fb; border-radius: var(--tp-radius); }
.product-thumb-placeholder { height: 200px; display: flex; align-items: center; justify-content: center; font-size: 4.5rem; color: #c5cce0; background: #f6f7fb; border-radius: var(--tp-radius); }
.timeline-simple { list-style: none; padding: 0; margin: 0; }
.timeline-simple li { position: relative; padding: 0 0 1rem 1.6rem; }
.timeline-simple li::before { content: ''; position: absolute; left: 5px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--tp-primary); }
.timeline-simple li::after { content: ''; position: absolute; left: 9px; top: 18px; bottom: 0; width: 2px; background: var(--tp-line); }
.timeline-simple li:last-child::after { display: none; }

/* Login */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--tp-bg); padding: 1rem; }
.auth-card { width: 100%; max-width: 920px; background: #fff; border-radius: 16px; box-shadow: 0 20px 50px rgba(28,36,55,.12); overflow: hidden; }
.auth-side { background: linear-gradient(135deg, #0db2de 0%, #005bea 100%); color: #fff; position: relative; overflow: hidden; }
.auth-side h2 { font-weight: 800; }
.auth-side .blob { position: absolute; border-radius: 50%; background: rgba(255,255,255,.12); }

/* Misc */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--tp-muted); }
.empty-state i { font-size: 2.4rem; margin-bottom: .75rem; color: #c5cce0; }
.badge { font-weight: 600; }
.badge-soft { background: #f1f3fb; color: #5b6e88; }
.main-footer { background: transparent; border-top: 1px solid var(--tp-line); }
.nav-tabs .nav-link { font-weight: 600; color: #5b6e88; }
.nav-tabs .nav-link.active { color: var(--tp-primary); }
.swal2-popup { font-family: 'Inter', system-ui, sans-serif !important; border-radius: 14px !important; }

@media (max-width: 575.98px) {
  .page-title { font-size: 1.2rem; }
  .kpi .kpi-value { font-size: 1.4rem; }
  .content-wrapper .container-fluid { padding-left: .6rem; padding-right: .6rem; }
}

@media print {
  .main-header, .main-sidebar, .main-footer, .no-print, .page-actions, .dataTables_filter, .dataTables_length, .dataTables_paginate { display: none !important; }
  .content-wrapper { margin: 0 !important; background: #fff !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  body { font-size: 12px; }
}
