:root {
    --font-main: 'Plus Jakarta Sans', sans-serif;
    --brand-blue: #004AAD;
    --brand-blue-hover: #003a88;
    --brand-blue-light: #2b70d4;
    --brand-lime: #99CC33;
    --brand-lime-hover: #86b828;
    --brand-lime-glow: rgba(153, 204, 51, 0.35);
    --transition-smooth: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
    --bg-base: #0a0f1d;
    --bg-surface: #111827;
    --bg-card: #162032;
    --bg-card-inner: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-brand: rgba(0, 74, 173, 0.35);
    --header-bg: rgba(10, 15, 29, 0.95);
    --input-bg: #1e293b;
    --input-border: rgba(255, 255, 255, 0.12);
}

[data-theme="light"] {
    --bg-base: #edf2f7;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-inner: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-subtle: rgba(0, 74, 173, 0.12);
    --border-brand: rgba(0, 74, 173, 0.25);
    --header-bg: rgba(237, 242, 247, 0.95);
    --input-bg: #f8fafc;
    --input-border: rgba(0, 74, 173, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

.background-decor {
    position: fixed;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 900px;
    height: 600px;
    background: radial-gradient(circle, rgba(0, 74, 173, 0.18) 0%, rgba(153, 204, 51, 0.08) 45%, transparent 70%);
    z-index: 0;
    pointer-events: none;
    filter: blur(80px);
}

/* NAVBAR */
.navbar {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 6%;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}

.brand {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-link {
    color: var(--brand-lime);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-smooth);
}

.back-link:hover {
    transform: translateX(-4px);
    color: #fff;
}

.logo-img-wrapper {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 32px;
    object-fit: contain;
}

[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }
[data-theme="light"] .logo-dark { display: none; }
[data-theme="light"] .logo-light { display: block; }

.header-right-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* --- INTERACTIVE DUAL-PILL THEME SWITCH TOGGLE --- */
.theme-switch-toggle {
    display: inline-flex;
    align-items: center;
    background: var(--bg-card-inner, rgba(255, 255, 255, 0.08));
    border: 1px solid var(--border-subtle);
    border-radius: 30px;
    padding: 3px;
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: var(--transition-smooth);
}

.theme-switch-toggle:hover {
    border-color: var(--brand-lime);
}

.theme-option {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 0.88rem;
    color: var(--text-muted);
    transition: var(--transition-smooth);
    position: relative;
    z-index: 2;
}

[data-theme="light"] .theme-switch-toggle .theme-light {
    background: #ffffff;
    color: #f59e0b;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
    font-weight: 700;
}

[data-theme="light"] .theme-switch-toggle .theme-dark {
    color: var(--text-muted);
    opacity: 0.45;
}

[data-theme="dark"] .theme-switch-toggle .theme-dark {
    background: var(--brand-blue);
    color: #38bdf8;
    box-shadow: 0 2px 8px rgba(0, 74, 173, 0.5);
    font-weight: 700;
}

[data-theme="dark"] .theme-switch-toggle .theme-light {
    color: var(--text-muted);
    opacity: 0.4;
}

/* --- FRAMELESS STAFF PORTAL ICON AT VERY RIGHT --- */
.btn-staff-frameless {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.35rem;
    text-decoration: none;
    transition: var(--transition-smooth);
    padding: 4px;
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
}

.btn-staff-frameless:hover {
    color: var(--brand-lime);
    transform: scale(1.18);
}

/* MAIN TRACKER LAYOUT */
.tracker-container {
    position: relative;
    z-index: 2;
    flex: 1;
    max-width: 960px;
    width: 100%;
    margin: 40px auto;
    padding: 0 20px;
}

/* SEARCH CARD */
.tracker-search-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
}

.search-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(0, 74, 173, 0.2);
    border: 1px solid var(--border-brand);
    color: var(--brand-blue-light);
    border-radius: 30px;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 16px;
}

[data-theme="dark"] .search-badge {
    color: var(--brand-lime);
    background: rgba(153, 204, 51, 0.12);
    border-color: rgba(153, 204, 51, 0.25);
}

.tracker-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.tracker-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    max-width: 680px;
    margin: 0 auto 28px auto;
    line-height: 1.6;
}

.search-form {
    display: flex;
    gap: 12px;
    max-width: 680px;
    margin: 0 auto 16px auto;
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 18px;
    color: var(--text-muted);
    font-size: 1rem;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 14px;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
}

.input-wrapper input:focus {
    border-color: var(--brand-lime);
    box-shadow: 0 0 0 3px var(--brand-lime-glow);
}

.btn-track {
    background: linear-gradient(135deg, var(--brand-blue), #003a88);
    color: #fff;
    border: none;
    padding: 0 26px;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.btn-track:hover {
    background: linear-gradient(135deg, #0056cc, var(--brand-blue));
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 74, 173, 0.4);
}

.search-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* LOADING & EMPTY STATES */
.tracker-loading, .tracker-empty {
    text-align: center;
    padding: 40px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
    margin-bottom: 30px;
}

.tracker-loading i {
    font-size: 2.5rem;
    color: var(--brand-lime);
    margin-bottom: 14px;
}

.tracker-empty i {
    font-size: 3rem;
    color: #f87171;
    margin-bottom: 14px;
}

.tracker-empty h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.tracker-empty p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(37, 211, 102, 0.15);
    color: #25d366;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.88rem;
    transition: var(--transition-smooth);
}

.btn-secondary:hover {
    background: #25d366;
    color: #fff;
}

/* RESULT CARD */
.tracker-result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 35px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin-bottom: 40px;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-subtle);
    gap: 20px;
    flex-wrap: wrap;
}

.order-id-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(0, 74, 173, 0.2);
    border: 1px solid var(--border-brand);
    color: var(--brand-lime);
    font-size: 0.8rem;
    font-weight: 800;
    border-radius: 6px;
    margin-bottom: 8px;
}

.project-name {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.client-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.client-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-pill-badge {
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(153, 204, 51, 0.18);
    color: var(--brand-lime);
    border: 1px solid rgba(153, 204, 51, 0.35);
}

/* STEPPER */
.stepper-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 35px 0;
    padding: 20px;
    background: var(--bg-card-inner);
    border-radius: 18px;
    border: 1px solid var(--border-subtle);
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 2;
    flex: 1;
}

.step-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--input-bg);
    border: 2px solid var(--border-subtle);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 8px;
    transition: var(--transition-smooth);
}

.step-label strong {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
}

.step-label span {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.step-item.active .step-icon {
    background: var(--brand-blue);
    border-color: var(--brand-lime);
    color: #fff;
    box-shadow: 0 0 16px var(--brand-lime-glow);
}

.step-item.active .step-label strong {
    color: var(--text-main);
}

.step-item.completed .step-icon {
    background: var(--brand-lime);
    border-color: var(--brand-lime);
    color: #0a0f1d;
}

.step-item.completed .step-label strong {
    color: var(--brand-lime);
}

.step-line {
    flex: 1;
    height: 3px;
    background: var(--border-subtle);
    margin: 0 10px;
    margin-bottom: 28px;
    transition: var(--transition-smooth);
}

.step-line.completed {
    background: var(--brand-lime);
}

/* DETAILS GRID */
.result-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.details-box {
    background: var(--bg-card-inner);
    border-radius: 18px;
    border: 1px solid var(--border-subtle);
    padding: 24px;
}

.details-box h3 {
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.status-notes {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.assigned-team {
    padding: 12px;
    background: rgba(0, 74, 173, 0.12);
    border: 1px solid var(--border-brand);
    border-radius: 12px;
    margin-bottom: 16px;
}

.team-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.team-name {
    font-size: 0.88rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-buttons-group {
    margin-top: 15px;
}

.btn-wa-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
    padding: 12px;
    background: #25d366;
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.88rem;
    transition: var(--transition-smooth);
}

.btn-wa-action:hover {
    background: #20ba59;
    transform: translateY(-2px);
}

/* INVOICE MINI SUMMARY */
.invoice-mini-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.86rem;
}

.inv-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border-subtle);
}

.balance-row {
    border-bottom: none;
    padding-top: 4px;
    font-size: 0.95rem;
}

.text-success { color: #22c55e; font-weight: 700; }
.text-warning { color: #f59e0b; font-weight: 800; }

.btn-settlement {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--brand-lime), #86b828);
    color: #0a0f1d;
    border: none;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.92rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.btn-settlement:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--brand-lime-glow);
}

.deliverables-preview {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-subtle);
}

.deliverables-preview h4 {
    font-size: 0.88rem;
    margin-bottom: 10px;
}

.deliverables-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.deliverable-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--input-bg);
    border-radius: 8px;
    font-size: 0.82rem;
}

.deliverable-item a {
    color: var(--brand-lime);
    text-decoration: none;
    font-weight: 600;
}

.btn-staff-header {
    background: var(--bg-card-inner);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    text-decoration: none;
    transition: var(--transition-smooth);
}

.btn-staff-header:hover {
    color: var(--brand-lime);
    border-color: var(--brand-lime);
    transform: translateY(-2px);
}

/* FOOTER */
.footer {
    padding: 25px 6%;
    border-top: 1px solid var(--border-subtle);
    background: var(--header-bg);
    margin-top: auto;
}

.footer-bottom-bar {
    max-width: 960px;
    margin-right: auto;
    padding-right: 110px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-badges {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-badges a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-badges a:hover {
    color: var(--brand-lime);
}

@media (max-width: 800px) {
    .tracker-search-card { padding: 25px 20px; }
    .tracker-title { font-size: 1.6rem; }
    .search-form { flex-direction: column; }
    .btn-track { padding: 14px; justify-content: center; }
    .stepper-wrapper { flex-wrap: wrap; gap: 15px; }
    .step-line { display: none; }
    .step-item { min-width: 45%; }
    .result-details-grid { grid-template-columns: 1fr; }
}
