/* ═══════════════════════════════════════════════════════════
 * PKKT Design System — Apex (own brand, Round 4.1)
 * ═══════════════════════════════════════════════════════════
 * Layered on top of existing style.css to upgrade the look
 * without rewriting everything. Loaded after style.css.
 * ═══════════════════════════════════════════════════════════ */

:root {
    /* ─── Brand colors ─── */
    --pkkt-primary:        #5B6CFF;
    --pkkt-primary-hover:  #4A5BEE;
    --pkkt-primary-soft:   #EEF2FF;
    --pkkt-secondary:      #06D6A0;
    --pkkt-accent:         #FFB800;
    --pkkt-danger:         #EF4444;
    --pkkt-warning:        #F59E0B;
    --pkkt-success:        #10B981;

    /* ─── Surface ─── */
    --pkkt-bg:           #F8FAFC;
    --pkkt-surface:      #FFFFFF;
    --pkkt-surface-2:    #F1F5F9;
    --pkkt-text:         #0F172A;
    --pkkt-text-2:       #64748B;
    --pkkt-text-3:       #94A3B8;
    --pkkt-border:       #E2E8F0;
    --pkkt-border-soft:  #F1F5F9;

    /* ─── Plan badges (gradients) ─── */
    --pkkt-plan-free:        #94A3B8;
    --pkkt-plan-basic:       #3B82F6;
    --pkkt-plan-standard:    #06D6A0;
    --pkkt-plan-pro:         linear-gradient(135deg, #8B5CF6, #5B6CFF);
    --pkkt-plan-enterprise:  linear-gradient(135deg, #F59E0B, #EF4444);

    /* ─── Effects ─── */
    --pkkt-shadow-sm:    0 1px 2px rgba(15, 23, 42, 0.04);
    --pkkt-shadow:       0 4px 12px rgba(15, 23, 42, 0.06);
    --pkkt-shadow-lg:    0 10px 30px rgba(15, 23, 42, 0.10);
    --pkkt-radius:       12px;
    --pkkt-radius-sm:    8px;
    --pkkt-radius-pill:  999px;
    --pkkt-anim:         all 0.15s ease;

    /* Map to legacy variable names so existing CSS still works */
    --primary:    var(--pkkt-primary);
    --success:    var(--pkkt-success);
    --danger:     var(--pkkt-danger);
    --warning:    var(--pkkt-warning);
    --bg:         var(--pkkt-bg);
    --surface:    var(--pkkt-surface);
    --surface-2:  var(--pkkt-surface-2);
    --text:       var(--pkkt-text);
    --text-2:     var(--pkkt-text-2);
    --muted:      var(--pkkt-text-2);
    --border:     var(--pkkt-border);
}

/* ─── Typography ─── */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter",
                 "IBM Plex Sans Thai", Tahoma, sans-serif;
    background: var(--pkkt-bg);
    color: var(--pkkt-text);
    -webkit-font-smoothing: antialiased;
}

/* ─── Buttons (upgrade) ─── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--pkkt-radius-sm);
    border: 1px solid transparent;
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: var(--pkkt-anim);
    white-space: nowrap;
}
.btn-primary {
    background: var(--pkkt-primary); color: white;
}
.btn-primary:hover { background: var(--pkkt-primary-hover); transform: translateY(-1px); box-shadow: var(--pkkt-shadow); }
.btn-secondary {
    background: white; color: var(--pkkt-text); border-color: var(--pkkt-border);
}
.btn-secondary:hover { background: var(--pkkt-surface-2); }
.btn-danger { background: var(--pkkt-danger); color: white; }
.btn-success { background: var(--pkkt-success); color: white; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }

/* ─── Cards ─── */
.card {
    background: var(--pkkt-surface);
    border: 1px solid var(--pkkt-border);
    border-radius: var(--pkkt-radius);
    padding: 20px;
    box-shadow: var(--pkkt-shadow-sm);
}
.card:hover { box-shadow: var(--pkkt-shadow); }

/* ─── Inputs ─── */
.input, input[type=text], input[type=email], input[type=password],
input[type=number], input[type=date], input[type=time], input[type=tel],
select, textarea {
    padding: 8px 12px;
    border: 1px solid var(--pkkt-border);
    border-radius: var(--pkkt-radius-sm);
    font-size: 14px;
    transition: var(--pkkt-anim);
    background: white;
    color: var(--pkkt-text);
}
.input:focus, input:focus, select:focus, textarea:focus {
    border-color: var(--pkkt-primary);
    box-shadow: 0 0 0 3px rgba(91, 108, 255, 0.1);
    outline: none;
}

/* ─── Badges ─── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 10px;
    border-radius: var(--pkkt-radius-pill);
    font-size: 11px; font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-free       { background: var(--pkkt-plan-free);     color: white; }
.badge-basic      { background: var(--pkkt-plan-basic);    color: white; }
.badge-standard   { background: var(--pkkt-plan-standard); color: white; }
.badge-pro        { background: var(--pkkt-plan-pro);      color: white; }
.badge-enterprise { background: var(--pkkt-plan-enterprise); color: white; }
.badge-success    { background: #DCFCE7; color: #166534; }
.badge-warning    { background: #FEF3C7; color: #854D0E; }
.badge-danger     { background: #FEE2E2; color: #991B1B; }

/* ─── PKKT horizontal top nav ─── */
.pkkt-topnav {
    background: white;
    border-bottom: 1px solid var(--pkkt-border);
    padding: 0;
    position: sticky; top: 0; z-index: 50;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.pkkt-topnav-inner {
    max-width: 1400px; margin: 0 auto;
    padding: 0 20px;
    display: flex; align-items: center; gap: 14px; min-height: 60px;
}
.pkkt-brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 18px;
    color: var(--pkkt-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
}
.pkkt-brand-logo {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--pkkt-plan-pro);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 800;
}

.pkkt-biz-card {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 12px;
    border: 1px solid var(--pkkt-border);
    border-radius: var(--pkkt-radius);
    cursor: pointer; transition: var(--pkkt-anim);
    background: white;
    min-width: 0;
}
.pkkt-biz-card:hover { border-color: var(--pkkt-primary); box-shadow: var(--pkkt-shadow-sm); }
.pkkt-biz-avatar {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--pkkt-surface-2);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.pkkt-biz-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pkkt-biz-info { display: flex; flex-direction: column; min-width: 0; }
.pkkt-biz-name {
    font-weight: 700; font-size: 13.5px; color: var(--pkkt-text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 200px;
}
.pkkt-biz-meta {
    font-size: 10.5px; color: var(--pkkt-text-2);
    display: flex; gap: 6px; align-items: center;
}
.pkkt-biz-meta code { font-size: 10px; background: var(--pkkt-surface-2); padding: 1px 5px; border-radius: 3px; font-family: monospace; color: var(--pkkt-text-2); }

.pkkt-nav-spacer { flex: 1; }

.pkkt-icon-btn {
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: white; border: 1px solid var(--pkkt-border-soft);
    cursor: pointer; transition: var(--pkkt-anim);
    color: var(--pkkt-text-2); position: relative;
}
.pkkt-icon-btn:hover { background: var(--pkkt-surface-2); color: var(--pkkt-text); border-color: var(--pkkt-border); }
.pkkt-icon-btn .pkkt-dot {
    position: absolute; top: 6px; right: 8px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--pkkt-danger); color: white;
    font-size: 9px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid white;
}

/* ─── Round 4.8.7+++++++.9d · FB-style Notification Dropdown ─── */
.pkkt-bell-wrap { position: relative; }
.pkkt-notif-panel {
    position: absolute; top: calc(100% + 8px); right: 0;
    width: 380px; max-height: 540px;
    background: white;
    border: 1px solid var(--pkkt-border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    display: flex; flex-direction: column;
    z-index: 1000;
    animation: pkkt-notif-fadein 0.15s ease-out;
}
@keyframes pkkt-notif-fadein {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.pkkt-notif-panel[hidden] { display: none !important; }

.pkkt-notif-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--pkkt-border);
    display: flex; justify-content: space-between; align-items: center;
}
.pkkt-notif-header strong { font-size: 16px; color: var(--pkkt-text); }
.pkkt-notif-mark-all {
    background: transparent; border: 0; cursor: pointer;
    color: var(--pkkt-primary, #2563eb);
    font-size: 12px; font-weight: 600;
    padding: 4px 8px; border-radius: 6px;
    text-decoration: none;
}
.pkkt-notif-mark-all:hover { background: var(--pkkt-surface-2, #f3f4f6); }

.pkkt-notif-list {
    flex: 1; overflow-y: auto;
    padding: 4px 0;
}
.pkkt-notif-empty {
    padding: 32px 16px; text-align: center;
    color: var(--pkkt-text-2, #6b7280); font-size: 14px;
}

.pkkt-notif-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px;
    text-decoration: none; color: inherit;
    transition: background 0.1s;
    cursor: pointer; position: relative;
}
.pkkt-notif-item:hover { background: var(--pkkt-surface-2, #f3f4f6); }
.pkkt-notif-item.unread { background: rgba(37, 99, 235, 0.04); }
.pkkt-notif-item.unread:hover { background: rgba(37, 99, 235, 0.08); }

.pkkt-notif-pic {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--pkkt-surface-2, #e5e7eb);
}
.pkkt-notif-pic-placeholder {
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: var(--pkkt-primary, #2563eb);
    font-size: 16px;
    background: var(--pkkt-surface-2, #e5e7eb);
}

.pkkt-notif-body { flex: 1; min-width: 0; }
.pkkt-notif-title {
    font-weight: 600; font-size: 14px; color: var(--pkkt-text);
    line-height: 1.3;
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.pkkt-notif-text {
    font-size: 13px; color: var(--pkkt-text-2, #6b7280);
    margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.pkkt-notif-time {
    font-size: 11px; color: var(--pkkt-text-3, #9ca3af);
    margin-top: 4px;
}

.pkkt-notif-unread-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--pkkt-primary, #2563eb);
    flex-shrink: 0;
    margin-top: 16px;
}

.pkkt-notif-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--pkkt-border);
    text-align: center;
}
.pkkt-notif-footer a {
    color: var(--pkkt-primary, #2563eb);
    font-size: 13px; font-weight: 600;
    text-decoration: none;
}
.pkkt-notif-footer a:hover { text-decoration: underline; }

@media (max-width: 480px) {
    .pkkt-notif-panel {
        position: fixed;
        top: 60px; left: 8px; right: 8px;
        width: auto; max-height: calc(100vh - 80px);
    }
}

/* ─── Main nav row (sections) ─── */
.pkkt-nav-row {
    background: white;
    border-bottom: 1px solid var(--pkkt-border);
}
.pkkt-nav-inner {
    max-width: 1400px; margin: 0 auto;
    padding: 0 20px;
    display: flex; gap: 4px; align-items: center;
    overflow-x: auto;
}
.pkkt-nav-tab {
    padding: 12px 16px;
    font-weight: 600; font-size: 14px;
    color: var(--pkkt-text-2);
    cursor: pointer;
    border: none; background: transparent;
    border-bottom: 3px solid transparent;
    transition: var(--pkkt-anim);
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex; align-items: center; gap: 6px;
}
.pkkt-nav-tab:hover { color: var(--pkkt-primary); }
.pkkt-nav-tab.active {
    color: var(--pkkt-primary);
    border-bottom-color: var(--pkkt-primary);
}
.pkkt-nav-tab .pkkt-nav-badge {
    background: var(--pkkt-danger); color: white;
    border-radius: 999px; padding: 1px 7px;
    font-size: 10.5px; font-weight: 700;
    margin-left: 4px;
}

/* ─── Plan badge (in top nav next to business name) ─── */
.pkkt-plan {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px;
    border-radius: var(--pkkt-radius-pill);
    font-size: 9.5px; font-weight: 800;
    letter-spacing: 0.04em;
    color: white;
    flex-shrink: 0;
}
.pkkt-plan.free       { background: var(--pkkt-plan-free); }
.pkkt-plan.basic      { background: var(--pkkt-plan-basic); }
.pkkt-plan.standard   { background: var(--pkkt-plan-standard); }
.pkkt-plan.pro        { background: var(--pkkt-plan-pro); }
.pkkt-plan.enterprise { background: var(--pkkt-plan-enterprise); }
.pkkt-days {
    font-size: 10.5px; color: var(--pkkt-text-2);
    margin-left: 6px;
}
.pkkt-days.urgent { color: var(--pkkt-danger); font-weight: 700; }

/* ─── Page header (modernized) ─── */
.page-header {
    display: flex; justify-content: space-between; align-items: flex-end;
    gap: 16px;
    margin: 24px 0 20px;
}
.page-header h1 {
    margin: 0 0 4px;
    font-size: 24px; font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--pkkt-text);
}
.page-header .subtitle {
    color: var(--pkkt-text-2);
    font-size: 13.5px;
}
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── KPI cards ─── */
.pkkt-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.pkkt-kpi {
    background: white;
    border: 1px solid var(--pkkt-border);
    border-radius: var(--pkkt-radius);
    padding: 16px 18px;
    transition: var(--pkkt-anim);
}
.pkkt-kpi:hover { border-color: var(--pkkt-primary); box-shadow: var(--pkkt-shadow); }
.pkkt-kpi .pkkt-kpi-label {
    font-size: 11.5px; color: var(--pkkt-text-2);
    font-weight: 600; letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.pkkt-kpi .pkkt-kpi-value {
    font-size: 26px; font-weight: 800;
    line-height: 1.1; letter-spacing: -0.02em;
    color: var(--pkkt-text);
}
.pkkt-kpi .pkkt-kpi-change {
    font-size: 11.5px; margin-top: 4px;
    color: var(--pkkt-text-2);
}
.pkkt-kpi .pkkt-kpi-change.up   { color: var(--pkkt-success); }
.pkkt-kpi .pkkt-kpi-change.down { color: var(--pkkt-danger); }

/* ─── Smart insight banner ─── */
.pkkt-insight {
    background: linear-gradient(135deg, #EEF2FF, #E0E7FF);
    border: 1px solid #C7D2FE;
    border-radius: var(--pkkt-radius);
    padding: 14px 18px;
    margin-bottom: 20px;
    display: flex; gap: 12px; align-items: flex-start;
}
.pkkt-insight-icon {
    font-size: 24px; line-height: 1;
}
.pkkt-insight-content { flex: 1; }
.pkkt-insight-title {
    font-weight: 700; color: var(--pkkt-primary);
    font-size: 13.5px; margin-bottom: 4px;
}
.pkkt-insight-body { font-size: 13.5px; color: #1E1B4B; line-height: 1.5; }

/* ─── Tables ─── */
.pkkt-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    background: white; border-radius: var(--pkkt-radius); overflow: hidden;
    border: 1px solid var(--pkkt-border);
}
.pkkt-table thead th {
    background: var(--pkkt-surface-2);
    padding: 10px 14px;
    font-size: 11.5px; font-weight: 700;
    color: var(--pkkt-text-2);
    text-transform: uppercase; letter-spacing: 0.04em;
    border-bottom: 1px solid var(--pkkt-border);
    text-align: left;
}
.pkkt-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--pkkt-border-soft);
    font-size: 13.5px;
}
.pkkt-table tbody tr:last-child td { border-bottom: none; }
.pkkt-table tbody tr:hover td { background: var(--pkkt-surface-2); }

/* ─── Mobile responsive ─── */
@media (max-width: 768px) {
    .pkkt-topnav-inner { padding: 0 12px; gap: 8px; }
    .pkkt-biz-name { max-width: 110px; font-size: 12.5px; }
    .pkkt-biz-meta { display: none; }
    .pkkt-nav-tab { padding: 10px 12px; font-size: 13px; }
    .pkkt-kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .pkkt-kpi .pkkt-kpi-value { font-size: 20px; }
}

/* ─── Print: hide everything except content ─── */
@media print {
    .pkkt-topnav, .pkkt-nav-row, .fc-bubble, .fc-panel,
    .no-print, .actions { display: none !important; }
}
