/* ═══════════════════════════════════════════════════════════════════════
   LUXURY LOCATIONS · CONTRACTOR PORTAL — Luxury Design System
   Matching the OwnerPortal's editorial luxury aesthetic
   ═══════════════════════════════════════════════════════════════════════ */

:root {
    /* Brand palette — matching OwnerPortal */
    --cp-nv: #1E3A5F;
    --cp-nv7: #284870;
    --cp-nv9: #0F1F33;
    --cp-gd: #C9A961;
    --cp-gd-d: #A88B45;
    --cp-gd-l: #E5D5A8;
    --cp-gd-w: #F5EFDC;
    --cp-gd-x: #FBF7E8;
    --cp-cream: #FAF6EE;
    --cp-cream-d: #F2EAD8;
    --cp-paper: #FFFFFF;
    --cp-shell: #F7F1E5;
    --cp-hairline: #E8DFCB;
    --cp-rule: #D9CDB0;
    --cp-ink: #1B1812;
    --cp-ink-2: #3D3528;
    --cp-ink-3: #6B6453;
    --cp-ink-4: #9A9382;
    --cp-ink-5: #C5BEA9;
    --cp-sage: #7A8970;
    --cp-sage-l: #E5E9E0;
    --cp-terra: #C8775E;
    --cp-terra-l: #F5E4DD;

    /* Fonts */
    --cp-fd: 'Playfair Display', Georgia, serif;
    --cp-fb: 'DM Sans', -apple-system, sans-serif;

    /* Layout tokens */
    --cp-sidebar-width: 232px;
    --cp-topbar-height: 68px;
    --cp-radius: 8px;
    --cp-radius-l: 14px;

    /* Shadows */
    --cp-sh-1: 0 1px 2px rgba(67,50,27,.04), 0 0 0 1px rgba(67,50,27,.03);
    --cp-sh-2: 0 4px 18px rgba(67,50,27,.06), 0 0 0 1px rgba(67,50,27,.04);
    --cp-sh-3: 0 12px 40px rgba(45,33,18,.12), 0 0 0 1px rgba(67,50,27,.04);

    /* Semantic */
    --cp-success: #7A8970;
    --cp-warning: #C9A961;
    --cp-danger: #C8775E;
}

/* ── RESET / BASE ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: var(--cp-fb);
    font-size: 15px;
    line-height: 1.55;
    color: var(--cp-ink);
    background: var(--cp-cream);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }

h1, h2, h3, h4 { font-family: var(--cp-fd); color: var(--cp-nv9); font-weight: 500; letter-spacing: -.015em; }
h1 { font-size: 32px; line-height: 1.1; }
h2 { font-size: 24px; line-height: 1.15; }
h3 { font-size: 18px; line-height: 1.25; }
h4 { font-size: 15px; line-height: 1.3; font-weight: 600; }

/* ── APP SHELL ── */
.cp-app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    position: relative;
}

.cp-layout {
    flex: 1;
    display: flex;
    min-height: 0;
}

.cp-main {
    flex: 1;
    min-width: 0;
    padding: 32px 32px 48px;
    margin-left: var(--cp-sidebar-width);
    margin-top: var(--cp-topbar-height);
}

/* ── TOP BAR ── */
.cp-topbar {
    height: var(--cp-topbar-height);
    background: var(--cp-cream);
    border-bottom: 1px solid var(--cp-hairline);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 24px;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.cp-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    width: calc(var(--cp-sidebar-width) - 28px);
    min-width: 200px;
}

.cp-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.cp-logo-mark {
    width: 34px;
    height: 34px;
    background: var(--cp-nv);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: var(--cp-fd);
    color: var(--cp-gd);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .02em;
}

.cp-logo-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.cp-logo-text b {
    font-family: var(--cp-fd);
    font-size: 16px;
    color: var(--cp-nv);
    font-weight: 600;
    line-height: 1;
}

.cp-logo-text span {
    font-size: 9.5px;
    color: var(--cp-ink-4);
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.cp-topbar-spacer { flex: 1; }

.cp-topbar-right { display: flex; align-items: center; gap: 4px; }

.cp-topbar-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--cp-nv7);
    position: relative;
    transition: background 0.2s ease;
}
.cp-topbar-btn:hover { background: var(--cp-shell); }

.cp-topbar-notif {
    position: relative;
    color: var(--cp-nv7);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}
.cp-topbar-notif:hover { background: var(--cp-shell); }

.cp-badge {
    position: absolute;
    top: 6px;
    right: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cp-terra);
    border: 2px solid var(--cp-cream);
}

.cp-badge-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--cp-terra);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    border: 2px solid var(--cp-cream);
}

.cp-topbar-user {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 5px 14px 5px 5px;
    border-radius: 30px;
    cursor: pointer;
    transition: background 0.2s ease;
}
.cp-topbar-user:hover { background: var(--cp-shell); }

.cp-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cp-nv) 0%, #3a5878 100%);
    color: var(--cp-gd-l);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--cp-fd);
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.cp-user-name {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.cp-user-name b {
    font-size: 13px;
    color: var(--cp-nv9);
    font-weight: 500;
}

.cp-user-name span {
    font-size: 10.5px;
    color: var(--cp-ink-4);
    letter-spacing: .04em;
}

.cp-btn-ghost {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--cp-nv7);
    transition: background 0.2s ease;
}
.cp-btn-ghost:hover { background: var(--cp-shell); }

/* Notification dropdown */
.cp-notif-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 380px;
    background: var(--cp-paper);
    border: 1px solid var(--cp-hairline);
    border-radius: var(--cp-radius-l);
    box-shadow: var(--cp-sh-3);
    z-index: 1000;
    overflow: hidden;
}

.cp-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 18px;
    cursor: pointer;
    transition: background 0.15s;
}

.cp-notif-item:hover { background: var(--cp-shell); }

.cp-notif-item.unread { background: var(--cp-gd-x); }

.cp-notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
    flex-shrink: 0;
    margin-top: 5px;
}

.cp-notif-dot.active { background: var(--cp-gd); }

/* ── SIDEBAR ── */
.cp-sidebar {
    width: var(--cp-sidebar-width);
    background: transparent;
    border-right: 1px solid var(--cp-hairline);
    flex-shrink: 0;
    padding: 28px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    position: fixed;
    top: var(--cp-topbar-height);
    left: 0;
    height: calc(100dvh - var(--cp-topbar-height));
    z-index: 90;
}

.cp-nav { display: flex; flex-direction: column; gap: 1px; }

.cp-nav-link {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--cp-ink-2);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    position: relative;
    margin-bottom: 1px;
}

.cp-nav-link:hover { background: var(--cp-shell); color: var(--cp-nv9); }

.cp-nav-link.active {
    background: var(--cp-paper);
    color: var(--cp-nv9);
    font-weight: 600;
    box-shadow: var(--cp-sh-1);
}

.cp-nav-link.active::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    background: var(--cp-gd);
    border-radius: 0 3px 3px 0;
}

.cp-nav-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--cp-ink-3); }
.cp-nav-link.active .cp-nav-icon { color: var(--cp-gd-d); }

.cp-nav-badge {
    margin-left: auto;
    background: var(--cp-terra);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.cp-nav-badge.gd { background: var(--cp-gd); color: var(--cp-nv9); }

/* ── MINIMAL LAYOUT (onboarding) ── */
.cp-minimal {
    min-height: 100vh;
    background: var(--cp-cream);
}

.cp-minimal-header {
    padding: 20px 32px;
    border-bottom: 1px solid var(--cp-hairline);
    background: var(--cp-paper);
}

.cp-minimal-content {
    max-width: 640px;
    margin: 40px auto;
    padding: 0 20px;
}

/* ── PAGE HEADER ── */
.cp-page-header {
    margin-bottom: 28px;
}

.cp-page-header h1 {
    font-family: var(--cp-fd);
    font-size: 28px;
    font-weight: 500;
    color: var(--cp-nv9);
    margin: 0 0 6px;
    letter-spacing: -.015em;
}

.cp-page-header p {
    color: var(--cp-ink-3);
    font-size: 14px;
    margin: 0;
}

/* ── CARDS ── */
.cp-card {
    background: var(--cp-paper);
    border: 1px solid var(--cp-hairline);
    border-radius: var(--cp-radius-l);
    padding: 20px 24px;
    box-shadow: var(--cp-sh-1);
}

.cp-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--cp-hairline);
}

.cp-card-header h3 {
    font-family: var(--cp-fd);
    font-size: 16px;
    font-weight: 500;
    color: var(--cp-nv9);
    margin: 0;
}

/* ── STAT CARDS ── */
.cp-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.cp-stat {
    background: var(--cp-paper);
    border: 1px solid var(--cp-hairline);
    border-radius: var(--cp-radius-l);
    padding: 20px 24px;
    box-shadow: var(--cp-sh-1);
    position: relative;
    overflow: hidden;
    transition: all 0.25s ease;
}

.cp-stat:hover { box-shadow: var(--cp-sh-2); transform: translateY(-2px); }

.cp-stat-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--cp-ink-4);
    text-transform: uppercase;
    letter-spacing: .14em;
    margin-bottom: 10px;
}

.cp-stat-value {
    font-family: var(--cp-fd);
    font-size: 32px;
    font-weight: 500;
    color: var(--cp-nv9);
    line-height: 1;
    font-feature-settings: "lnum", "tnum";
}

/* ── BUTTONS ── */
.cp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .02em;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.cp-btn-primary { background: var(--cp-gd); color: var(--cp-nv9); }
.cp-btn-primary:hover { background: var(--cp-gd-d); }

.cp-btn-secondary { background: var(--cp-paper); border: 1px solid var(--cp-hairline); color: var(--cp-nv9); }
.cp-btn-secondary:hover { border-color: var(--cp-rule); background: var(--cp-shell); }

.cp-btn-danger { background: var(--cp-terra); color: #fff; }
.cp-btn-danger:hover { background: #b5694f; }

.cp-btn-success { background: var(--cp-sage); color: #fff; }
.cp-btn-success:hover { background: #6b7a62; }

.cp-btn-dark { background: var(--cp-nv); color: var(--cp-gd-l); }
.cp-btn-dark:hover { background: var(--cp-nv7); }

.cp-btn-sm { padding: 7px 14px; font-size: 12px; }

/* ── STATUS PILLS ── */
.cp-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .02em;
}

.cp-status-active { background: var(--cp-sage-l); color: var(--cp-sage); }
.cp-status-pending { background: var(--cp-gd-w); color: var(--cp-gd-d); }
.cp-status-completed { background: rgba(30,58,95,.1); color: var(--cp-nv); }
.cp-status-rejected { background: var(--cp-terra-l); color: var(--cp-terra); }
.cp-status-open { background: var(--cp-shell); color: var(--cp-ink-2); }
.cp-status-emergency { background: var(--cp-terra-l); color: var(--cp-terra); }

/* ── TABLES ── */
.cp-table {
    width: 100%;
    border-collapse: collapse;
}

.cp-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 10px;
    font-weight: 600;
    color: var(--cp-ink-4);
    text-transform: uppercase;
    letter-spacing: .14em;
    border-bottom: 1px solid var(--cp-hairline);
}

.cp-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--cp-hairline);
    color: var(--cp-ink);
}

.cp-table tr:hover td { background: var(--cp-shell); }

/* ── FORM CONTROLS ── */
.cp-form-group {
    margin-bottom: 18px;
}

.cp-form-group label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--cp-ink-4);
    text-transform: uppercase;
    letter-spacing: .14em;
    margin-bottom: 6px;
}

.cp-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--cp-hairline);
    border-radius: var(--cp-radius);
    font-size: 14px;
    color: var(--cp-ink);
    background: var(--cp-paper);
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.cp-input:focus {
    outline: none;
    border-color: var(--cp-gd);
    box-shadow: 0 0 0 3px rgba(201,169,97,.15);
}

.cp-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--cp-hairline);
    border-radius: var(--cp-radius);
    font-size: 14px;
    color: var(--cp-ink);
    background: var(--cp-paper);
    min-height: 80px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.cp-textarea:focus {
    outline: none;
    border-color: var(--cp-gd);
    box-shadow: 0 0 0 3px rgba(201,169,97,.15);
}

.cp-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--cp-hairline);
    border-radius: var(--cp-radius);
    font-size: 14px;
    color: var(--cp-ink);
    background: var(--cp-paper);
    box-sizing: border-box;
}

/* ── JOB LIST ITEMS ── */
.cp-job-list { display: flex; flex-direction: column; gap: 8px; }

.cp-job-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--cp-paper);
    border: 1px solid var(--cp-hairline);
    border-radius: var(--cp-radius-l);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    box-shadow: var(--cp-sh-1);
}
.cp-job-item:hover { box-shadow: var(--cp-sh-2); transform: translateY(-1px); }

.cp-job-info { flex: 1; }
.cp-job-title { font-weight: 600; font-size: 14px; color: var(--cp-nv9); font-family: var(--cp-fd); }
.cp-job-meta { font-size: 12px; color: var(--cp-ink-3); margin-top: 3px; }
.cp-job-actions { display: flex; gap: 8px; }

/* ── EMPTY STATE ── */
.cp-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--cp-ink-3);
}

.cp-empty svg { margin-bottom: 12px; opacity: 0.4; }
.cp-empty h3 { font-family: var(--cp-fd); font-size: 18px; font-weight: 500; color: var(--cp-nv9); margin: 0 0 6px; }
.cp-empty p { font-size: 14px; margin: 0; color: var(--cp-ink-4); }

/* ── ONBOARDING STEPS ── */
.cp-steps {
    display: flex;
    gap: 0;
    margin-bottom: 32px;
}

.cp-step {
    flex: 1;
    text-align: center;
    position: relative;
    padding: 12px 8px;
}

.cp-step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--cp-hairline);
    color: var(--cp-ink-4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

.cp-step.active .cp-step-dot { background: var(--cp-gd); color: var(--cp-nv9); }
.cp-step.completed .cp-step-dot { background: var(--cp-sage); color: #fff; }

.cp-step-label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--cp-ink-4);
}
.cp-step.active .cp-step-label { color: var(--cp-gd-d); font-weight: 600; }
.cp-step.completed .cp-step-label { color: var(--cp-sage); }

/* ── RESTRICTION BANNER ── */
.cp-restriction-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--cp-gd-x), var(--cp-gd-w));
    border: 1px solid var(--cp-gd-l);
    border-radius: var(--cp-radius-l);
    color: var(--cp-ink-2);
    font-size: 13px;
    line-height: 1.5;
}

.cp-restriction-banner svg { color: var(--cp-gd-d); flex-shrink: 0; }

.cp-restricted-overlay {
    position: relative;
    pointer-events: none;
    opacity: 0.5;
}

.cp-restricted-message {
    text-align: center;
    padding: 40px 20px;
    background: var(--cp-paper);
    border: 1px dashed var(--cp-rule);
    border-radius: var(--cp-radius-l);
    margin-bottom: 24px;
    box-shadow: var(--cp-sh-1);
}
.cp-restricted-message h3 { margin: 0 0 8px; font-family: var(--cp-fd); font-size: 18px; font-weight: 500; color: var(--cp-nv9); }
.cp-restricted-message p { margin: 0; font-size: 13px; color: var(--cp-ink-3); }

/* ── EYEBROW / UTILITY ── */
.cp-eyebrow {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .16em;
    color: var(--cp-ink-4);
    font-family: var(--cp-fb);
}

.cp-num {
    font-family: var(--cp-fd);
    font-weight: 500;
    font-feature-settings: "lnum", "tnum";
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .cp-sidebar { display: none; }
    .cp-main { margin-left: 0; padding: 16px; }
    .cp-stats { grid-template-columns: repeat(2, 1fr); }
    .cp-topbar-left { width: auto; min-width: auto; }
}
