:root {
    --color-bg: #f5f6f8;
    --color-surface: #ffffff;
    --color-text-main: #2b2b2b; /* Warm charcoal */
    --color-text-muted: #5f6368;
    --color-blue: #0056b3; /* Product control blue */
    --color-orange: #ff6b00; /* Urgent/Accent */
    --color-red: #d32f2f;
    --color-amber: #e65100;
    --color-amber-bg: #ffe0b2;
    --color-green: #2e7d32;
    --color-green-bg: #c8e6c9;
    --color-red-bg: #ffcdd2;
    --color-border: #e0e2e5;
    --font-stack: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-stack);
    background-color: var(--color-bg);
    color: var(--color-text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, .drawer-title {
    font-weight: 600;
    color: var(--color-text-main);
}
.ws-title {
    font-size: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 12px;
}
.eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

/* Command Bar */
.command-bar {
    background-color: #ffffff;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 24px;
    font-size: 14px;
}
.command-bar-left, .command-bar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}
.command-date {
    font-weight: 500;
    color: var(--color-text-muted);
}
.command-search input {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    width: 250px;
    font-size: 14px;
}
.summary-value {
    font-weight: 600;
    color: var(--color-text-muted);
}
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    font-size: 18px;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--color-orange);
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 10px;
}

/* Avatars */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--color-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}
.avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--color-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
}
.member-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* App Header */
.app-header {
    background-color: var(--color-text-main);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.logo-container { height: 32px; margin-right: 32px; font-weight: bold; font-size: 18px; letter-spacing: -0.5px; display: flex; align-items: center;}
.app-nav {
    display: flex;
    gap: 4px;
    flex-grow: 1;
}
.nav-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    font-weight: 500;
    padding: 0 16px;
    min-height: 44px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}
.nav-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.nav-btn.active { color: #fff; background: rgba(255,255,255,0.2); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}
.club-filter {
    padding: 8px 32px 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.2);
    color: #fff;
    font-size: 14px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
}
.club-filter option { background: var(--color-surface); color: var(--color-text-main); }
.reset-btn {
    background: transparent;
    color: var(--color-surface);
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0 16px;
    min-height: 44px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}
.reset-btn:hover { background: rgba(255,255,255,0.1); }
.mobile-menu-btn { display: none; background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; min-height: 44px; min-width: 44px; }

/* Focus States */
button:focus-visible, select:focus-visible, input:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--color-blue);
    outline-offset: 2px;
}

/* Main Workspace */
.app-main { padding: 32px 24px; max-width: 1400px; margin: 0 auto; }
.workspace { display: none; }
.workspace.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Cards & Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    align-items: start;
}
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
}
.chart-container { width: 100%; height: 300px; }

/* Chips */
.chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
}
.chip-amber { background: var(--color-amber-bg); color: var(--color-amber); }
.chip-red { background: var(--color-red-bg); color: var(--color-red); }
.chip-green { background: var(--color-green-bg); color: var(--color-green); }
.chip-gray { background: #f1f3f4; color: var(--color-text-muted); }

/* Work Queue */
.queue-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.queue-item:last-child { border-bottom: none; padding-bottom: 0; }
.queue-item:first-child { padding-top: 0; }
.queue-info {
    display: flex;
    align-items: center;
    gap: 16px;
}
.queue-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.queue-meta { font-size: 13px; color: var(--color-text-muted); margin-top: 4px; }
.work-queue { list-style: none; }

/* Buttons */
.action-btn {
    background: var(--color-blue);
    color: #fff;
    border: none;
    padding: 0 16px;
    min-height: 40px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}
.action-btn:hover { background: #004494; }
.outline-btn {
    background: transparent;
    color: var(--color-blue);
    border: 1px solid var(--color-blue);
}
.outline-btn:hover { background: rgba(0,86,179,0.05); }

/* Filters & Tables */
.filters { margin-bottom: 24px; display: flex; gap: 16px; }
.filters select { 
    padding: 8px 32px 8px 12px; 
    border: 1px solid var(--color-border); 
    border-radius: 6px; 
    font-size: 14px;
    appearance: none;
    background-color: var(--color-surface);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    min-height: 44px;
}
.command-search input {
    min-height: 44px;
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 16px; text-align: left; border-bottom: 1px solid var(--color-border); }
.data-table th { font-weight: 600; color: var(--color-text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
.data-table tbody tr:hover { background-color: rgba(0,0,0,0.01); }

/* Retention specific */
.retention-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
}
.dashboard-stats { display: flex; gap: 16px; margin-bottom: 24px; }
.stat-box { background: var(--color-surface); padding: 20px; border-radius: 12px; border: 1px solid var(--color-border); font-size: 14px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.stat-box strong { font-size: 28px; color: var(--color-text-main); display: block; margin-top: 8px; font-weight: 700; }
.recent-activity { list-style: none; }
.activity-item { padding: 12px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.activity-item:last-child { border-bottom: none; }
.activity-time { color: var(--color-text-muted); margin-bottom: 4px; }

/* Pulse specific */
.pulse-stats { display: flex; gap: 24px; margin-top: 16px; }
.pulse-label { font-size: 13px; color: var(--color-text-muted); }
.pulse-value { font-size: 24px; font-weight: 600; color: var(--color-blue); }

/* Drawers */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); z-index: 200;
    backdrop-filter: blur(2px);
}
.modal-overlay.hidden { display: none; }
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 480px; max-width: 100%;
    background: var(--color-surface);
    z-index: 300;
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    transform: translateX(100%);
    display: flex; flex-direction: column;
}
.drawer-header {
    padding: 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex; justify-content: space-between; align-items: center;
}
.drawer-title { font-size: 18px; margin: 0; }
.close-drawer { background: none; border: none; font-size: 28px; cursor: pointer; color: var(--color-text-muted); min-height: 44px; min-width: 44px; display: flex; align-items: center; justify-content: center; }
.drawer-body { padding: 24px; overflow-y: auto; flex-grow: 1; }

.evidence-block { background: #f8f9fa; padding: 16px; border-radius: 8px; margin-bottom: 24px; border-left: 4px solid var(--color-orange); }
.evidence-block p { margin-bottom: 8px; font-size: 14px; }
.evidence-block p:last-child { margin-bottom: 0; }

.action-form { display: flex; flex-direction: column; gap: 20px; margin-top: 32px; border-top: 1px solid var(--color-border); padding-top: 24px; }
.action-form select { 
    padding: 12px; 
    border: 1px solid var(--color-border); 
    border-radius: 6px; 
    font-size: 15px; 
    appearance: none;
    background-color: var(--color-surface);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    min-height: 44px;
}
.approval-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.approval-check input[type="checkbox"] {
    margin-top: 4px;
    width: 20px;
    height: 20px;
    accent-color: var(--color-orange);
    min-height: unset;
}
.approval-check label {
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
}
.approve-btn { 
    background: var(--color-orange); 
    color: #fff; 
    border: none; 
    padding: 16px; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: 600; 
    font-size: 16px;
    transition: background 0.2s;
    min-height: 44px;
}
.approve-btn:hover:not(:disabled) { background: #e56000; }
.approve-btn:disabled { background: var(--color-border); color: var(--color-text-muted); cursor: not-allowed; }

/* Responsive */
@media (max-width: 900px) {
    .command-bar { flex-direction: column; gap: 12px; align-items: stretch; }
    .command-bar-right { justify-content: space-between; }
    .retention-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .app-header {
        height: auto;
        min-height: 64px;
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .logo-container {
        flex: 1 1 132px;
        margin-right: 0;
        min-width: 0;
        font-size: 15px;
    }
    .app-nav { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--color-text-main); padding: 16px; border-top: 1px solid rgba(255,255,255,0.1); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
    .app-nav.mobile-open { display: flex; }
    .mobile-menu-btn { display: flex; align-items: center; justify-content: center; margin-right: 0; }
    .header-actions {
        width: 100%;
        margin-left: 0;
        gap: 8px;
    }
    .club-filter { flex: 1 1 auto; max-width: none; min-width: 0; }
    .reset-btn { flex: 0 0 auto; }
    
    /* Mobile Table Transformations */
    .data-table thead { display: none; }
    .data-table tbody tr {
        display: flex;
        flex-direction: column;
        border: 1px solid var(--color-border);
        border-radius: 8px;
        margin-bottom: 16px;
        padding: 16px;
        background: var(--color-surface);
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    .data-table tbody td {
        border-bottom: 1px solid var(--color-border);
        padding: 12px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
    }
    .data-table tbody td:last-child { border-bottom: none; padding-bottom: 0; }
    .data-table tbody td:first-child { padding-top: 0; }
    .data-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--color-text-muted);
        font-size: 13px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }
}
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-delay: -1ms !important;
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        background-attachment: initial !important;
        scroll-behavior: auto !important;
        transition-duration: 0s !important;
        transition-delay: 0s !important;
    }
}
