:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: var(--bg-dark);
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0, transparent 50%),
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.1) 0, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
}

.container {
    max-width: 850px;
    width: 100%;
}

header {
    margin-bottom: 2rem;
    text-align: center;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.tagline {
    color: var(--text-muted);
    font-size: 1rem;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: var(--glass);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--glass-border);
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

input {
    flex: 1;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    color: white;
    outline: none;
    transition: border-color 0.3s ease;
}

input:focus {
    border-color: var(--primary);
}

button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

button:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
}

button:active {
    transform: scale(0.98);
}

.member-list {
    list-style: none;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    /* Keep as stretch for side panel */
    padding: 0;
    /* Important: internal content handles padding */
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    overflow: hidden;
    /* For side panel background */
    animation: slideIn 0.4s ease-out forwards;
}

.member-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #ec4899 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.member-name {
    font-weight: 500;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.btn-status {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    background: transparent;
    border: 1px solid var(--glass-border);
}

.btn-status.present {
    color: var(--success);
}

.btn-status.present.active {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-status.absent {
    color: var(--danger);
}

.btn-status.absent.active {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animations for list items */
.member-item:nth-child(1) {
    animation-delay: 0.1s;
}

.member-item:nth-child(2) {
    animation-delay: 0.2s;
}

.member-item:nth-child(3) {
    animation-delay: 0.3s;
}

.member-item:nth-child(n+4) {
    animation-delay: 0.4s;
}

/* Date Navigation */
.date-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 0.5rem;
}

.btn-icon {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--primary);
}

#datePicker {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    outline: none;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.75rem;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

/* Reports */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

#monthSelect {
    background: #1e293b;
    /* Solid background for dropdown to ensure visibility */
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    font-size: 0.9rem;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

#monthSelect option {
    background: #1e293b;
    color: white;
    padding: 10px;
}

.report-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--glass);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    border: 1px solid var(--glass-border);
}

.report-item .member-name {
    font-weight: 600;
}

.report-stats {
    display: flex;
    gap: 1.5rem;
}

.r-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.r-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.r-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.r-value.p {
    color: var(--success);
}

.r-value.a {
    color: var(--danger);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Admin/Security */
.admin-only {
    display: none !important;
}

body.admin-mode .admin-only {
    display: block !important;
    animation: slideIn 0.4s ease-out;
}

body.admin-mode button.admin-only {
    display: flex !important;
}

body.admin-mode .tab-content.admin-only:not(.active) {
    display: none !important;
}

.delete-log {
    margin-left: 8px;
    color: #ef4444;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2rem;
    line-height: 1;
    display: inline-block;
}

.delete-log:hover {
    color: #b91c1c;
    transform: scale(1.2);
}

.header-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.admin-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

body.admin-mode .admin-badge {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.7;
}

.btn-text:hover {
    opacity: 1;
}

/* Member Form */
.member-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.member-form h3 {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.input-row {
    display: flex;
    gap: 0.5rem;
}

.input-row input {
    flex: 1;
}

.btn-primary {
    width: 100%;
}

/* Member Item Enhancements */
.member-item {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
}

.member-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.member-details {
    display: flex;
    flex-direction: column;
}

.member-designation {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.member-logs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    font-size: 0.75rem;
}

.member-activity-summary {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 1rem;
    padding: 0 0.5rem;
}

.activity-label {
    font-weight: 600;
    color: var(--primary);
}

.log-tag {
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.delete-log {
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--danger);
    padding-left: 2px;
    font-weight: bold;
}

.delete-log:hover {
    transform: scale(1.2);
}

.log-tag.in {
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.3);
}

.log-tag.out {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.status-buttons {
    display: flex;
    gap: 0.25rem;
}

.status-buttons .btn-status {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.btn-status.present.active {
    background: var(--success);
    color: white;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.btn-status.absent.active {
    background: var(--danger);
    color: white;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.timer-buttons {
    display: flex;
    min-width: 90px;
}

.btn-delete {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
}

.btn-delete:hover {
    background: var(--danger);
    color: white;
}

.btn-status.checkin {
    border-color: var(--success);
    color: var(--success);
}

.btn-status.checkin:hover:not(:disabled) {
    background: var(--success);
    color: white;
}

.btn-status.checkout {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-status.checkout:hover:not(:disabled) {
    background: var(--danger);
    color: white;
}

/* Disabled State */
.btn-status:disabled {
    cursor: not-allowed;
    filter: grayscale(1);
    opacity: 0.3;
}

/* Member Detail View */
.detail-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.member-header-info h2 {
    font-size: 1.5rem;
    margin: 0;
}

.detail-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.d-stat {
    background: var(--glass);
    padding: 1.5rem 1rem;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--glass-border);
}

.d-stat span {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.d-stat label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-filters {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    color: var(--text-muted);
    cursor: pointer;
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.history-item {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.history-date {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.history-logs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 400px;
    margin: 1rem;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.modal-body .input-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin: 0;
}

.modal-body label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.modal-body select,
.modal-body input {
    width: 100%;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 0.75rem;
    color: white;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.member-item.admin-clickable {
    cursor: pointer;
    transition: all 0.3s ease;
}

.member-item.admin-clickable:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.add-manual-log {
    margin-top: 1rem;
    color: var(--primary);
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: underline;
}

.history-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.history-day-status {
    font-size: 0.8rem;
    font-weight: 600;
}

.history-day-status.present {
    color: var(--success);
}

.history-day-status.absent {
    color: var(--danger);
}

/* Admin Panel Styles */
#loginFormSection {
    display: block;
}

body.admin-mode #loginFormSection {
    display: none;
}

#adminPanelSection {
    display: none;
}

body.admin-mode #adminPanelSection {
    display: block;
}

.admin-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Calendar Matrix Styles */
.calendar-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    color: white;
}

.calendar-matrix th,
.calendar-matrix td {
    padding: 0.6rem 0.4rem;
    border: 1px solid var(--glass-border);
    text-align: center;
    min-width: 35px;
}

.calendar-matrix th {
    background: #1e293b;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 20;
}

.calendar-matrix .staff-name-col {
    text-align: left;
    min-width: 140px;
    font-weight: 600;
    position: sticky;
    left: 0;
    background: #1e293b;
    z-index: 25;
}

/* Header in staff column needs even higher z-index */
.calendar-matrix th.staff-name-col {
    z-index: 30;
}

.calendar-matrix td.p-cell {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    font-weight: 700;
}

.calendar-matrix td.a-cell {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    font-weight: 700;
}

.calendar-matrix td.empty-cell {
    color: var(--text-muted);
    opacity: 0.5;
}

.calendar-matrix td.empty-cell {
    color: rgba(255, 255, 255, 0.1);
}

.calendar-matrix tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.checkin-alert {
    background: rgba(234, 179, 8, 0.15);
    /* Yellow/Warning background */
    border: 1px solid rgba(234, 179, 8, 0.3);
    color: #fca5a5;
    /* Light Red/Pinkish for urgency? Or stick to yellow? User said 'pop'. */
    color: #fbbf24;
    /* Warning Yellow */
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.5rem;
    display: inline-block;
    width: 100%;
    text-align: center;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.1);
    animation: pulseAlert 2s infinite;
}

@keyframes pulseAlert {
    0% {
        box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(234, 179, 8, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(234, 179, 8, 0);
    }
}

/* --- Enhanced Visuals --- */

/* Toast System */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    transform: translateX(100%);
    animation: slideInToast 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    pointer-events: auto;
    border-left: 4px solid var(--primary);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.info {
    border-left-color: var(--primary);
}

.toast-content {
    display: flex;
    flex-direction: column;
}

.toast-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.toast.hiding {
    animation: slideOutToast 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideInToast {
    from {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }

    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes slideOutToast {
    from {
        transform: translateX(0) scale(1);
        opacity: 1;
    }

    to {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }
}

/* Neon Glow & Interactive Polish */
.member-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.member-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
}

.member-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.03), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.member-item:hover::before {
    transform: translateX(100%);
}

.btn-status.checkin {
    position: relative;
    overflow: hidden;
}

.btn-status.checkin:not(:disabled) {
    animation: slightPulse 3s infinite;
}

@keyframes slightPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }

    50% {
        box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
    }
}


/* Compact Header Controls */
.header-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.tagline {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Hide the tagline text 'Attendance Tracking' to save space if needed, 
   but let's keep it clean. Just make text muted */
.tagline {
    color: var(--text-muted);
    font-size: 1rem;
}

/* --- Active Working State --- */
.member-item.is-working {
    border-color: rgba(16, 185, 129, 0.5);
    /* Green Border */
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.1) 0%, rgba(30, 41, 59, 0.4) 100%);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.15);
    position: relative;
}

.member-item.is-working::after {
    content: '🟢 Working Now';
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
    0% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 5px rgba(16, 185, 129, 0.5);
    }

    100% {
        opacity: 0.7;
    }
}

/* Adjust layout for the badge */
.member-item.is-working .member-top {
    padding-right: 80px;
    /* Make room for the badge */
}

/* Ensure mobile responsiveness for the badge */
@media (max-width: 480px) {
    .member-item.is-working .member-top {
        padding-right: 0;
        padding-top: 1.5rem;
    }

    .member-item.is-working::after {
        top: 6px;
        right: 6px;
    }
}

/* --- Absent State --- */
.member-item.is-absent {
    border-color: rgba(239, 68, 68, 0.4);
    /* Red Border */
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.05) 0%, rgba(30, 41, 59, 0.4) 100%);
}

.member-item.is-absent::after {
    content: '🔴 Absent';
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.member-item.is-absent .member-top {
    padding-right: 80px;
}

/* --- Checked Out State --- */
.member-item.is-checked-out {
    border-color: rgba(148, 163, 184, 0.4);
    /* Slate Border */
    background: linear-gradient(145deg, rgba(148, 163, 184, 0.05) 0%, rgba(30, 41, 59, 0.4) 100%);
    opacity: 0.85;
    /* Slightly muted */
}

.member-item.is-checked-out::after {
    content: '⚪ Checked Out';
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(148, 163, 184, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.member-item.is-checked-out .member-top {
    padding-right: 90px;
}

/* --- Not Working State (Replaces Checked Out) --- */
.member-item.is-not-working {
    border-color: rgba(251, 146, 60, 0.4);
    /* Orange Border for Visibility */
    background: linear-gradient(145deg, rgba(251, 146, 60, 0.05) 0%, rgba(30, 41, 59, 0.4) 100%);
    opacity: 0.95;
}

.member-item.is-not-working::after {
    content: '⛔ Not Working';
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fb923c;
    /* Orange Text */
    background: rgba(251, 146, 60, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(251, 146, 60, 0.2);
}

.member-item.is-not-working .member-top {
    padding-right: 90px;
}

/* --- New Status Badge System (Non-overlapping) --- */

/* 1. Layout Adjustments */
.name-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    /* Allows badge to drop to next line on tiny screens */
}

/* 2. Badge Styles */
.status-pill {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

.pill-working {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    box-shadow: 0 0 5px rgba(16, 185, 129, 0.2);
    animation: pulseBadge 2s infinite;
}

.pill-absent {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.pill-off {
    color: #fb923c;
    background: rgba(251, 146, 60, 0.1);
    border: 1px solid rgba(251, 146, 60, 0.2);
}

.pill-completed {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
}

/* 3. Card Highlighting (using new 's-*' classes) */
.member-item.s-working {
    border-color: rgba(16, 185, 129, 0.5);
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.1) 0%, rgba(30, 41, 59, 0.4) 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.1);
}

.member-item.s-absent {
    border-color: rgba(239, 68, 68, 0.4);
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.05) 0%, rgba(30, 41, 59, 0.4) 100%);
}

.member-item.s-off {
    border-color: rgba(251, 146, 60, 0.4);
    background: linear-gradient(145deg, rgba(251, 146, 60, 0.05) 0%, rgba(30, 41, 59, 0.4) 100%);
}

.member-item.s-completed {
    border-color: rgba(56, 189, 248, 0.4);
    background: linear-gradient(145deg, rgba(56, 189, 248, 0.05) 0%, rgba(30, 41, 59, 0.4) 100%);
}

/* 4. Reset padding for member-top since we removed absolute positioning */
.member-item .member-top {
    padding-right: 0 !important;
}


/* --- Sales Panel Styling --- */
.member-item {
    flex-direction: row;
    /* Change main layout to row */
    align-items: stretch;
    justify-content: space-between;
}

.member-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-right: 1.5rem;
    border-right: 1px solid var(--glass-border);
}

.sales-panel {
    width: 130px;
    /* Fixed width for consistency */
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
    padding-left: 1rem;
    text-align: right;
}

.sales-stat-row {
    display: flex;
    flex-direction: column;
}

.sales-stat-row label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.sales-val {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.sales-val.highlight {
    color: var(--primary);
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

/* Sales Input Modal */
.btn-sm {
    font-size: 0.75rem;
    padding: 2px 0;
    margin-top: 4px;
    align-self: flex-end;
}

/* Responsiveness for Sales Panel */
@media (max-width: 600px) {
    .member-item {
        flex-direction: column;
    }

    .member-main-content {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }

    .sales-panel {
        width: 100%;
        flex-direction: row;
        justify-content: space-around;
        padding-left: 0;
        text-align: center;
    }

    .btn-sm {
        align-self: center;
    }
}

/* --- Sales Tab Styling --- */
.sales-entry-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sales-entry-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
}

.sales-inputs {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.sales-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sales-input-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.sales-input-group input {
    width: 80px;
    padding: 0.5rem;
    text-align: right;
    font-weight: 600;
}

/* Updated Daily View Sales Card */
.sales-panel {
    width: 150px;
    /* Wider for MTD/YTD */
    justify-content: space-between;
    padding: 0.5rem 0 0.5rem 1rem;
}

.sales-stat-block {
    margin-bottom: 0.5rem;
}

.sales-stat-block h4 {
    font-size: 0.7rem;
    color: var(--primary);
    margin-bottom: 0.2rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 2px;
}

.stat-row-mini {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stat-row-mini span:last-child {
    color: var(--text-main);
    font-weight: 600;
}

@media (max-width: 600px) {
    .sales-entry-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .sales-inputs {
        justify-content: space-between;
    }
}

/* --- Shopify Stat Card --- */
.stat-item.shopify-stat {
    background: linear-gradient(135deg, rgba(149, 117, 205, 0.2) 0%, rgba(30, 41, 59, 0.4) 100%);
    border-color: rgba(149, 117, 205, 0.5);
}

.stat-item.shopify-stat .stat-value {
    color: #b39ddb;
}

.stat-item.shopify-stat .stat-label {
    color: #9575cd;
}

/* --- Sales View Tab Styling --- */
.sales-view-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.sales-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1.25rem;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sales-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-light);
}

.sales-card-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.25rem;
    border-bottom: 1px solid var(--glass-border);
}

.sales-card-body {
    padding: 1.25rem;
}

.sales-group h5 {
    margin: 0 0 0.75rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sales-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0.5rem 0;
}

.sales-table th {
    text-align: left;
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 700;
}

.sales-table th:nth-child(2),
.sales-table th:nth-child(3),
.sales-table th:nth-child(4) {
    text-align: right;
    color: #a78bfa;
}

.sales-table td {
    padding: 1rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.sales-table tr:last-child td {
    border-bottom: none;
}

.t-label {
    font-size: 0.8rem;
    color: var(--text-color);
    font-weight: 500;
    opacity: 0.9;
}

.t-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    text-align: right;
}

.t-value.currency {
    color: #60a5fa;
    font-family: 'Inter', sans-serif;
}

.grand-total-card .t-value.currency {
    color: #60a5fa;
    text-shadow: 0 0 10px rgba(96, 165, 250, 0.3);
}

.shopify-card .t-value.currency {
    color: #b39ddb;
}

@media (max-width: 640px) {
    .sales-view-list {
        grid-template-columns: 1fr;
    }
}

.grand-total-card {
    grid-column: 1 / -1;
    margin-bottom: 1rem;
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(16px);
}

.grand-total-card .member-name {
    font-size: 1.25rem;
    letter-spacing: 1px;
}

.shopify-card {
    border-left: 5px solid #7e57c2 !important;
}

.shopify-card .member-name {
    color: #b39ddb;
}

/* Compact Sales Area in Daily View */
.member-card {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: stretch;
    padding: 0;
}

.member-main-content {
    flex: 1;
    padding: 1.5rem;
}

.sales-quick-stats {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.4) 0%, rgba(15, 23, 42, 0.6) 100%);
    border-left: 1px solid var(--glass-border);
    padding: 1.5rem 1.75rem;
    min-width: 200px;
    gap: 1.25rem;
}

.q-header {
    font-size: 0.65rem;
    font-weight: 800;
    color: #a78bfa;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(139, 92, 246, 0.3);
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

.q-stat {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.q-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    font-weight: 500;
}

.q-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #c7d2fe;
    display: flex;
    align-items: baseline;
    gap: 6px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.q-value span {
    font-size: 0.85rem;
    color: #818cf8;
    font-weight: 500;
    opacity: 0.8;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .member-card {
        flex-direction: column;
    }

    .sales-quick-stats {
        flex-direction: column;
        /* Back to column on mobile for header support */
        border-left: none;
        border-top: 1px solid var(--glass-border);
        min-width: 0;
        padding: 1.5rem;
        gap: 1.25rem;
        background: rgba(30, 41, 59, 0.5);
    }

    .q-header {
        text-align: center;
        border-bottom-style: dashed;
    }

    .q-stat {
        align-items: center;
    }
}