:root {
    --pk-bg: #ffffff;
    --pk-surface: #ffffff;
    --pk-sidebar-bg: #000000;
    --pk-sidebar-text: #e7e9ea;
    --pk-sidebar-heading: #71767b;
    --pk-sidebar-active: #1d9bf0;
    --pk-sidebar-hover: #181818;
    --pk-border: #eff3f4;
    --pk-text: #0f1419;
    --pk-muted: #536471;
    --pk-primary: #1d9bf0;
    --pk-primary-dark: #1a8cd8;
    --pk-radius: 1rem;
    --pk-radius-lg: 1.25rem;
    --pk-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --pk-shadow-lg: 0 4px 12px rgba(16, 24, 40, .08);

    --tint-green-bg: #e8f8ee; --tint-green-fg: #00ba7c;
    --tint-blue-bg: #e8f5fd;  --tint-blue-fg: #1d9bf0;
    --tint-orange-bg: #fef3e6; --tint-orange-fg: #ffad1f;
    --tint-purple-bg: #f2ecfd; --tint-purple-fg: #7856ff;
    --tint-pink-bg: #fdecf3;  --tint-pink-fg: #f91880;
    --tint-teal-bg: #e6faf6;  --tint-teal-fg: #00ba7c;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--pk-bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, 'Inter', sans-serif;
    color: var(--pk-text);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

a {
    text-decoration: none;
}

/* ---------- Navbar ---------- */
.pk-navbar {
    background: var(--pk-surface);
    border-bottom: 1px solid var(--pk-border);
    padding: .75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.pk-search {
    background: var(--pk-bg);
    border: 1px solid var(--pk-border);
    border-radius: .7rem;
    padding: .5rem .9rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--pk-muted);
    max-width: 340px;
    width: 100%;
}

.pk-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: .875rem;
    width: 100%;
    color: var(--pk-text);
}

.pk-kbd {
    font-size: .68rem;
    color: var(--pk-muted);
    border: 1px solid var(--pk-border);
    border-radius: .35rem;
    padding: .05rem .4rem;
    background: var(--pk-surface);
}

.pk-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pk-primary), #6ec6f7);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
}

/* ---------- Sidebar ---------- */
.pk-sidebar {
    background-color: var(--pk-sidebar-bg);
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    padding: 1.1rem .75rem;
}

.pk-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 0 .5rem 1.4rem;
}

.pk-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: .65rem;
    background: linear-gradient(135deg, var(--pk-primary), #6ec6f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}

.pk-brand-text {
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    line-height: 1.15;
}

.pk-brand-text small {
    display: block;
    color: #6b7280;
    font-weight: 600;
    font-size: .65rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.nav-divider {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--pk-sidebar-heading);
    font-weight: 700;
    padding: .9rem .6rem .4rem;
}

.pk-sidebar .nav-link {
    color: var(--pk-sidebar-text);
    border-radius: .6rem;
    padding: .55rem .65rem;
    font-weight: 500;
    font-size: .875rem;
    display: flex;
    align-items: center;
    gap: .65rem;
    transition: all .15s ease;
}

.pk-sidebar .nav-link i {
    font-size: 1.05rem;
    width: 1.1rem;
    text-align: center;
}

.pk-sidebar .nav-link:hover {
    background-color: var(--pk-sidebar-hover);
    color: #fff;
}

.pk-sidebar .nav-link.active {
    background: transparent;
    color: var(--pk-sidebar-active);
    font-weight: 600;
}

.pk-sidebar-footer {
    border-top: 1px solid #1f2430;
    margin-top: 1rem;
    padding: .9rem .6rem 0;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.pk-sidebar-footer .pk-avatar {
    background: linear-gradient(135deg, #4b5563, #1f2937);
}

.pk-sidebar-footer .name {
    color: #fff;
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.2;
}

.pk-sidebar-footer .role {
    color: var(--pk-sidebar-heading);
    font-size: .72rem;
}

/* ---------- Page header ---------- */
.pk-page-header h3 {
    color: var(--pk-text);
    margin-bottom: .15rem;
}

.pk-page-header p {
    color: var(--pk-muted);
    margin-bottom: 0;
    font-size: .9rem;
}

/* ---------- Cards ---------- */
.stat-card, .lead-card {
    border: 1px solid var(--pk-border);
    border-radius: var(--pk-radius-lg);
    box-shadow: var(--pk-shadow);
    background: var(--pk-surface);
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.15rem 1.3rem !important;
}

.stat-card .stat-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-card .stat-icon {
    width: 38px;
    height: 38px;
    border-radius: .7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.1;
    margin-top: .35rem;
}

.stat-card .stat-label {
    color: var(--pk-muted);
    font-size: .85rem;
    font-weight: 500;
}

.stat-card .stat-trend {
    font-size: .78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .25rem;
    margin-top: .35rem;
}

.stat-card .stat-trend.up { color: #00ba7c; }
.stat-card .stat-trend.down { color: #f4212e; }
.stat-card .stat-trend .vs { color: var(--pk-muted); font-weight: 500; }

.stat-card .sparkline-wrap {
    margin-top: .6rem;
    height: 40px;
}

.tint-green { background: var(--tint-green-bg); color: var(--tint-green-fg); }
.tint-blue { background: var(--tint-blue-bg); color: var(--tint-blue-fg); }
.tint-orange { background: var(--tint-orange-bg); color: var(--tint-orange-fg); }
.tint-purple { background: var(--tint-purple-bg); color: var(--tint-purple-fg); }
.tint-pink { background: var(--tint-pink-bg); color: var(--tint-pink-fg); }
.tint-teal { background: var(--tint-teal-bg); color: var(--tint-teal-fg); }

/* ---------- Segmented tabs ---------- */
.pk-segmented {
    background: var(--pk-bg);
    border-radius: .6rem;
    padding: .2rem;
    display: inline-flex;
    gap: .15rem;
}

.pk-segmented button {
    border: none;
    background: transparent;
    padding: .35rem .85rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--pk-muted);
    border-radius: .45rem;
    transition: all .15s ease;
}

.pk-segmented button.active {
    background: var(--pk-surface);
    color: var(--pk-text);
    box-shadow: var(--pk-shadow);
}

/* ---------- Badges (solid pills, matching reference table style) ---------- */
.badge {
    font-weight: 600;
    font-size: .72rem;
    padding: .38em .75em;
    border-radius: 9999px;
    letter-spacing: .01em;
}

.badge-soft-primary { background: var(--pk-primary); color: #fff; }
.badge-soft-success { background: #00ba7c; color: #fff; }
.badge-soft-warning { background: #ffad1f; color: #fff; }
.badge-soft-danger  { background: #f4212e; color: #fff; }
.badge-soft-secondary { background: #eff3f4; color: var(--pk-muted); }
.badge-soft-info { background: var(--pk-primary); color: #fff; }

/* ---------- Avatars in tables ---------- */
.pk-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8rem;
    color: #fff;
    flex-shrink: 0;
}

.avatar-1 { background: linear-gradient(135deg, #1d9bf0, #6ec6f7); }
.avatar-2 { background: linear-gradient(135deg, #00ba7c, #4ade80); }
.avatar-3 { background: linear-gradient(135deg, #f91880, #f472b6); }
.avatar-4 { background: linear-gradient(135deg, #ffad1f, #fbbf24); }
.avatar-5 { background: linear-gradient(135deg, #7856ff, #a78bfa); }

/* ---------- Table ---------- */
.table > :not(caption) > * > * {
    vertical-align: middle;
    border-bottom-color: var(--pk-border);
}

.pk-table thead th {
    text-transform: uppercase;
    font-size: .68rem;
    letter-spacing: .06em;
    color: var(--pk-muted);
    font-weight: 700;
    border-bottom: 1px solid var(--pk-border);
    padding-bottom: .75rem;
}

.pk-table tbody tr {
    transition: background-color .12s ease;
}

.pk-table tbody tr:hover {
    background-color: #fafbfc;
}

.content-clip {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.progress {
    height: .5rem;
    border-radius: 1rem;
    background-color: #eef0f3;
}

.progress-bar {
    border-radius: 1rem;
}

/* ---------- Buttons ---------- */
.btn {
    border-radius: 9999px;
    font-weight: 700;
}

.btn-sm {
    border-radius: 9999px;
}

.btn-primary {
    background: var(--pk-primary);
    border-color: var(--pk-primary);
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--pk-primary-dark);
    border-color: var(--pk-primary-dark);
}

.btn-outline-primary {
    color: var(--pk-primary);
    border-color: var(--pk-primary);
}

.btn-outline-primary:hover {
    background: var(--pk-primary);
    border-color: var(--pk-primary);
}

.btn-outline-secondary {
    color: var(--pk-text);
    border-color: var(--pk-border);
}

.btn-outline-secondary:hover {
    background: var(--pk-text);
    border-color: var(--pk-text);
}

.btn-dark {
    background: var(--pk-sidebar-bg);
    border-color: var(--pk-sidebar-bg);
}

.btn-dark:hover, .btn-dark:focus {
    background: #272c30;
    border-color: #272c30;
}

.text-primary { color: var(--pk-primary) !important; }

/* ---------- Empty states ---------- */
.pk-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--pk-muted);
}

.pk-empty i {
    font-size: 2.4rem;
    color: #d7dbe0;
    margin-bottom: .75rem;
    display: block;
}

/* ---------- Timeline ---------- */
.pk-timeline-item {
    position: relative;
    padding-left: 2.1rem;
    padding-bottom: 1.25rem;
}

.pk-timeline-item::before {
    content: '';
    position: absolute;
    left: .45rem;
    top: 1.6rem;
    bottom: 0;
    width: 2px;
    background: var(--pk-border);
}

.pk-timeline-item:last-child::before {
    display: none;
}

.pk-timeline-icon {
    position: absolute;
    left: 0;
    top: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    color: #fff;
}

.icon-bg-primary { background: var(--pk-primary); }
.icon-bg-accent { background: #00ba7c; }
.icon-bg-warn { background: #ffad1f; }
.icon-bg-pink { background: #f91880; }

/* ---------- Legend list (donut charts) ---------- */
.pk-legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .4rem 0;
    font-size: .84rem;
}

.pk-legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    margin-right: .55rem;
}

/* ---------- Login ---------- */
.pk-auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pk-sidebar-bg);
    position: relative;
    overflow: hidden;
    padding: 1rem;
}

.pk-auth-wrap::before {
    content: '';
    position: absolute;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(29, 155, 240, .22), transparent 70%);
    top: -160px;
    right: -100px;
}

.pk-auth-card {
    position: relative;
    z-index: 1;
    width: 400px;
    max-width: 100%;
    background: var(--pk-surface);
    border-radius: 1.25rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, .35);
}

/* ---------- Filter bar ---------- */
.pk-filter-bar {
    background: var(--pk-surface);
    border: 1px solid var(--pk-border);
    border-radius: var(--pk-radius);
    box-shadow: var(--pk-shadow);
}

.form-control, .form-select {
    border-radius: .6rem;
    border-color: var(--pk-border);
}

.form-control:focus, .form-select:focus {
    border-color: var(--pk-primary);
    box-shadow: 0 0 0 .2rem rgba(29, 155, 240, .15);
}

.form-check-input:checked {
    background-color: var(--pk-primary);
    border-color: var(--pk-primary);
}

.page-link {
    color: var(--pk-text);
}

.page-item.active .page-link {
    background-color: var(--pk-primary);
    border-color: var(--pk-primary);
}

.page-link:hover {
    color: var(--pk-primary);
}

.spinner-border {
    color: var(--pk-primary);
}

@media (max-width: 767px) {
    .pk-shell { flex-direction: column; }
    .pk-sidebar { width: 100% !important; height: auto; position: static; }
    .pk-search { max-width: none; }
}
